| Routines

34499: Display the code entry screen

Used by the routine at 34463. Displays the code entry screen and waits for a code to be entered. Returns with the zero flag set if the code entered is correct.
Input
IX | Address of the message to print (34187 or 34219)
34499 | LD DE,18432 | Print the message pointed to by IX at (8,0)
34502 | LD C,32
34504 | CALL 38528
34507 | LD HL,18498 | Print the graphic for the '1' key at (10,2)
34510 | LD DE,39680
34513 | LD C,0
34515 | CALL 37974
34518 | LD HL,18501 | Print the graphic for the '2' key at (10,5)
34521 | CALL 37974
34524 | LD HL,18504 | Print the graphic for the '3' key at (10,8)
34527 | CALL 37974
34530 | LD HL,18507 | Print the graphic for the '4' key at (10,11)
34533 | CALL 37974
34536 | LD HL,39808 | Copy the 128 attribute bytes from 39808 to the screen (lines 8, 9, 10 and 11)
34539 | LD DE,22784
34542 | LD BC,128
34545 | LDIR
34547 | LD A,(23672) | Collect the LSB of the system variable FRAMES
34550 | ADD A,37 | Add 37 to this value and replace it; this ensures that the value collected on the second pass through this routine is different from the value collected on the first pass
34552 | LD (23672),A
34555 | CP 179 | Is the value between 0 and 178?
34557 | JR C,34561 | Jump if so
34559 | SUB 180 | Otherwise subtract 180; note that if the original value of the LSB of the system variable FRAMES was 142, this leaves A holding 255, which is a bug
34561 | LD L,A | Now L holds either 255 or some number between 0 and 178
34562 | LD H,158 | Point HL at one of the entries in the table at 40448 (or at 40703 if L=255)
34564 | LD A,(HL) | Pick up the table entry
34565 | ADD A,L | Add L to obtain the actual code
34566 | LD (34276),A | Store the code at 34276
34569 | LD C,L | Copy the code index to C; this will be used to compute the grid location
34570 | LD E,47 | Calculate the ASCII code of the grid location number (0-9) in E
34572 | INC E
34573 | LD A,C
34574 | CP 18
34576 | JR C,34583
34578 | SUB 18
34580 | LD C,A
34581 | JR 34572
34583 | LD A,E | Print the grid location number at (8,30)
34584 | LD DE,18462
34587 | CALL 38545
34590 | LD A,C | Calculate the ASCII code of the grid location letter (A-R) in A
34591 | ADD A,65
34593 | LD DE,18461 | Print the grid location letter at (8,29)
34596 | CALL 38545
Here we enter a loop that prints a 2x2 coloured block at (10,16), (10,19), (10,22) or (10,25) whenever '1', '2', '3' or '4' is pressed, or returns to the calling routine at 34463 if ENTER is pressed.
34599 | LD IX,22864 | Point IX at the attribute file location of the first coloured block at (10,16)
34603 | CALL 34620 | Print a coloured block when '1', '2', '3' or '4' is pressed, or return to 34463 if ENTER is pressed
34606 | INC IX | Move IX along to the location of the next coloured block
34608 | INC IX
34610 | INC IX
34612 | LD A,IXl | Have we just printed the fourth coloured block at (10,25)?
34614 | CP 92
34616 | JR NZ,34603 | If not, jump back to print the next one
34618 | JR 34599 | Otherwise rewind IX to the location of the first coloured block