summaryrefslogtreecommitdiff
path: root/constants.asm
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2012-01-26 19:26:08 -0800
committerYamaArashi <shadow962@live.com>2012-01-26 19:26:08 -0800
commita4fe74fa239ce1b047cd4772fbda5fdac4be51ce (patch)
treec267ec0e18a174f3c4bdb11a245ad7aa3157c94e /constants.asm
parent4f17919fbab55d8394bd4b5405063d2101b42d06 (diff)
add V-blank handler and some associated functions, replace some addresses with labels, fix rWX and rWY
hg-commit-id: 2eaa734dd9dd
Diffstat (limited to 'constants.asm')
-rw-r--r--constants.asm79
1 files changed, 77 insertions, 2 deletions
diff --git a/constants.asm b/constants.asm
index 8fab2fb9..e55e5a26 100644
--- a/constants.asm
+++ b/constants.asm
@@ -89,6 +89,9 @@ TX_RAM: MACRO
; wram locations
+; the tiles of the row or column to be redrawn by RedrawExposedScreenEdge
+W_SCREENEDGETILES EQU $CBFC
+
; coordinates of the position of the cursor for the top menu item (id 0)
W_TOPMENUITEMY EQU $CC24
W_TOPMENUITEMX EQU $CC25
@@ -742,20 +745,92 @@ H_DIVISOR EQU $FF99 ; 1 byte
H_QUOTIENT EQU $FF95 ; 4 bytes, big endian order
H_REMAINDER EQU $FF99 ; 1 byte
+; is automatic background transfer during V-blank enabled?
+; if nonzero, yes
+; if zero, no
+H_AUTOBGTRANSFERENABLED EQU $FFBA
+
+TRANSFERTOP EQU 0
+TRANSFERMIDDLE EQU 1
+TRANSFERBOTTOM EQU 2
+
+; 00 = top third of background
+; 01 = middle third of background
+; 02 = bottom third of background
+H_AUTOBGTRANSFERPORTION EQU $FFBB
+
+; the destination address of the automatic background transfer
+H_AUTOBGTRANSFERDEST EQU $FFBC ; 2 bytes
+
+; temporary storage for stack pointer during memory transfers that use pop
+; to increase speed
+H_SPTEMP EQU $FFBF ; 2 bytes
+
+; source address for VBlankCopyBgMap function
+; the first byte doubles as the byte that enabled the transfer.
+; if it is 0, the transfer is disabled
+; if it is not 0, the transfer is enabled
+; this means that XX00 is not a valid source address
+H_VBCOPYBGSRC EQU $FFC1 ; 2 bytes
+
+; destination address for VBlankCopyBgMap function
+H_VBCOPYBGDEST EQU $FFC3 ; 2 bytes
+
+; number of rows for VBlankCopyBgMap to copy
+H_VBCOPYBGNUMROWS EQU $FFC5
+
+; size of VBlankCopy transfer in 8-byte units
+H_VBCOPYSIZE EQU $FFC6
+
+; source address for VBlankCopy function
+H_VBCOPYSRC EQU $FFC7
+
+; destination address for VBlankCopy function
+H_VBCOPYDEST EQU $FFC9
+
+; size of source data for VBlankCopyDouble in 4-byte units
+H_VBCOPYDOUBLESIZE EQU $FFCB
+
+; source address for VBlankCopyDouble function
+H_VBCOPYDOUBLESRC EQU $FFCC
+
+; destination address for VBlankCopyDouble function
+H_VBCOPYDOUBLEDEST EQU $FFCE
+
+; controls whether a row or column of 2x2 tile blocks is redrawn in V-blank
+; 00 = no redraw
+; 01 = redraw column
+; 02 = redraw row
+H_SCREENEDGEREDRAW EQU $FFD0
+
+REDRAWCOL EQU 1
+REDRAWROW EQU 2
+
+H_SCREENEDGEREDRAWADDR EQU $FFD1
+
H_RAND1 EQU $FFD3
H_RAND2 EQU $FFD4
+H_FRAMECOUNTER EQU $FFD5 ; decremented every V-blank (used for delays)
+
+; V-blank sets this to 0 each time it runs.
+; So, by setting it to a nonzero value and waiting for it to become 0 again,
+; you can detect that the V-blank handler has run since then.
+H_VBLANKOCCURRED EQU $FFD6
+
H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn
; hardware registers, from the pandocs http://nocash.emubase.de/pandocs.htm
rJOYP EQU $FF00
rDIV EQU $FF04
rLCDC EQU $FF40
+rSCY EQU $FF42
+rSCX EQU $FF43
rBGP EQU $FF47
rOBP0 EQU $FF48
rOBP1 EQU $FF49
-rWX EQU $FF4A
-rWY EQU $FF4B
+rWY EQU $FF4A
+rWX EQU $FF4B
rIE EQU $FFFF