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.

70 lines
917B

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