2019-05-18 03:14:16 +10:00
|
|
|
.equ RAMSTART 0x4000
|
2019-07-24 06:50:19 +10:00
|
|
|
.equ ZASM_REG_MAXCNT 0xff
|
|
|
|
.equ ZASM_LREG_MAXCNT 0x40
|
|
|
|
.equ ZASM_REG_BUFSZ 0x1000
|
|
|
|
.equ ZASM_LREG_BUFSZ 0x200
|
|
|
|
|
2019-05-18 03:14:16 +10:00
|
|
|
jp test
|
|
|
|
|
|
|
|
#include "core.asm"
|
2019-07-20 04:24:35 +10:00
|
|
|
#include "lib/util.asm"
|
2019-05-18 10:22:32 +10:00
|
|
|
#include "zasm/util.asm"
|
2019-05-28 07:45:05 +10:00
|
|
|
#include "zasm/const.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
|
2019-07-24 05:21:42 +10:00
|
|
|
sOther: .db "Other", 0
|
2019-05-18 03:14:16 +10:00
|
|
|
|
|
|
|
test:
|
2019-07-24 05:21:42 +10:00
|
|
|
ld sp, 0xffff
|
2019-05-18 03:14:16 +10:00
|
|
|
|
|
|
|
; Check that we compare whole strings (a prefix will not match a longer
|
|
|
|
; string).
|
|
|
|
call symInit
|
|
|
|
ld hl, sFOOBAR
|
|
|
|
ld de, 42
|
2019-07-23 05:59:47 +10:00
|
|
|
call symRegisterGlobal
|
2019-05-18 03:14:16 +10:00
|
|
|
jp nz, fail
|
|
|
|
ld hl, sFOO
|
|
|
|
ld de, 43
|
2019-07-23 05:59:47 +10:00
|
|
|
call symRegisterGlobal
|
2019-05-18 03:14:16 +10:00
|
|
|
jp nz, fail
|
|
|
|
|
|
|
|
ld hl, sFOO
|
2019-07-21 08:07:52 +10:00
|
|
|
call symFindVal ; don't match FOOBAR
|
2019-05-18 03:14:16 +10:00
|
|
|
jp nz, fail
|
2019-05-19 23:06:24 +10:00
|
|
|
ld a, d
|
|
|
|
or a
|
|
|
|
jp nz, fail
|
|
|
|
ld a, e
|
|
|
|
cp 43
|
|
|
|
jp nz, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-07-24 05:21:42 +10:00
|
|
|
ld hl, sOther
|
|
|
|
call symFindVal
|
|
|
|
jp z, fail
|
|
|
|
call nexttest
|
|
|
|
|
2019-05-18 03:14:16 +10:00
|
|
|
; success
|
|
|
|
xor a
|
|
|
|
halt
|
|
|
|
|
|
|
|
nexttest:
|
2019-07-24 05:21:42 +10:00
|
|
|
ld hl, testNum
|
|
|
|
inc (hl)
|
2019-05-18 03:14:16 +10:00
|
|
|
ret
|
|
|
|
|
|
|
|
fail:
|
|
|
|
ld a, (testNum)
|
|
|
|
halt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|