Prev: F34B Up: Map Next: F399
F350: 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
F350 PUSH BC Store number of codes left to enter
F351 CALL $F296 Set up player code entry
RET from F34A 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.
F354 JR Z,$F393 Jump out here if correct code entered
F356 CALL $F268 Print the following 'wrong code' message text on screen.
Jump down to F37C on RETurn after printing
Wrong code message text:
F359 DEFB $0D,$0D Codes for ENTER x 2 (move two lines down)
F35B DEFM " That is wrong - one more try"
F37B DEFB $FF End-of-message marker
Pause for a few seconds:
F37C LD DE,$000A Set outer loop counter (10)
F37F LD HL,$0000 Set inner loop counter (65536)
Pause loop:
F382 DEC DE Outer loop - decrement DE counter
F383 DEC HL Inner loop - decrement HL counter
F384 LD A,H Has inner loop counter reached zero?
F385 OR L
F386 JR NZ,$F383 If not, continue to decrement inner loop counter
F388 DEC DE Decrement outer loop counter
F389 LD A,D Has outer loop counter reached zero?
F38A OR E
F38B JR NZ,$F382 If not, continue to decrement both counters
F38D CALL $F299 Give the player another chance to enter the right code
F390 JP NZ,$0000 ...This time if there's no match, reset the computer.
Correct code has been entered
F393 POP BC Retrieve the number-of-codes-entered counter
F394 DJNZ $F350 Decrement and continue code generation and entry for 3 iterations
F396 JP $BF1A 3 codes have been correctly entered. Jump to initialize the game.
Prev: F34B Up: Map Next: F399