shithub: pokecrystal

Download patch

ref: 45e3f6aca90dc4dee962f5aafe4eb5590122361c
parent: d5f5e6d5dbfef49fac2c436d34f766497c8c0a5f
author: Rangi <[email protected]>
date: Fri Apr 19 07:35:27 EDT 2019

Identify some more WRAM labels

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1669,8 +1669,8 @@
 ; sets some flag
 ; seems to be unused
 ; params: 0
-	ld a, 1
-	ld [wc2b5], a
+	ld a, TRUE
+	ld [wUnusedMusicF9Flag], a
 	ret
 
 MusicE2:
@@ -2345,7 +2345,7 @@
 	dec a
 	jr nz, .loop
 	xor a
-	ld [wc2b5], a
+	ld [wUnusedMusicF9Flag], a
 	ld [wChannel1JumpCondition], a
 	ld [wChannel2JumpCondition], a
 	ld [wChannel3JumpCondition], a
--- a/docs/event_commands.md
+++ b/docs/event_commands.md
@@ -263,7 +263,9 @@
 ## `$49`: `closetext`
 
 
-## `$4A`: <code>loadbytec2cf <i>byte</i></code>
+## `$4A`: <code>writeunusedbytebuffer <i>byte</i></code>
+
+<code>[<i>wUnusedScriptByteBuffer</i>] = <i>byte</i></code>
 
 
 ## `$4B`: <code>farwritetext <i>text_pointer</i></code>
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -585,7 +585,7 @@
 	ld [hli], a
 	dec b
 	jr nz, .loop3
-	ld hl, wTimeCapsulePartyMon1 - 1 + 6
+	ld hl, wTimeCapsulePartyMon1 - 1 + PARTY_LENGTH
 	ld de, wc612
 	lb bc, 0, 0
 .loop4
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -1836,7 +1836,7 @@
 	ret
 
 GetMovementByte:
-	ld hl, wMovementDataPointer
+	ld hl, wMovementDataBank
 	call _GetMovementByte
 	ret
 
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -137,7 +137,7 @@
 	dw Script_opentext                   ; 47
 	dw Script_refreshscreen              ; 48
 	dw Script_closetext                  ; 49
-	dw Script_loadbytec2cf               ; 4a
+	dw Script_writeunusedbytebuffer      ; 4a
 	dw Script_farwritetext               ; 4b
 	dw Script_writetext                  ; 4c
 	dw Script_repeattext                 ; 4d
@@ -2636,12 +2636,12 @@
 	call GetScriptByte
 	ret
 
-Script_loadbytec2cf:
+Script_writeunusedbytebuffer:
 ; script command 0x4a
 ; parameters: byte
 
 	call GetScriptByte
-	ld [wc2cf], a
+	ld [wUnusedScriptByteBuffer], a
 	ret
 
 	db closetext_command ; unused
--- a/engine/overworld/warp_connection.asm
+++ b/engine/overworld/warp_connection.asm
@@ -1,6 +1,6 @@
 
 HandleNewMap:
-	call ClearUnusedC7E8
+	call ClearUnusedMapBuffer
 	call ResetMapBufferEventFlags
 	call ResetFlashIfOutOfCave
 	call GetCurrentMapSceneID
--- a/engine/pokemon/breeding.asm
+++ b/engine/pokemon/breeding.asm
@@ -254,7 +254,7 @@
 	ld [wCurSpecies], a
 	call GetPokemonName
 	xor a
-	ld [wd26b], a
+	ld [wUnusedEggHatchFlag], a
 	call GetBaseData
 	ld a, [wCurPartyMon]
 	ld hl, wPartyMon1
@@ -325,8 +325,8 @@
 	pop de
 	jr c, .nonickname
 
-	ld a, $1
-	ld [wd26b], a
+	ld a, TRUE
+	ld [wUnusedEggHatchFlag], a
 	xor a
 	ld [wMonType], a
 	push de
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -479,7 +479,7 @@
 	xor a
 	ld [wVirtualOAMSprite38Attributes], a
 	ld [wVirtualOAMSprite39Attributes], a
-	ld a, [wc296]
+	ld a, [wUnusedBCDNumber]
 	cp 100
 	jr nc, .max
 	add 1
--- a/home/map.asm
+++ b/home/map.asm
@@ -1,8 +1,8 @@
 ; Functions dealing with rendering and interacting with maps.
 
-ClearUnusedC7E8::
-	ld hl, wUnusedC7E8
-	ld bc, wUnusedC7E8End - wUnusedC7E8
+ClearUnusedMapBuffer::
+	ld hl, wUnusedMapBuffer
+	ld bc, wUnusedMapBufferEnd - wUnusedMapBuffer
 	ld a, 0
 	call ByteFill
 	ret
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -395,11 +395,11 @@
 ; Load the movement data pointer for object a.
 	ld [wMovementObject], a
 	ldh a, [hROMBank]
-	ld [wMovementDataPointer], a
+	ld [wMovementDataBank], a
 	ld a, l
-	ld [wMovementDataPointer + 1], a
+	ld [wMovementDataAddress], a
 	ld a, h
-	ld [wMovementDataPointer + 2], a
+	ld [wMovementDataAddress + 1], a
 	ld a, [wMovementObject]
 	call CheckObjectVisibility
 	ret c
--- a/macros/legacy.asm
+++ b/macros/legacy.asm
@@ -112,6 +112,7 @@
 checkpokeitem     EQUS "checkpokemail"
 passtoengine      EQUS "autoinput"
 verbosegiveitem2  EQUS "verbosegiveitemvar"
+loadbytec2cf      EQUS "writeunusedbytebuffer"
 
 ; macros/scripts/maps.asm
 
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -489,9 +489,9 @@
 	db closetext_command
 ENDM
 
-	enum loadbytec2cf_command ; $4a
-loadbytec2cf: MACRO
-	db loadbytec2cf_command
+	enum writeunusedbytebuffer_command ; $4a
+writeunusedbytebuffer: MACRO
+	db writeunusedbytebuffer_command
 	db \1 ; byte
 ENDM
 
--- a/wram.asm
+++ b/wram.asm
@@ -39,7 +39,7 @@
 wCurTrackDuty:: db
 wCurTrackIntensity:: db
 wCurTrackFrequency:: dw
-wc296:: db ; BCD value, dummied out
+wUnusedBCDNumber:: db ; BCD value, dummied out
 wCurNoteDuration:: db ; used in MusicE0 and LoadNote
 
 wCurMusicByte:: db ; c298
@@ -95,7 +95,7 @@
 wCryLength:: dw ; c2b2
 
 wLastVolume:: db ; c2b4
-wc2b5:: db ; c2b5
+wUnusedMusicF9Flag:: db ; c2b5
 
 wSFXPriority:: ; c2b6
 ; if nonzero, turn off music when playing sfx
@@ -145,7 +145,7 @@
 wGameLogicPaused:: db ; c2cd
 wSpriteUpdatesEnabled:: db
 
-wc2cf:: db ; ????
+wUnusedScriptByteBuffer:: db
 
 wMapTimeOfDay:: db
 
@@ -171,7 +171,8 @@
 wc2e2::
 wMovementObject::
 	db
-wMovementDataPointer:: ds 3 ; dba
+wMovementDataBank:: db
+wMovementDataAddress:: dw
 wc2e6:: ds 4
 wMovementByteWasControlSwitch:: db
 wMovementPointer:: dw ; c2eb
@@ -909,8 +910,10 @@
 
 ENDU ; c7e8
 
-wUnusedC7E8:: ds 24
-wUnusedC7E8End::
+; This was a buffer for map-related pointers in the 1997 G/S prototype.
+; See wMapBuffer in pokegold-spaceworld's wram.asm.
+wUnusedMapBuffer:: ds 24
+wUnusedMapBufferEnd::
 
 
 SECTION "Overworld Map", WRAM0
@@ -954,7 +957,7 @@
 wPrinterTileMapBufferEnd::
 wPrinterStatus:: db ; cbf8
 	ds 1
-wcbfa:: ds 1
+wcbfa:: db
 wGBPrinterSettings:: db
 	ds 16
 wGameboyPrinterRAMEnd::
@@ -2259,22 +2262,23 @@
 SECTION "Enemy Party", WRAMX
 
 UNION ; d26b
-wd26b::
 wPokedexShowPointerAddr:: dw
 wPokedexShowPointerBank:: db
 	ds 3
-wd271:: ds 5
+wd271:: dw ; mobile
 
 NEXTU ; d26b
+wUnusedEggHatchFlag:: db
+
+NEXTU ; d26b
 ; enemy party
 wOTPlayerName:: ds NAME_LENGTH ; d26b
-ENDU ; d276
-
 wOTPlayerID:: dw ; d276
 	ds 8
 wOTPartyCount::   db ; d280
 wOTPartySpecies:: ds PARTY_LENGTH ; d281
 wOTPartyEnd::     db ; older code doesn't check PartyCount
+ENDU ; d276
 
 UNION ; d288
 ; ot party mons
@@ -2309,10 +2313,10 @@
 wDudeBagEnd::
 ENDU ; d430
 
-wd430::
+wd430:: ; mobile
 wBattleAction:: db ; d430
 
-wd431:: db
+wd431:: db ; mobile
 wMapStatus:: db ; d432
 wMapEventStatus:: db ; d433
 
@@ -2778,8 +2782,10 @@
 wYanmaMapGroup:: db ; dc5a
 wYanmaMapNumber:: db
 wPlayerMonSelection:: ds 3
-wdc5f:: ds 1
-wdc60:: ds 19
+wdc5f:: db
+wdc60:: db
+
+	ds 18
 
 wStepCount:: db ; dc73
 wPoisonStepCount:: db ; dc74