Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
902B

  1. .equ RAMSTART 0x4000
  2. .equ ZASM_REG_MAXCNT 0xff
  3. .equ ZASM_LREG_MAXCNT 0x40
  4. .equ ZASM_REG_BUFSZ 0x1000
  5. .equ ZASM_LREG_BUFSZ 0x200
  6. jp test
  7. .inc "core.asm"
  8. .inc "lib/util.asm"
  9. .inc "zasm/util.asm"
  10. .inc "zasm/const.asm"
  11. .equ SYM_RAMSTART RAMSTART
  12. .inc "zasm/symbol.asm"
  13. testNum: .db 1
  14. sFOO: .db "FOO", 0
  15. sFOOBAR: .db "FOOBAR", 0
  16. sOther: .db "Other", 0
  17. test:
  18. ld sp, 0xffff
  19. ; Check that we compare whole strings (a prefix will not match a longer
  20. ; string).
  21. call symInit
  22. ld hl, sFOOBAR
  23. ld de, 42
  24. call symRegisterGlobal
  25. jp nz, fail
  26. ld hl, sFOO
  27. ld de, 43
  28. call symRegisterGlobal
  29. jp nz, fail
  30. ld hl, sFOO
  31. call symFindVal ; don't match FOOBAR
  32. jp nz, fail
  33. ld a, d
  34. or a
  35. jp nz, fail
  36. ld a, e
  37. cp 43
  38. jp nz, fail
  39. call nexttest
  40. ld hl, sOther
  41. call symFindVal
  42. jp z, fail
  43. call nexttest
  44. ; success
  45. xor a
  46. halt
  47. nexttest:
  48. ld hl, testNum
  49. inc (hl)
  50. ret
  51. fail:
  52. ld a, (testNum)
  53. halt