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

INCLUDE "hardware.inc"
; The address of an internal OAM entry
; @param \1 16-bit register
; @param \2 OAM index
; @param \3 offset
MACRO ld_OAM
ld \1, _OAM + \2 * sizeof_OAM_ATTRS + \3
ENDM
; The address of an internal OAM entry's Y coordinate
MACRO ld_OAM_y
ld_OAM \1, \2, 0
ENDM
; The address of an internal OAM entry's X coordinate
MACRO ld_OAM_x
ld_OAM \1, \2, 1
ENDM
; The address of an internal OAM entry's tile index
MACRO ld_OAM_tile
ld_OAM \1, \2, 2
ENDM
; The address of an internal OAM entry's attributes
MACRO ld_OAM_attr
ld_OAM \1, \2, 3
ENDM
; Set an entry in the internal OAM (copied on next DMA)
; @param \1 OAM index
; @param \2 X coordinate
; @param \3 Y coordinate
; @param \4 Tile index
; @param \5 Attributes
MACRO OAM_set
ld_OAM_y hl, \1
ld a, \3
ld [hli], a
ld a, \2
ld [hli], a
ld a, \4
ld [hli], a
ld a, \5
ld [hl], a
ENDM