1 ;Cannot be automatically tested because it differs every time,
2 ;I guess because of a date/time field.
4 ; test source file for assembling to COFF
5 ; build with (under DJGPP, for example):
6 ; nasm -f coff cofftest.asm
7 ; gcc -o cofftest cofftest.c cofftest.o
9 ; This file should test the following:
10 ; [1] Define and export a global text-section symbol
11 ; [2] Define and export a global data-section symbol
12 ; [3] Define and export a global BSS-section symbol
13 ; [4] Define a non-global text-section symbol
14 ; [5] Define a non-global data-section symbol
15 ; [6] Define a non-global BSS-section symbol
16 ; [7] Define a COMMON symbol
17 ; [8] Define a NASM local label
18 ; [9] Reference a NASM local label
19 ; [10] Import an external symbol
20 ; [11] Make a PC-relative call to an external symbol
21 ; [12] Reference a text-section symbol in the text section
22 ; [13] Reference a data-section symbol in the text section
23 ; [14] Reference a BSS-section symbol in the text section
24 ; [15] Reference a text-section symbol in the data section
25 ; [16] Reference a data-section symbol in the data section
26 ; [17] Reference a BSS-section symbol in the data section
36 COMMON _commvar
4 ; [7]
40 ; prototype: long lrotate(long x, int num);
46 .
label rol eax,1 ; [4] [8]
47 loop .
label ; [9] [12]
52 ; prototype: void greet(void);
53 _greet
mov eax,[_integer
] ; [14]
55 mov [localint
],eax ; [14]
57 mov eax,[localptr
] ; [13]
59 push dword [_integer
] ; [1] [14]
60 push dword _printfstr
; [13]
68 _asmstr
db 'hello, world', 0 ; [2]
71 _printfstr
db "integer==%d, localint==%d, commvar=%d"
75 localptr
dd localint
; [5] [17]
76 _textptr
dd _greet
; [15]
77 _selfptr
dd _selfptr
; [16]