Prev: 42185 Up: Map Next: 42250
42220: Prepare Top Score Text
Used by the routine at InitialiseGame.
Converts the top score into the digits shown on the telegram panel.
PrepareTopScoreText 42220 LD DE,42450 Point DE at the top score.
42223 LD HL,43122 Point HL at TelegramLines_HighScoreDigits.
This entry point is used by the routines at CheckTopScore and PrintTelegram.
This entry point converts B bytes of packed decimal digits at DE into characters at HL.
ConvertDigits 42226 LD B,3 Set the number of bytes to convert to three.
PrepareTopScoreText_ConvertDigitsLoop 42228 LD A,(DE) Fetch a pair of digits.
42229 RRCA Shift the first digit into the bottom half of the byte.
42230 RRCA
42231 RRCA
42232 RRCA
42233 AND %00001111 Keep just the digit.
42235 ADD A,48 Convert the digit to a character.
42237 LD (HL),A Write it to the text.
42238 INC HL Move on to the next character.
42239 LD A,(DE) Fetch the pair of digits again.
42240 AND %00001111 Keep just the second digit.
42242 ADD A,48 Convert it to a character.
42244 LD (HL),A Write it to the text.
42245 INC DE Move on to the next pair of digits and the next character.
42246 INC HL
42247 DJNZ PrepareTopScoreText_ConvertDigitsLoop Loop back until every pair has been converted.
42249 RET Return.
Prev: 42185 Up: Map Next: 42250