Merge pull request #176 from yenatch/interrupts

finally give labels to interrupts
This commit is contained in:
Bryan Bishop 2013-08-30 11:54:08 -07:00
commit 3e5b09b941
5 changed files with 161 additions and 121 deletions

View File

@ -26,7 +26,7 @@
ld l, a ld l, a
; down to business ; down to business
call JpHl call _hl_
; since this is called once per frame ; since this is called once per frame
call GameTimer call GameTimer

View File

@ -21,15 +21,29 @@ RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag
; Bit 6 Halt (0=Active, 1=Stop Timer) ; Bit 6 Halt (0=Active, 1=Stop Timer)
; Bit 7 Day Counter Carry Bit (1=Counter Overflow) ; Bit 7 Day Counter Carry Bit (1=Counter Overflow)
; interrupt flags
VBLANK EQU 0
LCD_STAT EQU 1
TIMER EQU 2
SERIAL EQU 3
JOYPAD EQU 4
; Hardware registers ; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W) rJOYP EQU $ff00 ; Joypad (R/W)
rSB EQU $ff01 ; Serial transfer data (R/W) rSB EQU $ff01 ; Serial transfer data (R/W)
rSC EQU $ff02 ; Serial Transfer Control (R/W) rSC EQU $ff02 ; Serial Transfer Control (R/W)
rSC_ON EQU 7
rSC_CGB EQU 1
rSC_CLOCK EQU 0
rDIV EQU $ff04 ; Divider Register (R/W) rDIV EQU $ff04 ; Divider Register (R/W)
rTIMA EQU $ff05 ; Timer counter (R/W) rTIMA EQU $ff05 ; Timer counter (R/W)
rTMA EQU $ff06 ; Timer Modulo (R/W) rTMA EQU $ff06 ; Timer Modulo (R/W)
rTAC EQU $ff07 ; Timer Control (R/W) rTAC EQU $ff07 ; Timer Control (R/W)
rTAC_ON EQU 2
rTAC_4096_HZ EQU 0
rTAC_262144_HZ EQU 1
rTAC_65536_HZ EQU 2
rTAC_16384_HZ EQU 3
rIF EQU $ff0f ; Interrupt Flag (R/W) rIF EQU $ff0f ; Interrupt Flag (R/W)
rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W)
rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W)

View File

@ -41,6 +41,9 @@ hMathBuffer EQU $ffb8
hLCDStatCustom EQU $ffc6 hLCDStatCustom EQU $ffc6
hSerialSend EQU $ffcd
hSerialReceive EQU $ffce
hSCX EQU $ffcf hSCX EQU $ffcf
hSCY EQU $ffd0 hSCY EQU $ffd0
hWX EQU $ffd1 hWX EQU $ffd1

252
main.asm
View File

@ -4,7 +4,7 @@ SECTION "rst0",ROM0[$0]
jp Start jp Start
SECTION "rst8",ROM0[$8] ; FarCall SECTION "rst8",ROM0[$8] ; FarCall
jp FarJpHl jp FarCall_hl
SECTION "rst10",ROM0[$10] ; Bankswitch SECTION "rst10",ROM0[$10] ; Bankswitch
ld [hROMBank], a ld [hROMBank], a
@ -38,13 +38,13 @@ SECTION "vblank",ROM0[$40] ; vblank interrupt
jp VBlank jp VBlank
SECTION "lcd",ROM0[$48] ; lcd interrupt SECTION "lcd",ROM0[$48] ; lcd interrupt
jp Function552 jp LCD
SECTION "timer",ROM0[$50] ; timer interrupt SECTION "timer",ROM0[$50] ; timer interrupt
jp Function3e93 jp Timer
SECTION "serial",ROM0[$58] ; serial interrupt SECTION "serial",ROM0[$58] ; serial interrupt
jp Function6ef jp Serial
SECTION "joypad",ROM0[$60] ; joypad interrupt SECTION "joypad",ROM0[$60] ; joypad interrupt
jp JoypadInt jp JoypadInt
@ -138,13 +138,13 @@ Function4a3: ; 4a3
and a and a
jr z, .asm_4af jr z, .asm_4af
ld hl, IncGradGBPalTable_00 ld hl, IncGradGBPalTable_00
ld b, $4 ld b, 4
jr Function4c7 jr FadeOut
.asm_4af .asm_4af
ld hl, IncGradGBPalTable_08 ld hl, IncGradGBPalTable_08
ld b, $4 ld b, 4
jr Function4c7 jr FadeOut
; 4b6 ; 4b6
Function4b6: ; 4b6 Function4b6: ; 4b6
@ -152,16 +152,15 @@ Function4b6: ; 4b6
and a and a
jr z, .asm_4c2 jr z, .asm_4c2
ld hl, IncGradGBPalTable_05 ld hl, IncGradGBPalTable_05
ld b, $3 ld b, 3
jr Function4c7 jr FadeOut
.asm_4c2 .asm_4c2
ld hl, IncGradGBPalTable_13 ld hl, IncGradGBPalTable_13
ld b, $3 ld b, 3
; 4c7 ; 4c7
Function4c7: ; 4c7 FadeOut: ; 4c7
.asm_4c7
push de push de
ld a, [hli] ld a, [hli]
call DmgToCgbBGPals call DmgToCgbBGPals
@ -174,7 +173,7 @@ Function4c7: ; 4c7
call DelayFrames call DelayFrames
pop de pop de
dec b dec b
jr nz, .asm_4c7 jr nz, FadeOut
ret ret
; 4dd ; 4dd
@ -183,13 +182,13 @@ Function4dd: ; 4dd
and a and a
jr z, .asm_4e9 jr z, .asm_4e9
ld hl, IncGradGBPalTable_04 - 1 ld hl, IncGradGBPalTable_04 - 1
ld b, $4 ld b, 4
jr Function501 jr FadeIn
.asm_4e9 .asm_4e9
ld hl, IncGradGBPalTable_12 - 1 ld hl, IncGradGBPalTable_12 - 1
ld b, $4 ld b, 4
jr Function501 jr FadeIn
; 4f0 ; 4f0
Function4f0: ; 4f0 Function4f0: ; 4f0
@ -197,16 +196,16 @@ Function4f0: ; 4f0
and a and a
jr z, .asm_4fc jr z, .asm_4fc
ld hl, IncGradGBPalTable_07 - 1 ld hl, IncGradGBPalTable_07 - 1
ld b, $3 ld b, 3
jr Function501 jr FadeIn
.asm_4fc .asm_4fc
ld hl, IncGradGBPalTable_15 - 1 ld hl, IncGradGBPalTable_15 - 1
ld b, $3 ld b, 3
; fallthrough ; fallthrough
; 501 ; 501
Function501: ; 501 FadeIn: ; 501
push de push de
ld a, [hld] ld a, [hld]
ld d, a ld d, a
@ -219,7 +218,7 @@ Function501: ; 501
call DelayFrames call DelayFrames
pop de pop de
dec b dec b
jr nz, Function501 jr nz, FadeIn
ret ret
; 517 ; 517
@ -247,23 +246,26 @@ IncGradGBPalTable_15: db %00000000, %00000000, %00000000
Function547: ; 547 Function547: ; 547
ld a, [hLCDStatCustom] ld a, [hLCDStatCustom]
cp $43 cp rSCX & $ff
ret nz ret nz
ld c, a ld c, a
ld a, [$d100] ld a, [LYOverrides]
ld [$ff00+c], a ld [$ff00+c], a
ret ret
; 552 ; 552
Function552: ; 552
LCD: ; 552
push af push af
ld a, [hLCDStatCustom] ld a, [hLCDStatCustom]
and a and a
jr z, .asm_566 jr z, .done
; At this point it's assumed we're in WRAM bank 5!
push bc push bc
ld a, [rLY] ld a, [rLY]
ld c, a ld c, a
ld b, $d1 ld b, LYOverrides >> 8
ld a, [bc] ld a, [bc]
ld b, a ld b, a
ld a, [hLCDStatCustom] ld a, [hLCDStatCustom]
@ -272,13 +274,12 @@ Function552: ; 552
ld [$ff00+c], a ld [$ff00+c], a
pop bc pop bc
.asm_566 .done
pop af pop af
reti reti
; 568 ; 568
DisableLCD: ; 568 DisableLCD: ; 568
; Turn the LCD off ; Turn the LCD off
@ -327,7 +328,7 @@ AskTimer: ; 591
ld a, [$ffe9] ld a, [$ffe9]
and a and a
jr z, .asm_59a jr z, .asm_59a
call Function3e93 call Timer
.asm_59a .asm_59a
pop af pop af
@ -631,31 +632,37 @@ Function6e3: ; 6e3
; 6ef ; 6ef
Serial: ; 6ef
Function6ef: ; 6ef
push af push af
push bc push bc
push de push de
push hl push hl
ld a, [$ffc9] ld a, [$ffc9]
and a and a
jr nz, .asm_71c jr nz, .asm_71c
ld a, [$c2d4] ld a, [$c2d4]
bit 0, a bit 0, a
jr nz, .asm_721 jr nz, .asm_721
ld a, [$ffcb] ld a, [$ffcb]
inc a inc a
jr z, .asm_726 jr z, .asm_726
ld a, [rSB] ld a, [rSB]
ld [$ffce], a ld [hSerialReceive], a
ld a, [$ffcd]
ld a, [hSerialSend]
ld [rSB], a ld [rSB], a
ld a, [$ffcb] ld a, [$ffcb]
cp $2 cp $2
jr z, .asm_752 jr z, .asm_752
ld a, $0
ld a, 0 << rSC_ON
ld [rSC], a ld [rSC], a
ld a, $80 ld a, 1 << rSC_ON
ld [rSC], a ld [rSC], a
jr .asm_752 jr .asm_752
@ -675,21 +682,24 @@ Function6ef: ; 6ef
jr nz, .asm_752 jr nz, .asm_752
.asm_730 .asm_730
ld [$ffce], a ld [hSerialReceive], a
ld [$ffcb], a ld [$ffcb], a
cp $2 cp $2
jr z, .asm_74f jr z, .asm_74f
xor a xor a
ld [rSB], a ld [rSB], a
ld a, $3 ld a, $3
ld [rDIV], a ld [rDIV], a
.asm_73f .asm_73f
ld a, [rDIV] ld a, [rDIV]
bit 7, a bit 7, a
jr nz, .asm_73f jr nz, .asm_73f
ld a, $0
ld a, 0 << rSC_ON
ld [rSC], a ld [rSC], a
ld a, $80 ld a, 1 << rSC_ON
ld [rSC], a ld [rSC], a
jr .asm_752 jr .asm_752
@ -701,7 +711,7 @@ Function6ef: ; 6ef
ld a, $1 ld a, $1
ld [$ffca], a ld [$ffca], a
ld a, $fe ld a, $fe
ld [$ffcd], a ld [hSerialSend], a
.asm_75a .asm_75a
pop hl pop hl
@ -716,7 +726,7 @@ Function75f: ; 75f
ld [$ffcc], a ld [$ffcc], a
.asm_763 .asm_763
ld a, [hl] ld a, [hl]
ld [$ffcd], a ld [hSerialSend], a
call Function78a call Function78a
push bc push bc
ld b, a ld b, a
@ -814,7 +824,7 @@ Function78a: ; 78a
ld [$cf5e], a ld [$cf5e], a
.asm_7f8 .asm_7f8
ld a, [$ffce] ld a, [hSerialReceive]
cp $fe cp $fe
ret nz ret nz
call Function82b call Function82b
@ -840,7 +850,7 @@ Function78a: ; 78a
ld a, $fe ld a, $fe
ret z ret z
ld a, [hl] ld a, [hl]
ld [$ffcd], a ld [hSerialSend], a
call DelayFrame call DelayFrame
jp Function78a jp Function78a
@ -877,7 +887,7 @@ Function83b: ; 83b
.asm_847 .asm_847
call DelayFrame call DelayFrame
ld a, [hl] ld a, [hl]
ld [$ffcd], a ld [hSerialSend], a
call Function78a call Function78a
ld b, a ld b, a
inc hl inc hl
@ -970,7 +980,7 @@ Function8c1: ; 8c1
call Function8f3 call Function8f3
ld a, [$cf56] ld a, [$cf56]
add b add b
ld [$ffcd], a ld [hSerialSend], a
ld a, [$ffcb] ld a, [$ffcb]
cp $2 cp $2
jr nz, .asm_8ee jr nz, .asm_8ee
@ -986,13 +996,13 @@ Function8c1: ; 8c1
; 8f3 ; 8f3
Function8f3: ; 8f3 Function8f3: ; 8f3
ld a, [$ffce] ld a, [hSerialReceive]
ld [$cf51], a ld [$cf51], a
and $f0 and $f0
cp b cp b
ret nz ret nz
xor a xor a
ld [$ffce], a ld [hSerialReceive], a
ld a, [$cf51] ld a, [$cf51]
and $f and $f
ld [$cf52], a ld [$cf52], a
@ -1001,7 +1011,7 @@ Function8f3: ; 8f3
Function908: ; 908 Function908: ; 908
xor a xor a
ld [$ffcd], a ld [hSerialSend], a
ld a, [$ffcb] ld a, [$ffcb]
cp $2 cp $2
ret nz ret nz
@ -1019,7 +1029,7 @@ Function919: ; 919
ld a, $2 ld a, $2
ld [rSB], a ld [rSB], a
xor a xor a
ld [$ffce], a ld [hSerialReceive], a
ld a, $0 ld a, $0
ld [rSC], a ld [rSC], a
ld a, $80 ld a, $80
@ -5554,7 +5564,7 @@ Function261b: ; 261b
ret ret
; 261f ; 261f
PushScriptPointer: ; 261f CallScript: ; 261f
; Call a script at a:hl. ; Call a script at a:hl.
ld [ScriptBank], a ld [ScriptBank], a
@ -5575,7 +5585,7 @@ Function2631: ; 2631
and a and a
ret nz ret nz
call GetMapEventBank call GetMapEventBank
jr PushScriptPointer jr CallScript
; 263b ; 263b
Function263b: ; 263b Function263b: ; 263b
@ -6985,27 +6995,28 @@ Function2d43: ; 2d43
; 2d54 ; 2d54
FarJpDe: ; 2d54 FarCall_de: ; 2d54
; Call a:de.
; Preserves other registers.
ld [hBuffer], a ld [hBuffer], a
ld a, [hROMBank] ld a, [hROMBank]
push af push af
ld a, [hBuffer] ld a, [hBuffer]
rst Bankswitch rst Bankswitch
call Function2d61 call .de
jr ReturnFarJump jr ReturnFarCall
; 2d61
Function2d61: ; 2d61 .de
push de push de
ret ret
; 2d63 ; 2d63
FarJpHl: ; 2d63 FarCall_hl: ; 2d63
; Jump to a:hl. ; Call a:hl.
; Preserves all registers besides a. ; Preserves other registers.
; Switch to the new bank.
ld [hBuffer], a ld [hBuffer], a
ld a, [hROMBank] ld a, [hROMBank]
push af push af
@ -7014,7 +7025,7 @@ FarJpHl: ; 2d63
call Function2d82 call Function2d82
; 2d6e ; 2d6e
ReturnFarJump: ; 2d6e ReturnFarCall: ; 2d6e
; We want to retain the contents of f. ; We want to retain the contents of f.
; To do this, we can pop to bc instead of af. ; To do this, we can pop to bc instead of af.
@ -7650,11 +7661,14 @@ CloseSRAM: ; 2fe1
ret ret
; 2fec ; 2fec
JpHl: ; 2fec
; Register aliases
_hl_: ; 2fec
jp [hl] jp [hl]
; 2fed ; 2fed
JpDe: ; 2fed _de_: ; 2fed
push de push de
ret ret
; 2fef ; 2fef
@ -8170,11 +8184,12 @@ Function31be: ; 31be
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
call JpHl
call _hl_
pop hl pop hl
ld a, h ld a, h
rst Bankswitch rst Bankswitch
ret ret
; 31cd ; 31cd
@ -10969,28 +10984,36 @@ Function3e80: ; 3e80
; 3e93 ; 3e93
Function3e93: ; 3e93 Timer: ; 3e93
push af push af
push bc push bc
push de push de
push hl push hl
ld a, [$ffe9] ld a, [$ffe9]
and a and a
jr z, .asm_3ed2 jr z, .asm_3ed2
xor a xor a
ld [rTAC], a ld [rTAC], a
; Turn off timer interrupt
ld a, [rIF] ld a, [rIF]
and $1b and 1 << VBLANK | 1 << LCD_STAT | 1 << SERIAL | 1 << JOYPAD
ld [rIF], a ld [rIF], a
ld a, [$c86a] ld a, [$c86a]
or a or a
jr z, .asm_3ed2 jr z, .asm_3ed2
ld a, [$c822] ld a, [$c822]
bit 1, a bit 1, a
jr nz, .asm_3eca jr nz, .asm_3eca
ld a, [rSC] ld a, [rSC]
and $80 and 1 << rSC_ON
jr nz, .asm_3eca jr nz, .asm_3eca
ld a, [hROMBank] ld a, [hROMBank]
push af push af
ld a, $44 ld a, $44
@ -10998,16 +11021,17 @@ Function3e93: ; 3e93
rst Bankswitch rst Bankswitch
call $58de call $58de
pop bc pop bc
ld a, b ld a, b
ld [$c981], a ld [$c981], a
rst Bankswitch rst Bankswitch
.asm_3eca .asm_3eca
ld a, [rTMA] ld a, [rTMA]
ld [rTIMA], a ld [rTIMA], a
ld a, $6
ld a, 1 << rTAC_ON | rTAC_65536_HZ
ld [rTAC], a ld [rTAC], a
.asm_3ed2 .asm_3ed2
@ -11702,7 +11726,7 @@ Function444d: ; 444d
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
call JpHl call _hl_
ret ret
; 445f ; 445f
@ -21139,7 +21163,7 @@ TrySurfOW: ; c9e7
ld a, BANK(AskSurfScript) ld a, BANK(AskSurfScript)
ld hl, AskSurfScript ld hl, AskSurfScript
call PushScriptPointer call CallScript
scf scf
ret ret
@ -21355,14 +21379,14 @@ TryWaterfallOW: ; cb56
jr c, .asm_cb74 jr c, .asm_cb74
ld a, BANK(UnknownScript_0xcb86) ld a, BANK(UnknownScript_0xcb86)
ld hl, UnknownScript_0xcb86 ld hl, UnknownScript_0xcb86
call PushScriptPointer call CallScript
scf scf
ret ret
.asm_cb74 .asm_cb74
ld a, BANK(UnknownScript_0xcb7e) ld a, BANK(UnknownScript_0xcb7e)
ld hl, UnknownScript_0xcb7e ld hl, UnknownScript_0xcb7e
call PushScriptPointer call CallScript
scf scf
ret ret
; cb7e ; cb7e
@ -21549,14 +21573,14 @@ TryWhirlpoolOW: ; ce3e
jr c, .asm_ce5c jr c, .asm_ce5c
ld a, BANK(UnknownScript_0xce6e) ld a, BANK(UnknownScript_0xce6e)
ld hl, UnknownScript_0xce6e ld hl, UnknownScript_0xce6e
call PushScriptPointer call CallScript
scf scf
ret ret
.asm_ce5c .asm_ce5c
ld a, BANK(UnknownScript_0xce66) ld a, BANK(UnknownScript_0xce66)
ld hl, UnknownScript_0xce66 ld hl, UnknownScript_0xce66
call PushScriptPointer call CallScript
scf scf
ret ret
; ce66 ; ce66
@ -21614,7 +21638,7 @@ TryHeadbuttOW: ; cec9
jr c, .asm_ceda jr c, .asm_ceda
ld a, $3 ld a, $3
ld hl, $4edc ld hl, $4edc
call PushScriptPointer call CallScript
scf scf
ret ret
@ -21794,14 +21818,14 @@ TryCutOW: ; d186
jr c, .asm_d19f jr c, .asm_d19f
ld a, BANK(UnknownScript_0xd1a9) ld a, BANK(UnknownScript_0xd1a9)
ld hl, UnknownScript_0xd1a9 ld hl, UnknownScript_0xd1a9
call PushScriptPointer call CallScript
scf scf
ret ret
.asm_d19f .asm_d19f
ld a, BANK(UnknownScript_0xd1cd) ld a, BANK(UnknownScript_0xd1cd)
ld hl, UnknownScript_0xd1cd ld hl, UnknownScript_0xd1cd
call PushScriptPointer call CallScript
scf scf
ret ret
; d1a9 ; d1a9
@ -27514,7 +27538,7 @@ Function1365b: ; 1365b
ld [$d03f + 2], a ld [$d03f + 2], a
ld a, BANK(UnknownScript_0x1369a) ld a, BANK(UnknownScript_0x1369a)
ld hl, UnknownScript_0x1369a ld hl, UnknownScript_0x1369a
call PushScriptPointer call CallScript
scf scf
ret ret
@ -34544,7 +34568,7 @@ Function25072: ; 25072
ld a, [$cf87] ld a, [$cf87]
ld d, a ld d, a
ld a, [$cf8a] ld a, [$cf8a]
call FarJpDe call FarCall_de
ret ret
; 25097 ; 25097
@ -48744,7 +48768,7 @@ AIChooseMove: ; 440ce
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, BANK(AIScoring) ld a, BANK(AIScoring)
call FarJpHl call FarCall_hl
jr .CheckLayer jr .CheckLayer
@ -51643,7 +51667,7 @@ StatsScreenInit: ; 4dc8a
ld hl, $753e ld hl, $753e
rst FarCall ; this loads graphics rst FarCall ; this loads graphics
pop hl pop hl
call JpHl call _hl_
call WhiteBGMap call WhiteBGMap
call ClearTileMap call ClearTileMap
pop bc pop bc
@ -53358,7 +53382,7 @@ Function505da: ; 505da
.asm_50622 .asm_50622
ld a, $14 ld a, $14
ld hl, UnknownScript_0x50669 ld hl, UnknownScript_0x50669
call PushScriptPointer call CallScript
scf scf
ret ret
@ -60436,7 +60460,7 @@ CheckTileEvent: ; 96874
ld h, [hl] ld h, [hl]
ld l, a ld l, a
call GetMapEventBank call GetMapEventBank
call PushScriptPointer call CallScript
ret ret
; 968c7 ; 968c7
@ -60502,7 +60526,7 @@ Function968ec: ; 968ec
call GetMapEventBank call GetMapEventBank
call GetFarHalfword call GetFarHalfword
call GetMapEventBank call GetMapEventBank
call PushScriptPointer call CallScript
ld hl, ScriptFlags ld hl, ScriptFlags
res 3, [hl] res 3, [hl]
@ -60519,7 +60543,7 @@ Function968ec: ; 968ec
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [$d44e] ld a, [$d44e]
call PushScriptPointer call CallScript
scf scf
ret ret
@ -60561,7 +60585,7 @@ Function9693a: ; 9693a
.asm_96966 .asm_96966
ld a, $4 ld a, $4
ld hl, $75f8 ld hl, $75f8
call PushScriptPointer call CallScript
scf scf
ret ret
; 96970 ; 96970
@ -60685,7 +60709,7 @@ TryObjectEvent: ; 969b5
ld h, [hl] ld h, [hl]
ld l, a ld l, a
call GetMapEventBank call GetMapEventBank
call PushScriptPointer call CallScript
; ld a, -1 ; ld a, -1
ret ret
; 96a12 ; 96a12
@ -60783,7 +60807,7 @@ TryReadSign: ; 96a38
ld h, [hl] ld h, [hl]
ld l, a ld l, a
call GetMapEventBank call GetMapEventBank
call PushScriptPointer call CallScript
scf scf
ret ret
@ -60797,7 +60821,7 @@ TryReadSign: ; 96a38
call FarCopyBytes call FarCopyBytes
ld a, $4 ld a, $4
ld hl, $7625 ld hl, $7625
call PushScriptPointer call CallScript
scf scf
ret ret
@ -60828,7 +60852,7 @@ TryReadSign: ; 96a38
call GetMapEventBank call GetMapEventBank
call GetFarHalfword call GetFarHalfword
call GetMapEventBank call GetMapEventBank
call PushScriptPointer call CallScript
scf scf
ret ret
@ -60908,7 +60932,7 @@ PlayerMovement: ; 96af0
; force the player to move in some direction ; force the player to move in some direction
ld a, $4 ld a, $4
ld hl, $653d ld hl, $653d
call PushScriptPointer call CallScript
; ld a, -1 ; ld a, -1
ld c, a ld c, a
scf scf
@ -60938,7 +60962,7 @@ CheckMenuOW: ; 96b30
ld a, BANK(StartMenuScript) ld a, BANK(StartMenuScript)
ld hl, StartMenuScript ld hl, StartMenuScript
call PushScriptPointer call CallScript
scf scf
ret ret
@ -60950,7 +60974,7 @@ CheckMenuOW: ; 96b30
call PlayTalkObject call PlayTalkObject
ld a, BANK(SelectMenuScript) ld a, BANK(SelectMenuScript)
ld hl, SelectMenuScript ld hl, SelectMenuScript
call PushScriptPointer call CallScript
scf scf
ret ret
; 96b58 ; 96b58
@ -61061,7 +61085,7 @@ Function96bd7: ; 96bd7
ret nz ret nz
ld a, $4 ld a, $4
ld hl, $7619 ld hl, $7619
call PushScriptPointer call CallScript
scf scf
ret ret
; 96beb ; 96beb
@ -61250,7 +61274,7 @@ Function97c30: ; 97c30
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [$d45d] ld a, [$d45d]
call PushScriptPointer call CallScript
scf scf
push af push af
xor a xor a
@ -61363,7 +61387,7 @@ Function97cc0: ; 97cc0
jr .asm_97cf4 jr .asm_97cf4
.asm_97cf4 .asm_97cf4
call PushScriptPointer call CallScript
scf scf
ret ret
; 97cf9 ; 97cf9
@ -69428,7 +69452,7 @@ Function100b12: ; 100b12
ld hl, $4f2c ld hl, $4f2c
ld a, $9 ld a, $9
ld de, LoadMenuDataHeader ld de, LoadMenuDataHeader
call FarJpDe call FarCall_de
ld a, $9 ld a, $9
ld [$cf94], a ld [$cf94], a
ld a, [$d0d2] ld a, [$d0d2]
@ -71392,7 +71416,7 @@ StartTitleScreen: ; 10ed67
call DrawGraphic call DrawGraphic
; Draw copyright text ; Draw copyright text
ld hl, $9c03 ; BG Map 1 (3,0) ld hl, $9c03 ; BGMap1(3,0)
ld bc, $010d ; 13x1 ld bc, $010d ; 13x1
ld d, $c ld d, $c
ld e, $10 ld e, $10
@ -71430,11 +71454,9 @@ StartTitleScreen: ; 10ed67
; LY/SCX trickery starts here ; LY/SCX trickery starts here
; Save WRAM bank
ld a, [rSVBK] ld a, [rSVBK]
push af push af
; WRAM bank 5 ld a, 5 ; BANK(LYOverrides)
ld a, 5
ld [rSVBK], a ld [rSVBK], a
; Make alternating lines come in from opposite sides ; Make alternating lines come in from opposite sides
@ -71442,28 +71464,27 @@ StartTitleScreen: ; 10ed67
; ( This part is actually totally pointless, you can't ; ( This part is actually totally pointless, you can't
; see anything until these values are overwritten! ) ; see anything until these values are overwritten! )
ld b, 40 ; alternate for 80 lines ld b, 80 / 2 ; alternate for 80 lines
ld hl, $d100 ; LY buffer ld hl, LYOverrides
.loop .loop
; $00 is the middle position ; $00 is the middle position
ld [hl], $70 ; coming from the left ld [hl], +112 ; coming from the left
inc hl inc hl
ld [hl], $90 ; coming from the right ld [hl], -112 ; coming from the right
inc hl inc hl
dec b dec b
jr nz, .loop jr nz, .loop
; Make sure the rest of the buffer is empty ; Make sure the rest of the buffer is empty
ld hl, $d150 ld hl, LYOverrides + 80
xor a xor a
ld bc, $0040 ld bc, LYOverridesEnd - (LYOverrides + 80)
call ByteFill call ByteFill
; Let LCD Stat know we're messing around with SCX ; Let LCD Stat know we're messing around with SCX
ld a, rSCX - rJOYP ld a, rSCX - rJOYP
ld [hLCDStatCustom], a ld [hLCDStatCustom], a
; Restore WRAM bank
pop af pop af
ld [rSVBK], a ld [rSVBK], a
@ -71477,14 +71498,13 @@ StartTitleScreen: ; 10ed67
set 2, a set 2, a
ld [rLCDC], a ld [rLCDC], a
; ld a, +112
ld a, $70
ld [hSCX], a ld [hSCX], a
ld a, $8 ld a, 8
ld [hSCY], a ld [hSCY], a
ld a, $7 ld a, 7
ld [hWX], a ld [hWX], a
ld a, $90 ld a, -112
ld [hWY], a ld [hWY], a
ld a, $1 ld a, $1

View File

@ -2098,15 +2098,18 @@ RoamMon3DVs: ; dfe2
SECTION "WRAMBank5",WRAMX[$d000],BANK[5] SECTION "WRAMBank5",WRAMX[$d000],BANK[5]
; 8 4-color palettes ; 8 4-color palettes
Unkn1Pals: Unkn1Pals: ; d000
ds $40 ds $40
Unkn2Pals: Unkn2Pals: ; d040
ds $40 ds $40
BGPals: BGPals: ; d080
ds $40 ds $40
OBPals: OBPals: ; d0c0
ds $40 ds $40
LYOverrides: ; d100
ds 144
LYOverridesEnd
SECTION "SRAMBank1",SRAM,BANK[1] SECTION "SRAMBank1",SRAM,BANK[1]