![]() |
Routines |
| Prev: BA57 | Up: Map | Next: BAFB |
|
Used by the routine at AFTER_GAME.
Called by AFTER_GAME before every game. It clears TEXT_SHOWN, so that the first list printed draws the border and shows the buffer, stops every line's flash, clears the buffer, draws the menu (DISPLAY_MENU) and flashes the lines chosen (FLASH_MENU). Then round a loop: print the text again (only its attributes, with the flashing, reach the screen), play the tune if it has not been heard (PLAY_TUNE_ONCE, which a key cuts short), and read the keys.
Keys 1 to 4 set bits 1 and 2 of CONTROL to 0 keyboard, 1 Kempston, 2 cursor, 3 Interface II; if several are held the highest wins, since each is applied in turn. Key 5 toggles bit 3, directional control, once a press (KEY5_HELD). A change to CONTROL beeps (PLAIN_BEEP). Key 0 starts the game. Every pass counts SEED up by one, so the time spent on the menu goes into the choice of start room (NEW_GAME_START).
As Knight Lore's menu, key 5 and all; Pentagram's is this code without key 5 and without the beep.
|
||||
| MENU | BA7E | XOR A | no list shown yet | |
| BA7F | LD (TEXT_SHOWN),A | |||
| BA82 | LD HL,MENU_COLOURS | no line flashing: all eight colours in MENU_COLOURS | ||
| BA85 | LD B,$08 | |||
| MENU_0 | BA87 | RES 7,(HL) | ||
| BA89 | INC HL | |||
| BA8A | DJNZ MENU_0 | |||
| BA8C | CALL CLEAR_SCRN_BUFFER | a clear buffer; the text, the border and the whole screen; the lines chosen | ||
| BA8F | CALL DISPLAY_MENU | |||
| BA92 | CALL FLASH_MENU | |||
| MENU_LOOP | BA95 | CALL DISPLAY_MENU | the text again; the tune, once | |
| BA98 | LD DE,TUNE_MENU | |||
| BA9B | CALL PLAY_TUNE_ONCE | |||
| BA9E | LD A,$F7 | E = keys 1-5, key 1 in bit 0 | ||
| BAA0 | CALL READ_KEYS | |||
| BAA3 | LD E,A | |||
| BAA4 | LD A,(CONTROL) | A = CONTROL, and as it was into CONTROL_BEFORE | ||
| BAA7 | LD (CONTROL_BEFORE),A | |||
| BAAA | BIT 0,E | 1: keyboard | ||
| BAAC | JR Z,MENU_1 | |||
| BAAE | AND $F9 | |||
| MENU_1 | BAB0 | BIT 1,E | 2: Kempston | |
| BAB2 | JR Z,MENU_2 | |||
| BAB4 | AND $F9 | |||
| BAB6 | OR $02 | |||
| MENU_2 | BAB8 | BIT 2,E | 3: cursor keys | |
| BABA | JR Z,MENU_3 | |||
| BABC | AND $F9 | |||
| BABE | OR $04 | |||
| MENU_3 | BAC0 | BIT 3,E | 4: Interface II | |
| BAC2 | JR Z,MENU_4 | |||
| BAC4 | OR $06 | |||
| MENU_4 | BAC6 | LD (CONTROL),A | the new method | |
| BAC9 | LD HL,KEY5_HELD | key 5 not held: clear its latch (at the end) | ||
| BACC | BIT 4,E | |||
| BACE | JR Z,MENU_KEY5_RELEASED | |||
| BAD0 | BIT 0,(HL) | still held since the last pass: nothing | ||
| BAD2 | JR NZ,MENU_BEEP_IF_CHANGED | |||
| BAD4 | SET 0,(HL) | a new press: latch it, and toggle directional control | ||
| BAD6 | LD A,(CONTROL) | |||
| BAD9 | XOR $08 | |||
| BADB | LD (CONTROL),A | |||
| MENU_BEEP_IF_CHANGED | BADE | LD HL,CONTROL_BEFORE | A is the new CONTROL whichever way this is reached: beep if it has changed | |
| BAE1 | CP (HL) | |||
| BAE2 | CALL NZ,PLAIN_BEEP | |||
| BAE5 | LD A,$EF | key 0 (bit 0 of the 6-0 half-row): start the game | ||
| BAE7 | CALL READ_KEYS | |||
| BAEA | BIT 0,A | |||
| BAEC | RET NZ | |||
| BAED | LD HL,SEED | one more to the seed each pass | ||
| BAF0 | INC (HL) | |||
| BAF1 | CALL FLASH_MENU | flash the choice; round again | ||
| BAF4 | JP MENU_LOOP | |||
| MENU_KEY5_RELEASED | BAF7 | RES 0,(HL) | key 5 is up: clear the latch | |
| BAF9 | JR MENU_BEEP_IF_CHANGED | |||
| Prev: BA57 | Up: Map | Next: BAFB |