2019-05-18 00:00:30 +10:00
|
|
|
jp test
|
|
|
|
|
|
|
|
#include "core.asm"
|
|
|
|
#include "parse.asm"
|
2019-05-18 10:22:32 +10:00
|
|
|
#include "zasm/util.asm"
|
|
|
|
#include "zasm/parse.asm"
|
2019-05-18 00:00:30 +10:00
|
|
|
|
|
|
|
; mocks. aren't used in tests
|
|
|
|
zasmIsFirstPass:
|
|
|
|
symSelect:
|
|
|
|
symFind:
|
|
|
|
symGetVal:
|
|
|
|
jp fail
|
|
|
|
|
|
|
|
testNum: .db 1
|
|
|
|
|
|
|
|
s99: .db "99", 0
|
|
|
|
s0x99: .db "0x99", 0
|
2019-05-18 13:00:57 +10:00
|
|
|
s0x100: .db "0x100", 0
|
2019-05-18 00:34:01 +10:00
|
|
|
s0b0101: .db "0b0101", 0
|
|
|
|
s0b01010101: .db "0b01010101", 0
|
2019-05-18 00:00:30 +10:00
|
|
|
sFoo: .db "Foo", 0
|
|
|
|
|
|
|
|
test:
|
|
|
|
ld hl, 0xffff
|
|
|
|
ld sp, hl
|
|
|
|
|
|
|
|
ld hl, s99
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixh
|
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixl
|
|
|
|
cp 99
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-18 13:00:57 +10:00
|
|
|
ld hl, s0x100
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixh
|
|
|
|
cp 1
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixl
|
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-18 00:00:30 +10:00
|
|
|
ld hl, sFoo
|
|
|
|
call parseLiteral
|
|
|
|
jp z, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-18 00:34:01 +10:00
|
|
|
ld hl, s0b0101
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixh
|
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixl
|
|
|
|
cp 0b0101
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
|
|
|
ld hl, s0b01010101
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixh
|
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
ld a, ixl
|
|
|
|
cp 0b01010101
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-18 00:00:30 +10:00
|
|
|
; success
|
|
|
|
xor a
|
|
|
|
halt
|
|
|
|
|
|
|
|
nexttest:
|
|
|
|
ld a, (testNum)
|
|
|
|
inc a
|
|
|
|
ld (testNum), a
|
|
|
|
ret
|
|
|
|
|
|
|
|
fail:
|
|
|
|
ld a, (testNum)
|
|
|
|
halt
|
|
|
|
|
|
|
|
|