diff --git a/home.asm b/home.asm index 0fe6bd706..54db23cd9 100644 --- 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 diff --git a/home/header.asm b/home/header.asm new file mode 100644 index 000000000..3531d2851 --- /dev/null +++ b/home/header.asm @@ -0,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 diff --git a/home/interrupts.asm b/home/interrupts.asm deleted file mode 100644 index 0cae6441c..000000000 --- a/home/interrupts.asm +++ /dev/null @@ -1,16 +0,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 diff --git a/home/rst.asm b/home/rst.asm deleted file mode 100644 index 6fe5bd572..000000000 --- a/home/rst.asm +++ /dev/null @@ -1,35 +0,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