Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/home/print_text.asm
1270 views
1
; This function is used to wait a short period after printing a letter to the
2
; screen unless the player presses the A/B button or the delay is turned off
3
; through the [wStatusFlags5] or [wLetterPrintingDelayFlags] flags.
4
PrintLetterDelay::
5
ld a, [wStatusFlags5]
6
bit BIT_NO_TEXT_DELAY, a
7
ret nz
8
ld a, [wLetterPrintingDelayFlags]
9
bit BIT_TEXT_DELAY, a
10
ret z
11
push hl
12
push de
13
push bc
14
ld a, [wLetterPrintingDelayFlags]
15
bit BIT_FAST_TEXT_DELAY, a
16
jr z, .waitOneFrame
17
ld a, [wOptions]
18
and $f
19
ldh [hFrameCounter], a
20
jr .checkButtons
21
.waitOneFrame
22
ld a, 1
23
ldh [hFrameCounter], a
24
.checkButtons
25
call Joypad
26
ldh a, [hJoyHeld]
27
.checkAButton
28
bit B_PAD_A, a
29
jr z, .checkBButton
30
jr .endWait
31
.checkBButton
32
bit B_PAD_B, a
33
jr z, .buttonsNotPressed
34
.endWait
35
call DelayFrame
36
jr .done
37
.buttonsNotPressed ; if neither A nor B is pressed
38
ldh a, [hFrameCounter]
39
and a
40
jr nz, .checkButtons
41
.done
42
pop bc
43
pop de
44
pop hl
45
ret
46
47