![]() |
Routines |
| Prev: A7CB | Up: Map | Next: A830 |
|
Used by the routine at InitialiseGame.
Called every frame in town. It makes the lines of the telegram appear one letter at a time, like a telegram being typed. Each line has a counter which is 0E once the line is complete. The first line which is not complete shows a blinking cursor on alternate frames, and on the other frames prints its next letter and clicks.
|
||||
| TypeTelegram | A7DA | LD A,($A267) | Fetch the town flag. | |
| A7DD | AND A | Return if the game is not in town. | ||
| A7DE | RET Z | |||
| A7DF | LD B,$06 | Set the number of lines to six. | ||
| A7E1 | LD HL,$A830 | Point HL at TelegramLines. | ||
| A7E4 | LD DE,$0012 | Set the size of a telegram line in DE. | ||
| A7E7 | LD A,($A267) | Fetch the town flag, which is also the column of the panel and keep the panel column in C. | ||
| A7EA | LD C,A | |||
| TypeTelegram_NextLine | A7EB | LD A,(HL) | Fetch the counter of the line. | |
| A7EC | CP $0E | Jump to TypeTelegram_StashLine if the line is not complete. | ||
| A7EE | JR NZ,TypeTelegram_StashLine | |||
| A7F0 | ADD HL,DE | Move on to the next line. | ||
| A7F1 | DJNZ TypeTelegram_NextLine | Loop back until every line has been checked. | ||
| A7F3 | RET | Return. | ||
|
Find the position of the next letter of the line.
|
||||
| TypeTelegram_StashLine | A7F4 | PUSH HL | Stash the address of the line on the stack. | |
| A7F5 | PUSH AF | Stash the counter of the line on the stack. | ||
| A7F6 | INC HL | Move on to the low byte of the screen address. | ||
| A7F7 | LD E,(HL) | Fetch the low byte of the screen address. | ||
| A7F8 | INC HL | Move on to the high byte. | ||
| A7F9 | LD D,(HL) | Fetch the high byte of the screen address. | ||
| A7FA | INC HL | Move on to the attribute. | ||
| A7FB | EX DE,HL | Swap the screen address into HL. | ||
| A7FC | ADD A,C | Add the counter and the column of the panel to the address. | ||
| A7FD | CALL AddAToHL | Point HL at the position of the next letter. | ||
| A800 | LD A,(DE) | Fetch the attribute. | ||
| A801 | INC DE | Move on to the first letter. | ||
| A802 | EX AF,AF' | Keep the attribute in the alternate accumulator. | ||
| A803 | LD A,($A216) | Fetch the low byte of the frame counter. | ||
| A806 | AND %00000001 | Keep bit 0. | ||
| A808 | JR Z,TypeTelegram_RestoreCounter | Jump to TypeTelegram_RestoreCounter on even frames. | ||
|
On odd frames draw the cursor in the next position.
|
||||
| A80A | ADD A,$5E | Convert the odd frame into the number of the cursor character. | ||
| A80C | CALL ConvertCharacter | Convert the character to the number of its tile. | ||
| A80F | LD BC,$8EA8 | Point BC at Font. | ||
| A812 | CALL DrawTile | Draw the cursor. | ||
| A815 | POP AF | Retrieve the counter of the line. | ||
| A816 | POP HL | Retrieve the address of the line. | ||
| A817 | RET | Return. | ||
|
On even frames print the next letter and click.
|
||||
| TypeTelegram_RestoreCounter | A818 | POP AF | Retrieve the counter of the line. | |
| A819 | EX DE,HL | Swap the pointer to the letters into HL. | ||
| A81A | CALL AddAToHL | Point HL at the next letter of the line. | ||
| A81D | EX DE,HL | Swap the pointer back into DE. | ||
| A81E | LD A,(DE) | Fetch the letter. | ||
| A81F | CALL ConvertCharacter | Convert the letter to the number of its tile. | ||
| A822 | PUSH AF | Stash the tile number on the stack. | ||
| A823 | CALL PlayTypingSound | Play a click. | ||
| A826 | POP AF | Retrieve the tile number. | ||
| A827 | LD BC,$8EA8 | Point BC at Font. | ||
| A82A | CALL DrawTile | Draw the letter. | ||
| A82D | POP HL | Retrieve the address of the line. | ||
| A82E | INC (HL) | Increase the counter of the line. | ||
| A82F | RET | Return. | ||
| Prev: A7CB | Up: Map | Next: A830 |