Fix jmp/call near offsets in long mode
[nasm.git] / test / multisection.asm
blob34e7f7d8ad55093ff8c01f4703ae226832f58486
1 ;Testname=aout; Arguments=-faout -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
2 ;Testname=aoutb; Arguments=-faoutb -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
3 ;Testname=as86; Arguments=-fas86 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
4 ;Testname=elf32; Arguments=-felf32 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
5 ;Testname=elf64; Arguments=-felf64 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
6 ;Testname=obj; Arguments=-fobj -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
7 ;Testname=rdf; Arguments=-frdf -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
8 ;Testname=win32; Arguments=-fwin32 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
9 ;Testname=win64; Arguments=-fwin64 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
11 ; To test where code that is placed before any explicit SECTION
12 ; gets placed, and what happens if a .text section has an ORG
13 ;statement, uncomment the following lines.
15 ; times 10h nop
17 ;section .text
18 ;org 0x300
19 ; times 20h inc ax
21 ; let's see which of these sections can be placed in the specified order.
23 section .appspecific
24 section .data
25 section .stringdata
26 section .mytext
27 section .code
28 section .extra_code
31 section .stringdata
32 mystr1: db "Hello, this is string 1", 13, 10, '$'
34 section .extra_code
35 org 0x200
36 bits 16
37 more:
38 mov si, asciz1
39 mov ah, 0x0E
40 xor bx, bx
41 .print:
42 lodsb
43 test al, al
44 jz .end
45 int 0x10
46 jmp short .print
47 .end:
49 xor ax, ax
50 int 0x16
52 mov ax, 0x4c00
53 int 0x21
55 section .appspecific
56 asciz1: db "This is string 2", 0
58 section .code
59 org 0x100
60 bits 16
62 start:
63 mov dx, mystr1
64 mov ah, 9
65 int 0x21
67 xor ax, ax
68 int 0x16
70 jmp more
72 section .text
73 xor eax,eax
74 times 50h nop
76 section .mytext
78 xor ebx,ebx
80 section .data
81 db 95h,95h,95h,95h,95h,95h,95h,95h
83 section .hmm
84 resd 2
86 section .bss
87 resd 8
89 section .final1
90 inc ax
92 section .final2
93 inc bx
95 section .final3
96 inc cx