pokecrystal-board/home/print_text.asm

134 lines
1.7 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
PrintLetterDelay::
; 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
2019-04-08 05:15:10 -07:00
; 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?
2019-04-08 05:15:10 -07:00
ld a, [wTextboxFlags]
bit 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?
2019-04-08 05:15:10 -07:00
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
2023-09-30 10:12:57 -07:00
ldh [hTextDelayFrames], a
.checkjoypad
call GetJoypad
; input override
ld a, [wDisableTextAcceleration]
and a
jr nz, .wait
; Wait one frame if holding A or B.
ldh 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
2023-09-30 10:12:57 -07:00
ldh a, [hTextDelayFrames]
and a
jr nz, .checkjoypad
.end
pop af
ldh [hOAMUpdate], a
pop bc
pop de
pop hl
ret
2018-06-24 07:09:41 -07:00
CopyDataUntil::
; 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
2018-06-24 07:09:41 -07:00
PrintNum::
homecall _PrintNum
ret
FarPrintText1bpp::
2020-04-06 10:02:23 -07:00
ldh [hTempBank], a
ldh a, [hROMBank]
push af
2020-04-06 10:02:23 -07:00
ldh a, [hTempBank]
rst Bankswitch
call PrintText1bpp
pop af
rst Bankswitch
ret
Small home/ reorganization Time to move everything out of home.asm: - InexplicablyEmptyFunction was moved to home/map.asm - The wDebugFlags functions and xor_a brothers were moved to home/flag.asm because they're all flag-related. - ret_2f3e was moved into home/region.asm - The register alias sisters were moved to a new file called home/call_regs.asm - IsInArray and SkipNames were joined by AddNTimes from home/math.asm into home/array.asm, as they're all used to index arrays. - CallPointerAt was moved into home/print_text.asm because given the contents of that file it doesn't feel very out of place (that file isn't very aptly named...) - CountSetBits was moved into home/pokedex_flags.asm because it's unique use is counting the amount of seen/caught mon in the podedex. GetWeekday was pulled into this by proximity. Other changes were also made: - PushLYOverrides was moved from home/sprite_anims.asm to home/battle.asm, because it's almost exclusively used for battle animations, with the lone exception being the Magnet Train. - home/copy.asm was renamed to home/gfx.asm, as it's all gfx-related - home/copy2.asm was renamed to home/copy.asm, now it's the only file called copy. - SetHPPal and GetHPPal were moved from home/hp_pals.asm to home/tilemap.asm, as they're attrmap related, like many functions in that file are. - home/rtc.asm was renamed to home/time_palettes.asm, as it had very little to do with the RTC at all, all RTC functions being in home/time.asm - home/handshake.asm was renamed to home/printer.asm. - home/mon_data_2.asm was renamed to home/mon_party.asm.
2020-02-21 14:48:51 -08:00
CallPointerAt::
ldh a, [hROMBank]
push af
ld a, [hli]
rst Bankswitch
ld a, [hli]
ld h, [hl]
ld l, a
call _hl_
pop hl
ld a, h
rst Bankswitch
ret