Prev: 32929 Up: Map Next: 33021
32961: Menu 1: Highlight/store selected control option (1-4)
Used by the routine at 32929.
Input
HL Address pointer for the relevant port address at 35762 relating to the key that's been pressed.
The player has picked a valid controls option on menu 1 (32825). Store the choice number (1-4), play a high pitched sound and highlight their choice on screen.
32961 INC HL Advance to the second byte of the pair (to give the number)
32962 LD A,(HL) Identify key pressed (1-4)
32963 LD (35754),A ...and store it
Play a high pitched sound (and also set the border to black)
32966 LD C,255 C register contains the outer loop counter for the sound duration
32968 LD HL,13107 H = 51, L = 51 - but also used as a token address pointer somewhere in ROM
Outer loop start - toggle speaker on and pause briefly
32971 LD B,16 Pause duration
32973 LD A,16 Set bit 4 - speaker bit
32975 OUT (254),A Output it (speaker toggle = on)
32977 DJNZ 32977 Short pause
The following instructions make a few changes to the value held in the A register, which is then used in the next short pause loop at 32992.
32979 LD H,(HL)
32980 ADD A,H
32981 ADD A,L
32982 AND 15
32984 ADD A,96
32986 ADD A,B
Toggle speaker off and pause briefly
32987 LD B,A Transfer to the B register to be used as a pause timer
32988 LD A,0 Reset the A register (reset speaker bit)
32990 OUT (254),A Output it (speaker toggle = off)
32992 DJNZ 32992 Another short pause
32994 DEC C Decrement the outer loop counter
32995 JR NZ,32971 ...and repeat until zero.
Highlight/flash the menu option selected
32997 LD A,(35754) Get the menu option selected (1-4)
33000 LD HL,22689 Screen attribute display position for first option (Kempston)
33003 LD DE,64 64 characters = 2 lines to jump down to next option
33006 LD B,4 Four menu options to check (1-4)
33008 LD C,1 Start with 1
33010 LD (HL),15 Reset colour/attribute for this option (INK 7, PAPER 1)
33012 CP C Is it this option that's selected?
33013 JR NZ,33017
33015 LD (HL),207 ...If so, set attribute to FLASH 1, BRIGHT 1
33017 ADD HL,DE Move attribute screen address down two lines to next option
33018 INC C Increment...
33019 DJNZ 33010 ...and check for 2, 3 and then 4 in the same way
Prev: 32929 Up: Map Next: 33021