6.4 Binary Output Format

Asmc Macro Assembler

6.4 Binary Output Format

If the binary output format has been selected, the contents of the file are just the raw data bytes emitted by the assembler, no header, relocations or symbol tables are generated. All references have to be resolved internally.

The binary format is most useful for bootloaders or DOS COM files, but may be used to create any binary format. See sample Win32_5, that demonstrates how the binary format is used to create a Win32 application.

If a listing file is produced, a binary map will be added, which shows the file and memory layout of the image:

 
                                    .model tiny

                                    .data

00000000  0D0A48656C6C6F2C20    str1    db 13,10,"Hello, world!",13,10,'$'

00000000                            .code

                                    org 100h

00000100                        start:

00000100  B409                      mov ah, 09h
00000102  BA0000                    mov dx, offset str1
00000105  CD21                      int 21h
00000107  B8004C                    mov ax, 4c00h
0000010A  CD21                      int 21h

                                    end start


Binary Map:

Segment                  Pos(file)      VA  Size(fil) Size(mem)
---------------------------------------------------------------
_TEXT                           0      100         C         C
_DATA                           C      10C        12        12
---------------------------------------------------------------
                                                  1E        1E

Note that bytes with "undefined contents" at the start and the end of the output file are skipped and won't become part of the binary.