Prev: 907A Up: Map Next: 909F
907B: NKEY2
Used by the routines at CHONUM and main_routine.
Generate four semi-random bytes at address held in BUFPNT.
NKEY2 907B PUSH HL preserve registers.
907C PUSH DE
907D PUSH BC
WAIT1 907E PUSH BC Call KEY-SCAN in Spectrum ROM to see if a key was pressed.
907F CALL $028E
9082 POP BC
9083 INC C Increment C
9084 LD A,E Copy key value to A.
9085 INC A If a key is still being pressed jump back to WAIT1.
9086 JR NZ,WAIT1
9088 LD HL,(BUFPNT) Store C at address in BUFPNT.
908B LD (HL),C
908C SLA C Double value in C register and store at next address.
908E INC HL
908F LD (HL),C
9090 LD A,R Copy R register into A and store at next address.
9092 INC HL
9093 LD (HL),A
9094 RLCA Double the value in A and store at next address.
9095 INC HL
9096 LD (HL),A
9097 INC HL Set BUFPNT to next address.
9098 LD (BUFPNT),HL
909B POP BC Restore registers and return.
909C POP DE
909D POP HL
909E RET
Prev: 907A Up: Map Next: 909F