![]() |
Routines |
| Prev: 42955 | Up: Map | Next: 43056 |
|
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 14 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 | 42970 | LD A,(41575) | Fetch the town flag. | |
| 42973 | AND A | Return if the game is not in town. | ||
| 42974 | RET Z | |||
| 42975 | LD B,6 | Set the number of lines to six. | ||
| 42977 | LD HL,43056 | Point HL at TelegramLines. | ||
| 42980 | LD DE,18 | Set the size of a telegram line in DE. | ||
| 42983 | LD A,(41575) | Fetch the town flag, which is also the column of the panel and keep the panel column in C. | ||
| 42986 | LD C,A | |||
| TypeTelegram_NextLine | 42987 | LD A,(HL) | Fetch the counter of the line. | |
| 42988 | CP 14 | Jump to TypeTelegram_StashLine if the line is not complete. | ||
| 42990 | JR NZ,TypeTelegram_StashLine | |||
| 42992 | ADD HL,DE | Move on to the next line. | ||
| 42993 | DJNZ TypeTelegram_NextLine | Loop back until every line has been checked. | ||
| 42995 | RET | Return. | ||
|
Find the position of the next letter of the line.
|
||||
| TypeTelegram_StashLine | 42996 | PUSH HL | Stash the address of the line on the stack. | |
| 42997 | PUSH AF | Stash the counter of the line on the stack. | ||
| 42998 | INC HL | Move on to the low byte of the screen address. | ||
| 42999 | LD E,(HL) | Fetch the low byte of the screen address. | ||
| 43000 | INC HL | Move on to the high byte. | ||
| 43001 | LD D,(HL) | Fetch the high byte of the screen address. | ||
| 43002 | INC HL | Move on to the attribute. | ||
| 43003 | EX DE,HL | Swap the screen address into HL. | ||
| 43004 | ADD A,C | Add the counter and the column of the panel to the address. | ||
| 43005 | CALL AddAToHL | Point HL at the position of the next letter. | ||
| 43008 | LD A,(DE) | Fetch the attribute. | ||
| 43009 | INC DE | Move on to the first letter. | ||
| 43010 | EX AF,AF' | Keep the attribute in the alternate accumulator. | ||
| 43011 | LD A,(41494) | Fetch the low byte of the frame counter. | ||
| 43014 | AND %00000001 | Keep bit 0. | ||
| 43016 | JR Z,TypeTelegram_RestoreCounter | Jump to TypeTelegram_RestoreCounter on even frames. | ||
|
On odd frames draw the cursor in the next position.
|
||||
| 43018 | ADD A,94 | Convert the odd frame into the number of the cursor character. | ||
| 43020 | CALL ConvertCharacter | Convert the character to the number of its tile. | ||
| 43023 | LD BC,36520 | Point BC at Font. | ||
| 43026 | CALL DrawTile | Draw the cursor. | ||
| 43029 | POP AF | Retrieve the counter of the line. | ||
| 43030 | POP HL | Retrieve the address of the line. | ||
| 43031 | RET | Return. | ||
|
On even frames print the next letter and click.
|
||||
| TypeTelegram_RestoreCounter | 43032 | POP AF | Retrieve the counter of the line. | |
| 43033 | EX DE,HL | Swap the pointer to the letters into HL. | ||
| 43034 | CALL AddAToHL | Point HL at the next letter of the line. | ||
| 43037 | EX DE,HL | Swap the pointer back into DE. | ||
| 43038 | LD A,(DE) | Fetch the letter. | ||
| 43039 | CALL ConvertCharacter | Convert the letter to the number of its tile. | ||
| 43042 | PUSH AF | Stash the tile number on the stack. | ||
| 43043 | CALL PlayTypingSound | Play a click. | ||
| 43046 | POP AF | Retrieve the tile number. | ||
| 43047 | LD BC,36520 | Point BC at Font. | ||
| 43050 | CALL DrawTile | Draw the letter. | ||
| 43053 | POP HL | Retrieve the address of the line. | ||
| 43054 | INC (HL) | Increase the counter of the line. | ||
| 43055 | RET | Return. | ||
| Prev: 42955 | Up: Map | Next: 43056 |