shithub: pokecrystal

Download patch

ref: 44128c5d989cf56e0305bedc37044c093bc02668
parent: 7bd8d56ff93e14839d304cc3a3a2a182e992f909
author: mid-kid <esteve.varela@gmail.com>
date: Sun Feb 23 09:28:21 EST 2020

Create home/header.asm

Contains what was previously in:
- home/rst.asm
- home/interrupts.asm
- home.asm

All of this should be in a static location in the ROM so it kinda makes
sense together.

--- a/home.asm
+++ b/home.asm
@@ -1,23 +1,9 @@
 INCLUDE "constants.asm"
 
-
 SECTION "NULL", ROM0
-
 NULL::
 
-
-INCLUDE "home/rst.asm"
-
-
-INCLUDE "home/interrupts.asm"
-
-
-SECTION "Header", ROM0
-
-Start::
-	nop
-	jp _Start
-
+INCLUDE "home/header.asm"
 
 SECTION "Home", ROM0
 
--- /dev/null
+++ b/home/header.asm
@@ -1,0 +1,66 @@
+; rst vectors (called through the rst instruction)
+
+SECTION "rst0", ROM0
+	di
+	jp Start
+
+SECTION "rst8", ROM0 ; rst FarCall
+	jp FarCall_hl
+
+SECTION "rst10", ROM0 ; rst Bankswitch
+	ldh [hROMBank], a
+	ld [MBC3RomBank], a
+	ret
+
+SECTION "rst18", ROM0
+	rst $38
+
+SECTION "rst20", ROM0
+	rst $38
+
+SECTION "rst28", ROM0 ; rst JumpTable
+	push de
+	ld e, a
+	ld d, 0
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld h, [hl]
+; SECTION "rst30", ROM0
+	ld l, a
+	pop de
+	jp hl
+
+SECTION "rst38", ROM0
+	rst $38
+
+
+; Game Boy hardware interrupts
+
+SECTION "vblank", ROM0
+	jp VBlank
+
+SECTION "lcd", ROM0
+	jp LCD
+
+SECTION "timer", ROM0
+	jp Timer
+
+SECTION "serial", ROM0
+	jp Serial
+
+SECTION "joypad", ROM0
+	jp JoypadInt
+
+
+; Game Boy cartridge header
+
+SECTION "Header", ROM0
+
+Start::
+	nop
+	jp _Start
+
+; The cartridge header data is filled in by rgbfix.
+; This makes sure it doesn't get used.
+	ds $0150 - $0104
--- a/home/interrupts.asm
+++ /dev/null
@@ -1,16 +1,0 @@
-; Game Boy hardware interrupts
-
-SECTION "vblank", ROM0
-	jp VBlank
-
-SECTION "lcd", ROM0
-	jp LCD
-
-SECTION "timer", ROM0
-	jp Timer
-
-SECTION "serial", ROM0
-	jp Serial
-
-SECTION "joypad", ROM0
-	jp JoypadInt
--- a/home/rst.asm
+++ /dev/null
@@ -1,35 +1,0 @@
-; rst vectors
-
-SECTION "rst0", ROM0
-	di
-	jp Start
-
-SECTION "rst8", ROM0 ; rst FarCall
-	jp FarCall_hl
-
-SECTION "rst10", ROM0 ; rst Bankswitch
-	ldh [hROMBank], a
-	ld [MBC3RomBank], a
-	ret
-
-SECTION "rst18", ROM0
-	rst $38
-
-SECTION "rst20", ROM0
-	rst $38
-
-SECTION "rst28", ROM0 ; rst JumpTable
-	push de
-	ld e, a
-	ld d, 0
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld h, [hl]
-; SECTION "rst30", ROM0
-	ld l, a
-	pop de
-	jp hl
-
-SECTION "rst38", ROM0
-	rst $38