summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-06-02 20:16:37 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-06-02 20:16:37 -0400
commit956d010d59ad225bea768aec172ccb56977b1775 (patch)
tree4385f7c50ebb09e747f9e2cac4bc900d925060d4 /home
parent513028a98e6225e39c53ea64e4f9c483b3abd55b (diff)
Make the repository build all four ROMs
Diffstat (limited to 'home')
-rw-r--r--home/audio.asm4
-rw-r--r--home/bankswitch.asm4
-rw-r--r--home/clear_sprites.asm4
-rw-r--r--home/copy.asm4
-rw-r--r--home/copy_tilemap.asm4
-rw-r--r--home/farcall.asm4
-rw-r--r--home/init.asm12
-rw-r--r--home/math.asm41
-rw-r--r--home/pokemon.asm12
-rw-r--r--home/predef.asm4
-rw-r--r--home/rst.asm20
-rw-r--r--home/sram.asm4
-rw-r--r--home/unknown.asm87
13 files changed, 194 insertions, 10 deletions
diff --git a/home/audio.asm b/home/audio.asm
index a983bf3..ede88d4 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Audio interface", ROM0[$3CBF]
+else
+SECTION "Audio interface", ROM0[$3C83]
+endc
DisableAudio:: ; 3cbf
push hl
diff --git a/home/bankswitch.asm b/home/bankswitch.asm
index b8549bc..574fa64 100644
--- a/home/bankswitch.asm
+++ b/home/bankswitch.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Bankswitch", ROM0[$32C2]
+else
+SECTION "Bankswitch", ROM0[$3286]
+endc
; Moved to a rst vector in final US releases (not sure about JP)
; All rst vectors are unused at this point in development
diff --git a/home/clear_sprites.asm b/home/clear_sprites.asm
index c6ac3aa..90e8f38 100644
--- a/home/clear_sprites.asm
+++ b/home/clear_sprites.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Sprite clearing", ROM0[$32DC]
+else
+SECTION "Sprite clearing", ROM0[$32A0]
+endc
ClearSprites:: ; 32dc
ld hl, wVirtualOAM
diff --git a/home/copy.asm b/home/copy.asm
index b289aea..757da0d 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Copy functions", ROM0[$32F7]
+else
+SECTION "Copy functions", ROM0[$32BB]
+endc
; Copy bc bytes from a:hl to de.
FarCopyBytes:: ; 32f7
diff --git a/home/copy_tilemap.asm b/home/copy_tilemap.asm
index fceef45..27c33c0 100644
--- a/home/copy_tilemap.asm
+++ b/home/copy_tilemap.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Tilemap copy/restore funcs", ROM0[$3355]
+else
+SECTION "Tilemap copy/restore funcs", ROM0[$3319]
+endc
BackUpTilesToBuffer:: ; 3355
hlcoord 0, 0
diff --git a/home/farcall.asm b/home/farcall.asm
index f7a97d0..32fcce5 100644
--- a/home/farcall.asm
+++ b/home/farcall.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Farcall", ROM0[$2FA8]
+else
+SECTION "FarCall", ROM0[$2F6C]
+endc
FarCall_hl:: ; 2fa8
push af
diff --git a/home/init.asm b/home/init.asm
index 0a31e69..5498b35 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -7,7 +7,19 @@ SECTION "Entry point", ROM0[$100]
SECTION "Global check value", ROM0[$14E]
; The ROM has an incorrect global check, so set it here
; It is not corrected by RGBFIX
+if def(GOLD)
+if DEBUG
db $21, $C6
+else
+ db $7e, $49
+endc
+else
+if DEBUG
+ db $c9, $2f
+else
+ db $b1, $7a
+endc
+endc
SECTION "Init", ROM0[$52F]
diff --git a/home/math.asm b/home/math.asm
new file mode 100644
index 0000000..2f3b408
--- /dev/null
+++ b/home/math.asm
@@ -0,0 +1,41 @@
+include "constants.asm"
+
+if DEBUG
+SECTION "Home Math", ROM0[$341F]
+else
+SECTION "Home Math", ROM0[$33E3]
+endc
+
+_341F:: ; 341f
+; Returns hl + a * 6
+ and a
+ ret z
+ ld bc, 6
+.loop:
+ add hl, bc
+ dec a
+ jr nz, .loop
+ ret
+
+AddAMulBC:: ; 3429
+; Returns hl + a * bc
+ and a
+ ret z
+.loop:
+ add hl, bc
+ dec a
+ jr nz, .loop
+ ret
+
+memcmp:: ; 3430
+; Compare c bytes at hl and de
+; Returns z if all equal, nz otherwise.
+.loop:
+ ld a, [de]
+ cp [hl]
+ ret nz
+ inc de
+ inc hl
+ dec c
+ jr nz, .loop
+ ret
diff --git a/home/pokemon.asm b/home/pokemon.asm
index 9b1eec2..1f51f8e 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
-SECTION "3A4B", ROM0[$3a4b]
+if DEBUG
+SECTION "3A4B", ROM0[$3A4B]
+else
+SECTION "3A4B", ROM0[$3A0F]
+endc
; copies the base stat data of a pokemon to wMonHeader
; INPUT:
; [wcb5b] = pokemon ID in dex order
@@ -43,7 +47,11 @@ GetMonHeader:: ; 3a4b (0:3a4b)
pop bc
ret
-SECTION "3AED", ROM0[$3aed]
+if DEBUG
+SECTION "3AED", ROM0[$3AED]
+else
+SECTION "3AED", ROM0[$3AB1]
+endc
; Uncompresses the front or back sprite of the specified mon
; assumes the corresponding mon header is already loaded
diff --git a/home/predef.asm b/home/predef.asm
index 69620ce..a9ff091 100644
--- a/home/predef.asm
+++ b/home/predef.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Predef", ROM0[$2FDE]
+else
+SECTION "Predef", ROM0[$2FA2]
+endc
Predef:: ; 2fde
ld [wPredefID], a
diff --git a/home/rst.asm b/home/rst.asm
index 851775b..884f5a9 100644
--- a/home/rst.asm
+++ b/home/rst.asm
@@ -1,25 +1,29 @@
; rst vectors
SECTION "rst00", ROM0[$000]
- rst $38
+ rst $38
SECTION "rst08", ROM0[$008]
- rst $38
+ rst $38
SECTION "rst10", ROM0[$010]
- rst $38
+ rst $38
SECTION "rst18", ROM0[$018]
- rst $38
+ rst $38
SECTION "rst20", ROM0[$020]
- rst $38
+ rst $38
SECTION "rst28", ROM0[$028]
- rst $38
+ rst $38
SECTION "rst30", ROM0[$030]
- rst $38
+ rst $38
SECTION "rst38", ROM0[$038]
- jp $F080 ; Jumps in the middle of unmapped memory. Probably used to trigger a breakpoint of sorts.
+if DEBUG && def(SILVER)
+ rst $38
+else
+ jp $F080 ; Jumps in the middle of unmapped memory. Probably used to trigger a breakpoint of sorts.
+endc
diff --git a/home/sram.asm b/home/sram.asm
index 5f9cfe2..03d4411 100644
--- a/home/sram.asm
+++ b/home/sram.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "SRAM functions", ROM0[$32A7]
+else
+SECTION "SRAM functions", ROM0[$326B]
+endc
OpenSRAM:: ; 32a7
push af
diff --git a/home/unknown.asm b/home/unknown.asm
index e2046e3..c216f62 100644
--- a/home/unknown.asm
+++ b/home/unknown.asm
@@ -1,6 +1,10 @@
INCLUDE "constants.asm"
+if DEBUG
SECTION "Empty function", ROM0[$2F97]
+else
+SECTION "Empty function", ROM0[$2F5B]
+endc
InexplicablyEmptyFunction:: ; 2f97
REPT 16
@@ -34,3 +38,86 @@ _2007:: ; 2007
ld [wce5f], a
call CloseSRAM
ret
+
+SECTION "Unknown functions 2", ROM0[$2075]
+
+_2075:: ; 2075
+; Prepares a buffer for the clock display, which in the Debug ROM is displayed on the bottom of the screen.
+; This function is called every frame, and loads special tiles into the $66-$7a space.
+ ld hl, wcbd2
+ ld bc, $14
+ ld a, " "
+ call ByteFill
+
+if DEBUG
+ ld hl, $d153
+ bit 0, [hl]
+ jr z, ._209e
+ ld hl, $d65b
+ ld de, wcbd2 + 4
+ ld c, $01
+ call _20CD
+ ld hl, $d65a
+ ld de, wcbd2 + 8
+ ld c, $01
+ call _20CD
+ ret
+._209e:
+endc
+
+ ld hl, hHours
+ ld de, wcbd2
+ call _20DC
+ ld hl, hMinutes
+ ld de, wcbd2 + 3
+ call _20DC
+ ldh a, [hDays]
+ and 7
+ add $71 ; Sunday
+ ld [wcbd2 + 6], a
+ ld a, $78 ; power
+ ld [wcbd2 + 9], a
+ inc a ; mobile
+ ld [wcbd2 + 11], a
+ ldh a, [hSeconds]
+ and 1
+ ret z
+ ld a, $70 ; :
+ ld [wcbd2 + 2], a
+ ret
+
+_20CD:: ; 20cd
+; PrintAsHex
+ ld a, [hli]
+ ld b, a
+ swap a
+ call _20F1
+ ld a, b
+ call _20F1
+ dec c
+ jr nz, _20CD
+ ret
+
+_20DC:: ; 20dc
+; PrintAsDec
+ ld a, [hli]
+ ld b, 0
+._20df:
+ inc b
+ sub 10
+ jr nc, ._20df
+ dec b
+ add 10
+ push af
+ ld a, b
+ call _20F1
+ pop af
+ call _20F1
+ ret
+
+_20F1:: ; 20f1
+ and %1111
+ add $66 ; digit 0
+ ld [de], a
+ inc de
+ ret