diff options
author | yenatch <yenatch@gmail.com> | 2018-04-09 21:30:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-09 21:30:24 -0400 |
commit | 40b537d45b4b8937038126f7e5d2d21ccee460c0 (patch) | |
tree | 881a090b80b2c22985fc6d1231b03c6721a83462 /home/print_text.asm | |
parent | e4b41fad4fd3787ca2e61adb5377ba8f68fca7ef (diff) | |
parent | 53ff57ca663dc5bf9c3731022b0eb0dc73f2207f (diff) |
Merge pull request #503 from Rangi42/master
Factor wMisc into meaningful parts; move most code out of home.asm
Diffstat (limited to 'home/print_text.asm')
-rw-r--r-- | home/print_text.asm | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/home/print_text.asm b/home/print_text.asm new file mode 100644 index 000000000..66f0b5e01 --- /dev/null +++ b/home/print_text.asm @@ -0,0 +1,125 @@ +PrintLetterDelay:: ; 313d +; Wait before printing the next letter. + +; The text speed setting in wOptions is actually a frame count: +; fast: 1 frame +; mid: 3 frames +; slow: 5 frames + +; wTextBoxFlags[!0] and A or B override text speed with a one-frame delay. +; wOptions[4] and wTextBoxFlags[!1] disable the delay. + + ld a, [wOptions] + bit NO_TEXT_SCROLL, a + ret nz + +; non-scrolling text? + ld a, [wTextBoxFlags] + bit NO_TEXT_DELAY_F, a + ret z + + push hl + push de + push bc + + ld hl, hOAMUpdate + ld a, [hl] + push af + +; orginally turned oam update off... +; ld a, 1 + ld [hl], a + +; force fast scroll? + ld a, [wTextBoxFlags] + bit FAST_TEXT_DELAY_F, a + jr z, .fast + +; text speed + ld a, [wOptions] + and %111 + jr .updatedelay + +.fast + ld a, TEXT_DELAY_FAST + +.updatedelay + ld [wTextDelayFrames], a + +.checkjoypad + call GetJoypad + +; input override + ld a, [wDisableTextAcceleration] + and a + jr nz, .wait + +; Wait one frame if holding A or B. + ld a, [hJoyDown] + bit A_BUTTON_F, a + jr z, .checkb + jr .delay +.checkb + bit B_BUTTON_F, a + jr z, .wait + +.delay + call DelayFrame + jr .end + +.wait + ld a, [wTextDelayFrames] + and a + jr nz, .checkjoypad + +.end + pop af + ld [hOAMUpdate], a + pop bc + pop de + pop hl + ret +; 318c + +CopyDataUntil:: ; 318c +; Copy [hl .. bc) to de. + +; In other words, the source data is +; from hl up to but not including bc, +; and the destination is de. + + ld a, [hli] + ld [de], a + inc de + ld a, h + cp b + jr nz, CopyDataUntil + ld a, l + cp c + jr nz, CopyDataUntil + ret +; 0x3198 + +PrintNum:: ; 3198 + homecall _PrintNum + ret +; 31a4 + +MobilePrintNum:: ; 31a4 + homecall _MobilePrintNum + ret +; 31b0 + +FarPrintText:: ; 31b0 + ld [hBuffer], a + ld a, [hROMBank] + push af + ld a, [hBuffer] + rst Bankswitch + + call PrintText + + pop af + rst Bankswitch + ret +; 31be |