shithub: pokecrystal

Download patch

ref: 60c1061a67270f89b5f40ae1d807958b63608287
parent: abb7f2fa20e49cf56a55c81d4ec86431e3009098
author: yenatch <[email protected]>
date: Sun Sep 8 20:59:06 EDT 2013

clean up some common includes and give names to wram copy functions

--- a/main.asm
+++ b/main.asm
@@ -474,15 +474,14 @@
 
 
 INCLUDE "common/menu.asm"
-
 INCLUDE "common/handshake.asm"
-
 INCLUDE "common/game_time.asm"
-
 INCLUDE "common/map.asm"
 
 
 Function2d43: ; 2d43
+; Inexplicably empty.
+; Seen in PredefPointers.
 	nop
 	nop
 	nop
@@ -504,7 +503,6 @@
 
 
 INCLUDE "common/farcall.asm"
-
 INCLUDE "common/predef.asm"
 
 
@@ -624,7 +622,7 @@
 	bit 1, a
 	ret z
 	ld a, [hJoyDown]
-	bit 1, a
+	bit A_BUTTON, a
 	ret
 ; 2ec6
 
@@ -640,7 +638,6 @@
 	ret
 ; 2ecb
 
-
 Function2ecb: ; 2ecb
 	push hl
 	ld hl, $c2cc
@@ -718,9 +715,7 @@
 
 
 INCLUDE "common/item.asm"
-
 INCLUDE "common/random.asm"
-
 INCLUDE "common/sram.asm"
 
 
@@ -764,6 +759,7 @@
 	ret
 ; 3026
 
+
 CopyBytes: ; 0x3026
 ; copy bc bytes from hl to de
 	inc b  ; we bail the moment b hits 0, so include the last run
@@ -794,9 +790,9 @@
 	; retrieve the previous value of [hl]; put it in [de]
 	pop af
 	ld [de], a
+	inc de
 
 	; handle loop stuff
-	inc de
 	dec bc
 	ld a, b
 	or c
@@ -858,7 +854,7 @@
 	ret
 ; 0x306b
 
-Function306b: ; 306b
+FarCopyWRAM: ; 306b
 	ld [hBuffer], a
 	ld a, [rSVBK]
 	push af
@@ -870,7 +866,7 @@
 	ret
 ; 307b
 
-Function307b: ; 307b
+GetFarWRAMByte: ; 307b
 	ld [hBuffer], a
 	ld a, [rSVBK]
 	push af
@@ -884,7 +880,7 @@
 	ret
 ; 308d
 
-Function308d: ; 308d
+GetFarWRAMWord: ; 308d
 	ld [hBuffer], a
 	ld a, [rSVBK]
 	push af
@@ -898,6 +894,7 @@
 	ret
 ; 309d
 
+
 Function309d: ; 309d
 	ld a, [rSVBK]
 	push af
@@ -12440,12 +12437,12 @@
 	ld de, $d000
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ld hl, $4b37
 	ld de, MartPointer
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	call Function96a4
 	ld a, $1
 	ld [hCGBPalUpdate], a
@@ -12480,7 +12477,7 @@
 	add hl, bc
 	ld bc, $0004
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ld a, $1
 	ld [hCGBPalUpdate], a
 	ret
@@ -12543,7 +12540,7 @@
 	ld de, $d000
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	call Function96a4
 	call Function9699
 	call Function96b3
@@ -12671,7 +12668,7 @@
 	ld de, $d050
 	ld bc, $0030
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	call Function96b3
 	ret
 ; 8e85
@@ -12689,7 +12686,7 @@
 	ld de, $d038
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 8e9f
 
@@ -12703,7 +12700,7 @@
 	ld de, $d000
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 8eb9
 
@@ -12721,7 +12718,7 @@
 	ld de, $d000
 	ld bc, $0030
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	call Function96a4
 	ld a, $1
 	ld [hCGBPalUpdate], a
@@ -12748,7 +12745,7 @@
 	ld de, $d018
 	ld bc, $0018
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	call Function9699
 	ld hl, AttrMap
 	ld bc, $0814
@@ -12917,7 +12914,7 @@
 	ld de, $d080
 	ld bc, $0080
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 96b3
 
@@ -12999,7 +12996,7 @@
 	ld de, MartPointer
 	ld bc, $0010
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 9729
 
@@ -20807,7 +20804,7 @@
 	ld de, CurMart
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ld a, $1
 	ld [hCGBPalUpdate], a
 	ret
@@ -50219,7 +50216,7 @@
 	ld de, $d038
 	ld bc, $0008
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 49418
 
@@ -50282,7 +50279,7 @@
 	ld de, $d010
 	ld bc, $0030
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	callba Function96a4
 	ret
 ; 49826
@@ -54331,7 +54328,7 @@
 	ld de, $cd53
 	ld bc, $000c
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ld a, [rSVBK]
 	push af
 	ld a, $1
@@ -54353,7 +54350,7 @@
 Function4ea44: ; 4ea44
 	ld a, $0
 	ld hl, InLinkBattle
-	call Function307b
+	call GetFarWRAMByte
 	cp $4
 	jr z, .asm_4ea59
 	ld a, [Options]
@@ -54380,7 +54377,7 @@
 .asm_4ea72
 	ld a, $5
 	ld hl, $dc00
-	call Function307b
+	call GetFarWRAMByte
 	bit 0, a
 	jr z, .asm_4ea80
 	and a
@@ -57145,7 +57142,7 @@
 	push hl
 	ld a, $1
 	ld hl, BasePicSize
-	call Function307b
+	call GetFarWRAMByte
 	pop hl
 	and $f
 	ld de, $d990
@@ -71107,11 +71104,11 @@
 	ld [$d16e], a
 	ld a, $1
 	ld hl, CurPartySpecies
-	call Function307b
+	call GetFarWRAMByte
 	ld [$d16b], a
 	ld a, $1
 	ld hl, UnownLetter
-	call Function307b
+	call GetFarWRAMByte
 	ld [$d16c], a
 	call Functiond065c
 	ld [$d16d], a
@@ -76812,7 +76809,7 @@
 	ld de, $d000
 	ld bc, $0054
 	ld a, $3
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 1003ab
 
@@ -76824,7 +76821,7 @@
 	ld de, $d080
 	ld bc, $0054
 	ld a, $3
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 1003c9
 
@@ -76833,7 +76830,7 @@
 	ld de, $ccb4
 	ld bc, $0054
 	ld a, $3
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 1003d8
 
@@ -77477,7 +77474,7 @@
 Function1009a5: ; 1009a5
 	ld bc, $0168
 	ld a, $3
-	call Function306b
+	call FarCopyWRAM
 	ret
 ; 1009ae
 
@@ -78530,7 +78527,7 @@
 	ld de, EnemyMoveAnimation
 	ld bc, $0026
 	ld a, $5
-	call Function306b
+	call FarCopyWRAM
 	ld de, EnemyMoveEffect
 	ret
 ; 10219f