Split mobile/timer code out of home.asm.

This commit is contained in:
yenatch 2014-08-22 10:57:06 -07:00
parent 49b00673b0
commit a5862306b7
2 changed files with 144 additions and 144 deletions

145
home.asm
View File

@ -2083,152 +2083,9 @@ Function3b3c:: ; 3b3c
INCLUDE "home/audio.asm"
INCLUDE "home/mobile.asm"
Function3e32:: ; 3e32
; Mobile
cp $2
ld [$c988], a
ld a, l
ld [$c986], a
ld a, h
ld [$c987], a
jr nz, .asm_3e4f
ld [$c982], a
ld a, l
ld [$c981], a
ld hl, $c983
ld a, c
ld [hli], a
ld a, b
ld [hl], a
.asm_3e4f
ld hl, $c822
set 6, [hl]
ld a, [hROMBank]
push af
ld a, BANK(Function110030)
ld [$c981], a
rst Bankswitch
jp Function110030
; 3e60
Function3e60:: ; 3e60
ld [$c986], a
ld a, l
ld [$c987], a
ld a, h
ld [$c988], a
pop bc
ld a, b
ld [$c981], a
rst Bankswitch
ld hl, $c822
res 6, [hl]
ld hl, $c987
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$c986]
ret
; 3e80
Function3e80:: ; 3e80
ld a, [hROMBank]
push af
ld a, BANK(Function1116c5)
ld [$c981], a
rst Bankswitch
call Function1116c5
pop bc
ld a, b
ld [$c981], a
rst Bankswitch
ret
; 3e93
Timer:: ; 3e93
push af
push bc
push de
push hl
ld a, [$ffe9]
and a
jr z, .asm_3ed2
xor a
ld [rTAC], a
; Turn off timer interrupt
ld a, [rIF]
and 1 << VBLANK | 1 << LCD_STAT | 1 << SERIAL | 1 << JOYPAD
ld [rIF], a
ld a, [$c86a]
or a
jr z, .asm_3ed2
ld a, [$c822]
bit 1, a
jr nz, .asm_3eca
ld a, [rSC]
and 1 << rSC_ON
jr nz, .asm_3eca
ld a, [hROMBank]
push af
ld a, BANK(Function1118de)
ld [$c981], a
rst Bankswitch
call Function1118de
pop bc
ld a, b
ld [$c981], a
rst Bankswitch
.asm_3eca
ld a, [rTMA]
ld [rTIMA], a
ld a, 1 << rTAC_ON | rTAC_65536_HZ
ld [rTAC], a
.asm_3ed2
pop hl
pop de
pop bc
pop af
reti
; 3ed7
Function3ed7:: ; 3ed7
ld [$dc02], a
ld a, [hROMBank]
push af
ld a, BANK(Function114243)
rst Bankswitch
call Function114243
pop bc
ld a, b
rst Bankswitch
ld a, [$dc02]
ret
; 3eea
Function3eea:: ; 3eea
push hl
push bc

143
home/mobile.asm Normal file
View File

@ -0,0 +1,143 @@
Function3e32:: ; 3e32
; Mobile
cp $2
ld [$c988], a
ld a, l
ld [$c986], a
ld a, h
ld [$c987], a
jr nz, .asm_3e4f
ld [$c982], a
ld a, l
ld [$c981], a
ld hl, $c983
ld a, c
ld [hli], a
ld a, b
ld [hl], a
.asm_3e4f
ld hl, $c822
set 6, [hl]
ld a, [hROMBank]
push af
ld a, BANK(Function110030)
ld [$c981], a
rst Bankswitch
jp Function110030
; 3e60
Function3e60:: ; 3e60
ld [$c986], a
ld a, l
ld [$c987], a
ld a, h
ld [$c988], a
pop bc
ld a, b
ld [$c981], a
rst Bankswitch
ld hl, $c822
res 6, [hl]
ld hl, $c987
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$c986]
ret
; 3e80
Function3e80:: ; 3e80
ld a, [hROMBank]
push af
ld a, BANK(Function1116c5)
ld [$c981], a
rst Bankswitch
call Function1116c5
pop bc
ld a, b
ld [$c981], a
rst Bankswitch
ret
; 3e93
Timer:: ; 3e93
push af
push bc
push de
push hl
ld a, [$ffe9]
and a
jr z, .asm_3ed2
xor a
ld [rTAC], a
; Turn off timer interrupt
ld a, [rIF]
and 1 << VBLANK | 1 << LCD_STAT | 1 << SERIAL | 1 << JOYPAD
ld [rIF], a
ld a, [$c86a]
or a
jr z, .asm_3ed2
ld a, [$c822]
bit 1, a
jr nz, .asm_3eca
ld a, [rSC]
and 1 << rSC_ON
jr nz, .asm_3eca
ld a, [hROMBank]
push af
ld a, BANK(Function1118de)
ld [$c981], a
rst Bankswitch
call Function1118de
pop bc
ld a, b
ld [$c981], a
rst Bankswitch
.asm_3eca
ld a, [rTMA]
ld [rTIMA], a
ld a, 1 << rTAC_ON | rTAC_65536_HZ
ld [rTAC], a
.asm_3ed2
pop hl
pop de
pop bc
pop af
reti
; 3ed7
Function3ed7:: ; 3ed7
ld [$dc02], a
ld a, [hROMBank]
push af
ld a, BANK(Function114243)
rst Bankswitch
call Function114243
pop bc
ld a, b
rst Bankswitch
ld a, [$dc02]
ret
; 3eea