Routines |
Prev: 62089 | Up: Map | Next: 62201 |
Used by the routine at 62288.
|
||||
62102 | CALL 62068 | Pick a code sheet reference for the code that the player has to enter | ||
This entry point is used by the routine at 62288.
|
||||
62105 | CALL 3435 | Clear the screen (ROM CLS routine) | ||
62108 | LD A,2 | Stream type = 2 | ||
62110 | CALL 5633 | Open stream for printing | ||
62113 | LD BC,4379 | B = character row (27), C = column (17) | ||
62116 | CALL 3545 | These values are reversed and used to calculate screen address position in HL (16614) ready to print at. | ||
62119 | CALL 62056 | Print the following characters/message on screen. Return from CALL goes to instructions after the message, at 62141 |
||
Initial screen message text:
|
||||
62122 | DEFM "Type in number at " | Message to be printed (at previous CALL) | ||
62140 | DEFB 255 | End-of-string marker | ||
Print the co-ordinates for the required code from the code sheet.
|
||||
62141 | LD A,(62049) | Value (0-16) signifying first part of code that the player needs to enter | ||
62144 | ADD A,65 | 65 added to this code, to give it values of between 65 and 80 This corresponds to ASCII character codes (A to P) |
||
62146 | RST 16 | Print this value on screen | ||
62147 | LD A,44 | ASCII value for comma (,) | ||
62149 | RST 16 | Print it | ||
62150 | LD A,(62048) | Get the second part of the code (number from 0-41) | ||
62153 | CP 10 | Is it <10? | ||
62155 | JR C,62191 | If so, fine to go ahead and print it as it's only 1 character (0-9) | ||
Code number value is >=10 so we'll need to print two numeric characters
The next routine identifies the first digit (D register) as 49, 50, 51 or 52 - ASCII codes for 1, 2, 3 or 4 - for the 10s digit
Then prints that followed by the following value. |
||||
62157 | LD D,49 | ASCII value for '1' - first digit | ||
62159 | LD E,10 | Offset value for 2nd digit | ||
62161 | CP 20 | Code number <20? | ||
62163 | JR C,62185 | |||
62165 | LD D,50 | If not, set ASCII value for '2' - first digit | ||
62167 | LD E,20 | Offset value for 2nd digit | ||
62169 | CP 30 | Code number <30? | ||
62171 | JR C,62185 | |||
62173 | LD D,51 | If not, set ASCII value for '3' - first digit | ||
62175 | LD E,30 | Offset value for 2nd digit | ||
62177 | CP 40 | Code number <40? | ||
62179 | JR C,62185 | |||
62181 | LD D,52 | If not, set ASCII value for '4' - first digit | ||
62183 | LD E,40 | Offset value for 2nd digit | ||
Print the first digit (tens) of the code:
|
||||
62185 | LD A,D | Get the ASCII code value | ||
62186 | RST 16 | Print the first code digit | ||
62187 | LD A,(62048) | As it's two digits, we need to get the second | ||
62190 | SUB E | So subtract the offset (the 'tens' amount) from its value (e.g. 25-20 to get 5) | ||
Print the second digit (ones) of the code:
|
||||
62191 | ADD A,48 | Add 48 to get to ASCII values for characters 0 to 9 (48-57) | ||
62193 | RST 16 | Print the second code digit | ||
62194 | CALL 61946 | Retrieve the code from the code table at 60600 2 byte code returned in DE (first - low - byte in E, second - high - byte in D) |
||
62197 | LD (61944),DE | Store the code in a 2-byte holding buffer |
Prev: 62089 | Up: Map | Next: 62201 |