2019-10-04 20:26:21 -04:00
|
|
|
.equ RAMSTART 0x4000
|
|
|
|
; declare DIREC_LASTVAL manually so that we don't have to include directive.asm
|
|
|
|
.equ DIREC_LASTVAL RAMSTART
|
|
|
|
|
2019-05-17 10:00:30 -04:00
|
|
|
jp test
|
|
|
|
|
|
|
|
#include "core.asm"
|
|
|
|
#include "parse.asm"
|
2019-07-19 14:24:35 -04:00
|
|
|
#include "lib/util.asm"
|
2019-05-17 20:22:32 -04:00
|
|
|
#include "zasm/util.asm"
|
2019-07-19 14:24:35 -04:00
|
|
|
#include "lib/parse.asm"
|
2019-05-17 20:22:32 -04:00
|
|
|
#include "zasm/parse.asm"
|
2019-05-17 10:00:30 -04:00
|
|
|
|
|
|
|
; mocks. aren't used in tests
|
2019-05-20 09:17:50 -04:00
|
|
|
zasmGetPC:
|
2019-05-17 10:00:30 -04:00
|
|
|
zasmIsFirstPass:
|
|
|
|
symSelect:
|
2019-07-20 18:07:52 -04:00
|
|
|
symFindVal:
|
2019-05-17 10:00:30 -04:00
|
|
|
jp fail
|
|
|
|
|
|
|
|
testNum: .db 1
|
|
|
|
|
|
|
|
s99: .db "99", 0
|
|
|
|
s0x99: .db "0x99", 0
|
2019-05-17 23:00:57 -04:00
|
|
|
s0x100: .db "0x100", 0
|
2019-05-17 10:34:01 -04:00
|
|
|
s0b0101: .db "0b0101", 0
|
|
|
|
s0b01010101: .db "0b01010101", 0
|
2019-05-17 10:00:30 -04:00
|
|
|
sFoo: .db "Foo", 0
|
|
|
|
|
|
|
|
test:
|
|
|
|
ld hl, 0xffff
|
|
|
|
ld sp, hl
|
|
|
|
|
|
|
|
ld hl, s99
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
push ix \ pop hl
|
|
|
|
ld a, h
|
2019-05-17 10:00:30 -04:00
|
|
|
or a
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
ld a, l
|
2019-05-17 10:00:30 -04:00
|
|
|
cp 99
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-17 23:00:57 -04:00
|
|
|
ld hl, s0x100
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
push ix \ pop hl
|
|
|
|
ld a, h
|
2019-05-17 23:00:57 -04:00
|
|
|
cp 1
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
ld a, l
|
2019-05-17 23:00:57 -04:00
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-17 10:00:30 -04:00
|
|
|
ld hl, sFoo
|
|
|
|
call parseLiteral
|
|
|
|
jp z, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-17 10:34:01 -04:00
|
|
|
ld hl, s0b0101
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
push ix \ pop hl
|
|
|
|
ld a, h
|
2019-05-17 10:34:01 -04:00
|
|
|
or a
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
ld a, l
|
2019-05-17 10:34:01 -04:00
|
|
|
cp 0b0101
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
|
|
|
ld hl, s0b01010101
|
|
|
|
call parseLiteral
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
push ix \ pop hl
|
|
|
|
ld a, h
|
2019-05-17 10:34:01 -04:00
|
|
|
or a
|
|
|
|
jp nz, fail
|
2019-05-20 07:50:23 -04:00
|
|
|
ld a, l
|
2019-05-17 10:34:01 -04:00
|
|
|
cp 0b01010101
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-10-04 20:26:21 -04:00
|
|
|
.equ FOO 0x42
|
|
|
|
.equ BAR @+1
|
|
|
|
ld a, BAR
|
|
|
|
cp 0x43
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-17 10:00:30 -04:00
|
|
|
; success
|
|
|
|
xor a
|
|
|
|
halt
|
|
|
|
|
|
|
|
nexttest:
|
|
|
|
ld a, (testNum)
|
|
|
|
inc a
|
|
|
|
ld (testNum), a
|
|
|
|
ret
|
|
|
|
|
|
|
|
fail:
|
|
|
|
ld a, (testNum)
|
|
|
|
halt
|
|
|
|
|
|
|
|
|