ref: 52ba96f5f4ec53450a0ff6257ea1040d09b7e537
parent: 6c94ac124803fe0d1920fa535c915c0d833e209e
author: yenatch <yenatch@gmail.com>
date: Mon May 26 06:05:58 EDT 2014
Don't hardcode wram sections (except for alignment). Sprite buffers must be aligned to the nearest $100, so these sections are explicitly defined.
--- a/wram.asm
+++ b/wram.asm
@@ -4,7 +4,9 @@
SECTION "WRAM Bank 0", WRAM0
+ ds 256
+
SECTION "Sprite State Data", WRAM0[$c100]
wSpriteStateData1:: ; c100
@@ -29,6 +31,9 @@
; C1xF
ds $10 * $10
+
+SECTION "Sprite State Data 2", WRAM0[$c200]
+
wSpriteStateData2:: ; c200
; more data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
@@ -52,13 +57,12 @@
ds $10 * $10
+SECTION "OAM Buffer", WRAM0[$c300]
+
wOAMBuffer:: ; c300
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
-
-SECTION "Tile Map", WRAM0[$c3a0]
-
wTileMap:: ; c3a0
; buffer for tiles that are visible on screen (20 columns by 18 rows)
ds 20 * 18
@@ -70,9 +74,8 @@
; c670
+ ds 1420
-SECTION "Screen Edge Tiles", WRAM0[$cbfc]
-
wScreenEdgeTiles:: ; cbfc
; the tiles of the row or column to be redrawn by RedrawExposedScreenEdge
ds 20 * 2
@@ -152,8 +155,8 @@
; cc56
+ ds 124
-SECTION "RLE", WRAM0[$ccd2]
wRLEByteCount:: ; ccd2
ds 1
@@ -189,9 +192,8 @@
; cce3
+ ds 55
-SECTION "Stat Modifiers", WRAM0[$cd1a]
-
; stat modifiers for the player's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
@@ -653,6 +655,7 @@
; contain the upper and lower bit of each of the 8 pixels, respectively
ds 1
+ ds 2
SECTION "Sprite Buffers", SRAM
@@ -664,7 +667,7 @@
ds SPRITEBUFFERSIZE
-SECTION "Sprites", WRAMX[$d0a1], BANK[1]
+SECTION "Sprites", WRAMX, BANK[1]
W_SPRITECURPOSX:: ; d0a1
ds 1
@@ -911,14 +914,16 @@
ds 11
-SECTION "Pokedex", WRAMX[$d2f7], BANK[1]
+flag_array: MACRO
+ ds ((\1) + 7) / 8
+ENDM
wPokedexOwned:: ; d2f7
- ds (150 / 8) + 1
+ flag_array 151
wPokedexOwnedEnd::
wPokedexSeen:: ; d30a
- ds (150 / 8) + 1
+ flag_array 151
wPokedexSeenEnd::
@@ -929,9 +934,8 @@
ds 20 * 2
ds 1 ; end
-; money is in decimal
wPlayerMoney:: ; d347
- ds 3
+ ds 3 ; BCD
W_RIVALNAME:: ; d34a
ds 11
@@ -1065,9 +1069,8 @@
W_GRASSTILE:: ; d535
ds 1
+ ds 4
-SECTION "Items", WRAMX[$d53a], BANK[1]
-
wNumBoxItems:: ; d53a
ds 1
wBoxItems:: ; d53b
@@ -1077,9 +1080,8 @@
ds 4
-; coins are in decimal
wPlayerCoins:: ; d5a4
- ds 2
+ ds 2 ; BCD
W_MISSABLEOBJECTFLAGS:: ; d5a6
; bit array of missable objects. set = removed