Prev: 89AF Up: Map Next: 89EF
89B0: CHONUM
Used by the routine at main_routine.
Get a number from user between 1-8 or 2-8 depending on state of flag, print it at coordinates in BC, and return number-1 in A.
CHONUM 89B0 PUSH BC Preserve coordinates.
KEYIT 89B1 CALL $02BF Call KEYBOARD routine in Spectrum ROM.
89B4 CP $31 Jump back to KEYIT until a number between 1 and 9 is pressed.
89B6 JP M,KEYIT
89B9 CP $39
89BB JP P,KEYIT
89BE LD (NUM),A Store key code in NUM.
89C1 LD A,(no_less_than_2_flag) If no_less_than_2_flag is clear jump to NOADD.
89C4 OR A
89C5 JR Z,NOADD
89C7 LD A,(NUM) Else load NUM into A (key code of key pressed).
89CA CP $32 Jump back to KEYIT if the number was less than 2.
89CC JP M,KEYIT
NOADD 89CF POP BC Restore coordinates.
89D0 LD A,$47 Set ATTR-T to $47 (bright white on black).
89D2 LD ($5C8F),A
89D5 LD A,(NUM) Load NUM into A and call DH_P to print it at coordinates in BC.
89D8 CALL DH_P
89DB LD HL,S60 Play key bloop sound effect.
89DE CALL play_sound_effect_in_HL
89E1 CALL NKEY2 Call NKEY2.
89E4 LD A,$00 Clear flag byte that prevents entering a number less than 2.
89E6 LD (no_less_than_2_flag),A
89E9 LD A,(NUM) Load NUM into A and subtract $31 so that A = number pressed-1 and return.
89EC SUB $31
89EE RET
Prev: 89AF Up: Map Next: 89EF