pokecrystal/home/text.asm

1147 lines
14 KiB
NASM
Raw Normal View History

2014-08-15 06:50:39 +00:00
BORDER_WIDTH EQU 2
TEXTBOX_WIDTH EQU SCREEN_WIDTH
TEXTBOX_INNERW EQU TEXTBOX_WIDTH - BORDER_WIDTH
TEXTBOX_HEIGHT EQU 6
TEXTBOX_INNERH EQU TEXTBOX_HEIGHT - BORDER_WIDTH
TEXTBOX_X EQU 0
TEXTBOX_INNERX EQU TEXTBOX_X + 1
TEXTBOX_Y EQU SCREEN_HEIGHT - TEXTBOX_HEIGHT
TEXTBOX_INNERY EQU TEXTBOX_Y + 2
TEXTBOX_PAL EQU 7
ClearBox:: ; fb6
2013-08-20 19:58:08 +00:00
; Fill a c*b box at hl with blank tiles.
ld a, " "
2014-08-15 06:50:39 +00:00
Functionfb8::
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 bc, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
add hl, bc
pop bc
dec b
2014-08-15 06:50:39 +00:00
jr nz, .col
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.
ld hl, TileMap
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]
bit 7, a
ret z
jp WaitBGMap
; fdb
2014-08-15 06:50:39 +00:00
ClearScreen:: ; fdb
ld a, TEXTBOX_PAL
2013-08-20 19:58:08 +00:00
ld hl, 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
2014-08-15 06:50:39 +00:00
; Draw a text box width c height b at hl.
2013-08-20 19:58:08 +00:00
; Dimensions do not include the border.
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
inc c
2014-08-15 06:50:39 +00:00
ld a, TEXTBOX_PAL
.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
Function1052:: ; 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
2013-08-20 19:58:08 +00:00
call Function106c
Function105a:: ; 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
2013-08-20 19:58:08 +00:00
call Function13e5
ret
; 106c
Function106c:: ; 106c
2013-08-20 19:58:08 +00:00
push hl
call SpeechTextBox
call Function1ad2
call Function321c
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
2014-08-15 06:50:39 +00:00
dict: macro
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
endm
dict $15, Char15
dict $4f, Line
dict $4e, NextLine
dict $16, Char16
dict $00, NullChar
dict $4c, Function1337
dict $4b, Char4B
dict $51, Paragraph
dict $49, PrintMomsName
dict $52, PrintPlayerName
dict $53, PrintRivalName
dict $35, Char35
dict $36, Char36
dict $37, Char37
dict $38, PrintRedsName
dict $39, PrintGreensName
dict $54, Char54
dict $5b, Char5B
dict $5e, Char5E
dict $5c, Char5C
dict $5d, Char5D
dict $23, Char23
dict $22, Char22
dict $55, ContText
dict $56, Char56
dict $57, DoneText
dict $58, PromptText
dict $4a, Char4A
dict $24, Char24
dict $25, NextChar
2013-08-20 19:58:08 +00:00
cp $1f
2014-08-15 06:50:39 +00:00
jr nz, .ok
2013-08-20 19:58:08 +00:00
ld a, $7f
2014-08-15 06:50:39 +00:00
.ok
dict $5f, Char5F
dict $59, Char59
dict $5a, Char5A
dict $3f, Char3F
dict $14, Char14
cp $e4 ; handakuten
jr z, .place
cp $e5 ; dakuten
jr z, .place
jr .nope
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
.nope
2013-08-20 19:58:08 +00:00
cp $60
2014-08-15 06:50:39 +00:00
jr nc, .place
2013-08-20 19:58:08 +00:00
cp $40
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
2013-08-20 19:58:08 +00:00
add $80
2014-08-15 06:50:39 +00:00
jr .daku2
.daku1
2013-08-20 19:58:08 +00:00
add $90
2014-08-15 06:50:39 +00:00
.daku2
ld b, $e5 ; dakuten
call Diacritic
jr .place
.handakuten
cp "ぱ"
jr nc, .han1
add "ハ" - "パ"
jr .han2
.han1
add "は" - "ぱ"
.han2
ld b, $e4 ; handakuten
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
2013-10-02 00:47:54 +00:00
callba Function17f036
2013-08-20 19:58:08 +00:00
jp PlaceNextChar
; 1186
2014-08-15 06:50:39 +00:00
print_name: macro
2013-08-20 19:58:08 +00:00
push de
2014-08-15 06:50:39 +00:00
ld de, \1
jp Function126a
2014-08-15 06:50:39 +00:00
endm
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
Char5D: print_name Char5DText ; 11a9
Char5C: print_name Char5CText ; 11b0
Char5B: print_name Char5BText ; 11b7
Char5E: print_name Char5EText ; 11be
Char54: print_name Char54Text ; 11c5
Char23: print_name Char23Text ; 11cc
Char56: print_name Char56Text ; 11d3
Char4A: print_name Char4AText ; 11da
Char24: print_name Char24Text ; 11e1
Char35: print_name Char35Text ; 11e8
Char36: print_name Char36Text ; 11ef
Char37: print_name Char37Text ; 11f6
Char59:: ; 11fd
2013-08-20 19:58:08 +00:00
ld a, [hBattleTurn]
2014-08-15 06:50:39 +00:00
xor 1
jr Char59_5A
2013-08-20 19:58:08 +00:00
2014-08-15 06:50:39 +00:00
Char5A:: ; 1203
2013-08-20 19:58:08 +00:00
ld a, [hBattleTurn]
2014-08-15 06:50:39 +00:00
Char59_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
2014-08-15 06:50:39 +00:00
jr Function126a
.enemy
2013-08-20 19:58:08 +00:00
ld de, Char5AText ; Enemy
call PlaceString
ld h, b
ld l, c
ld de, EnemyMonNick
2014-08-15 06:50:39 +00:00
jr Function126a
2014-08-15 06:50:39 +00:00
Char3F:: ; 121b
2013-08-20 19:58:08 +00:00
push de
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
ld a, [InLinkBattle]
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
ld de, OTName
2013-08-20 19:58:08 +00:00
call PlaceString
ld h, b
ld l, c
ld de, String12a2
call PlaceString
push bc
2013-10-02 00:47:54 +00:00
callab Function39939
2013-08-20 19:58:08 +00:00
pop hl
ld de, StringBuffer1
2014-08-15 06:50:39 +00:00
jr Function126a
.rival
2013-08-20 19:58:08 +00:00
ld de, RivalName
2014-08-15 06:50:39 +00:00
jr Function126a
2013-08-20 19:58:08 +00:00
.linkbattle
2014-08-15 06:50:39 +00:00
ld de, OTName
jr Function126a
2014-08-15 06:50:39 +00:00
Char14:: ; 1252
2013-08-20 19:58:08 +00:00
push de
ld de, PlayerName
call PlaceString
ld h, b
ld l, c
ld a, [PlayerGender]
bit 0, a
ld de, String12a5
2014-08-15 06:50:39 +00:00
jr z, Function126a
2013-08-20 19:58:08 +00:00
ld de, String12a6
2014-08-15 06:50:39 +00:00
jr Function126a
Function126a:: ; 126a
2013-08-20 19:58:08 +00:00
call PlaceString
ld h, b
ld l, c
pop de
jp NextChar
; 0x1273
2014-08-15 06:50:39 +00:00
Char5CText:: db "TM@" ; 1273
Char5DText:: db "TRAINER@" ; 1276
Char5BText:: db "PC@" ; 127e
Char5EText:: db "ROCKET@" ; 1281
Char54Text:: db "POKé@" ; 1288
Char23Text:: db "こうげき@" ; 128d
Char56Text:: db "……@" ; 1292
Char5AText:: db "Enemy @" ; 1295
Char4AText:: db $e1, $e2, "@" ; PK MN ; 129c
Char24Text:: db $70, $71, "@" ; PO KE ; 129f
String12a2:: db " @" ; 12a2
Char35Text::
Char36Text::
2014-08-15 06:50:39 +00:00
Char37Text:: db "@" ; 12a4
String12a5:: db "@" ; 12a5
String12a6:: db "@" ; 12a6
2013-08-20 19:58:08 +00:00
; 12a7
2014-08-15 06:50:39 +00:00
NextLine:: ; 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
2014-08-15 06:50:39 +00:00
Char16:: ; 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
2013-08-20 19:58:08 +00:00
.asm_12c4
ld a, h
and a
jr nz, .asm_12cd
ld a, l
2014-08-15 06:50:39 +00:00
cp SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
jr c, .asm_12d1
.asm_12cd
add hl, de
inc c
jr .asm_12c4
.asm_12d1
ld hl, TileMap
2014-08-15 06:50:39 +00:00
ld de, SCREEN_WIDTH
2013-08-20 19:58:08 +00:00
ld a, c
.asm_12d8
and a
jr z, .asm_12df
add hl, de
dec a
jr .asm_12d8
.asm_12df
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
2014-08-15 06:50:39 +00:00
Line:: ; 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
2013-08-20 19:58:08 +00:00
ld a, [InLinkBattle]
cp $3
jr z, .asm_1301
cp $4
jr z, .asm_1301
call Function13c7
.asm_1301
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
call Function13b6
call Functionaaf
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 Function13cd
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
2013-08-20 19:58:08 +00:00
ld a, [InLinkBattle]
or a
jr nz, .asm_1328
call Function13c7
.asm_1328
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
call Function13b6
push de
call Functionaaf
pop de
ld a, [InLinkBattle]
or a
call z, Function13cd
Function1337:: ; 1337
2013-08-20 19:58:08 +00:00
push de
call Function138c
call Function138c
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
Char5F:: ; 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
2013-08-20 19:58:08 +00:00
ld a, [InLinkBattle]
cp $3
2014-08-15 06:50:39 +00:00
jr z, .ok
2013-08-20 19:58:08 +00:00
cp $4
2014-08-15 06:50:39 +00:00
jr z, .ok
2013-08-20 19:58:08 +00:00
call Function13c7
2014-08-15 06:50:39 +00:00
.ok
2013-08-20 19:58:08 +00:00
call Function13b6
call Functionaaf
ld a, [InLinkBattle]
cp $3
2014-08-15 06:50:39 +00:00
jr z, DoneText
2013-08-20 19:58:08 +00:00
cp $4
2014-08-15 06:50:39 +00:00
jr z, DoneText
2013-08-20 19:58:08 +00:00
call Function13cd
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
Function138c:: ; 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
.col
2013-08-20 19:58:08 +00:00
push af
2014-08-15 06:50:39 +00:00
ld c, TEXTBOX_INNERW
.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
inc hl
pop af
dec a
2014-08-15 06:50:39 +00:00
jr nz, .col
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
Function13b6:: ; 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
call WaitBGMap
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
Function13c7:: ; 13c7
2014-08-15 06:50:39 +00:00
ld a, "▼"
2013-08-20 19:58:08 +00:00
ld [$c606], a
ret
; 13cd
Function13cd:: ; 13cd
2013-08-20 19:58:08 +00:00
ld a, [$c605]
ld [$c606], a
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
Function13e0:: ; 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
Function13e5:: ; 13e5
2013-08-20 19:58:08 +00:00
ld a, [$cfcf]
push af
set 1, a
ld [$cfcf], a
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
call Function13f6
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
pop af
ld [$cfcf], a
ret
; 13f6
Function13f6:: ; 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 Function13f6
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
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
2013-08-20 19:58:08 +00:00
dw Text_00
dw Text_01
dw Text_02
dw Text_03
dw Text_04
dw Text_05
dw Text_06
dw Text_07
dw Text_08
dw Text_09
dw Text_0A
dw Text_PlaySound ; $0b
dw Text_0C
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_14
dw Text_15
dw Text_16
; 143e
Text_00:: ; 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_01:: ; 1449
2013-08-20 19:58:08 +00:00
; TX_RAM
; 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_16:: ; 1455
2013-08-20 19:58:08 +00:00
; TX_FAR
; 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 Function13f6
pop hl
pop af
ld [hROMBank], a
ld [MBC3RomBank], a
ret
; 1470
Text_02:: ; 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_03:: ; 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]
ld [$d0e6], a
ld c, a
ld a, [hli]
2014-08-15 06:50:39 +00:00
ld [$d0e6 + 1], a
2013-08-20 19:58:08 +00:00
ld b, a
ret
; 148b
Text_04:: ; 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_05:: ; 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_06:: ; 149f
; TX_WAITBUTTON
; wait for button press
; show arrow
; [06]
ld a, [InLinkBattle]
cp $3
jp z, Text_0D
cp $4
jp z, Text_0D
2014-08-15 06:50:39 +00:00
2013-08-20 19:58:08 +00:00
push hl
call Function13c7
push bc
call Functionaaf
pop bc
call Function13cd
pop hl
ret
; 14ba
Text_07:: ; 14ba
2013-08-20 19:58:08 +00:00
push hl
call Function13cd
call Function138c
call Function138c
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_08:: ; 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
2013-08-20 19:58:08 +00:00
jp [hl]
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_09:: ; 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 6, a
ld b, a
call PrintNum
ld b, h
ld c, l
pop hl
ret
; 14ed
Text_0A:: ; 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
Function1522:: ; 1522
2013-08-20 19:58:08 +00:00
push de
ld e, [hl]
inc hl
ld d, [hl]
2014-07-18 17:25:03 +00:00
call PlayCry
2013-08-20 19:58:08 +00:00
pop de
pop hl
pop bc
ret
; 152d
TextSFX:: ; 152d
2013-08-20 19:58:08 +00:00
dbw $0b, SFX_DEX_FANFARE_50_79
dbw $12, SFX_FANFARE
dbw $0e, SFX_DEX_FANFARE_20_49
dbw $0f, SFX_ITEM
dbw $10, SFX_CAUGHT_MON
dbw $11, SFX_DEX_FANFARE_80_109
dbw $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_0C:: ; 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
call Functionaaf
pop bc
pop hl
ret
; 156a
Text_14:: ; 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
2014-02-25 02:51:20 +00:00
ld hl, Unknown_24000
2013-08-20 19:58:08 +00:00
add hl, de
add hl, de
2014-02-25 02:51:20 +00:00
ld a, BANK(Unknown_24000)
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_15:: ; 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
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
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@"
; 15d8