pokecrystal/home/text.asm

1152 lines
16 KiB
NASM
Raw Normal View History

ClearBox:: ; fb6
2013-08-20 19:58:08 +00:00
; Fill a c*b box at hl with blank tiles.
ld a, " "
; fallthrough
2014-08-15 06:50:39 +00:00
FillBoxWithByte::
2015-10-16 17:35:43 +00:00
.row
2013-08-20 19:58:08 +00:00
push bc
push hl
2015-10-16 17:35:43 +00:00
.col
2013-08-20 19:58:08 +00:00
ld [hli], a
dec c
2015-10-16 17:35:43 +00:00
jr nz, .col
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
ld bc, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
add hl, bc
pop bc
dec b
2015-10-16 17:35:43 +00:00
jr nz, .row
2013-08-20 19:58:08 +00:00
ret
; fc8
ClearTileMap:: ; fc8
2013-08-20 19:58:08 +00:00
; Fill TileMap with blank tiles.
hlcoord 0, 0
2013-08-20 19:58:08 +00:00
ld a, " "
2014-08-15 06:50:39 +00:00
ld bc, TileMapEnd - TileMap
2013-08-20 19:58:08 +00:00
call ByteFill
2014-08-15 06:50:39 +00:00
; Update the BG Map.
2013-08-20 19:58:08 +00:00
ld a, [rLCDC]
2017-12-29 17:53:21 +00:00
bit rLCDC_ENABLE, a
2013-08-20 19:58:08 +00:00
ret z
jp WaitBGMap
; fdb
2014-08-15 06:50:39 +00:00
ClearScreen:: ; fdb
2017-12-14 05:36:24 +00:00
ld a, PAL_BG_TEXT
hlcoord 0, 0, AttrMap
2014-08-15 06:50:39 +00:00
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
2013-08-20 19:58:08 +00:00
call ByteFill
jr ClearTileMap
; fe8
TextBox:: ; fe8
; Draw a text box at hl with room for b lines of c characters each.
; Places a border around the textbox, then switches the palette to the
2015-10-16 17:35:43 +00:00
; text black-and-white scheme.
2013-08-20 19:58:08 +00:00
push bc
push hl
call TextBoxBorder
pop hl
pop bc
jr TextBoxPalette
; ff1
TextBoxBorder:: ; ff1
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
; Top
2013-08-20 19:58:08 +00:00
push hl
ld a, "┌"
ld [hli], a
inc a ; "─"
2014-08-15 06:50:39 +00:00
call .PlaceChars
2013-08-20 19:58:08 +00:00
inc a ; "┐"
ld [hl], a
pop hl
2014-08-15 06:50:39 +00:00
; Middle
ld de, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
add hl, de
2014-08-15 06:50:39 +00:00
.row
2013-08-20 19:58:08 +00:00
push hl
ld a, "│"
ld [hli], a
ld a, " "
2014-08-15 06:50:39 +00:00
call .PlaceChars
2013-08-20 19:58:08 +00:00
ld [hl], "│"
pop hl
2014-08-15 06:50:39 +00:00
ld de, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
add hl, de
dec b
2014-08-15 06:50:39 +00:00
jr nz, .row
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
; Bottom
2013-08-20 19:58:08 +00:00
ld a, "└"
ld [hli], a
ld a, "─"
2014-08-15 06:50:39 +00:00
call .PlaceChars
2013-08-20 19:58:08 +00:00
ld [hl], "┘"
ret
; 101e
2014-08-15 06:50:39 +00:00
.PlaceChars: ; 101e
; Place char a c times.
ld d, c
2013-08-20 19:58:08 +00:00
.loop
2014-08-15 06:50:39 +00:00
ld [hli], a
2013-08-20 19:58:08 +00:00
dec d
jr nz, .loop
ret
; 1024
TextBoxPalette:: ; 1024
2013-08-20 19:58:08 +00:00
; Fill text box width c height b at hl with pal 7
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
2013-08-20 19:58:08 +00:00
inc c
2017-12-14 05:36:24 +00:00
ld a, PAL_BG_TEXT
2014-08-15 06:50:39 +00:00
.col
2013-08-20 19:58:08 +00:00
push bc
push hl
2014-08-15 06:50:39 +00:00
.row
2013-08-20 19:58:08 +00:00
ld [hli], a
dec c
2014-08-15 06:50:39 +00:00
jr nz, .row
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
ld de, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
add hl, de
pop bc
dec b
2014-08-15 06:50:39 +00:00
jr nz, .col
2013-08-20 19:58:08 +00:00
ret
; 103e
SpeechTextBox:: ; 103e
2013-08-20 19:58:08 +00:00
; Standard textbox.
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_X, TEXTBOX_Y
ld b, TEXTBOX_INNERH
ld c, TEXTBOX_INNERW
2013-08-20 19:58:08 +00:00
jp TextBox
; 1048
2014-08-15 06:50:39 +00:00
TestText:: ; 1048
text "ゲームフりーク!"
done
2013-08-20 19:58:08 +00:00
; 1052
RadioTerminator:: ; 1052
2014-08-15 06:50:39 +00:00
ld hl, .stop
2013-08-20 19:58:08 +00:00
ret
2014-08-15 06:50:39 +00:00
.stop db "@"
2013-08-20 19:58:08 +00:00
; 1057
PrintText:: ; 1057
call SetUpTextBox
2015-11-01 01:05:02 +00:00
BuenaPrintText:: ; 105a
2013-08-20 19:58:08 +00:00
push hl
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
2013-08-20 19:58:08 +00:00
call ClearBox
pop hl
PrintTextBoxText:: ; 1065
2014-08-15 06:50:39 +00:00
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
call PlaceHLTextAtBC
2013-08-20 19:58:08 +00:00
ret
; 106c
SetUpTextBox:: ; 106c
2013-08-20 19:58:08 +00:00
push hl
call SpeechTextBox
call UpdateSprites
2015-11-25 15:16:29 +00:00
call ApplyTilemap
2013-08-20 19:58:08 +00:00
pop hl
ret
; 1078
PlaceString:: ; 1078
2013-08-20 19:58:08 +00:00
push hl
PlaceNextChar:: ; 1079
2013-08-20 19:58:08 +00:00
ld a, [de]
cp "@"
jr nz, CheckDict
ld b, h
ld c, l
pop hl
ret
pop de
NextChar:: ; 1083
2013-08-20 19:58:08 +00:00
inc de
jp PlaceNextChar
CheckDict:: ; 1087
dict: MACRO
2014-08-15 06:50:39 +00:00
if \1 == 0
2013-08-20 19:58:08 +00:00
and a
2014-08-15 06:50:39 +00:00
else
cp \1
endc
jp z, \2
2017-12-28 21:31:16 +00:00
ENDM
2015-10-04 18:14:51 +00:00
dict2: MACRO
2015-10-04 18:14:51 +00:00
cp \1
2016-03-03 05:07:17 +00:00
jr nz, ._\@
2015-10-04 18:14:51 +00:00
ld a, \2
2016-03-03 05:07:17 +00:00
._\@:
2017-12-28 21:31:16 +00:00
ENDM
2015-10-04 18:14:51 +00:00
2017-12-15 05:38:52 +00:00
dict "<DAY>", Char15
dict "<LINE>", LineChar
dict "<NEXT>", NextLineChar
dict TX_FAR, TextFar
dict $00, NullChar
dict $4c, Char4C
dict $4b, Char4B
dict "<PARA>", Paragraph
dict "<MOM>", PrintMomsName
dict "<PLAYER>", PrintPlayerName
dict "<RIVAL>", PrintRivalName
dict $35, Char35
dict $36, Char36
dict $37, Char37
dict "<RED>", PrintRedsName
dict "<GREEN>", PrintGreensName
dict "#", PlacePOKe
dict "<PC>", PCChar
dict "<ROCKET>", RocketChar
dict "<TM>", TMChar
dict "<TRNER>", TrainerChar
dict "<KOUGEKI>", PlaceKougeki
dict "<LNBRK>", Char22
dict "<CONT>", ContText
dict "<......>", SixDotsChar
dict "<DONE>", DoneText
dict "<PROMPT>", PromptText
dict "<PKMN>", PlacePKMN
dict "<POKE>", PlacePOKE
dict "%", NextChar
dict2 "¯", " "
dict "<DEXEND>", PlaceDexEnd
dict "<TARGET>", PlaceMoveTargetsName
dict "<USER>", PlaceMoveUsersName
dict "<ENEMY>", PlaceEnemysName
dict "<PLAY_G>", PlaceGenderedPlayerName
2016-03-03 05:07:17 +00:00
cp "゚"
jr z, .place ; should be .diacritic
2016-03-03 05:07:17 +00:00
cp "゙"
jr z, .place ; should be .diacritic
jr .not_diacritic
2014-08-15 06:50:39 +00:00
.diacritic
2013-08-20 19:58:08 +00:00
ld b, a
2014-08-15 06:50:39 +00:00
call Diacritic
2013-08-20 19:58:08 +00:00
jp NextChar
2014-08-15 06:50:39 +00:00
.not_diacritic
2016-03-03 05:07:17 +00:00
cp $60 ; Regular characters
2014-08-15 06:50:39 +00:00
jr nc, .place
2016-03-03 05:07:17 +00:00
cp "パ"
2014-08-15 06:50:39 +00:00
jr nc, .handakuten
.dakuten
2013-08-20 19:58:08 +00:00
cp $20
2014-08-15 06:50:39 +00:00
jr nc, .daku1
2016-03-03 05:07:17 +00:00
add "カ" - "ガ"
2014-08-15 06:50:39 +00:00
jr .daku2
.daku1
2016-03-03 05:07:17 +00:00
add "か" - "が"
2014-08-15 06:50:39 +00:00
.daku2
2016-03-03 05:07:17 +00:00
ld b, "゙" ; dakuten
2014-08-15 06:50:39 +00:00
call Diacritic
jr .place
.handakuten
cp "ぱ"
jr nc, .han1
add "ハ" - "パ"
jr .han2
.han1
add "は" - "ぱ"
.han2
2016-03-03 05:07:17 +00:00
ld b, "゚" ; handakuten
2014-08-15 06:50:39 +00:00
call Diacritic
.place
2013-08-20 19:58:08 +00:00
ld [hli], a
call PrintLetterDelay
jp NextChar
; 0x117b
2014-08-15 06:50:39 +00:00
Char15:: ; 117b
2013-08-20 19:58:08 +00:00
ld c, l
ld b, h
2017-12-24 17:47:30 +00:00
farcall Function17f036
2013-08-20 19:58:08 +00:00
jp PlaceNextChar
; 1186
print_name: MACRO
2013-08-20 19:58:08 +00:00
push de
2014-08-15 06:50:39 +00:00
ld de, \1
2015-10-04 18:14:51 +00:00
jp PlaceCommandCharacter
2017-12-28 21:31:16 +00:00
ENDM
2014-08-15 06:50:39 +00:00
PrintMomsName: print_name MomsName ; 1186
PrintPlayerName: print_name PlayerName ; 118d
PrintRivalName: print_name RivalName ; 1194
PrintRedsName: print_name RedsName ; 119b
PrintGreensName: print_name GreensName ; 11a2
2016-03-03 05:07:17 +00:00
TrainerChar: print_name TrainerCharText ; 11a9
TMChar: print_name TMCharText ; 11b0
PCChar: print_name PCCharText ; 11b7
RocketChar: print_name RocketCharText ; 11be
PlacePOKe: print_name PlacePOKeText ; 11c5
PlaceKougeki: print_name KougekiText ; 11cc
SixDotsChar: print_name SixDotsCharText ; 11d3
PlacePKMN: print_name PlacePKMNText ; 11da
PlacePOKE: print_name PlacePOKEText ; 11e1
Char35: print_name Char35Text ; 11e8
Char36: print_name Char36Text ; 11ef
Char37: print_name Char37Text ; 11f6
2014-08-15 06:50:39 +00:00
2015-10-04 18:14:51 +00:00
PlaceMoveTargetsName:: ; 11fd
2013-08-20 19:58:08 +00:00
ld a, [hBattleTurn]
2014-08-15 06:50:39 +00:00
xor 1
2015-10-04 18:14:51 +00:00
jr PlaceMoveTargetsName_5A
2013-08-20 19:58:08 +00:00
2015-10-04 18:14:51 +00:00
PlaceMoveUsersName:: ; 1203
2013-08-20 19:58:08 +00:00
ld a, [hBattleTurn]
2015-10-04 18:14:51 +00:00
PlaceMoveTargetsName_5A: ; 1205
2013-08-20 19:58:08 +00:00
push de
and a
2014-08-15 06:50:39 +00:00
jr nz, .enemy
2013-08-20 19:58:08 +00:00
ld de, BattleMonNick
2015-10-04 18:14:51 +00:00
jr PlaceCommandCharacter
2014-08-15 06:50:39 +00:00
.enemy
2015-10-04 18:14:51 +00:00
ld de, EnemyText ; Enemy
2013-08-20 19:58:08 +00:00
call PlaceString
ld h, b
ld l, c
ld de, EnemyMonNick
2015-10-04 18:14:51 +00:00
jr PlaceCommandCharacter
2014-08-15 06:50:39 +00:00
2015-10-04 18:14:51 +00:00
PlaceEnemysName:: ; 121b
2013-08-20 19:58:08 +00:00
push de
2014-08-15 06:50:39 +00:00
ld a, [wLinkMode]
2013-08-20 19:58:08 +00:00
and a
jr nz, .linkbattle
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
ld a, [TrainerClass]
cp RIVAL1
2014-08-15 06:50:39 +00:00
jr z, .rival
cp RIVAL2
2014-08-15 06:50:39 +00:00
jr z, .rival
2016-01-18 05:39:01 +00:00
ld de, OTClassName
2013-08-20 19:58:08 +00:00
call PlaceString
ld h, b
ld l, c
ld de, String12a2
call PlaceString
push bc
2017-12-24 17:47:30 +00:00
callfar Battle_GetTrainerName
2013-08-20 19:58:08 +00:00
pop hl
ld de, StringBuffer1
2015-10-04 18:14:51 +00:00
jr PlaceCommandCharacter
2014-08-15 06:50:39 +00:00
.rival
2013-08-20 19:58:08 +00:00
ld de, RivalName
2015-10-04 18:14:51 +00:00
jr PlaceCommandCharacter
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
.linkbattle
2016-01-18 05:39:01 +00:00
ld de, OTClassName
2015-10-04 18:14:51 +00:00
jr PlaceCommandCharacter
2014-08-15 06:50:39 +00:00
2015-10-04 18:14:51 +00:00
PlaceGenderedPlayerName:: ; 1252
2013-08-20 19:58:08 +00:00
push de
ld de, PlayerName
call PlaceString
ld h, b
ld l, c
ld a, [wPlayerGender]
2013-08-20 19:58:08 +00:00
bit 0, a
ld de, String_kun
2015-10-04 18:14:51 +00:00
jr z, PlaceCommandCharacter
ld de, String_chan
2015-10-04 18:14:51 +00:00
jr PlaceCommandCharacter
2014-08-15 06:50:39 +00:00
2015-10-04 18:14:51 +00:00
PlaceCommandCharacter:: ; 126a
2013-08-20 19:58:08 +00:00
call PlaceString
ld h, b
ld l, c
pop de
jp NextChar
; 0x1273
2015-10-04 18:14:51 +00:00
TMCharText:: db "TM@" ; 1273
TrainerCharText:: db "TRAINER@" ; 1276
PCCharText:: db "PC@" ; 127e
RocketCharText:: db "ROCKET@" ; 1281
PlacePOKeText:: db "POKé@" ; 1288
2015-10-16 17:35:43 +00:00
KougekiText:: db "こうげき@" ; 128d
2015-10-04 18:14:51 +00:00
SixDotsCharText:: db "……@" ; 1292
EnemyText:: db "Enemy @" ; 1295
PlacePKMNText:: db "<PK><MN>@" ; PK MN ; 129c
PlacePOKEText:: db "<PO><KE>@" ; PO KE ; 129f
2014-08-15 06:50:39 +00:00
String12a2:: db " @" ; 12a2
Char35Text::
Char36Text::
2014-08-15 06:50:39 +00:00
Char37Text:: db "@" ; 12a4
String_kun:: db "@" ; 12a5
String_chan:: db "@" ; 12a6
2013-08-20 19:58:08 +00:00
; 12a7
2015-10-04 18:14:51 +00:00
NextLineChar:: ; 12a7
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
ld bc, SCREEN_WIDTH * 2
2013-08-20 19:58:08 +00:00
add hl, bc
push hl
jp NextChar
; 12b0
2014-08-15 06:50:39 +00:00
Char22:: ; 12b0
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
ld bc, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
add hl, bc
push hl
jp NextChar
; 12b9
2015-10-04 18:14:51 +00:00
TextFar:: ; 12b9
2013-08-20 19:58:08 +00:00
pop hl
push de
2014-08-15 06:50:39 +00:00
ld bc, -TileMap + $10000
2013-08-20 19:58:08 +00:00
add hl, bc
2014-08-15 06:50:39 +00:00
ld de, -SCREEN_WIDTH
ld c, 1
.loop
2013-08-20 19:58:08 +00:00
ld a, h
and a
jr nz, .next
2013-08-20 19:58:08 +00:00
ld a, l
2014-08-15 06:50:39 +00:00
cp SCREEN_WIDTH
jr c, .done
2013-08-20 19:58:08 +00:00
.next
2013-08-20 19:58:08 +00:00
add hl, de
inc c
jr .loop
2013-08-20 19:58:08 +00:00
.done
hlcoord 0, 0
2014-08-15 06:50:39 +00:00
ld de, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
ld a, c
.loop2
2013-08-20 19:58:08 +00:00
and a
jr z, .done2
2013-08-20 19:58:08 +00:00
add hl, de
dec a
jr .loop2
2013-08-20 19:58:08 +00:00
.done2
2013-08-20 19:58:08 +00:00
pop de
inc de
ld a, [de]
ld c, a
2014-08-15 06:50:39 +00:00
ld b, 0
2013-08-20 19:58:08 +00:00
add hl, bc
push hl
jp NextChar
; 12ea
2015-10-04 18:14:51 +00:00
LineChar:: ; 12ea
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
2013-08-20 19:58:08 +00:00
push hl
jp NextChar
; 0x12f2
2014-08-15 06:50:39 +00:00
Paragraph:: ; 12f2
2013-08-20 19:58:08 +00:00
push de
2014-08-15 06:50:39 +00:00
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, .linkbattle
cp LINK_MOBILE
jr z, .linkbattle
call LoadBlinkingCursor
2014-08-15 06:50:39 +00:00
.linkbattle
call Text_WaitBGMap
2015-11-30 03:29:45 +00:00
call ButtonSound
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
2013-08-20 19:58:08 +00:00
call ClearBox
call UnloadBlinkingCursor
2014-08-15 06:50:39 +00:00
ld c, 20
2013-08-20 19:58:08 +00:00
call DelayFrames
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
2013-08-20 19:58:08 +00:00
pop de
jp NextChar
; 131f
Char4B:: ; 131f
ld a, [wLinkMode]
2013-08-20 19:58:08 +00:00
or a
jr nz, .communication
call LoadBlinkingCursor
2014-08-15 06:50:39 +00:00
.communication
call Text_WaitBGMap
2013-08-20 19:58:08 +00:00
push de
2015-11-30 03:29:45 +00:00
call ButtonSound
2013-08-20 19:58:08 +00:00
pop de
ld a, [wLinkMode]
2013-08-20 19:58:08 +00:00
or a
call z, UnloadBlinkingCursor
2013-08-20 19:58:08 +00:00
2015-10-04 18:14:51 +00:00
Char4C:: ; 1337
2013-08-20 19:58:08 +00:00
push de
call TextScroll
call TextScroll
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
2013-08-20 19:58:08 +00:00
pop de
jp NextChar
; 1345
2014-08-15 06:50:39 +00:00
ContText:: ; 1345
2013-08-20 19:58:08 +00:00
push de
2014-08-15 06:50:39 +00:00
ld de, .cont
2013-08-20 19:58:08 +00:00
ld b, h
ld c, l
call PlaceString
ld h, b
ld l, c
pop de
jp NextChar
2014-08-15 06:50:39 +00:00
.cont db $4b, "@"
2013-08-20 19:58:08 +00:00
; 1356
2015-10-10 03:09:03 +00:00
PlaceDexEnd:: ; 1356
2014-08-15 06:50:39 +00:00
; Legacy: ends a Pokédex entry (Red).
; Dex entries are now regular strings.
2013-08-20 19:58:08 +00:00
ld [hl], "."
pop hl
ret
; 135a
2014-08-15 06:50:39 +00:00
PromptText:: ; 135a
ld a, [wLinkMode]
cp LINK_COLOSSEUM
2014-08-15 06:50:39 +00:00
jr z, .ok
cp LINK_MOBILE
2014-08-15 06:50:39 +00:00
jr z, .ok
call LoadBlinkingCursor
2013-08-20 19:58:08 +00:00
.ok
call Text_WaitBGMap
2015-11-30 03:29:45 +00:00
call ButtonSound
ld a, [wLinkMode]
cp LINK_COLOSSEUM
2014-08-15 06:50:39 +00:00
jr z, DoneText
cp LINK_MOBILE
2014-08-15 06:50:39 +00:00
jr z, DoneText
call UnloadBlinkingCursor
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
DoneText:: ; 137c
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
ld de, .stop
2013-08-20 19:58:08 +00:00
dec de
ret
2014-08-15 06:50:39 +00:00
.stop db "@"
2013-08-20 19:58:08 +00:00
; 1383
2014-08-15 06:50:39 +00:00
NullChar:: ; 1383
ld a, "?"
2013-08-20 19:58:08 +00:00
ld [hli], a
call PrintLetterDelay
jp NextChar
; 138c
TextScroll:: ; 138c
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1
ld a, TEXTBOX_INNERH - 1
2014-08-15 06:50:39 +00:00
.col
2013-08-20 19:58:08 +00:00
push af
2014-08-15 06:50:39 +00:00
ld c, TEXTBOX_INNERW
2014-08-15 06:50:39 +00:00
.row
2013-08-20 19:58:08 +00:00
ld a, [hli]
ld [de], a
inc de
dec c
2014-08-15 06:50:39 +00:00
jr nz, .row
2013-08-20 19:58:08 +00:00
inc de
inc de
inc hl
2013-08-20 19:58:08 +00:00
inc hl
pop af
dec a
2014-08-15 06:50:39 +00:00
jr nz, .col
2014-08-15 06:50:39 +00:00
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ld a, " "
ld bc, TEXTBOX_INNERW
2013-08-20 19:58:08 +00:00
call ByteFill
2014-08-15 06:50:39 +00:00
ld c, 5
2013-08-20 19:58:08 +00:00
call DelayFrames
ret
; 13b6
Text_WaitBGMap:: ; 13b6
2013-08-20 19:58:08 +00:00
push bc
ld a, [hOAMUpdate]
push af
2014-08-15 06:50:39 +00:00
ld a, 1
2013-08-20 19:58:08 +00:00
ld [hOAMUpdate], a
2013-08-20 19:58:08 +00:00
call WaitBGMap
2013-08-20 19:58:08 +00:00
pop af
ld [hOAMUpdate], a
pop bc
ret
; 13c6
2014-08-15 06:50:39 +00:00
Diacritic:: ; 13c6
2013-08-20 19:58:08 +00:00
ret
; 13c7
LoadBlinkingCursor:: ; 13c7
2014-08-15 06:50:39 +00:00
ld a, "▼"
ldcoord_a 18, 17
2013-08-20 19:58:08 +00:00
ret
; 13cd
UnloadBlinkingCursor:: ; 13cd
lda_coord 17, 17
ldcoord_a 18, 17
2013-08-20 19:58:08 +00:00
ret
; 13d4
2014-08-15 06:50:39 +00:00
FarString:: ; 13d4
2013-08-20 19:58:08 +00:00
ld b, a
ld a, [hROMBank]
push af
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
ld a, b
rst Bankswitch
call PlaceString
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
pop af
rst Bankswitch
ret
; 13e0
PokeFluteTerminatorCharacter:: ; 13e0
2014-08-15 06:50:39 +00:00
ld hl, .stop
2013-08-20 19:58:08 +00:00
ret
2014-08-15 06:50:39 +00:00
.stop db "@"
2013-08-20 19:58:08 +00:00
; 13e5
PlaceHLTextAtBC:: ; 13e5
ld a, [TextBoxFlags]
2013-08-20 19:58:08 +00:00
push af
2017-12-29 18:18:17 +00:00
set NO_TEXT_DELAY_F, a
ld [TextBoxFlags], a
2014-08-15 06:50:39 +00:00
call DoTextUntilTerminator
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
pop af
ld [TextBoxFlags], a
2013-08-20 19:58:08 +00:00
ret
; 13f6
DoTextUntilTerminator:: ; 13f6
2013-08-20 19:58:08 +00:00
ld a, [hli]
cp "@"
ret z
2014-08-15 06:50:39 +00:00
call .TextCommand
jr DoTextUntilTerminator
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
.TextCommand:
2013-08-20 19:58:08 +00:00
push hl
push bc
ld c, a
ld b, 0
ld hl, TextCommands
add hl, bc
add hl, bc
2013-08-20 19:58:08 +00:00
ld e, [hl]
inc hl
ld d, [hl]
pop bc
pop hl
2014-08-15 06:50:39 +00:00
; jp de
2013-08-20 19:58:08 +00:00
push de
ret
; 1410
TextCommands:: ; 1410
; entries correspond to macros/text.asm enumeration
dw Text_TX
dw Text_TX_RAM
dw Text_TX_BCD
dw Text_TX_MOVE
dw Text_TX_BOX
dw Text_TX_LOW
dw Text_WAIT_BUTTON
dw Text_TX_SCROLL
dw Text_START_ASM
dw Text_TX_NUM
dw Text_TX_EXIT
2013-08-20 19:58:08 +00:00
dw Text_PlaySound ; $0b
dw Text_TX_DOTS
2013-08-20 19:58:08 +00:00
dw Text_0D
dw Text_PlaySound ; $0e
dw Text_PlaySound ; $0f
dw Text_PlaySound ; $10
dw Text_PlaySound ; $11
dw Text_PlaySound ; $12
dw Text_PlaySound ; $13
dw Text_TX_STRINGBUFFER
dw Text_TX_DAY
dw Text_TX_FAR
2013-08-20 19:58:08 +00:00
; 143e
Text_TX:: ; 143e
2013-08-20 19:58:08 +00:00
; TX
; write text until "@"
; [$00]["...@"]
ld d, h
ld e, l
ld h, b
ld l, c
call PlaceString
ld h, d
ld l, e
inc hl
ret
; 1449
Text_TX_RAM:: ; 1449
; text_from_ram
2013-08-20 19:58:08 +00:00
; write text from a ram address
; little endian
; [$01][addr]
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
ld h, b
ld l, c
call PlaceString
pop hl
ret
; 1455
Text_TX_FAR:: ; 1455
; text_jump
2013-08-20 19:58:08 +00:00
; write text from a different bank
; little endian
; [$16][addr][bank]
ld a, [hROMBank]
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld [hROMBank], a
ld [MBC3RomBank], a
push hl
ld h, d
ld l, e
call DoTextUntilTerminator
2013-08-20 19:58:08 +00:00
pop hl
pop af
ld [hROMBank], a
ld [MBC3RomBank], a
ret
; 1470
Text_TX_BCD:: ; 1470
2014-08-15 06:50:39 +00:00
; TX_BCD
; write bcd from address, typically ram
2013-08-20 19:58:08 +00:00
; [$02][addr][flags]
; flags: see PrintBCDNumber
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
push hl
ld h, b
ld l, c
ld c, a
call PrintBCDNumber
ld b, h
ld c, l
pop hl
ret
; 1480
Text_TX_MOVE:: ; 1480
2013-08-20 19:58:08 +00:00
; TX_MOVE
; move to a new tile
2014-08-15 06:50:39 +00:00
; [$03][addr]
2013-08-20 19:58:08 +00:00
ld a, [hli]
2015-11-23 21:04:53 +00:00
ld [wMenuScrollPosition + 2], a
2013-08-20 19:58:08 +00:00
ld c, a
ld a, [hli]
2015-11-23 21:04:53 +00:00
ld [wMenuScrollPosition + 2 + 1], a
2013-08-20 19:58:08 +00:00
ld b, a
ret
; 148b
Text_TX_BOX:: ; 148b
2013-08-20 19:58:08 +00:00
; TX_BOX
; draw a box
; little endian
2014-08-15 06:50:39 +00:00
; [$04][addr][height][width]
2013-08-20 19:58:08 +00:00
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
push hl
ld h, d
ld l, e
call TextBox
pop hl
ret
; 149b
Text_TX_LOW:: ; 149b
2013-08-20 19:58:08 +00:00
; TX_LOW
; write text at (1,16)
; [$05]
2014-08-15 06:50:39 +00:00
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
2013-08-20 19:58:08 +00:00
ret
; 149f
Text_WAIT_BUTTON:: ; 149f
2013-08-20 19:58:08 +00:00
; TX_WAITBUTTON
; wait for button press
; show arrow
; [06]
ld a, [wLinkMode]
cp LINK_COLOSSEUM
2013-08-20 19:58:08 +00:00
jp z, Text_0D
cp LINK_MOBILE
2013-08-20 19:58:08 +00:00
jp z, Text_0D
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
push hl
call LoadBlinkingCursor
2013-08-20 19:58:08 +00:00
push bc
2015-11-30 03:29:45 +00:00
call ButtonSound
2013-08-20 19:58:08 +00:00
pop bc
call UnloadBlinkingCursor
2013-08-20 19:58:08 +00:00
pop hl
ret
; 14ba
Text_TX_SCROLL:: ; 14ba
; pushes text up two lines and sets the BC cursor to the border tile
; below the first character column of the text box.
2013-08-20 19:58:08 +00:00
push hl
call UnloadBlinkingCursor
call TextScroll
call TextScroll
2013-08-20 19:58:08 +00:00
pop hl
2014-08-15 06:50:39 +00:00
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
2013-08-20 19:58:08 +00:00
ret
; 14c9
Text_START_ASM:: ; 14c9
2013-08-20 19:58:08 +00:00
; TX_ASM
bit 7, h
2014-08-15 06:50:39 +00:00
jr nz, .not_rom
jp hl
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
.not_rom
2013-08-20 19:58:08 +00:00
ld a, "@"
ld [hl], a
ret
; 14d2
Text_TX_NUM:: ; 14d2
2014-08-15 06:50:39 +00:00
; TX_NUM
; [$09][addr][hi:bytes lo:digits]
2013-08-20 19:58:08 +00:00
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
push hl
ld h, b
ld l, c
ld b, a
and $f
ld c, a
ld a, b
and $f0
swap a
set PRINTNUM_RIGHTALIGN_F, a
2013-08-20 19:58:08 +00:00
ld b, a
call PrintNum
ld b, h
ld c, l
pop hl
ret
; 14ed
Text_TX_EXIT:: ; 14ed
2013-08-20 19:58:08 +00:00
push hl
push bc
call GetJoypad
2013-08-20 19:58:08 +00:00
ld a, [hJoyDown]
and A_BUTTON | B_BUTTON
2014-08-15 06:50:39 +00:00
jr nz, .done
2013-08-20 19:58:08 +00:00
ld c, 30
call DelayFrames
2014-08-15 06:50:39 +00:00
.done
2013-08-20 19:58:08 +00:00
pop bc
pop hl
ret
; 1500
Text_PlaySound:: ; 1500
; chars:
; $0b, $0e, $0f, $10, $11, $12, $13
; see TextSFX
push bc
dec hl
ld a, [hli]
ld b, a
push hl
ld hl, TextSFX
2014-08-15 06:50:39 +00:00
.loop
2013-08-20 19:58:08 +00:00
ld a, [hli]
2014-08-15 06:50:39 +00:00
cp -1
jr z, .done
2013-08-20 19:58:08 +00:00
cp b
2014-08-15 06:50:39 +00:00
jr z, .play
2013-08-20 19:58:08 +00:00
inc hl
inc hl
2014-08-15 06:50:39 +00:00
jr .loop
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
.play
2013-08-20 19:58:08 +00:00
push de
ld e, [hl]
inc hl
ld d, [hl]
2013-10-08 17:10:36 +00:00
call PlaySFX
2013-08-20 19:58:08 +00:00
call WaitSFX
pop de
2014-08-15 06:50:39 +00:00
.done
2013-08-20 19:58:08 +00:00
pop hl
pop bc
ret
; 1522
Unreferenced_Function1522:: ; 1522
; TX_CRY
2013-08-20 19:58:08 +00:00
push de
ld e, [hl]
inc hl
ld d, [hl]
call PlayMonCry
2013-08-20 19:58:08 +00:00
pop de
pop hl
pop bc
ret
; 152d
TextSFX:: ; 152d
2015-10-30 14:34:35 +00:00
dbw TX_SOUND_0B, SFX_DEX_FANFARE_50_79
dbw TX_SOUND_12, SFX_FANFARE
dbw TX_SOUND_0E, SFX_DEX_FANFARE_20_49
dbw TX_SOUND_0F, SFX_ITEM
dbw TX_SOUND_10, SFX_CAUGHT_MON
dbw TX_SOUND_11, SFX_DEX_FANFARE_80_109
dbw TX_SOUND_13, SFX_SLOT_MACHINE_START
2014-08-15 06:50:39 +00:00
db -1
2013-08-20 19:58:08 +00:00
; 1543
Text_TX_DOTS:: ; 1543
2014-08-15 06:50:39 +00:00
; [$0C][num]
2013-08-20 19:58:08 +00:00
ld a, [hli]
ld d, a
push hl
ld h, b
ld l, c
2014-08-15 06:50:39 +00:00
.loop
2013-08-20 19:58:08 +00:00
push de
ld a, "…"
ld [hli], a
call GetJoypad
2013-08-20 19:58:08 +00:00
ld a, [hJoyDown]
and A_BUTTON | B_BUTTON
2014-08-15 06:50:39 +00:00
jr nz, .next
2013-08-20 19:58:08 +00:00
ld c, 10
call DelayFrames
2014-08-15 06:50:39 +00:00
.next
2013-08-20 19:58:08 +00:00
pop de
dec d
2014-08-15 06:50:39 +00:00
jr nz, .loop
2013-08-20 19:58:08 +00:00
ld b, h
ld c, l
pop hl
ret
; 1562
Text_0D:: ; 1562
2013-08-20 19:58:08 +00:00
; wait for key down
; display arrow
push hl
push bc
2015-11-30 03:29:45 +00:00
call ButtonSound
2013-08-20 19:58:08 +00:00
pop bc
pop hl
ret
; 156a
Text_TX_STRINGBUFFER:: ; 156a
2014-02-25 02:51:20 +00:00
; Print a string from one of the following:
; 0: StringBuffer3
; 1: StringBuffer4
; 2: StringBuffer5
; 3: StringBuffer2
; 4: StringBuffer1
; 5: EnemyMonNick
; 6: BattleMonNick
2013-08-20 19:58:08 +00:00
; [$14][id]
ld a, [hli]
push hl
ld e, a
ld d, 0
2015-10-30 14:34:35 +00:00
ld hl, StringBufferPointers
2013-08-20 19:58:08 +00:00
add hl, de
add hl, de
2015-10-30 14:34:35 +00:00
ld a, BANK(StringBufferPointers)
2013-08-20 19:58:08 +00:00
call GetFarHalfword
ld d, h
ld e, l
ld h, b
ld l, c
call PlaceString
pop hl
ret
; 1582
Text_TX_DAY:: ; 1582
2013-08-20 19:58:08 +00:00
; TX_DAY
call GetWeekday
push hl
push bc
ld c, a
ld b, 0
ld hl, .Days
add hl, bc
add hl, bc
2013-08-20 19:58:08 +00:00
ld a, [hli]
ld h, [hl]
ld l, a
ld d, h
ld e, l
pop hl
call PlaceString
ld h, b
ld l, c
ld de, .Day
call PlaceString
pop hl
ret
.Days: ; 15a2
2013-08-20 19:58:08 +00:00
dw .Sun
dw .Mon
dw .Tues
dw .Wednes
dw .Thurs
dw .Fri
dw .Satur
.Sun: db "SUN@"
.Mon: db "MON@"
.Tues: db "TUES@"
.Wednes: db "WEDNES@"
.Thurs: db "THURS@"
.Fri: db "FRI@"
.Satur: db "SATUR@"
.Day: db "DAY@"
2013-08-20 19:58:08 +00:00
; 15d8