shithub: pokecrystal

Download patch

ref: 9e3bd6cb9b4366ba242d828d2e3bfd7a26e588e4
parent: 038166f97c7cc7466fd8012cfcb23fc013e025cd
author: yenatch <yenatch@gmail.com>
date: Wed Aug 19 17:51:04 EDT 2015

Label scratch space and a bunch of box lists.

--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -982,7 +982,7 @@
 
 GetSubstitutePic: ; cc64c
 
-	ld hl, $a000
+	ld hl, sScratch
 	ld bc, $310
 .loop
 	xor a
@@ -997,20 +997,20 @@
 	jr z, .player
 
 	ld hl, MonsterSpriteGFX
-	ld de, $a000 + $130
+	ld de, sScratch + $130
 	call CopyMonsterSpriteTile
 	ld hl, MonsterSpriteGFX + $10
-	ld de, $a000 + $1a0
+	ld de, sScratch + $1a0
 	call CopyMonsterSpriteTile
 	ld hl, MonsterSpriteGFX + $20
-	ld de, $a000 + $140
+	ld de, sScratch + $140
 	call CopyMonsterSpriteTile
 	ld hl, MonsterSpriteGFX + $30
-	ld de, $a000 + $1b0
+	ld de, sScratch + $1b0
 	call CopyMonsterSpriteTile
 
 	ld hl, $9000
-	ld de, $a000
+	ld de, sScratch
 	lb bc, BANK(GetSubstitutePic), 7 * 7
 	call Request2bpp
 	jr .done
@@ -1017,20 +1017,20 @@
 
 .player
 	ld hl, MonsterSpriteGFX + $40
-	ld de, $a000 + $100
+	ld de, sScratch + $100
 	call CopyMonsterSpriteTile
 	ld hl, MonsterSpriteGFX + $50
-	ld de, $a000 + $160
+	ld de, sScratch + $160
 	call CopyMonsterSpriteTile
 	ld hl, MonsterSpriteGFX + $60
-	ld de, $a000 + $110
+	ld de, sScratch + $110
 	call CopyMonsterSpriteTile
 	ld hl, MonsterSpriteGFX + $70
-	ld de, $a000 + $170
+	ld de, sScratch + $170
 	call CopyMonsterSpriteTile
 
 	ld hl, $9310
-	ld de, $a000
+	ld de, sScratch
 	lb bc, BANK(GetSubstitutePic), 6 * 6
 	call Request2bpp
 
@@ -1061,7 +1061,7 @@
 	ret
 
 GetMinimizePic: ; cc6e7 (33:46e7)
-	ld hl, $a000
+	ld hl, sScratch
 	ld bc, $310
 .loop
 	xor a
@@ -1078,7 +1078,7 @@
 	ld de, $a1a0
 	call CopyMinimizePic
 	ld hl, $9000
-	ld de, $a000
+	ld de, sScratch
 	lb bc, BANK(GetMinimizePic), $31
 	ret
 
@@ -1086,7 +1086,7 @@
 	ld de, $a160
 	call CopyMinimizePic
 	ld hl, $9310
-	ld de, $a000
+	ld de, sScratch
 	lb bc, BANK(GetMinimizePic), $24
 	ret
 
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -2421,12 +2421,12 @@
 	ret
 
 .asm_4145b
-	ld a, $0
+	ld a, BANK(sScratch)
 	call GetSRAMBank
 	callba Function1de0d7
 	ld hl, VTiles2
-	ld de, $a000
-	ld c, $31
+	ld de, sScratch
+	ld c, 7 * 7
 	ld a, [hROMBank]
 	ld b, a
 	call Get2bpp
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -137,15 +137,15 @@
 
 Functione73:: ; e73
 	push de
-	ld a, $0
+	ld a, BANK(sScratch)
 	call GetSRAMBank
 	push bc
-	ld de, $a000
+	ld de, sScratch
 	ld a, b
 	call FarDecompress
 	pop bc
 	pop hl
-	ld de, $a000
+	ld de, sScratch
 	call Request2bpp
 	call CloseSRAM
 	ret
--- a/main.asm
+++ b/main.asm
@@ -10055,20 +10055,20 @@
 ; e66e
 
 Unknown_e66e: ; e66e
-	dbw 2, $a000
-	dbw 2, $a450
-	dbw 2, $a8a0
-	dbw 2, $acf0
-	dbw 2, $b140
-	dbw 2, $b590
-	dbw 2, $b9e0
-	dbw 3, $a000
-	dbw 3, $a450
-	dbw 3, $a8a0
-	dbw 3, $acf0
-	dbw 3, $b140
-	dbw 3, $b590
-	dbw 3, $b9e0
+	dbw BANK(sBox1),  sBox1
+	dbw BANK(sBox2),  sBox2
+	dbw BANK(sBox3),  sBox3
+	dbw BANK(sBox4),  sBox4
+	dbw BANK(sBox5),  sBox5
+	dbw BANK(sBox6),  sBox6
+	dbw BANK(sBox7),  sBox7
+	dbw BANK(sBox8),  sBox8
+	dbw BANK(sBox9),  sBox9
+	dbw BANK(sBox10), sBox10
+	dbw BANK(sBox11), sBox11
+	dbw BANK(sBox12), sBox12
+	dbw BANK(sBox13), sBox13
+	dbw BANK(sBox14), sBox14
 ; e698
 
 Functione698: ; e698
@@ -21770,10 +21770,10 @@
 	push af
 	ld a, $6
 	ld [rSVBK], a
-	ld a, $0
+	ld a, BANK(sScratch)
 	call GetSRAMBank
 	ld de, w6_d000
-	ld hl, $a000
+	ld hl, sScratch
 	ld a, [hROMBank]
 	ld b, a
 	ld c, $31
@@ -21793,12 +21793,12 @@
 	call PlaceString
 	xor a
 	call GetSRAMBank
-	ld hl, $a000
+	ld hl, sScratch
 	ld bc, $0310
 	xor a
 	call ByteFill
 	ld hl, $9310
-	ld de, $a000
+	ld de, sScratch
 	ld c, $31
 	ld a, [hROMBank]
 	ld b, a
@@ -21816,10 +21816,11 @@
 	db "Do what?@"
 
 UnownDexMenuString:
-	db $ef, " PRINT", $4e
-	db $f5, " CANCEL", $4e
-	db $df, " PREVIOUS", $4e
-	db $eb, " NEXT@"
+	db   $ef, " PRINT"
+	next $f5, " CANCEL"
+	next $df, " PREVIOUS"
+	next $eb, " NEXT"
+	db   "@"
 
 UnownDexVacantString:
 	db "VACANT@"
@@ -23884,7 +23885,7 @@
 	xor a
 	call GetSRAMBank
 	hlcoord 0, 0
-	ld de, $a000
+	ld de, sScratch
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
 	call CopyBytes
 	call CloseSRAM
@@ -23891,7 +23892,7 @@
 	call Function2173
 	xor a
 	call GetSRAMBank
-	ld hl, $a000
+	ld hl, sScratch
 	decoord 0, 0
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
 .asm_2444c
@@ -26187,9 +26188,9 @@
 ; 252ec (9:52ec)
 
 String_252ec: ; 252ec
-	db "NAME/", $4e
-	db $4e
-	db "MONEY@"
+	db   "NAME/"
+	next ""
+	next "MONEY@"
 
 Tilemap_252f9: ; 252f9
 	db $27, $28, $ff ; ID NO
@@ -26226,8 +26227,9 @@
 ; 2534c (9:534c)
 
 String_2534c: ; 2534c
-	db "#DEX", $4e
-	db "PLAY TIME@"
+	db   "#DEX"
+	next "PLAY TIME"
+	db   "@"
 
 String_2535b: ; 2535b
 	db "@"
@@ -31370,10 +31372,10 @@
 ; 29591
 
 String29591: ; 29591
-	db "─── №.", $4e
-	db $4e
-	db "OT/", $4e
-	db $73, "№.@"
+	db   "─── №."
+	next ""
+	next "OT/"
+	next $73, "№.@"
 ; 295a1
 
 Function295a1: ; 295a1
@@ -31393,9 +31395,9 @@
 ; 295c2
 
 String295c2: ; 295c2
-	db "EGG", $4e
-	db "OT/?????", $4e
-	db $73, "№.?????@"
+	db   "EGG"
+	next "OT/?????"
+	next $73, "№.?????@"
 ; 295d8
 
 Function295d8: ; 295d8
@@ -42392,21 +42394,20 @@
 ; 0x4a810
 
 BoxAddressTable1: ; 4a810
-	;  bank, address
-	dbw $02, $a000
-	dbw $02, $a450
-	dbw $02, $a8a0
-	dbw $02, $acf0
-	dbw $02, $b140
-	dbw $02, $b590
-	dbw $02, $b9e0
-	dbw $03, $a000
-	dbw $03, $a450
-	dbw $03, $a8a0
-	dbw $03, $acf0
-	dbw $03, $b140
-	dbw $03, $b590
-	dbw $03, $b9e0
+	dbw BANK(sBox1),  sBox1
+	dbw BANK(sBox2),  sBox2
+	dbw BANK(sBox3),  sBox3
+	dbw BANK(sBox4),  sBox4
+	dbw BANK(sBox5),  sBox5
+	dbw BANK(sBox6),  sBox6
+	dbw BANK(sBox7),  sBox7
+	dbw BANK(sBox8),  sBox8
+	dbw BANK(sBox9),  sBox9
+	dbw BANK(sBox10), sBox10
+	dbw BANK(sBox11), sBox11
+	dbw BANK(sBox12), sBox12
+	dbw BANK(sBox13), sBox13
+	dbw BANK(sBox14), sBox14
 ; 4a83a
 
 UpdateOTPointer: ; 0x4a83a
@@ -42555,21 +42556,20 @@
 ; 4a8f4
 
 BoxAddressTable2: ; 4a8f4
-	;  bank, address
-	dbw $02, $a000
-	dbw $02, $a450
-	dbw $02, $a8a0
-	dbw $02, $acf0
-	dbw $02, $b140
-	dbw $02, $b590
-	dbw $02, $b9e0
-	dbw $03, $a000
-	dbw $03, $a450
-	dbw $03, $a8a0
-	dbw $03, $acf0
-	dbw $03, $b140
-	dbw $03, $b590
-	dbw $03, $b9e0
+	dbw BANK(sBox1),  sBox1
+	dbw BANK(sBox2),  sBox2
+	dbw BANK(sBox3),  sBox3
+	dbw BANK(sBox4),  sBox4
+	dbw BANK(sBox5),  sBox5
+	dbw BANK(sBox6),  sBox6
+	dbw BANK(sBox7),  sBox7
+	dbw BANK(sBox8),  sBox8
+	dbw BANK(sBox9),  sBox9
+	dbw BANK(sBox10), sBox10
+	dbw BANK(sBox11), sBox11
+	dbw BANK(sBox12), sBox12
+	dbw BANK(sBox13), sBox13
+	dbw BANK(sBox14), sBox14
 ; 4a91e
 
 Function4a91e: ; 4a91e
@@ -44720,21 +44720,20 @@
 ; 4d99f
 
 Unknown_4d99f: ; 4d99f
-	;  bank, address
-	dbw $02, $a000
-	dbw $02, $a450
-	dbw $02, $a8a0
-	dbw $02, $acf0
-	dbw $02, $b140
-	dbw $02, $b590
-	dbw $02, $b9e0
-	dbw $03, $a000
-	dbw $03, $a450
-	dbw $03, $a8a0
-	dbw $03, $acf0
-	dbw $03, $b140
-	dbw $03, $b590
-	dbw $03, $b9e0
+	dbw BANK(sBox1),  sBox1
+	dbw BANK(sBox2),  sBox2
+	dbw BANK(sBox3),  sBox3
+	dbw BANK(sBox4),  sBox4
+	dbw BANK(sBox5),  sBox5
+	dbw BANK(sBox6),  sBox6
+	dbw BANK(sBox7),  sBox7
+	dbw BANK(sBox8),  sBox8
+	dbw BANK(sBox9),  sBox9
+	dbw BANK(sBox10), sBox10
+	dbw BANK(sBox11), sBox11
+	dbw BANK(sBox12), sBox12
+	dbw BANK(sBox13), sBox13
+	dbw BANK(sBox14), sBox14
 ; 4d9c9
 
 UnknownText_0x4d9c9: ; 0x4d9c9
@@ -77077,7 +77076,7 @@
 	push de
 	xor a
 	call GetSRAMBank
-	ld hl, $a000
+	ld hl, sScratch
 	ld bc, $0000
 .asm_e000b
 	push bc
@@ -77105,11 +77104,11 @@
 	cp $31
 	jr c, .asm_e000b
 	ld hl, OverworldMap
-	ld de, $a000
+	ld de, sScratch
 	ld bc, $0310
 	call CopyBytes
 	pop hl
-	ld de, $a000
+	ld de, sScratch
 	ld c, $31
 	ld a, [hROMBank]
 	ld b, a
@@ -82612,20 +82611,20 @@
 
 Unknown_e33a6: ; e33a6
 	;  bank, address
-	dbw $02, $a000
-	dbw $02, $a450
-	dbw $02, $a8a0
-	dbw $02, $acf0
-	dbw $02, $b140
-	dbw $02, $b590
-	dbw $02, $b9e0
-	dbw $03, $a000
-	dbw $03, $a450
-	dbw $03, $a8a0
-	dbw $03, $acf0
-	dbw $03, $b140
-	dbw $03, $b590
-	dbw $03, $b9e0
+	dbw BANK(sBox1),  sBox1
+	dbw BANK(sBox2),  sBox2
+	dbw BANK(sBox3),  sBox3
+	dbw BANK(sBox4),  sBox4
+	dbw BANK(sBox5),  sBox5
+	dbw BANK(sBox6),  sBox6
+	dbw BANK(sBox7),  sBox7
+	dbw BANK(sBox8),  sBox8
+	dbw BANK(sBox9),  sBox9
+	dbw BANK(sBox10), sBox10
+	dbw BANK(sBox11), sBox11
+	dbw BANK(sBox12), sBox12
+	dbw BANK(sBox13), sBox13
+	dbw BANK(sBox14), sBox14
 ; e33d0
 
 Functione33d0: ; e33d0 (38:73d0)
@@ -82843,21 +82842,20 @@
 ; e36a5 (38:76a5)
 
 Unknown_e36a5: ; e36a5
-	;  bank, address
-	dbw $02, $a000
-	dbw $02, $a450
-	dbw $02, $a8a0
-	dbw $02, $acf0
-	dbw $02, $b140
-	dbw $02, $b590
-	dbw $02, $b9e0
-	dbw $03, $a000
-	dbw $03, $a450
-	dbw $03, $a8a0
-	dbw $03, $acf0
-	dbw $03, $b140
-	dbw $03, $b590
-	dbw $03, $b9e0
+	dbw BANK(sBox1),  sBox1
+	dbw BANK(sBox2),  sBox2
+	dbw BANK(sBox3),  sBox3
+	dbw BANK(sBox4),  sBox4
+	dbw BANK(sBox5),  sBox5
+	dbw BANK(sBox6),  sBox6
+	dbw BANK(sBox7),  sBox7
+	dbw BANK(sBox8),  sBox8
+	dbw BANK(sBox9),  sBox9
+	dbw BANK(sBox10), sBox10
+	dbw BANK(sBox11), sBox11
+	dbw BANK(sBox12), sBox12
+	dbw BANK(sBox13), sBox13
+	dbw BANK(sBox14), sBox14
 ; e36cf
 
 Functione36cf: ; e36cf (38:76cf)
@@ -93166,7 +93164,7 @@
 
 Function1de0d7: ; 1de0d7
 	ld hl, LZ_1de0e1
-	ld de, $a000
+	ld de, sScratch
 	call Decompress
 	ret
 ; 1de0e1
--- a/wram.asm
+++ b/wram.asm
@@ -2674,6 +2674,8 @@
 
 SECTION "Scratch", SRAM, BANK [0]
 
+sScratch::
+
 
 SECTION "SRAM Bank 0", SRAM [$a600], BANK [0]