Prev: F289 Up: Map Next: F2F9
F296: Code sheet - initialize and print security code to enter
Used by the routine at F350.
F296 CALL $F274 Pick a code sheet reference for the code that the player has to enter
This entry point is used by the routine at F350.
F299 CALL $0D6B Clear the screen (ROM CLS routine)
F29C LD A,$02 Stream type = 2
F29E CALL $1601 Open stream for printing
F2A1 LD BC,$111B B = character row (27), C = column (17)
F2A4 CALL $0DD9 These values are reversed and used to calculate screen address position in HL (16614) ready to print at.
F2A7 CALL $F268 Print the following characters/message on screen.
Return from CALL goes to instructions after the message, at F2BD
Initial screen message text:
F2AA DEFM "Type in number at " Message to be printed (at previous CALL)
F2BC DEFB $FF End-of-string marker
Print the co-ordinates for the required code from the code sheet.
F2BD LD A,($F261) Value (0-16) signifying first part of code that the player needs to enter
F2C0 ADD A,$41 65 added to this code, to give it values of between 65 and 80
This corresponds to ASCII character codes (A to P)
F2C2 RST $10 Print this value on screen
F2C3 LD A,$2C ASCII value for comma (,)
F2C5 RST $10 Print it
F2C6 LD A,($F260) Get the second part of the code (number from 0-41)
F2C9 CP $0A Is it <10?
F2CB JR C,$F2EF 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.
F2CD LD D,$31 ASCII value for '1' - first digit
F2CF LD E,$0A Offset value for 2nd digit
F2D1 CP $14 Code number <20?
F2D3 JR C,$F2E9
F2D5 LD D,$32 If not, set ASCII value for '2' - first digit
F2D7 LD E,$14 Offset value for 2nd digit
F2D9 CP $1E Code number <30?
F2DB JR C,$F2E9
F2DD LD D,$33 If not, set ASCII value for '3' - first digit
F2DF LD E,$1E Offset value for 2nd digit
F2E1 CP $28 Code number <40?
F2E3 JR C,$F2E9
F2E5 LD D,$34 If not, set ASCII value for '4' - first digit
F2E7 LD E,$28 Offset value for 2nd digit
Print the first digit (tens) of the code:
F2E9 LD A,D Get the ASCII code value
F2EA RST $10 Print the first code digit
F2EB LD A,($F260) As it's two digits, we need to get the second
F2EE 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:
F2EF ADD A,$30 Add 48 to get to ASCII values for characters 0 to 9 (48-57)
F2F1 RST $10 Print the second code digit
F2F2 CALL $F1FA Retrieve the code from the code table at ECB8
2 byte code returned in DE (first - low - byte in E, second - high - byte in D)
F2F5 LD ($F1F8),DE Store the code in a 2-byte holding buffer
Prev: F289 Up: Map Next: F2F9