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.

47 lines
910 B

  1. INCLUDE "hardware.inc"
  2. ; The address of an internal OAM entry
  3. ; @param \1 16-bit register
  4. ; @param \2 OAM index
  5. ; @param \3 offset
  6. MACRO ld_OAM
  7. ld \1, _OAM + \2 * sizeof_OAM_ATTRS + \3
  8. ENDM
  9. ; The address of an internal OAM entry's Y coordinate
  10. MACRO ld_OAM_y
  11. ld_OAM \1, \2, 0
  12. ENDM
  13. ; The address of an internal OAM entry's X coordinate
  14. MACRO ld_OAM_x
  15. ld_OAM \1, \2, 1
  16. ENDM
  17. ; The address of an internal OAM entry's tile index
  18. MACRO ld_OAM_tile
  19. ld_OAM \1, \2, 2
  20. ENDM
  21. ; The address of an internal OAM entry's attributes
  22. MACRO ld_OAM_attr
  23. ld_OAM \1, \2, 3
  24. ENDM
  25. ; Set an entry in the internal OAM (copied on next DMA)
  26. ; @param \1 OAM index
  27. ; @param \2 X coordinate
  28. ; @param \3 Y coordinate
  29. ; @param \4 Tile index
  30. ; @param \5 Attributes
  31. MACRO OAM_set
  32. ld_OAM_y hl, \1
  33. ld a, \3
  34. ld [hli], a
  35. ld a, \2
  36. ld [hli], a
  37. ld a, \4
  38. ld [hli], a
  39. ld a, \5
  40. ld [hl], a
  41. ENDM