An emulator, assembler, and disassembler for the Sega Game Gear
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.
 
 
 
 
 

104 lines
1.3 KiB

  1. ;; Copyright (C) 2016 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. ;; Released under the terms of the MIT License. See LICENSE for details.
  3. ; ----- CRATER UNIT TESTING SUITE ---------------------------------------------
  4. ; 08-instructions.asm
  5. ; Exhaustive test of instruction syntax
  6. .define COUNTER $C010
  7. .define OFFSET 6
  8. .define OFFSET2 157
  9. .org $1000
  10. str1: .ascii "Hello, world!"
  11. .org $0000
  12. main:
  13. di
  14. call inst
  15. halt
  16. .org $0066
  17. nmi:
  18. retn
  19. .org $2000
  20. inst:
  21. inc a
  22. inc c
  23. inc hl
  24. inc sp
  25. inc (hl)
  26. inc ( hl )
  27. inc ix
  28. inc iyl
  29. inc (ix)
  30. inc ( ix )
  31. inc (iy+0)
  32. inc (ix+3)
  33. inc (ix+OFFSET)
  34. inc (ix-OFFSET)
  35. inc ( ix + 7 )
  36. inc (ix-8)
  37. inc (ix - +9)
  38. inc (iy+127)
  39. inc (iy-128)
  40. add a, e
  41. add a, 5
  42. add a, $12
  43. add a, (hl)
  44. add a, (ix+4)
  45. add hl, bc
  46. add ix, de
  47. adc a, e
  48. adc a, 5
  49. adc a, $12
  50. adc a, (hl)
  51. adc a, (ix+4)
  52. adc hl, bc
  53. rlca
  54. rrca
  55. rla
  56. rra
  57. daa
  58. cpl
  59. scf
  60. ccf
  61. halt
  62. exx
  63. ei
  64. di
  65. cpd
  66. cpdr
  67. cpi
  68. cpir
  69. ind
  70. indr
  71. ini
  72. inir
  73. ldd
  74. lddr
  75. ldi
  76. ldir
  77. otdr
  78. otir
  79. outd
  80. outi
  81. rrd
  82. rld
  83. ld hl, COUNTER ; H contains $C0, L contains $10
  84. ld d, (hl) ; D contains $FF (garbage)
  85. ld c, $3B ; C contains $3B
  86. ld (hl), c ; memory address $C010 contains $3B
  87. ld hl, str1
  88. ld b, (hl) ; B contains 'H'
  89. ld hl, (str1) ; H contains 'e', L contains 'H'
  90. ld (hl), b ; error, writing to cartridge ROM