Prev: 42730 Up: Map Next: 42864
42748: Print Telegram
Used by the routine at DrawGameScreen.
Prints the whole telegram panel in town. It converts the bullet price, the horse price and the fine into digits, prints the first four lines of the telegram and, in a game for two players, the line which shows the score of the player who is not currently playing.
telegram
PrintTelegram 42748 LD A,(41575) Fetch the town flag.
42751 AND A Return if the game is not in town.
42752 RET Z
42753 LD HL,43069 Point HL at TelegramLines_BulletDigits.
42756 LD DE,41566 Point DE at BulletPrice.
42759 CALL ConvertPriceToDigits Convert the price to digits.
42762 LD HL,43087 Point HL at TelegramLines_HorseDigits.
42765 LD DE,41564 Point DE at HorsePrice.
42768 CALL ConvertPriceToDigits Convert the price to digits.
42771 LD HL,43105 Point HL at TelegramLines_FineDigits.
42774 LD DE,41562 Point DE at Fine.
42777 CALL ConvertPriceToDigits Convert the amount to digits.
42780 LD DE,43056 Point DE at TelegramLines.
42783 LD B,4 Set the number of lines to four.
42785 CALL PrintTelegram_Lines Print the four lines.
42788 LD A,(41500) Fetch the option flags.
42791 BIT 0,A Return if the game has only one player.
42793 RET Z
42794 LD A,(41535) Fetch the number of the current player.
42797 AND %00000001 Keep bit 0.
42799 JR NZ,PrintTelegram_FirstPlayerLine Jump to PrintTelegram_FirstPlayerLine if the second player is playing.
42801 LD DE,43146 Point DE at TelegramLines_SecondPlayerScore.
PrintTelegram_ScoreLine 42804 PUSH DE Stash the address of the line on the stack.
42805 LD HL,41578 Point HL at OtherPlayerState.
42808 EX DE,HL Swap the two addresses.
42809 LD A,12 Set the offset to the digits within the line.
42811 CALL AddAToHL Point HL at the digits.
42814 CALL ConvertDigits Convert the score to digits.
42817 POP DE Retrieve the address of the line.
42818 LD B,1 Set the number of lines to print to one.
This entry point prints B lines of the telegram, starting with the line at DE.
PrintTelegram_Lines 42820 LD C,14 Set the number of characters in a line to fourteen.
42822 INC DE Skip the counter of the line.
42823 LD A,(DE) Fetch the low byte of the screen address of the line.
42824 INC DE Move on to the high byte.
42825 ADD A,4 Add four to move past the left edge of the panel.
42827 LD L,A Keep the low byte of the screen address in L.
42828 LD A,(DE) Fetch the high byte of the screen address of the line.
42829 INC DE Move on to the attribute.
42830 LD H,A Keep the high byte of the screen address in H.
42831 LD A,(DE) Fetch the attribute of the line.
42832 INC DE Move on to the first character.
42833 EX AF,AF' Keep the attribute in the alternate accumulator.
PrintTelegram_LinesLoop 42834 LD A,(DE) Fetch a character.
42835 INC DE Move on to the next character.
42836 PUSH BC Stash the counters on the stack.
42837 CALL ConvertCharacter Convert the character to the number of its tile.
42840 LD BC,36520 Point BC at Font.
42843 CALL DrawTile Draw the character on the screen.
42846 INC L Move to the next screen position.
42847 POP BC Retrieve the counters.
42848 DEC C Decrease the character counter.
42849 JR NZ,PrintTelegram_LinesLoop Loop back until the whole line has been printed.
42851 DJNZ PrintTelegram_Lines Loop back until every line has been printed.
42853 RET Return.
PrintTelegram_FirstPlayerLine 42854 LD DE,43128 Point DE at the score line for the first player.
42857 JR PrintTelegram_ScoreLine Jump to PrintTelegram_ScoreLine.
42859 DEFB 201,175,50,48,168 Unused.
Prev: 42730 Up: Map Next: 42864