Example Assembler Listing
Assembly listing with machine code
By counting the bytes generated, it is possible to see how the numbers in the symbol table were derived.
DOSSEG
.MODEL SMALL,C
DGROUP GROUP _DATA,STACK
0000 _DATA SEGMENT WORD PUBLIC 'DATA'
0000 000A [ ARR DB 10 DUP(?)
00
]
000A _DATA ENDS
0000 STACK SEGMENT PARA STACK 'STACK'
0000 0400 [ DB 1024 DUP(?)
00
]
0400 STACK ENDS
0000 _TEXT SEGMENT WORD PUBLIC 'CODE'
ASSUME CS:_TEXT,DS:DGROUP,SS:DGROUP
0000 BA ---- R START: MOV DX,DGROUP ;SET UP DS REGISTER
0003 8E DA MOV DS,DX
;READS AT MOST 10 CHARACTERS
;WILL ACCEPT LESS IF ESC IS PRESSED
0005 B9 000A MOV CX,10
0008 8D 1E 0000 R LEA BX,ARR
000C B4 01 MOV AH,01H
000E CD 21 TOP: INT 21H
0010 88 07 MOV [BX],AL
0012 3C 1B CMP AL,01BH
0014 74 03 JZ DONE
0016 43 INC BX
0017 E2 F5 LOOP TOP
0019 DONE:
0019 B8 4C00 MOV AX,4C00H ;TERMINATE PROGRAM
001C CD 21 INT 21H
001E _TEXT ENDS
END START
Symbol Table
N a m e Type Value Attr
ARR . . . . . . . . . . . . . . Byte 0000 _DATA
DONE . . . . . . . . . . . . . . L Near 0019 _TEXT
START . . . . . . . . . . . . . L Near 0000 _TEXT
TOP . . . . . . . . . . . . . . L Near 000E _TEXT