Prev: 62283 Up: Map Next: 62361
62288: Code sheet - code entry count and validation
Input
B 3 - number of correct responses needed (set in previous routine)
Keeps count of correct and incorrect codes entered, displaying a message if a wrong code is entered.
  • THREE correct codes need to be entered to start the game proper
  • ONE incorrect code is allowed, the machine is reset upon the second incorrent entry
62288 PUSH BC Store number of codes left to enter
62289 CALL 62102 Set up player code entry
RET from 62282 after code that has been input is compared with valid code.
Zero flag set (Z) indicates there's a match - the code is correct.
Non-zero (NZ) indicates the wrong code has been entered.
62292 JR Z,62355 Jump out here if correct code entered
62294 CALL 62056 Print the following 'wrong code' message text on screen.
Jump down to 62332 on RETurn after printing
Wrong code message text:
62297 DEFB 13,13 Codes for ENTER x 2 (move two lines down)
62299 DEFM " That is wrong - one more try"
62331 DEFB 255 End-of-message marker
Pause for a few seconds:
62332 LD DE,10 Set outer loop counter (10)
62335 LD HL,0 Set inner loop counter (65536)
Pause loop:
62338 DEC DE Outer loop - decrement DE counter
62339 DEC HL Inner loop - decrement HL counter
62340 LD A,H Has inner loop counter reached zero?
62341 OR L
62342 JR NZ,62339 If not, continue to decrement inner loop counter
62344 DEC DE Decrement outer loop counter
62345 LD A,D Has outer loop counter reached zero?
62346 OR E
62347 JR NZ,62338 If not, continue to decrement both counters
62349 CALL 62105 Give the player another chance to enter the right code
62352 JP NZ,0 ...This time if there's no match, reset the computer.
Correct code has been entered
62355 POP BC Retrieve the number-of-codes-entered counter
62356 DJNZ 62288 Decrement and continue code generation and entry for 3 iterations
62358 JP 48922 3 codes have been correctly entered. Jump to initialize the game.
Prev: 62283 Up: Map Next: 62361