summaryrefslogtreecommitdiff
path: root/hram.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /hram.asm
parent53fcd05aa24693093d8af1dc8ec4fedd3957decc (diff)
Sync with pokered
Diffstat (limited to 'hram.asm')
-rw-r--r--hram.asm499
1 files changed, 289 insertions, 210 deletions
diff --git a/hram.asm b/hram.asm
index 0e1fae7e..f3ffc564 100644
--- a/hram.asm
+++ b/hram.asm
@@ -1,333 +1,412 @@
-hSoftReset EQU $FF8A
+SECTION "HRAM", HRAM
+
; Initialized to 16.
; Decremented each input iteration if the player
; presses the reset sequence (A+B+SEL+START).
; Soft reset when 0 is reached.
+hSoftReset:: db
-; base tile ID to which offsets are added
-hBaseTileID EQU $FF8B
-
-; 3-byte BCD number
-hItemPrice EQU $FF8B
-
-hDexWeight EQU $FF8B
-
-hWarpDestinationMap EQU $FF8B
-
-hOAMTile EQU $FF8B
-
-hPreviousTileset EQU $FF8B
-
-hEastWestConnectedMapWidth EQU $FF8B
-
-hSlideAmount EQU $FF8B
-
-hRLEByteValue EQU $FF8B
+UNION
+hBaseTileID:: ; base tile ID to which offsets are added
+hDexWeight::
+hWarpDestinationMap::
+hOAMTile::
+hROMBankTemp::
+hPreviousTileset::
+hRLEByteValue::
+ db
-H_SPRITEWIDTH EQU $FF8B ; in tiles
-H_SPRITEINTERLACECOUNTER EQU $FF8B
-H_SPRITEHEIGHT EQU $FF8C ; in tiles
-H_SPRITEOFFSET EQU $FF8D
+hSpriteIndexOrTextID:: ; DisplayTextID's argument
+hPartyMonIndex::
+ db
-; counters for blinking down arrow
-H_DOWNARROWBLINKCNT1 EQU $FF8B
-H_DOWNARROWBLINKCNT2 EQU $FF8C
-
-H_SPRITEDATAOFFSET EQU $FF8B
-H_SPRITEINDEX EQU $FF8C
-
-hMapStride EQU $FF8B
-hMapWidth EQU $FF8C
+hVRAMSlot::
+ db
-hNorthSouthConnectionStripWidth EQU $FF8B
-hNorthSouthConnectedMapWidth EQU $FF8C
+hFourTileSpriteCount::
+hHalveItemPrices::
+ db
-; DisplayTextID's argument
-hSpriteIndexOrTextID EQU $FF8C
+NEXTU
+hItemPrice:: ds 3 ; BCD number
-hPartyMonIndex EQU $FF8C
+NEXTU
+hSlideAmount:: db
; the total number of tiles being shifted each time the pic slides by one tile
-hSlidingRegionSize EQU $FF8C
-
-; 2 bytes
-hEnemySpeed EQU $FF8D
-
-hVRAMSlot EQU $FF8D
-
-hFourTileSpriteCount EQU $FF8E
+hSlidingRegionSize:: db
; -1 = left
; 0 = right
-hSlideDirection EQU $FF8D
-
-hSpriteFacingDirection EQU $FF8D
-
-hSpriteMovementByte2 EQU $FF8D
-
-hSpriteImageIndex EQU $FF8D
+hSlideDirection:: db
-hLoadSpriteTemp1 EQU $FF8D
-hLoadSpriteTemp2 EQU $FF8E
-
-hHalveItemPrices EQU $FF8E
-
-hSpriteOffset2 EQU $FF8F
-
-hOAMBufferOffset EQU $FF90
-
-hSpriteScreenX EQU $FF91
-hSpriteScreenY EQU $FF92
-
-hTilePlayerStandingOn EQU $FF93
-
-hSpritePriority EQU $FF94
-
-; 2 bytes
-hSignCoordPointer EQU $FF95
-
-hNPCMovementDirections2Index EQU $FF95
-
-; CalcPositionOfPlayerRelativeToNPC
-hNPCSpriteOffset EQU $FF95
-
-; temp value used when swapping bytes
-hSwapTemp EQU $FF95
-
-hExperience EQU $FF96 ; 3 bytes, big endian
-
-; Multiplication and division variables are meant
-; to overlap for back-to-back usage. Big endian.
-
-H_MULTIPLICAND EQU $FF96 ; 3 bytes
-H_MULTIPLIER EQU $FF99 ; 1 byte
-H_PRODUCT EQU $FF95 ; 4 bytes
-
-H_DIVIDEND EQU $FF95 ; 4 bytes
-H_DIVISOR EQU $FF99 ; 1 byte
-H_QUOTIENT EQU $FF95 ; 4 bytes
-H_REMAINDER EQU $FF99 ; 1 byte
-
-H_DIVIDEBUFFER EQU $FF9A
-
-H_MULTIPLYBUFFER EQU $FF9B
+NEXTU
+hSpriteInterlaceCounter::
+hSpriteWidth:: db ; in tiles
+hSpriteHeight:: db ; in tiles
+hSpriteOffset:: db
+NEXTU
+; counters for blinking down arrow
+hDownArrowBlinkCount1:: db
+hDownArrowBlinkCount2:: db
+
+NEXTU
+hMapStride::
+hEastWestConnectedMapWidth::
+hNorthSouthConnectionStripWidth::
+ db
+hMapWidth::
+hNorthSouthConnectedMapWidth::
+ db
+
+NEXTU
+hSpriteDataOffset:: db
+hSpriteIndex:: db
+hSpriteImageIndex::
+hSpriteFacingDirection::
+hSpriteMovementByte2::
+ db
+
+NEXTU
+ ds 2
+hLoadSpriteTemp1:: db
+hLoadSpriteTemp2:: db
+
+NEXTU
+ ds 2
+hEnemySpeed:: dw
+ENDU
+
+UNION
+hSpriteOffset2:: db
+hOAMBufferOffset:: db
+hSpriteScreenX:: db
+hSpriteScreenY:: db
+
+NEXTU
+hFF8F:: db
+hFF90:: db
+hFF91:: db
+hFF92:: db
+ENDU
+
+hTilePlayerStandingOn:: db
+
+hSpritePriority:: db
+
+UNION
+;; Multiplication and division variables are meant
+;; to overlap for back-to-back usage. Big endian.
+UNION
+ ds 1
+hMultiplicand:: ds 3
+hMultiplier:: db
+ ds 1
+hMultiplyBuffer:: ds 4
+NEXTU
+hProduct:: ds 4
+NEXTU
+hDividend:: ds 4
+hDivisor:: db
+hDivideBuffer:: ds 5
+NEXTU
+hQuotient:: ds 4
+hRemainder:: db
+ENDU
+
+NEXTU
; PrintNumber (big endian).
-H_PASTLEADINGZEROES EQU $FF95 ; last char printed
-H_NUMTOPRINT EQU $FF96 ; 3 bytes
-H_POWEROFTEN EQU $FF99 ; 3 bytes
-H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes
-
+hPastLeadingZeros:: db ; last char printed
+hNumToPrint:: ds 3
+hPowerOf10:: ds 3
+hSavedNumToPrint:: ds 3
+
+NEXTU
+hNPCMovementDirections2Index::
+hNPCSpriteOffset::
; distance in steps between NPC and player
-hNPCPlayerYDistance EQU $FF95
-hNPCPlayerXDistance EQU $FF96
-
-hFindPathNumSteps EQU $FF97
-
+hNPCPlayerYDistance::
+ db
+hNPCPlayerXDistance::
+ db
+hFindPathNumSteps:: db
; bit 0: set when the end of the path's Y coordinate matches the target's
; bit 1: set when the end of the path's X coordinate matches the target's
; When both bits are set, the end of the path is at the target's position
; (i.e. the path has been found).
-hFindPathFlags EQU $FF98
-
-hFindPathYProgress EQU $FF99
-hFindPathXProgress EQU $FF9A
-
+hFindPathFlags:: db
+hFindPathYProgress:: db
+hFindPathXProgress:: db
; 0 = from player to NPC
; 1 = from NPC to player
-hNPCPlayerRelativePosPerspective EQU $FF9B
-
+hNPCPlayerRelativePosPerspective:: db
+ ds 1
; bit 0:
; 0 = target is to the south or aligned
; 1 = target is to the north
; bit 1:
; 0 = target is to the east or aligned
; 1 = target is to the west
-hNPCPlayerRelativePosFlags EQU $FF9D
-
-; some code zeroes this for no reason when writing a coin amount
-hUnusedCoinsByte EQU $FF9F
-
-hMoney EQU $FF9F ; 3-byte BCD number
-hCoins EQU $FFA0 ; 2-byte BCD number
-
-hDivideBCDDivisor EQU $FFA2 ; 3-byte BCD number
-hDivideBCDQuotient EQU $FFA2 ; 3-byte BCD number
-hDivideBCDBuffer EQU $FFA5 ; 3-byte BCD number
+hNPCPlayerRelativePosFlags:: db
-hSerialReceivedNewData EQU $FFA9
+NEXTU
+hSwapItemID:: db
+hSwapItemQuantity:: db
-; $01 = using external clock
-; $02 = using internal clock
-; $ff = establishing connection
-hSerialConnectionStatus EQU $FFAA
+NEXTU
+hSignCoordPointer:: dw
-hSerialIgnoringInitialData EQU $FFAB
+NEXTU
+ ds 1
+hMutateWY:: db
+hMutateWX:: db
-hSerialSendData EQU $FFAC
+NEXTU
+; temp value used when swapping bytes or words
+hSwapTemp:: db
+hExperience:: ds 3 ; big endian
+ENDU
-hSerialReceiveData EQU $FFAD
-
-; these values are copied to SCX, SCY, and WY during V-blank
-hSCX EQU $FFAE
-hSCY EQU $FFAF
-hWY EQU $FFB0
+UNION
+hMoney:: ds 3 ; BCD number
+NEXTU
+; some code zeroes this for no reason when writing a coin amount
+hUnusedCoinsByte:: db
+hCoins:: ds 2 ; BCD number
+ENDU
-hJoyLast EQU $FFB1
-hJoyReleased EQU $FFB2
-hJoyPressed EQU $FFB3
-hJoyHeld EQU $FFB4
-hJoy5 EQU $FFB5
-hJoy6 EQU $FFB6
-hJoy7 EQU $FFB7
+hDivideBCDDivisor::
+hDivideBCDQuotient::
+ ds 3 ; BCD number
+hDivideBCDBuffer::
+ ds 3 ; BCD number
-H_LOADEDROMBANK EQU $FFB8
+ ds 1
-hSavedROMBank EQU $FFB9
+hSerialReceivedNewData:: db
+; $01 = using external clock
+; $02 = using internal clock
+; $ff = establishing connection
+hSerialConnectionStatus:: db
+hSerialIgnoringInitialData:: db
+hSerialSendData:: db
+hSerialReceiveData:: db
+
+; these values are copied to rSCX, rSCY, and rWY during V-blank
+hSCX:: db
+hSCY:: db
+hWY:: db
+
+hJoyLast:: db
+hJoyReleased:: db
+hJoyPressed:: db
+hJoyHeld:: db
+hJoy5:: db
+hJoy6:: db
+hJoy7:: db
+
+hLoadedROMBank:: db
+hSavedROMBank:: db
; 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
+hAutoBGTransferEnabled:: db
; 00 = top third of background
; 01 = middle third of background
; 02 = bottom third of background
-H_AUTOBGTRANSFERPORTION EQU $FFBB
+hAutoBGTransferPortion:: db
; the destination address of the automatic background transfer
-H_AUTOBGTRANSFERDEST EQU $FFBC ; 2 bytes
+hAutoBGTransferDest:: dw
+
+hRedrawMapViewRowOffset:: db
; temporary storage for stack pointer during memory transfers that use pop
; to increase speed
-H_SPTEMP EQU $FFBF ; 2 bytes
+hSPTemp:: dw
; 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
+hVBlankCopyBGSource:: dw
; destination address for VBlankCopyBgMap function
-H_VBCOPYBGDEST EQU $FFC3 ; 2 bytes
+hVBlankCopyBGDest:: dw
; number of rows for VBlankCopyBgMap to copy
-H_VBCOPYBGNUMROWS EQU $FFC5
+hVBlankCopyBGNumRows:: db
; size of VBlankCopy transfer in 16-byte units
-H_VBCOPYSIZE EQU $FFC6
+hVBlankCopySize:: db
; source address for VBlankCopy function
-H_VBCOPYSRC EQU $FFC7
+hVBlankCopySource:: dw
; destination address for VBlankCopy function
-H_VBCOPYDEST EQU $FFC9
+hVBlankCopyDest:: dw
; size of source data for VBlankCopyDouble in 8-byte units
-H_VBCOPYDOUBLESIZE EQU $FFCB
+hVBlankCopyDoubleSize:: db
; source address for VBlankCopyDouble function
-H_VBCOPYDOUBLESRC EQU $FFCC
+hVBlankCopyDoubleSource:: dw
; destination address for VBlankCopyDouble function
-H_VBCOPYDOUBLEDEST EQU $FFCE
+hVBlankCopyDoubleDest:: dw
; controls whether a row or column of 2x2 tile blocks is redrawn in V-blank
; 00 = no redraw
; 01 = redraw column
; 02 = redraw row
-hRedrawRowOrColumnMode EQU $FFD0
-
-REDRAW_COL EQU 1
-REDRAW_ROW EQU 2
+hRedrawRowOrColumnMode:: db
-hRedrawRowOrColumnDest EQU $FFD1
+hRedrawRowOrColumnDest:: dw
-hRandomAdd EQU $FFD3
-hRandomSub EQU $FFD4
+hRandomAdd:: db
+hRandomSub:: db
-H_FRAMECOUNTER EQU $FFD5 ; decremented every V-blank (used for delays)
+hFrameCounter:: db ; 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
+hVBlankOccurred:: db
; 00 = indoor
; 01 = cave
; 02 = outdoor
; this is often set to 00 in order to turn off water and flower BG tile animations
-hTilesetType EQU $FFD7
-
-hMovingBGTilesCounter1 EQU $FFD8
+hTilesetType:: db
-H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10
+hMovingBGTilesCounter1:: db
-hItemCounter EQU $FFDB
+ ds 1
-hCanceledPrinting EQU $FFDB
+hCurrentSpriteOffset:: db ; multiple of $10
-hGymGateIndex EQU $FFDB
+UNION
+hPlayerFacing:: db
+hPlayerYCoord:: db
+hPlayerXCoord:: db
-hGymTrashCanRandNumMask EQU $FFDB
-
-hDexRatingNumMonsSeen EQU $FFDB
-hDexRatingNumMonsOwned EQU $FFDC
+NEXTU
; $00 = bag full
; $01 = got item
; $80 = didn't meet required number of owned mons
; $FF = player cancelled
-hOaksAideResult EQU $FFDB
+hOaksAideResult::
+hOaksAideRequirement:: ; required number of owned mons
+ db
+hOaksAideRewardItem:: db
+hOaksAideNumMonsOwned:: db
+
+NEXTU
+hVendingMachineItem:: db
+hVendingMachinePrice:: ds 3 ; BCD number
+
+NEXTU
+hGymGateIndex:: db
+hGymGateAnswer:: db
+
+NEXTU
+hDexRatingNumMonsSeen:: db
+hDexRatingNumMonsOwned:: db
+
+NEXTU
+hItemToRemoveID:: db
+hItemToRemoveIndex:: db
+
+NEXTU
+hItemCounter::
+hSavedCoordIndex::
+hMissableObjectIndex::
+hGymTrashCanRandNumMask::
+ db
-hOaksAideRequirement EQU $FFDB ; required number of owned mons
-hOaksAideRewardItem EQU $FFDC
-hOaksAideNumMonsOwned EQU $FFDD
+NEXTU
+hFFDB:: db
+hFFDC:: db
-hItemToRemoveID EQU $FFDB
-hItemToRemoveIndex EQU $FFDC
+NEXTU
+hCanceledPrinting:: db
+ENDU
-hVendingMachineItem EQU $FFDB
-hVendingMachinePrice EQU $FFDC ; 3-byte BCD number
+ ds 1
+
+hBackupGymGateIndex::
+hUnlockedSilphCoDoors::
+ db
; the first tile ID in a sequence of tile IDs that increase by 1 each step
-hStartTileID EQU $FFE1
+hStartTileID:: db
+
+ ds 2
+
+hNewPartyLength:: db
+
+UNION
+hDividend2:: db
+hDivisor2:: db
+hQuotient2:: db
-hNewPartyLength EQU $FFE4
+NEXTU
+hIsHiddenMissableObject:: db
+ENDU
-hDividend2 EQU $FFE5
-hDivisor2 EQU $FFE6
-hQuotient2 EQU $FFE7
+hMapROMBank:: db
-hSpriteVRAMSlotAndFacing EQU $FFE9
+hSpriteVRAMSlotAndFacing:: db
-hCoordsInFrontOfPlayerMatch EQU $FFEA
+hCoordsInFrontOfPlayerMatch::
+hSpriteAnimFrameCounter::
+ db
-hSpriteAnimFrameCounter EQU $FFEA
+UNION
+hSpriteScreenYCoord:: db
+hSpriteScreenXCoord:: db
+hSpriteMapYCoord:: db
+hSpriteMapXCoord:: db
-hItemAlreadyFound EQU $FFEB
+NEXTU
+hItemAlreadyFound:: db
+ ds 2
+hDidntFindAnyHiddenObject:: db
-hDidntFindAnyHiddenObject EQU $FFEE
+NEXTU
+ ds 1
+hSavedMapTextPtr:: dw
+ ds 1
+ENDU
-H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn
+ ds 4
-hLCDCPointer EQU $FFF4
+hWhoseTurn:: db ; 0 on player's turn, 1 on enemy's turn
-hJoyInput EQU $FFF5
+hLCDCPointer:: db
-hDisableJoypadPolling EQU $FFF8 ; non-zero value disables polling of joypad
+hJoyInput:: db
+
+ ds 2
+
+hDisableJoypadPolling:: db
+
+hClearLetterPrintingDelayFlags:: db
; bit 0: draw HP fraction to the right of bar instead of below (for party menu)
; bit 1: menu is double spaced
-hFlags_0xFFFA EQU $FFFA
+hFlagsFFFA:: db
+
+hFieldMoveMonMenuTopMenuItemX:: db
-hFieldMoveMonMenuTopMenuItemX EQU $FFFB
+hFFFC:: db
-h_0xFFFC EQU $FFFC
+ ds 1
-hGBC EQU $FFFE ; 0 if DMG, != 0 if GBC
+; 0 if DMG, != 0 if GBC
+hGBC:: db