summaryrefslogtreecommitdiff
path: root/test/multisection.asm
blob: 34e7f7d8ad55093ff8c01f4703ae226832f58486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
;Testname=aout;  Arguments=-faout  -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=aoutb; Arguments=-faoutb -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=as86;  Arguments=-fas86  -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=elf32; Arguments=-felf32 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=elf64; Arguments=-felf64 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=obj;   Arguments=-fobj   -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=rdf;   Arguments=-frdf   -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=win32; Arguments=-fwin32 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o
;Testname=win64; Arguments=-fwin64 -olnxhello.o -Ox; Files=stdout stderr lnxhello.o

; To test where code that is placed before any explicit SECTION
; gets placed, and what happens if a .text section has an ORG
;statement, uncomment the following lines.
;
;	times	10h	nop
;
;section .text
;org 0x300
;	times	20h	inc ax

; let's see which of these sections can be placed in the specified order.

section .appspecific
section .data
section .stringdata
section .mytext
section .code
section .extra_code


section .stringdata
mystr1: db "Hello, this is string 1", 13, 10, '$'

section .extra_code
org 0x200
bits 16
more:
   mov si, asciz1
   mov ah, 0x0E
   xor bx, bx
.print:
   lodsb
   test al, al
   jz .end
   int  0x10
   jmp short .print
.end:

   xor ax, ax
   int 0x16

   mov ax, 0x4c00
   int 0x21

section .appspecific
asciz1: db "This is string 2", 0

section .code
org 0x100
bits 16

start:
   mov dx, mystr1
   mov ah, 9
   int 0x21

   xor ax, ax
   int 0x16

   jmp more

section .text
	xor	eax,eax
	times	50h nop

section .mytext

	xor	ebx,ebx

section .data
	db	95h,95h,95h,95h,95h,95h,95h,95h

section .hmm
	resd	2

section .bss
	resd	8

section .final1
	inc	ax

section .final2
	inc	bx

section .final3
	inc	cx