doc: Add NASMENV to the index (BR 1917084)
[nasm/autotest.git] / rdoff / test / rdftest1.asm
blob76f1e43e1acc05a1e80bfac3d25477136b4948c1
1 ;; program to test RDOFF production and linkage
3 ;; items to test include:
4 ;; [1] relocation within the same segment in each module
5 ;; [2] relocation to different segments in same module
6 ;; [3] relocation to same segment in different module
7 ;; [4] relocation to different segment in different module
8 ;; [5] relative relocation to same module
9 ;; [6] relative relocation to different module
10 ;; [7] correct generation of BSS addresses
12 [SECTION .text]
13 [BITS 32]
15 _main:
16 mov ax,localdata ; [2] (16 bit) => 66 b8 0000
17 mov eax,localdata2 ; [2] (32 bit) => b8 0000000a
19 [EXTERN _fardata]
21 mov eax,[_fardata] ; [4] => a1 00000000 (+20)
22 mov cx,next ; [1] => 66 b9 0012
23 next:
24 call localproc ; [5] => e8 00000019
26 [EXTERN _farproc]
27 mov eax,_farproc ; [3] => b8 00000000 (+40+0)
28 call _farproc ; [6] => e8 -$ (-0+40+0) (=1f)
30 mov eax,localbss ; [7] => b8 00000000
32 [GLOBAL _term]
33 _term: xor ax,ax ; => 66 31 c0
34 int 21h ; => cd 21
35 jmp _term ; => e9 -0a (=fffffff6)
37 localproc:
38 ret ; => c3
40 [GLOBAL _test1proc]
41 _test1proc:
42 call localproc ; [5] => e8 -$ (-0+0+?) (=-6=fffffffa)
43 ret ; => c3
45 [SECTION .data]
46 [GLOBAL localdata2]
47 localdata: db 'localdata',0
48 localdata2: db 'localdata2',0
49 farref: dd _fardata ; [3] => 0 (+20)
50 localref: dd _main ; [2] => 0 (+0)
52 [SECTION .bss]
53 localbss: resw 4 ; reserve 8 bytes BSS