diff options
Diffstat (limited to 'home/text.asm')
-rw-r--r-- | home/text.asm | 226 |
1 files changed, 87 insertions, 139 deletions
diff --git a/home/text.asm b/home/text.asm index a1f6b75eb..7f07d0813 100644 --- a/home/text.asm +++ b/home/text.asm @@ -1,4 +1,4 @@ -ClearBox:: ; fb6 +ClearBox:: ; Fill a c*b box at hl with blank tiles. ld a, " " ; fallthrough @@ -18,10 +18,9 @@ FillBoxWithByte:: dec b jr nz, .row ret -; fc8 -ClearTileMap:: ; fc8 +ClearTileMap:: ; Fill wTileMap with blank tiles. hlcoord 0, 0 @@ -34,19 +33,17 @@ ClearTileMap:: ; fc8 bit rLCDC_ENABLE, a ret z jp WaitBGMap -; fdb -ClearScreen:: ; fdb +ClearScreen:: ld a, PAL_BG_TEXT hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill jr ClearTileMap -; fe8 -TextBox:: ; fe8 +TextBox:: ; 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 ; text black-and-white scheme. @@ -56,10 +53,9 @@ TextBox:: ; fe8 pop hl pop bc jr TextBoxPalette -; ff1 -TextBoxBorder:: ; ff1 +TextBoxBorder:: ; Top push hl @@ -96,9 +92,8 @@ TextBoxBorder:: ; ff1 ld [hl], "┘" ret -; 101e -.PlaceChars: ; 101e +.PlaceChars: ; Place char a c times. ld d, c .loop @@ -106,10 +101,9 @@ TextBoxBorder:: ; ff1 dec d jr nz, .loop ret -; 1024 -TextBoxPalette:: ; 1024 +TextBoxPalette:: ; Fill text box width c height b at hl with pal 7 ld de, wAttrMap - wTileMap add hl, de @@ -132,58 +126,52 @@ TextBoxPalette:: ; 1024 dec b jr nz, .col ret -; 103e -SpeechTextBox:: ; 103e +SpeechTextBox:: ; Standard textbox. hlcoord TEXTBOX_X, TEXTBOX_Y ld b, TEXTBOX_INNERH ld c, TEXTBOX_INNERW jp TextBox -; 1048 -TestText:: ; 1048 +TestText:: text "ゲームフりーク!" done -; 1052 -RadioTerminator:: ; 1052 +RadioTerminator:: ld hl, .stop ret .stop db "@" -; 1057 -PrintText:: ; 1057 +PrintText:: call SetUpTextBox -BuenaPrintText:: ; 105a +BuenaPrintText:: push hl hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW call ClearBox pop hl -PrintTextBoxText:: ; 1065 +PrintTextBoxText:: bccoord TEXTBOX_INNERX, TEXTBOX_INNERY call PlaceHLTextAtBC ret -; 106c -SetUpTextBox:: ; 106c +SetUpTextBox:: push hl call SpeechTextBox call UpdateSprites call ApplyTilemap pop hl ret -; 1078 -PlaceString:: ; 1078 +PlaceString:: push hl -PlaceNextChar:: ; 1079 +PlaceNextChar:: ld a, [de] cp "@" jr nz, CheckDict @@ -193,11 +181,11 @@ PlaceNextChar:: ; 1079 ret pop de -NextChar:: ; 1083 +NextChar:: inc de jp PlaceNextChar -CheckDict:: ; 1087 +CheckDict:: dict: MACRO if \1 == 0 and a @@ -299,12 +287,11 @@ ENDM ; 0x117b -DayOfWeekChar:: ; 117b +DayOfWeekChar:: ld c, l ld b, h farcall Function17f036 jp PlaceNextChar -; 1186 print_name: MACRO @@ -313,35 +300,35 @@ print_name: MACRO jp PlaceCommandCharacter ENDM -PrintMomsName: print_name wMomsName ; 1186 -PrintPlayerName: print_name wPlayerName ; 118d -PrintRivalName: print_name wRivalName ; 1194 -PrintRedsName: print_name wRedsName ; 119b -PrintGreensName: print_name wGreensName ; 11a2 - -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 -PlaceJPRoute: print_name PlaceJPRouteText ; 11e8 -PlaceWatashi: print_name PlaceWatashiText ; 11ef -PlaceKokoWa: print_name PlaceKokoWaText ; 11f6 - - -PlaceMoveTargetsName:: ; 11fd +PrintMomsName: print_name wMomsName +PrintPlayerName: print_name wPlayerName +PrintRivalName: print_name wRivalName +PrintRedsName: print_name wRedsName +PrintGreensName: print_name wGreensName + +TrainerChar: print_name TrainerCharText +TMChar: print_name TMCharText +PCChar: print_name PCCharText +RocketChar: print_name RocketCharText +PlacePOKe: print_name PlacePOKeText +PlaceKougeki: print_name KougekiText +SixDotsChar: print_name SixDotsCharText +PlacePKMN: print_name PlacePKMNText +PlacePOKE: print_name PlacePOKEText +PlaceJPRoute: print_name PlaceJPRouteText +PlaceWatashi: print_name PlaceWatashiText +PlaceKokoWa: print_name PlaceKokoWaText + + +PlaceMoveTargetsName:: ld a, [hBattleTurn] xor 1 jr PlaceMoveUsersName.place -PlaceMoveUsersName:: ; 1203 +PlaceMoveUsersName:: ld a, [hBattleTurn] -.place: ; 1205 +.place: push de and a jr nz, .enemy @@ -358,7 +345,7 @@ PlaceMoveUsersName:: ; 1203 jr PlaceCommandCharacter -PlaceEnemysName:: ; 121b +PlaceEnemysName:: push de ld a, [wLinkMode] @@ -392,7 +379,7 @@ PlaceEnemysName:: ; 121b jr PlaceCommandCharacter -PlaceGenderedPlayerName:: ; 1252 +PlaceGenderedPlayerName:: push de ld de, wPlayerName call PlaceString @@ -406,7 +393,7 @@ PlaceGenderedPlayerName:: ; 1252 jr PlaceCommandCharacter -PlaceCommandCharacter:: ; 126a +PlaceCommandCharacter:: call PlaceString ld h, b ld l, c @@ -431,25 +418,22 @@ PlaceWatashiText:: PlaceKokoWaText:: db "@" KunSuffixText:: db "@" ChanSuffixText:: db "@" -; 12a7 -NextLineChar:: ; 12a7 +NextLineChar:: pop hl ld bc, SCREEN_WIDTH * 2 add hl, bc push hl jp NextChar -; 12b0 -LineBreakChar:: ; 12b0 +LineBreakChar:: pop hl ld bc, SCREEN_WIDTH add hl, bc push hl jp NextChar -; 12b9 -TextFar:: ; 12b9 +TextFar:: pop hl push de ld bc, -wTileMap + $10000 @@ -489,17 +473,16 @@ TextFar:: ; 12b9 add hl, bc push hl jp NextChar -; 12ea -LineChar:: ; 12ea +LineChar:: pop hl hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 push hl jp NextChar ; 0x12f2 -Paragraph:: ; 12f2 +Paragraph:: push de ld a, [wLinkMode] @@ -521,10 +504,9 @@ Paragraph:: ; 12f2 hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY pop de jp NextChar -; 131f -_ContText:: ; 131f +_ContText:: ld a, [wLinkMode] or a jr nz, .communication @@ -542,17 +524,16 @@ _ContText:: ; 131f call z, UnloadBlinkingCursor ; fallthrough -_ContTextNoPause:: ; 1337 +_ContTextNoPause:: push de call TextScroll call TextScroll hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 pop de jp NextChar -; 1345 -ContText:: ; 1345 +ContText:: push de ld de, .cont ld b, h @@ -564,18 +545,16 @@ ContText:: ; 1345 jp NextChar .cont: db "<_CONT>@" -; 1356 -PlaceDexEnd:: ; 1356 +PlaceDexEnd:: ; Ends a Pokédex entry in Gen 1. ; Dex entries are now regular strings. ld [hl], "." pop hl ret -; 135a -PromptText:: ; 135a +PromptText:: ld a, [wLinkMode] cp LINK_COLOSSEUM jr z, .ok @@ -593,23 +572,21 @@ PromptText:: ; 135a jr z, DoneText call UnloadBlinkingCursor -DoneText:: ; 137c +DoneText:: pop hl ld de, .stop dec de ret .stop: db "@" -; 1383 -NullChar:: ; 1383 +NullChar:: ld a, "?" ld [hli], a call PrintLetterDelay jp NextChar -; 138c -TextScroll:: ; 138c +TextScroll:: hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1 ld a, TEXTBOX_INNERH - 1 @@ -640,9 +617,8 @@ TextScroll:: ; 138c ld c, 5 call DelayFrames ret -; 13b6 -Text_WaitBGMap:: ; 13b6 +Text_WaitBGMap:: push bc ld a, [hOAMUpdate] push af @@ -655,25 +631,21 @@ Text_WaitBGMap:: ; 13b6 ld [hOAMUpdate], a pop bc ret -; 13c6 -Diacritic:: ; 13c6 +Diacritic:: ret -; 13c7 -LoadBlinkingCursor:: ; 13c7 +LoadBlinkingCursor:: ld a, "▼" ldcoord_a 18, 17 ret -; 13cd -UnloadBlinkingCursor:: ; 13cd +UnloadBlinkingCursor:: lda_coord 17, 17 ldcoord_a 18, 17 ret -; 13d4 -FarString:: ; 13d4 +FarString:: ld b, a ld a, [hROMBank] push af @@ -685,17 +657,15 @@ FarString:: ; 13d4 pop af rst Bankswitch ret -; 13e0 -PokeFluteTerminatorCharacter:: ; 13e0 +PokeFluteTerminatorCharacter:: ld hl, .stop ret .stop: db "@" -; 13e5 -PlaceHLTextAtBC:: ; 13e5 +PlaceHLTextAtBC:: ld a, [wTextBoxFlags] push af set NO_TEXT_DELAY_F, a @@ -706,9 +676,8 @@ PlaceHLTextAtBC:: ; 13e5 pop af ld [wTextBoxFlags], a ret -; 13f6 -DoTextUntilTerminator:: ; 13f6 +DoTextUntilTerminator:: ld a, [hli] cp "@" ret z @@ -732,9 +701,8 @@ DoTextUntilTerminator:: ; 13f6 ; jp de push de ret -; 1410 -TextCommands:: ; 1410 +TextCommands:: ; entries correspond to TX_* constants (see macros/scripts/text.asm) dw Text_TX ; TX_START dw Text_TX_RAM ; TX_RAM @@ -759,9 +727,8 @@ TextCommands:: ; 1410 dw Text_TX_STRINGBUFFER ; TX_STRINGBUFFER dw Text_TX_DAY ; TX_DAY dw Text_TX_FAR ; TX_FAR -; 143e -Text_TX:: ; 143e +Text_TX:: ; TX ; write text until "@" ; [$00]["...@"] @@ -775,9 +742,8 @@ Text_TX:: ; 143e ld l, e inc hl ret -; 1449 -Text_TX_RAM:: ; 1449 +Text_TX_RAM:: ; text_from_ram ; write text from a ram address ; little endian @@ -793,9 +759,8 @@ Text_TX_RAM:: ; 1449 call PlaceString pop hl ret -; 1455 -Text_TX_FAR:: ; 1455 +Text_TX_FAR:: ; text_jump ; write text from a different bank ; little endian @@ -823,9 +788,8 @@ Text_TX_FAR:: ; 1455 ld [hROMBank], a ld [MBC3RomBank], a ret -; 1470 -Text_TX_BCD:: ; 1470 +Text_TX_BCD:: ; TX_BCD ; write bcd from address, typically ram ; [$02][addr][flags] @@ -845,9 +809,8 @@ Text_TX_BCD:: ; 1470 ld c, l pop hl ret -; 1480 -Text_TX_MOVE:: ; 1480 +Text_TX_MOVE:: ; TX_MOVE ; move to a new tile ; [$03][addr] @@ -859,9 +822,8 @@ Text_TX_MOVE:: ; 1480 ld [wMenuScrollPosition + 2 + 1], a ld b, a ret -; 148b -Text_TX_BOX:: ; 148b +Text_TX_BOX:: ; TX_BOX ; draw a box ; little endian @@ -881,18 +843,16 @@ Text_TX_BOX:: ; 148b call TextBox pop hl ret -; 149b -Text_TX_LOW:: ; 149b +Text_TX_LOW:: ; TX_LOW ; write text at (1,16) ; [$05] bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 ret -; 149f -Text_WAIT_BUTTON:: ; 149f +Text_WAIT_BUTTON:: ; TX_WAITBUTTON ; wait for button press ; show arrow @@ -912,9 +872,8 @@ Text_WAIT_BUTTON:: ; 149f call UnloadBlinkingCursor pop hl ret -; 14ba -Text_TX_SCROLL:: ; 14ba +Text_TX_SCROLL:: ; pushes text up two lines and sets the BC cursor to the border tile ; below the first character column of the text box. push hl @@ -924,9 +883,8 @@ Text_TX_SCROLL:: ; 14ba pop hl bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 ret -; 14c9 -Text_START_ASM:: ; 14c9 +Text_START_ASM:: ; TX_ASM bit 7, h @@ -937,9 +895,8 @@ Text_START_ASM:: ; 14c9 ld a, "@" ld [hl], a ret -; 14d2 -Text_TX_NUM:: ; 14d2 +Text_TX_NUM:: ; TX_NUM ; [$09][addr][hi:bytes lo:digits] ld a, [hli] @@ -963,9 +920,8 @@ Text_TX_NUM:: ; 14d2 ld c, l pop hl ret -; 14ed -Text_TX_EXIT:: ; 14ed +Text_TX_EXIT:: push hl push bc call GetJoypad @@ -978,9 +934,8 @@ Text_TX_EXIT:: ; 14ed pop bc pop hl ret -; 1500 -Text_PlaySound:: ; 1500 +Text_PlaySound:: ; chars: ; $0b, $0e, $0f, $10, $11, $12, $13 ; see TextSFX @@ -1014,9 +969,8 @@ Text_PlaySound:: ; 1500 pop hl pop bc ret -; 1522 -Unreferenced_Function1522:: ; 1522 +Unreferenced_Function1522:: ; TX_CRY push de ld e, [hl] @@ -1027,9 +981,8 @@ Unreferenced_Function1522:: ; 1522 pop hl pop bc ret -; 152d -TextSFX:: ; 152d +TextSFX:: dbw TX_SOUND_DEX_FANFARE_50_79, SFX_DEX_FANFARE_50_79 dbw TX_SOUND_FANFARE, SFX_FANFARE dbw TX_SOUND_DEX_FANFARE_20_49, SFX_DEX_FANFARE_20_49 @@ -1038,9 +991,8 @@ TextSFX:: ; 152d dbw TX_SOUND_DEX_FANFARE_80_109, SFX_DEX_FANFARE_80_109 dbw TX_SOUND_SLOT_MACHINE_START, SFX_SLOT_MACHINE_START db -1 -; 1543 -Text_TX_DOTS:: ; 1543 +Text_TX_DOTS:: ; [$0C][num] ld a, [hli] ld d, a @@ -1067,9 +1019,8 @@ Text_TX_DOTS:: ; 1543 ld c, l pop hl ret -; 1562 -Text_LINK_WAIT_BUTTON:: ; 1562 +Text_LINK_WAIT_BUTTON:: ; wait for key down ; display arrow push hl @@ -1078,9 +1029,8 @@ Text_LINK_WAIT_BUTTON:: ; 1562 pop bc pop hl ret -; 156a -Text_TX_STRINGBUFFER:: ; 156a +Text_TX_STRINGBUFFER:: ; Print a string from one of the following: ; 0: wStringBuffer3 ; 1: wStringBuffer4 @@ -1107,9 +1057,8 @@ Text_TX_STRINGBUFFER:: ; 156a call PlaceString pop hl ret -; 1582 -Text_TX_DAY:: ; 1582 +Text_TX_DAY:: ; TX_DAY call GetWeekday @@ -1134,7 +1083,7 @@ Text_TX_DAY:: ; 1582 pop hl ret -.Days: ; 15a2 +.Days: dw .Sun dw .Mon dw .Tues @@ -1151,4 +1100,3 @@ Text_TX_DAY:: ; 1582 .Fri: db "FRI@" .Satur: db "SATUR@" .Day: db "DAY@" -; 15d8 |