Decided to go ahead and commit these little NASM-syntax test files I've been

using for testing various things during development.  Many don't even actually
assemble, as they're testing error conditions.  These all need to be integrated
into a test suite at some point to be truly useful.

svn path=/trunk/yasm/; revision=336
0.3
Peter Johnson 24 years ago
parent 8178f883a5
commit dd9ad840fe
  1. 35
      tests/nasm/addrop.asm
  2. 14
      tests/nasm/bits.asm
  3. 18
      tests/nasm/data.asm
  4. 4
      tests/nasm/enter.asm
  5. 5
      tests/nasm/equ.asm
  6. 2
      tests/nasm/error1.asm
  7. 11
      tests/nasm/errors.asm
  8. 2
      tests/nasm/first.asm
  9. 65
      tests/nasm/fp.asm
  10. 38
      tests/nasm/fp2.asm
  11. 12
      tests/nasm/jumps.asm
  12. 26
      tests/nasm/labels.asm
  13. 31
      tests/nasm/labels2.asm
  14. 16
      tests/nasm/labels3.asm
  15. 3
      tests/nasm/lds.asm
  16. 39
      tests/nasm/mem.asm
  17. 2
      tests/nasm/mem2.asm
  18. 21
      tests/nasm/multisect.asm
  19. 21
      tests/nasm/multisect2.asm
  20. 12
      tests/nasm/numconst.asm
  21. 3
      tests/nasm/opsize.asm
  22. 24
      tests/nasm/reloc.asm
  23. 5
      tests/nasm/reloc2.asm
  24. 20
      tests/nasm/second.asm
  25. 6
      tests/nasm/shift.asm
  26. 6
      tests/nasm/signed.asm
  27. 11
      tests/nasm/sizes.asm
  28. 12
      tests/nasm/sizes2.asm
  29. 6
      tests/nasm/store.asm
  30. 8
      tests/nasm/string.asm
  31. 2
      tests/nasm/test1.asm
  32. 3
      tests/nasm/times.asm

@ -0,0 +1,35 @@
[BITS 32]
db 0FFh
idiv al ; F6 F8
db 0FEh
idiv ax ; 66 F7 F8
db 0FDh
idiv eax ; F7 F8
db 0FCh
idiv byte [word 0] ; 67 F6 3E 00 00
db 0FBh
idiv byte [dword 0xFFFFFFFF] ; F6 3D FF FF FF FF
db 0FAh
idiv byte [0] ; F6 3D 00 00 00 00
db 0F9h
a16 idiv byte [word 0] ; 67 67 F6 3E 00 00
db 0F8h
a16 idiv byte [dword 0] ; 67 F6 3D 00 00 00 00
db 0F7h
a16 idiv byte [0] ; 67 F6 3D 00 00
db 0F6h
a32 idiv byte [0] ; F6 3D 00 00 00 00
[BITS 16]
nop
idiv al
idiv ax
idiv eax
nop
idiv byte [word 0]
idiv byte [dword 0xFFFFFFFF]
idiv byte [0]
idiv dword [es:dword 5]
idiv dword [byte es:5]
idiv word [es:dword edi+5]
idiv word [es:edi+dword 5]
nop

@ -0,0 +1,14 @@
bits 16
[ bits 16 ]
[bits
[bits 16
[eax]
[bits 16]
[bits 32]
[bits 64]
a equ 5
[bits a]
b equ 16
[bits b]
[bits 30+2]
[section .text]

@ -0,0 +1,18 @@
db 1,2,
;db 1,#ss,3
;db 1.5
;dw 1.5
dd 1.5
dq 1.5
dt 1.5
dd "hello"
dq "hello"
dt "hello"
dd 0x1
dq 0x1
dt 0x1
dd hello
dq hello
dt hello
hello:

@ -0,0 +1,4 @@
tst equ 69000
enter tst, 5

@ -0,0 +1,5 @@
mov ax,blah
shl ax,4-blah
blah equ 3

@ -0,0 +1,2 @@
BITS 16
mov ax, es:[di]

@ -0,0 +1,11 @@
[BITS 16]
;mov ax,es:[di]
mov ax,[es:ds:0]
mov ax,[word dword es:0]
[BITS 32]
;mov ax,fs:[di]
mov ax,[fs:di]
;mov ax,[gs:edi+eax+ebx]
mov ,bx
mov ax,
[blah]

@ -0,0 +1,65 @@
[SECTION .data]
dt 3.141592653589793
resb 6
dq 3.141592653589793
resb 8
dd 3.141592653589793
resb 12
dt 1.e-4096
resb 6
dt 1.e-2048
resb 6
dt 1.e-1024
resb 6
dt 1.e-512
resb 6
dt 1.e-256
resb 6
dt 1.e-128
resb 6
dt 1.e-64
resb 6
dt 1.e-32
resb 6
dt 1.e-16
resb 6
dt 1.e-8
resb 6
dt 1.e-4
resb 6
dt 1.e-2
resb 6
dt 1.e-1
resb 6
dt 1.e-0
resb 6
dt 1.e+4096
resb 6
dt 1.e+2048
resb 6
dt 1.e+1024
resb 6
dt 1.e+512
resb 6
dt 1.e+256
resb 6
dt 1.e+128
resb 6
dt 1.e+64
resb 6
dt 1.e+32
resb 6
dt 1.e+16
resb 6
dt 1.e+8
resb 6
dt 1.e+4
resb 6
dt 1.e+2
resb 6
dt 1.e+1
resb 6
dt 1.e+0
resb 6
dt 0.
dt 0.0000

@ -0,0 +1,38 @@
dt 125.
;times 6 db 0
dt 1.25
;times 6 db 0
dt 3.141592653589793
;times 6 db 0
dt 1.e16
;times 6 db 0
dt 1.6e-20
;times 6 db 0
dt 5876.
;times 6 db 0
dd 1.1754943508222875e-38
;times 4 db 0
dq 1.1754943508222875e-38
dt 1.1754943508222875e-38
;times 6 db 0
dd 3.4028234663852886e+38
;times 4 db 0
dq 3.4028234663852886e+38
dt 3.4028234663852886e+38
;times 6 db 0
dd 2.2250738585072014E-308
;times 4 db 0
dq 2.2250738585072014E-308
dt 2.2250738585072014E-308
;times 6 db 0
;dd 1.7976931348623157E+308
;times 4 db 0
;times 4 db 0
dq 1.7976931348623157E+308
dt 1.7976931348623157E+308
;times 6 db 0

@ -0,0 +1,12 @@
BITS 16
label:
jmp 1
jmp +1
jmp -1
jmp label
nop
je $$+1
je $+1
je $-1
je label

@ -0,0 +1,26 @@
label
.label2
..@label3
..start
amaze
.0
.?
.~
.$
.#
._
.@
.a
;..
jmp ._
test0$#@~.?:
jmp amaze.~
.@@#~?_.$
ret
_
jmp test0$#@~.?.@@#~?_.$
?
ret;
jmp 5
jmp _
jmp ?

@ -0,0 +1,31 @@
;[EXTERN banana]
[GLOBAL banana]
;[COMMON banana 4]
apple:
mov ax, 5
.orange:
mov dx, banana
.orange.white:
mov al, 1
banana.echo:
mov dx, 5+2
.insane:
banana:
blah..host..me:
test.:
.me:
;banana.echo:
jmp apple
jmp apple.orange
jmp apple.orange.white
jmp banana
jmp banana.echo
;jmp banana.insane
jmp banana.echo.insane
jmp blah..host..me
jmp test..me
;banana equ 5
;banana equ 7

@ -0,0 +1,16 @@
apple:
.orange:
.orange.white:
banana.echo:
.insane:
jmp joe
jmp apple
jmp apple.orange
jmp apple.orange.white
jmp joe
jmp banana
jmp banana.echo
jmp banana.insane
jmp banana.echo.insane
jmp joe

@ -0,0 +1,3 @@
lds ax,[1]
lds ax,dword [1]

@ -0,0 +1,39 @@
[BITS 16]
a32 mov ax, [eax]
mov ax, [eax]
mov ax, [di]
mov ax, [di-si+si]
mov ax, [bx-(bx-di)-2]
mov ax, [2*(bx+di)-bx-2*di]
mov ax, [2*(bx*2+di)-bx-2*bx-2*di]
mov ax, [2*(bx*2)-bx-2*bx+di]
mov ax, [(bx+di)*(bx+di)-bx*bx-2*bx*di-di*di+di]
mov ax, [(blah2-blah)*di]
blah
inc ax
blah2
mov ax, [(blah2-blah)*di]
[BITS 32]
mov ax, [si]
mov ax, [esi+400]
mov ax, [byte esi+400]
a16 mov ax, [esi+eax]
mov ax, [400-esi]
mov ax, [esi-eax]
mov ax, [(esi+400)+200]
mov ax, [esi+400-200]
mov ax, [eax+400/200]
mov ax, [400/200+eax]
mov ax, [eax+'a']
mov ax, [eax+eax-eax+eax-ebx+ebx]
mov ax, [eax*5]
mov ax, [10]
mov ax, [edx]
mov ax, [edx*2]
mov ax, [nosplit edx*2]
mov ax, [edx*1]
mov ax, [nosplit edx*1]
mov ax, [edx*3]
mov ax, [esi+ebp]
mov ax, [ebp+esi]
mov ax, [ebp*1+esi]

@ -0,0 +1,2 @@
[bits 16]
mov ax,[di-si+si+126]

@ -0,0 +1,21 @@
[section .text]
aaa
aam
div ax
imul eax
[section .data]
db 'hello',0
[section .text]
div al
bswap eax
[section .bss]
resb 25
[section .data]
db 'bye!',0
[section .text]
mov ax, 5

@ -0,0 +1,21 @@
[section text]
aaa
aam
div ax
imul eax
[section .data]
db 'hello',0
[section .TEXT]
div al
bswap eax
[section .bss]
resb 25
[section .data]
db 'bye!',0
[section .TEXT]
mov ax, 5

@ -0,0 +1,12 @@
mov ax,100
mov ax,0a2h
mov ax,$0a2
mov ax,0xa2
mov ax,777q
mov ax,10010011b
mov eax,'abcd'
db 'hello'
db 'h','e','l','l','o'
dd 'ninechars'
dd 'nine','char','s'
db 'ninechars',0,0,0

@ -0,0 +1,3 @@
mov ax,1
mov ax,word 1
mov ax,byte 1

@ -0,0 +1,24 @@
[SECTION .data]
uhoh db 5
[GLOBAL blah]
blah dw 5
[SECTION .text]
[EXTERN hi]
[EXTERN hi]
[EXTERN bye]
mov eax, hi+2
mov eax, bye
mov eax, [hi]
mov eax, [bye+2]
mov eax, $$
mov eax, $
mov eax, $-$$
;mov eax, uhoh wrt $$
mov eax, hi+bye
mov eax, bye+$
mov eax, hi-$

@ -0,0 +1,5 @@
SECTION .text
.text db 5

@ -0,0 +1,20 @@
aaa
aam
mov ax,16
test al,al
blah
xor ax,ax
[SECTION .text]
daa
[SECTION .data]
db 5,6,7,8
[SECTION .text]
jmp blah

@ -0,0 +1,6 @@
blah equ 1
shl al, 1
shl al, 2-1
shl al, blah
shl al, 2-blah

@ -0,0 +1,6 @@
imul ax, bx, byte 255
imul ax, bx, byte 0xFF
imul ax, bx, byte -0x80
imul ax, bx, byte -0x7F
add ax, 100000
add ax, -100000

@ -0,0 +1,11 @@
BITS 32
aaa
aad 500
aad 10
aad 0xFF
aad 0
idiv al
idiv ax
idiv eax
idiv byte [0]

@ -0,0 +1,12 @@
aaa
aad 500
aad 10
aad 0xFF
aad 0
here:
idiv al
idiv ax
idiv eax
idiv byte [0]
idiv dword [eax]

@ -0,0 +1,6 @@
label:
db label
dw label
dd label

@ -0,0 +1,8 @@
mov eax, 'hi'
mov eax, 'hehe'
mov eax, 'hello'
mov eax, ''
db 0,0,0
db 'hi"'
db "hi\"
db "hi\n"

@ -0,0 +1,2 @@
mov ax,[di]

@ -0,0 +1,3 @@
;times 8 times 4 db 0
times 'ab' db 0
times 1.2 db 0
Loading…
Cancel
Save