1 ; test source file for assembling to binary files
3 ; nasm -f bin -o bintest.com bintest.asm
5 ; When run (as a DOS .COM file), this program should print
7 ; on two successive lines, then exit cleanly.
9 ; This file should test the following:
10 ; [1] Define a text-section symbol
11 ; [2] Define a data-section symbol
12 ; [3] Define a BSS-section symbol
13 ; [4] Define a NASM local label
14 ; [5] Reference a NASM local label
15 ; [6] Reference a text-section symbol in the text section
16 ; [7] Reference a data-section symbol in the text section
17 ; [8] Reference a BSS-section symbol in the text section
18 ; [9] Reference a text-section symbol in the data section
19 ; [10] Reference a data-section symbol in the data section
20 ; [11] Reference a BSS-section symbol in the data section
29 end mov ax,0x4c00 ; [1]
32 start
mov byte [bss_sym
],',' ; [1] [8]
35 mov bx,[dataptr
] ; [7]
38 .
loop mov dx,datasym
; [1] [4] [7]
44 mov bx,[textptr
] ; [7]
49 datasym
db 'hello world', 13, 10, '$' ; [2]
50 bssptr
dw bss_sym
; [2] [11]
51 dataptr
dw datasym
+5 ; [2] [10]
52 textptr
dw end ; [2] [9]