mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-06 12:38:05 +11:00
64 lines
821 B
NASM
64 lines
821 B
NASM
.equ RAMSTART 0x4000
|
|
jp test
|
|
|
|
#include "core.asm"
|
|
#include "lib/util.asm"
|
|
#include "zasm/util.asm"
|
|
#include "zasm/const.asm"
|
|
.equ SYM_RAMSTART RAMSTART
|
|
#include "zasm/symbol.asm"
|
|
|
|
; Pretend that we aren't in first pass
|
|
zasmIsFirstPass:
|
|
jp unsetZ
|
|
|
|
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 symRegisterGlobal
|
|
jp nz, fail
|
|
ld hl, sFOO
|
|
ld de, 43
|
|
call symRegisterGlobal
|
|
jp nz, fail
|
|
|
|
ld hl, sFOO
|
|
call symFindVal ; don't match FOOBAR
|
|
jp nz, fail
|
|
ld a, d
|
|
or a
|
|
jp nz, fail
|
|
ld a, e
|
|
cp 43
|
|
jp nz, fail
|
|
call nexttest
|
|
|
|
; success
|
|
xor a
|
|
halt
|
|
|
|
nexttest:
|
|
ld a, (testNum)
|
|
inc a
|
|
ld (testNum), a
|
|
ret
|
|
|
|
fail:
|
|
ld a, (testNum)
|
|
halt
|
|
|
|
|
|
|
|
|