shithub: pokered

Download patch

ref: cf399a8c86a7340a8c3162400657dca1c5d3ba0a
parent: 1cf79b6f15761ec95ba1b0f9d6d83781c4240612
author: yenatch <yenatch@gmail.com>
date: Mon Aug 11 20:01:04 EDT 2014

Split copy and serial functions out of home.asm.

--- a/home.asm
+++ b/home.asm
@@ -79,32 +79,9 @@
 	jr nz, .loop
 	ret
 
-FarCopyData::
-; Copy bc bytes from a:hl to de.
-	ld [wBuffer], a
-	ld a, [H_LOADEDROMBANK]
-	push af
-	ld a, [wBuffer]
-	ld [H_LOADEDROMBANK], a
-	ld [MBC3RomBank], a
-	call CopyData
-	pop af
-	ld [H_LOADEDROMBANK], a
-	ld [MBC3RomBank], a
-	ret
+INCLUDE "home/copy.asm"
 
-CopyData::
-; Copy bc bytes from hl to de.
-	ld a, [hli]
-	ld [de], a
-	inc de
-	dec bc
-	ld a, c
-	or b
-	jr nz, CopyData
-	ret
 
-
 SECTION "Entry", ROM0[$100]
 	nop
 	jp Start
@@ -908,556 +885,14 @@
 
 
 INCLUDE "data/collision.asm"
-
-
-FarCopyData2::
-; Identical to FarCopyData, but uses $ff8b
-; as temp space instead of wBuffer.
-	ld [$ff8b],a
-	ld a,[H_LOADEDROMBANK]
-	push af
-	ld a,[$ff8b]
-	ld [H_LOADEDROMBANK],a
-	ld [MBC3RomBank],a
-	call CopyData
-	pop af
-	ld [H_LOADEDROMBANK],a
-	ld [MBC3RomBank],a
-	ret
-
-FarCopyData3::
-; Copy bc bytes from a:de to hl.
-	ld [$ff8b],a
-	ld a,[H_LOADEDROMBANK]
-	push af
-	ld a,[$ff8b]
-	ld [H_LOADEDROMBANK],a
-	ld [MBC3RomBank],a
-	push hl
-	push de
-	push de
-	ld d,h
-	ld e,l
-	pop hl
-	call CopyData
-	pop de
-	pop hl
-	pop af
-	ld [H_LOADEDROMBANK],a
-	ld [MBC3RomBank],a
-	ret
-
-FarCopyDataDouble::
-; Expand bc bytes of 1bpp image data
-; from a:hl to 2bpp data at de.
-	ld [$ff8b],a
-	ld a,[H_LOADEDROMBANK]
-	push af
-	ld a,[$ff8b]
-	ld [H_LOADEDROMBANK],a
-	ld [MBC3RomBank],a
-.loop
-	ld a,[hli]
-	ld [de],a
-	inc de
-	ld [de],a
-	inc de
-	dec bc
-	ld a,c
-	or b
-	jr nz,.loop
-	pop af
-	ld [H_LOADEDROMBANK],a
-	ld [MBC3RomBank],a
-	ret
-
-CopyVideoData::
-; Wait for the next VBlank, then copy c 2bpp
-; tiles from b:de to hl, 8 tiles at a time.
-; This takes c/8 frames.
-
-	ld a, [H_AUTOBGTRANSFERENABLED]
-	push af
-	xor a ; disable auto-transfer while copying
-	ld [H_AUTOBGTRANSFERENABLED], a
-
-	ld a, [H_LOADEDROMBANK]
-	ld [$ff8b], a
-
-	ld a, b
-	ld [H_LOADEDROMBANK], a
-	ld [MBC3RomBank], a
-
-	ld a, e
-	ld [H_VBCOPYSRC], a
-	ld a, d
-	ld [H_VBCOPYSRC + 1], a
-
-	ld a, l
-	ld [H_VBCOPYDEST], a
-	ld a, h
-	ld [H_VBCOPYDEST + 1], a
-
-.loop
-	ld a, c
-	cp 8
-	jr nc, .keepgoing
-
-.done
-	ld [H_VBCOPYSIZE], a
-	call DelayFrame
-	ld a, [$ff8b]
-	ld [H_LOADEDROMBANK], a
-	ld [MBC3RomBank], a
-	pop af
-	ld [H_AUTOBGTRANSFERENABLED], a
-	ret
-
-.keepgoing
-	ld a, 8
-	ld [H_VBCOPYSIZE], a
-	call DelayFrame
-	ld a, c
-	sub 8
-	ld c, a
-	jr .loop
-
-CopyVideoDataDouble::
-; Wait for the next VBlank, then copy c 1bpp
-; tiles from b:de to hl, 8 tiles at a time.
-; This takes c/8 frames.
-	ld a, [H_AUTOBGTRANSFERENABLED]
-	push af
-	xor a ; disable auto-transfer while copying
-	ld [H_AUTOBGTRANSFERENABLED], a
-	ld a, [H_LOADEDROMBANK]
-	ld [$ff8b], a
-
-	ld a, b
-	ld [H_LOADEDROMBANK], a
-	ld [MBC3RomBank], a
-
-	ld a, e
-	ld [H_VBCOPYDOUBLESRC], a
-	ld a, d
-	ld [H_VBCOPYDOUBLESRC + 1], a
-
-	ld a, l
-	ld [H_VBCOPYDOUBLEDEST], a
-	ld a, h
-	ld [H_VBCOPYDOUBLEDEST + 1], a
-
-.loop
-	ld a, c
-	cp 8
-	jr nc, .keepgoing
-
-.done
-	ld [H_VBCOPYDOUBLESIZE], a
-	call DelayFrame
-	ld a, [$ff8b]
-	ld [H_LOADEDROMBANK], a
-	ld [MBC3RomBank], a
-	pop af
-	ld [H_AUTOBGTRANSFERENABLED], a
-	ret
-
-.keepgoing
-	ld a, 8
-	ld [H_VBCOPYDOUBLESIZE], a
-	call DelayFrame
-	ld a, c
-	sub 8
-	ld c, a
-	jr .loop
-
-ClearScreenArea::
-; Clear tilemap area cxb at hl.
-	ld a, $7f ; blank tile
-	ld de, 20 ; screen width
-.y
-	push hl
-	push bc
-.x
-	ld [hli], a
-	dec c
-	jr nz, .x
-	pop bc
-	pop hl
-	add hl, de
-	dec b
-	jr nz, .y
-	ret
-
-CopyScreenTileBufferToVRAM::
-; Copy wTileMap to the BG Map starting at b * $100.
-; This is done in thirds of 6 rows, so it takes 3 frames.
-
-	ld c, 6
-
-	ld hl, $600 * 0
-	ld de, wTileMap + 20 * 6 * 0
-	call .setup
-	call DelayFrame
-
-	ld hl, $600 * 1
-	ld de, wTileMap + 20 * 6 * 1
-	call .setup
-	call DelayFrame
-
-	ld hl, $600 * 2
-	ld de, wTileMap + 20 * 6 * 2
-	call .setup
-	jp DelayFrame
-
-.setup
-	ld a, d
-	ld [H_VBCOPYBGSRC+1], a
-	call GetRowColAddressBgMap
-	ld a, l
-	ld [H_VBCOPYBGDEST], a
-	ld a, h
-	ld [H_VBCOPYBGDEST+1], a
-	ld a, c
-	ld [H_VBCOPYBGNUMROWS], a
-	ld a, e
-	ld [H_VBCOPYBGSRC], a
-	ret
-
-ClearScreen::
-; Clear wTileMap, then wait
-; for the bg map to update.
-	ld bc, 20 * 18
-	inc b
-	ld hl, wTileMap
-	ld a, $7f
-.loop
-	ld [hli], a
-	dec c
-	jr nz, .loop
-	dec b
-	jr nz, .loop
-	jp Delay3
-
-
+INCLUDE "home/copy2.asm"
 INCLUDE "home/text.asm"
 INCLUDE "home/vcopy.asm"
 INCLUDE "home/init.asm"
 INCLUDE "home/vblank.asm"
 INCLUDE "home/fade.asm"
-
-
-Serial:: ; 2125 (0:2125)
-	push af
-	push bc
-	push de
-	push hl
-	ld a, [$ffaa]
-	inc a
-	jr z, .asm_2142
-	ld a, [$ff01]
-	ld [$ffad], a
-	ld a, [$ffac]
-	ld [$ff01], a
-	ld a, [$ffaa]
-	cp $2
-	jr z, .asm_2162
-	ld a, $80
-	ld [$ff02], a
-	jr .asm_2162
-.asm_2142
-	ld a, [$ff01]
-	ld [$ffad], a
-	ld [$ffaa], a
-	cp $2
-	jr z, .asm_215f
-	xor a
-	ld [$ff01], a
-	ld a, $3
-	ld [rDIV], a ; $ff04
-.asm_2153
-	ld a, [rDIV] ; $ff04
-	bit 7, a
-	jr nz, .asm_2153
-	ld a, $80
-	ld [$ff02], a
-	jr .asm_2162
-.asm_215f
-	xor a
-	ld [$ff01], a
-.asm_2162
-	ld a, $1
-	ld [$ffa9], a
-	ld a, $fe
-	ld [$ffac], a
-	pop hl
-	pop de
-	pop bc
-	pop af
-	reti
-
-Func_216f:: ; 216f (0:216f)
-	ld a, $1
-	ld [$ffab], a
-.asm_2173
-	ld a, [hl]
-	ld [$ffac], a
-	call Func_219a
-	push bc
-	ld b, a
-	inc hl
-	ld a, $30
-.asm_217e
-	dec a
-	jr nz, .asm_217e
-	ld a, [$ffab]
-	and a
-	ld a, b
-	pop bc
-	jr z, .asm_2192
-	dec hl
-	cp $fd
-	jr nz, .asm_2173
-	xor a
-	ld [$ffab], a
-	jr .asm_2173
-.asm_2192
-	ld [de], a
-	inc de
-	dec bc
-	ld a, b
-	or c
-	jr nz, .asm_2173
-	ret
-
-Func_219a:: ; 219a (0:219a)
-	xor a
-	ld [$ffa9], a
-	ld a, [$ffaa]
-	cp $2
-	jr nz, .asm_21a7
-	ld a, $81
-	ld [$ff02], a
-.asm_21a7
-	ld a, [$ffa9]
-	and a
-	jr nz, .asm_21f1
-	ld a, [$ffaa]
-	cp $1
-	jr nz, .asm_21cc
-	call Func_2237
-	jr z, .asm_21cc
-	call Func_2231
-	push hl
-	ld hl, wcc48
-	inc [hl]
-	jr nz, .asm_21c3
-	dec hl
-	inc [hl]
-.asm_21c3
-	pop hl
-	call Func_2237
-	jr nz, .asm_21a7
-	jp Func_223f
-.asm_21cc
-	ld a, [rIE] ; $ffff
-	and $f
-	cp $8
-	jr nz, .asm_21a7
-	ld a, [W_NUMHITS] ; wd074
-	dec a
-	ld [W_NUMHITS], a ; wd074
-	jr nz, .asm_21a7
-	ld a, [wd075]
-	dec a
-	ld [wd075], a
-	jr nz, .asm_21a7
-	ld a, [$ffaa]
-	cp $1
-	jr z, .asm_21f1
-	ld a, $ff
-.asm_21ee
-	dec a
-	jr nz, .asm_21ee
-.asm_21f1
-	xor a
-	ld [$ffa9], a
-	ld a, [rIE] ; $ffff
-	and $f
-	sub $8
-	jr nz, .asm_2204
-	ld [W_NUMHITS], a ; wd074
-	ld a, $50
-	ld [wd075], a
-.asm_2204
-	ld a, [$ffad]
-	cp $fe
-	ret nz
-	call Func_2237
-	jr z, .asm_221f
-	push hl
-	ld hl, wcc48
-	ld a, [hl]
-	dec a
-	ld [hld], a
-	inc a
-	jr nz, .asm_2219
-	dec [hl]
-.asm_2219
-	pop hl
-	call Func_2237
-	jr z, Func_223f
-.asm_221f
-	ld a, [rIE] ; $ffff
-	and $f
-	cp $8
-	ld a, $fe
-	ret z
-	ld a, [hl]
-	ld [$ffac], a
-	call DelayFrame
-	jp Func_219a
-
-Func_2231:: ; 2231 (0:2231)
-	ld a, $f
-.asm_2233
-	dec a
-	jr nz, .asm_2233
-	ret
-
-Func_2237:: ; 2237 (0:2237)
-	push hl
-	ld hl, wcc47
-	ld a, [hli]
-	or [hl]
-	pop hl
-	ret
-
-Func_223f:: ; 223f (0:223f)
-	dec a
-	ld [wcc47], a
-	ld [wcc48], a
-	ret
-
-Func_2247:: ; 2247 (0:2247)
-	ld hl, wcc42
-	ld de, wcc3d
-	ld c, $2
-	ld a, $1
-	ld [$ffab], a
-.asm_2253
-	call DelayFrame
-	ld a, [hl]
-	ld [$ffac], a
-	call Func_219a
-	ld b, a
-	inc hl
-	ld a, [$ffab]
-	and a
-	ld a, $0
-	ld [$ffab], a
-	jr nz, .asm_2253
-	ld a, b
-	ld [de], a
-	inc de
-	dec c
-	jr nz, .asm_2253
-	ret
-
-Func_226e:: ; 226e (0:226e)
-	call SaveScreenTilesToBuffer1
-	callab PrintWaitingText
-	call Func_227f
-	jp LoadScreenTilesFromBuffer1
-
-Func_227f:: ; 227f (0:227f)
-	ld a, $ff
-	ld [wcc3e], a
-.asm_2284
-	call Func_22c3
-	call DelayFrame
-	call Func_2237
-	jr z, .asm_22a0
-	push hl
-	ld hl, wcc48
-	dec [hl]
-	jr nz, .asm_229f
-	dec hl
-	dec [hl]
-	jr nz, .asm_229f
-	pop hl
-	xor a
-	jp Func_223f
-.asm_229f
-	pop hl
-.asm_22a0
-	ld a, [wcc3e]
-	inc a
-	jr z, .asm_2284
-	ld b, $a
-.asm_22a8
-	call DelayFrame
-	call Func_22c3
-	dec b
-	jr nz, .asm_22a8
-	ld b, $a
-.asm_22b3
-	call DelayFrame
-	call Func_22ed
-	dec b
-	jr nz, .asm_22b3
-	ld a, [wcc3e]
-	ld [wcc3d], a
-	ret
-
-Func_22c3:: ; 22c3 (0:22c3)
-	call asm_22d7
-	ld a, [wcc42]
-	add $60
-	ld [$ffac], a
-	ld a, [$ffaa]
-	cp $2
-	jr nz, asm_22d7
-	ld a, $81
-	ld [$ff02], a
-asm_22d7:: ; 22d7 (0:22d7)
-	ld a, [$ffad]
-	ld [wcc3d], a
-	and $f0
-	cp $60
-	ret nz
-	xor a
-	ld [$ffad], a
-	ld a, [wcc3d]
-	and $f
-	ld [wcc3e], a
-	ret
-
-Func_22ed:: ; 22ed (0:22ed)
-	xor a
-	ld [$ffac], a
-	ld a, [$ffaa]
-	cp $2
-	ret nz
-	ld a, $81
-	ld [$ff02], a
-	ret
-
-Func_22fa:: ; 22fa (0:22fa)
-	ld a, $2
-	ld [$ff01], a
-	xor a
-	ld [$ffad], a
-	ld a, $80
-	ld [$ff02], a
-	ret
-
-
-; timer interrupt is apparently not invoked anyway
-Timer:: ; 2306 (0:2306)
-	reti
-
-
+INCLUDE "home/serial.asm"
+INCLUDE "home/timer.asm"
 INCLUDE "home/audio.asm"
 
 
--- /dev/null
+++ b/home/copy.asm
@@ -1,0 +1,24 @@
+FarCopyData::
+; Copy bc bytes from a:hl to de.
+	ld [wBuffer], a
+	ld a, [H_LOADEDROMBANK]
+	push af
+	ld a, [wBuffer]
+	ld [H_LOADEDROMBANK], a
+	ld [MBC3RomBank], a
+	call CopyData
+	pop af
+	ld [H_LOADEDROMBANK], a
+	ld [MBC3RomBank], a
+	ret
+
+CopyData::
+; Copy bc bytes from hl to de.
+	ld a, [hli]
+	ld [de], a
+	inc de
+	dec bc
+	ld a, c
+	or b
+	jr nz, CopyData
+	ret
--- /dev/null
+++ b/home/copy2.asm
@@ -1,0 +1,228 @@
+FarCopyData2::
+; Identical to FarCopyData, but uses $ff8b
+; as temp space instead of wBuffer.
+	ld [$ff8b],a
+	ld a,[H_LOADEDROMBANK]
+	push af
+	ld a,[$ff8b]
+	ld [H_LOADEDROMBANK],a
+	ld [MBC3RomBank],a
+	call CopyData
+	pop af
+	ld [H_LOADEDROMBANK],a
+	ld [MBC3RomBank],a
+	ret
+
+FarCopyData3::
+; Copy bc bytes from a:de to hl.
+	ld [$ff8b],a
+	ld a,[H_LOADEDROMBANK]
+	push af
+	ld a,[$ff8b]
+	ld [H_LOADEDROMBANK],a
+	ld [MBC3RomBank],a
+	push hl
+	push de
+	push de
+	ld d,h
+	ld e,l
+	pop hl
+	call CopyData
+	pop de
+	pop hl
+	pop af
+	ld [H_LOADEDROMBANK],a
+	ld [MBC3RomBank],a
+	ret
+
+FarCopyDataDouble::
+; Expand bc bytes of 1bpp image data
+; from a:hl to 2bpp data at de.
+	ld [$ff8b],a
+	ld a,[H_LOADEDROMBANK]
+	push af
+	ld a,[$ff8b]
+	ld [H_LOADEDROMBANK],a
+	ld [MBC3RomBank],a
+.loop
+	ld a,[hli]
+	ld [de],a
+	inc de
+	ld [de],a
+	inc de
+	dec bc
+	ld a,c
+	or b
+	jr nz,.loop
+	pop af
+	ld [H_LOADEDROMBANK],a
+	ld [MBC3RomBank],a
+	ret
+
+CopyVideoData::
+; Wait for the next VBlank, then copy c 2bpp
+; tiles from b:de to hl, 8 tiles at a time.
+; This takes c/8 frames.
+
+	ld a, [H_AUTOBGTRANSFERENABLED]
+	push af
+	xor a ; disable auto-transfer while copying
+	ld [H_AUTOBGTRANSFERENABLED], a
+
+	ld a, [H_LOADEDROMBANK]
+	ld [$ff8b], a
+
+	ld a, b
+	ld [H_LOADEDROMBANK], a
+	ld [MBC3RomBank], a
+
+	ld a, e
+	ld [H_VBCOPYSRC], a
+	ld a, d
+	ld [H_VBCOPYSRC + 1], a
+
+	ld a, l
+	ld [H_VBCOPYDEST], a
+	ld a, h
+	ld [H_VBCOPYDEST + 1], a
+
+.loop
+	ld a, c
+	cp 8
+	jr nc, .keepgoing
+
+.done
+	ld [H_VBCOPYSIZE], a
+	call DelayFrame
+	ld a, [$ff8b]
+	ld [H_LOADEDROMBANK], a
+	ld [MBC3RomBank], a
+	pop af
+	ld [H_AUTOBGTRANSFERENABLED], a
+	ret
+
+.keepgoing
+	ld a, 8
+	ld [H_VBCOPYSIZE], a
+	call DelayFrame
+	ld a, c
+	sub 8
+	ld c, a
+	jr .loop
+
+CopyVideoDataDouble::
+; Wait for the next VBlank, then copy c 1bpp
+; tiles from b:de to hl, 8 tiles at a time.
+; This takes c/8 frames.
+	ld a, [H_AUTOBGTRANSFERENABLED]
+	push af
+	xor a ; disable auto-transfer while copying
+	ld [H_AUTOBGTRANSFERENABLED], a
+	ld a, [H_LOADEDROMBANK]
+	ld [$ff8b], a
+
+	ld a, b
+	ld [H_LOADEDROMBANK], a
+	ld [MBC3RomBank], a
+
+	ld a, e
+	ld [H_VBCOPYDOUBLESRC], a
+	ld a, d
+	ld [H_VBCOPYDOUBLESRC + 1], a
+
+	ld a, l
+	ld [H_VBCOPYDOUBLEDEST], a
+	ld a, h
+	ld [H_VBCOPYDOUBLEDEST + 1], a
+
+.loop
+	ld a, c
+	cp 8
+	jr nc, .keepgoing
+
+.done
+	ld [H_VBCOPYDOUBLESIZE], a
+	call DelayFrame
+	ld a, [$ff8b]
+	ld [H_LOADEDROMBANK], a
+	ld [MBC3RomBank], a
+	pop af
+	ld [H_AUTOBGTRANSFERENABLED], a
+	ret
+
+.keepgoing
+	ld a, 8
+	ld [H_VBCOPYDOUBLESIZE], a
+	call DelayFrame
+	ld a, c
+	sub 8
+	ld c, a
+	jr .loop
+
+ClearScreenArea::
+; Clear tilemap area cxb at hl.
+	ld a, $7f ; blank tile
+	ld de, 20 ; screen width
+.y
+	push hl
+	push bc
+.x
+	ld [hli], a
+	dec c
+	jr nz, .x
+	pop bc
+	pop hl
+	add hl, de
+	dec b
+	jr nz, .y
+	ret
+
+CopyScreenTileBufferToVRAM::
+; Copy wTileMap to the BG Map starting at b * $100.
+; This is done in thirds of 6 rows, so it takes 3 frames.
+
+	ld c, 6
+
+	ld hl, $600 * 0
+	ld de, wTileMap + 20 * 6 * 0
+	call .setup
+	call DelayFrame
+
+	ld hl, $600 * 1
+	ld de, wTileMap + 20 * 6 * 1
+	call .setup
+	call DelayFrame
+
+	ld hl, $600 * 2
+	ld de, wTileMap + 20 * 6 * 2
+	call .setup
+	jp DelayFrame
+
+.setup
+	ld a, d
+	ld [H_VBCOPYBGSRC+1], a
+	call GetRowColAddressBgMap
+	ld a, l
+	ld [H_VBCOPYBGDEST], a
+	ld a, h
+	ld [H_VBCOPYBGDEST+1], a
+	ld a, c
+	ld [H_VBCOPYBGNUMROWS], a
+	ld a, e
+	ld [H_VBCOPYBGSRC], a
+	ret
+
+ClearScreen::
+; Clear wTileMap, then wait
+; for the bg map to update.
+	ld bc, 20 * 18
+	inc b
+	ld hl, wTileMap
+	ld a, $7f
+.loop
+	ld [hli], a
+	dec c
+	jr nz, .loop
+	dec b
+	jr nz, .loop
+	jp Delay3
--- /dev/null
+++ b/home/serial.asm
@@ -1,0 +1,304 @@
+Serial:: ; 2125 (0:2125)
+	push af
+	push bc
+	push de
+	push hl
+	ld a, [$ffaa]
+	inc a
+	jr z, .asm_2142
+	ld a, [$ff01]
+	ld [$ffad], a
+	ld a, [$ffac]
+	ld [$ff01], a
+	ld a, [$ffaa]
+	cp $2
+	jr z, .asm_2162
+	ld a, $80
+	ld [$ff02], a
+	jr .asm_2162
+.asm_2142
+	ld a, [$ff01]
+	ld [$ffad], a
+	ld [$ffaa], a
+	cp $2
+	jr z, .asm_215f
+	xor a
+	ld [$ff01], a
+	ld a, $3
+	ld [rDIV], a ; $ff04
+.asm_2153
+	ld a, [rDIV] ; $ff04
+	bit 7, a
+	jr nz, .asm_2153
+	ld a, $80
+	ld [$ff02], a
+	jr .asm_2162
+.asm_215f
+	xor a
+	ld [$ff01], a
+.asm_2162
+	ld a, $1
+	ld [$ffa9], a
+	ld a, $fe
+	ld [$ffac], a
+	pop hl
+	pop de
+	pop bc
+	pop af
+	reti
+
+Func_216f:: ; 216f (0:216f)
+	ld a, $1
+	ld [$ffab], a
+.asm_2173
+	ld a, [hl]
+	ld [$ffac], a
+	call Func_219a
+	push bc
+	ld b, a
+	inc hl
+	ld a, $30
+.asm_217e
+	dec a
+	jr nz, .asm_217e
+	ld a, [$ffab]
+	and a
+	ld a, b
+	pop bc
+	jr z, .asm_2192
+	dec hl
+	cp $fd
+	jr nz, .asm_2173
+	xor a
+	ld [$ffab], a
+	jr .asm_2173
+.asm_2192
+	ld [de], a
+	inc de
+	dec bc
+	ld a, b
+	or c
+	jr nz, .asm_2173
+	ret
+
+Func_219a:: ; 219a (0:219a)
+	xor a
+	ld [$ffa9], a
+	ld a, [$ffaa]
+	cp $2
+	jr nz, .asm_21a7
+	ld a, $81
+	ld [$ff02], a
+.asm_21a7
+	ld a, [$ffa9]
+	and a
+	jr nz, .asm_21f1
+	ld a, [$ffaa]
+	cp $1
+	jr nz, .asm_21cc
+	call Func_2237
+	jr z, .asm_21cc
+	call Func_2231
+	push hl
+	ld hl, wcc48
+	inc [hl]
+	jr nz, .asm_21c3
+	dec hl
+	inc [hl]
+.asm_21c3
+	pop hl
+	call Func_2237
+	jr nz, .asm_21a7
+	jp Func_223f
+.asm_21cc
+	ld a, [rIE] ; $ffff
+	and $f
+	cp $8
+	jr nz, .asm_21a7
+	ld a, [W_NUMHITS] ; wd074
+	dec a
+	ld [W_NUMHITS], a ; wd074
+	jr nz, .asm_21a7
+	ld a, [wd075]
+	dec a
+	ld [wd075], a
+	jr nz, .asm_21a7
+	ld a, [$ffaa]
+	cp $1
+	jr z, .asm_21f1
+	ld a, $ff
+.asm_21ee
+	dec a
+	jr nz, .asm_21ee
+.asm_21f1
+	xor a
+	ld [$ffa9], a
+	ld a, [rIE] ; $ffff
+	and $f
+	sub $8
+	jr nz, .asm_2204
+	ld [W_NUMHITS], a ; wd074
+	ld a, $50
+	ld [wd075], a
+.asm_2204
+	ld a, [$ffad]
+	cp $fe
+	ret nz
+	call Func_2237
+	jr z, .asm_221f
+	push hl
+	ld hl, wcc48
+	ld a, [hl]
+	dec a
+	ld [hld], a
+	inc a
+	jr nz, .asm_2219
+	dec [hl]
+.asm_2219
+	pop hl
+	call Func_2237
+	jr z, Func_223f
+.asm_221f
+	ld a, [rIE] ; $ffff
+	and $f
+	cp $8
+	ld a, $fe
+	ret z
+	ld a, [hl]
+	ld [$ffac], a
+	call DelayFrame
+	jp Func_219a
+
+Func_2231:: ; 2231 (0:2231)
+	ld a, $f
+.asm_2233
+	dec a
+	jr nz, .asm_2233
+	ret
+
+Func_2237:: ; 2237 (0:2237)
+	push hl
+	ld hl, wcc47
+	ld a, [hli]
+	or [hl]
+	pop hl
+	ret
+
+Func_223f:: ; 223f (0:223f)
+	dec a
+	ld [wcc47], a
+	ld [wcc48], a
+	ret
+
+Func_2247:: ; 2247 (0:2247)
+	ld hl, wcc42
+	ld de, wcc3d
+	ld c, $2
+	ld a, $1
+	ld [$ffab], a
+.asm_2253
+	call DelayFrame
+	ld a, [hl]
+	ld [$ffac], a
+	call Func_219a
+	ld b, a
+	inc hl
+	ld a, [$ffab]
+	and a
+	ld a, $0
+	ld [$ffab], a
+	jr nz, .asm_2253
+	ld a, b
+	ld [de], a
+	inc de
+	dec c
+	jr nz, .asm_2253
+	ret
+
+Func_226e:: ; 226e (0:226e)
+	call SaveScreenTilesToBuffer1
+	callab PrintWaitingText
+	call Func_227f
+	jp LoadScreenTilesFromBuffer1
+
+Func_227f:: ; 227f (0:227f)
+	ld a, $ff
+	ld [wcc3e], a
+.asm_2284
+	call Func_22c3
+	call DelayFrame
+	call Func_2237
+	jr z, .asm_22a0
+	push hl
+	ld hl, wcc48
+	dec [hl]
+	jr nz, .asm_229f
+	dec hl
+	dec [hl]
+	jr nz, .asm_229f
+	pop hl
+	xor a
+	jp Func_223f
+.asm_229f
+	pop hl
+.asm_22a0
+	ld a, [wcc3e]
+	inc a
+	jr z, .asm_2284
+	ld b, $a
+.asm_22a8
+	call DelayFrame
+	call Func_22c3
+	dec b
+	jr nz, .asm_22a8
+	ld b, $a
+.asm_22b3
+	call DelayFrame
+	call Func_22ed
+	dec b
+	jr nz, .asm_22b3
+	ld a, [wcc3e]
+	ld [wcc3d], a
+	ret
+
+Func_22c3:: ; 22c3 (0:22c3)
+	call asm_22d7
+	ld a, [wcc42]
+	add $60
+	ld [$ffac], a
+	ld a, [$ffaa]
+	cp $2
+	jr nz, asm_22d7
+	ld a, $81
+	ld [$ff02], a
+asm_22d7:: ; 22d7 (0:22d7)
+	ld a, [$ffad]
+	ld [wcc3d], a
+	and $f0
+	cp $60
+	ret nz
+	xor a
+	ld [$ffad], a
+	ld a, [wcc3d]
+	and $f
+	ld [wcc3e], a
+	ret
+
+Func_22ed:: ; 22ed (0:22ed)
+	xor a
+	ld [$ffac], a
+	ld a, [$ffaa]
+	cp $2
+	ret nz
+	ld a, $81
+	ld [$ff02], a
+	ret
+
+Func_22fa:: ; 22fa (0:22fa)
+	ld a, $2
+	ld [$ff01], a
+	xor a
+	ld [$ffad], a
+	ld a, $80
+	ld [$ff02], a
+	ret
--- /dev/null
+++ b/home/timer.asm
@@ -1,0 +1,3 @@
+; timer interrupt is apparently not invoked anyway
+Timer:: ; 2306 (0:2306)
+	reti