1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
; This function is used to wait a short period after printing a letter to the
; screen unless the player presses the A/B button or the delay is turned off
; through the [wd730] or [wLetterPrintingDelayFlags] flags.
PrintLetterDelay::
ld a, [wd730]
bit 6, a
ret nz
ld a, [wLetterPrintingDelayFlags]
bit 1, a
ret z
push hl
push de
push bc
ld a, [wLetterPrintingDelayFlags]
bit 0, a
jr z, .waitOneFrame
ld a, [wOptions]
and $f
ldh [hFrameCounter], a
jr .checkButtons
.waitOneFrame
ld a, 1
ldh [hFrameCounter], a
.checkButtons
call Joypad
ldh a, [hJoyHeld]
.checkAButton
bit BIT_A_BUTTON, a
jr z, .checkBButton
jr .endWait
.checkBButton
bit BIT_B_BUTTON, a
jr z, .buttonsNotPressed
.endWait
call DelayFrame
jr .done
.buttonsNotPressed ; if neither A nor B is pressed
ldh a, [hFrameCounter]
and a
jr nz, .checkButtons
.done
pop bc
pop de
pop hl
ret
|