2019-05-18 03:14:16 +10:00
|
|
|
.equ RAMSTART 0x4000
|
|
|
|
jp test
|
|
|
|
|
|
|
|
#include "core.asm"
|
2019-05-18 10:22:32 +10:00
|
|
|
#include "zasm/util.asm"
|
2019-05-18 03:14:16 +10:00
|
|
|
.equ SYM_RAMSTART RAMSTART
|
2019-05-18 10:22:32 +10:00
|
|
|
#include "zasm/symbol.asm"
|
2019-05-18 03:14:16 +10:00
|
|
|
|
|
|
|
testNum: .db 1
|
|
|
|
|
|
|
|
sFOO: .db "FOO", 0
|
|
|
|
sFOOBAR: .db "FOOBAR", 0
|
|
|
|
|
|
|
|
test:
|
|
|
|
ld hl, 0xffff
|
|
|
|
ld sp, hl
|
|
|
|
|
|
|
|
; Check that we compare whole strings (a prefix will not match a longer
|
|
|
|
; string).
|
|
|
|
call symInit
|
|
|
|
ld hl, sFOOBAR
|
|
|
|
ld de, 42
|
|
|
|
call symRegister
|
|
|
|
jp nz, fail
|
|
|
|
ld hl, sFOO
|
|
|
|
ld de, 43
|
|
|
|
call symRegister
|
|
|
|
jp nz, fail
|
|
|
|
|
|
|
|
ld hl, sFOO
|
2019-05-19 23:54:42 +10:00
|
|
|
call symFind ; don't match FOOBAR
|
2019-05-18 03:14:16 +10:00
|
|
|
jp nz, fail
|
2019-05-19 23:06:24 +10:00
|
|
|
call symGetVal
|
|
|
|
ld a, d
|
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
ld a, e
|
|
|
|
cp 43
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-18 03:14:16 +10:00
|
|
|
; success
|
|
|
|
xor a
|
|
|
|
halt
|
|
|
|
|
|
|
|
nexttest:
|
|
|
|
ld a, (testNum)
|
|
|
|
inc a
|
|
|
|
ld (testNum), a
|
|
|
|
ret
|
|
|
|
|
|
|
|
fail:
|
|
|
|
ld a, (testNum)
|
|
|
|
halt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|