An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

01_basic_math.asm 2.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ;; Copyright (C) 2014-2015 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. ; This file contains test cases for basic arithmetic operations on registers,
  5. ; without involving memory or control flow.
  6. .include "_header.asm"
  7. test:
  8. ld a, 0
  9. ld b, 0
  10. ld c, 0
  11. ld d, 0
  12. ld e, 0
  13. ld h, 0
  14. ld l, 0
  15. emu rassert(a=$00, b=$00, c=$00, d=$00, e=$00, h=$00, l=$00)
  16. inc a
  17. emu rassert(a=$01, b=$00, c=$00, d=$00, e=$00, h=$00, l=$00)
  18. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  19. inc b
  20. emu rassert(a=$01, b=$01, c=$00, d=$00, e=$00, h=$00, l=$00)
  21. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  22. inc c
  23. emu rassert(a=$01, b=$01, c=$01, d=$00, e=$00, h=$00, l=$00)
  24. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  25. inc d
  26. emu rassert(a=$01, b=$01, c=$01, d=$01, e=$00, h=$00, l=$00)
  27. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  28. inc e
  29. emu rassert(a=$01, b=$01, c=$01, d=$01, e=$01, h=$00, l=$00)
  30. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  31. inc h
  32. emu rassert(a=$01, b=$01, c=$01, d=$01, e=$01, h=$01, l=$00)
  33. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  34. inc l
  35. emu rassert(a=$01, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  36. emu fassert(s=0, z=0, f5=0, h=0, f3=0, pv=0, n=0)
  37. inc a
  38. inc a
  39. inc a
  40. emu rassert(a=$04, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  41. ld a, 42
  42. emu rassert(a=$2A, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  43. inc a
  44. emu rassert(a=$2B, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  45. emu fassert(s=0, z=0, f5=1, h=0, f3=0, pv=0, n=0)
  46. ld a, $0F
  47. emu rassert(a=$0F, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  48. inc a
  49. emu rassert(a=$10, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  50. emu fassert(s=0, z=0, f5=0, h=1, f3=0, pv=0, n=0)
  51. ld a, $FE
  52. inc a
  53. emu rassert(a=$FF, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  54. emu fassert(s=1, z=0, f5=1, h=1, f3=1, pv=0, n=0)
  55. inc a
  56. emu rassert(a=$00, b=$01, c=$01, d=$01, e=$01, h=$01, l=$01)
  57. emu fassert(s=0, z=1, f5=0, h=1, f3=0, pv=1, n=0)
  58. inc bc
  59. inc de
  60. inc hl
  61. emu rassert(a=$00, b=$01, c=$02, d=$01, e=$02, h=$01, l=$02)
  62. emu fassert(s=0, z=1, f5=0, h=1, f3=0, pv=1, n=0)
  63. ld c, $FF
  64. inc bc
  65. emu rassert(a=$00, b=$02, c=$00, d=$01, e=$02, h=$01, l=$02)
  66. ld b, $FF
  67. ld c, $FE
  68. inc bc
  69. emu rassert(a=$00, b=$FF, c=$FF, d=$01, e=$02, h=$01, l=$02)
  70. inc bc
  71. emu rassert(a=$00, b=$00, c=$00, d=$01, e=$02, h=$01, l=$02)