rename and clean up _Start, Init

This commit is contained in:
yenatch 2013-08-19 18:40:59 -04:00
parent 75d5cc3bb6
commit 8af06f3cc2

View File

@ -20,7 +20,7 @@ SECTION "rst20",HOME[$20] ; Unused
SECTION "rst28",HOME[$28] ; JumpTable SECTION "rst28",HOME[$28] ; JumpTable
push de push de
ld e, a ld e, a
ld d, 00 ld d, 0
add hl, de add hl, de
add hl, de add hl, de
ld a, [hli] ld a, [hli]
@ -52,7 +52,7 @@ SECTION "joypad",HOME[$60] ; joypad interrupt
SECTION "romheader",HOME[$100] SECTION "romheader",HOME[$100]
Start: Start:
nop nop
jp Function16e jp _Start
SECTION "start",HOME[$150] SECTION "start",HOME[$150]
@ -71,10 +71,10 @@ Reset: ; 150
set 7, [hl] set 7, [hl]
ld c, $20 ld c, $20
call DelayFrames call DelayFrames
jr Function17d jr Init
; 16e ; 16e
Function16e: ; 16e _Start: ; 16e
cp $11 cp $11
jr z, .asm_175 jr z, .asm_175
xor a xor a
@ -89,7 +89,7 @@ Function16e: ; 16e
ld [$ffea], a ld [$ffea], a
; 17d ; 17d
Function17d: ; 17d Init: ; 17d
di di
xor a xor a
ld [rIF], a ld [rIF], a
@ -109,10 +109,12 @@ Function17d: ; 17d
ld [$d000], a ld [$d000], a
ld a, $4 ld a, $4
ld [rTAC], a ld [rTAC], a
.asm_1a2
.wait
ld a, [rLY] ld a, [rLY]
cp $91 cp 145
jr nz, .asm_1a2 jr nz, .wait
xor a xor a
ld [rLCDC], a ld [rLCDC], a
ld hl, $c000 ld hl, $c000
@ -137,20 +139,18 @@ Function17d: ; 17d
ld [$ffea], a ld [$ffea], a
pop af pop af
ld [hCGB], a ld [hCGB], a
call Function25a call ClearWRAM
ld a, $1 ld a, $1
ld [rSVBK], a ld [rSVBK], a
call Function245 call ClearVRAM
call ClearSprites call ClearSprites
call Function270 call Function270
ld a, BANK(Function4031) ld a, BANK(Function4031)
rst Bankswitch rst Bankswitch
call Function4031 call Function4031
; Note that Function642e is called later assuming it's in the same bank.
xor a xor a
ld [$ffde], a ld [$ffde], a
ld [$ffcf], a ld [$ffcf], a
@ -174,9 +174,10 @@ Function17d: ; 17d
xor a xor a
ld [hBGMapAddress], a ld [hBGMapAddress], a
callba Function14089 callba Function14089
xor a xor a
ld [$6000], a ld [MBC3LatchClock], a
ld [$0000], a ld [MBC3SRAMEnable], a
ld a, [hCGB] ld a, [hCGB]
and a and a
@ -189,6 +190,7 @@ Function17d: ; 17d
ld a, $f ld a, $f
ld [rIE], a ld [rIE], a
ei ei
call DelayFrame call DelayFrame
ld a, $30 ld a, $30
call Predef call Predef
@ -198,12 +200,16 @@ Function17d: ; 17d
jp Function642e jp Function642e
; 245 ; 245
Function245: ; 245 ClearVRAM: ; 245
ld a, $1 ; Wipe VRAM banks 0 and 1
ld a, 1
ld [rVBK], a ld [rVBK], a
call $024f call .clear
xor a xor a
ld [rVBK], a ld [rVBK], a
.clear
ld hl, VTiles0 ld hl, VTiles0
ld bc, $2000 ld bc, $2000
xor a xor a
@ -211,8 +217,10 @@ Function245: ; 245
ret ret
; 25a ; 25a
Function25a: ; 25a ClearWRAM: ; 25a
ld a, $1 ; Wipe swappable WRAM banks (1-7)
ld a, 1
.asm_25c .asm_25c
push af push af
ld [rSVBK], a ld [rSVBK], a
@ -222,7 +230,7 @@ Function25a: ; 25a
call ByteFill call ByteFill
pop af pop af
inc a inc a
cp $8 cp 8
jr nc, .asm_25c jr nc, .asm_25c
ret ret
; 270 ; 270
@ -239,7 +247,6 @@ Function270: ; 270
; 283 ; 283
VBlank: ; 283 VBlank: ; 283
INCLUDE "engine/vblank.asm" INCLUDE "engine/vblank.asm"
@ -18205,14 +18212,14 @@ Function6389: ; 6389
ld a, $13 ld a, $13
ld hl, $554c ld hl, $554c
rst FarCall rst FarCall
jp Function17d jp Init
; 6392 ; 6392
Function6392: ; 6392 Function6392: ; 6392
ld a, $13 ld a, $13
ld hl, $53b1 ld hl, $53b1
rst FarCall rst FarCall
jp Function17d jp Init
; 639b ; 639b
Function639b: ; 639b Function639b: ; 639b