Routines |
Prev: 29756 | Up: Map | Next: 30123 |
Used by the routine at 27136.
|
||||
30001 | CALL 35386 | Wait for fire button / key to be released | ||
30004 | CALL 35723 | Play downward scale sound | ||
30007 | CALL 34265 | Set Magic Knight's available action flags and validate I.D. Card if appropriate | ||
30010 | LD BC,2048 | Set B = 8 (eight action flags) and C = 0 (count of set flags) | ||
30013 | LD A,(23698) | Load A with available in-game menu command flags, part 1 | ||
30016 | RLCA | Pop a bit into carry flag | ||
30017 | JR NC,30020 | If Magic Knight action flag is not set then skip ahead to 30020 to repeat loop for next flag... | ||
30019 | INC C | ...else increase count of set flags | ||
30020 | DJNZ 30016 | Loop back for next bit until all eight are done | ||
30022 | LD B,8 | Set B = 8 (another eight action flags) | ||
30024 | LD A,(23699) | Load A with available in-game menu command flags, part 2 | ||
30027 | RLCA | Pop a bit into carry flag | ||
30028 | JR NC,30031 | If Magic Knight action flag is not set then skip ahead to 30031 to repeat loop for next flag... | ||
30030 | INC C | ...else increase count of set flags | ||
30031 | DJNZ 30027 | Loop back for next bit until all eight are done | ||
30033 | LD A,8 | Load A with 8 (as minimal command window has bottom y-coordinate of 8) | ||
30035 | ADD A,C | Increase A by number of extra commands available | ||
30036 | LD C,A | Load value back into C | ||
30037 | LD A,(37091) | Load A with y-coordinate (characters) of top of menu window | ||
30040 | ADD A,C | Update y-coordinate of bottom of window according to number of extra commands... | ||
30041 | LD (37092),A | ... | ||
30044 | LD A,0 | Display main in-game menu window (window number zero)... | ||
30046 | CALL 34982 | ... | ||
30049 | LD HL,38685 | Print "COMMANDS AVAILABLE:-" followed by first five commands (pick up, drop, etc.) that are always available... | ||
30052 | CALL 34762 | ... | ||
30055 | LD HL,38734 | Point HL at zero immediately preceding list of conditional entry (main in-game menu) texts | ||
30058 | LD A,(23698) | Load A with available in-game menu command flags, part 1 | ||
30061 | CALL 30123 | Print currently available additional in-game menu command options, part 1 | ||
30064 | LD A,(23699) | Load A with available in-game menu command flags, part 2 | ||
30067 | CALL 30123 | Print currently available additional in-game menu command options, part 2 | ||
30070 | CALL 35296 | Process keyboard / joystick input on a menu and load A with selected item index | ||
30073 | CP 5 | If index of selected item is less than 5 (i.e. is a permanent, yellow entry)... | ||
30075 | JR C,30097 | ...then skip ahead to 30097 | ||
30077 | SUB 4 | Subtract 4 from index to get index within currently available conditional entries... | ||
30079 | LD B,A | ...and load this value into B | ||
30080 | LD C,0 | Load C with zero | ||
30082 | LD HL,(23698) | Load HL with available in-game menu command flags | ||
At this point, B is initialised to the index of the selected menu option among the currently available conditional entries. The following loop loads C with the index of the selected action's action flag (bit) in the WORD value at 23698.
|
||||
30085 | RR H | Perform 16-bit rotation (right) through HL and into carry flag... | ||
30087 | RR L | ...so that carry flag contains "current" action flag | ||
30089 | INC C | Increase C (index of current action flag) | ||
30090 | JR NC,30085 | If current action flag is not set then loop back to 30085... | ||
30092 | DJNZ 30085 | ...otherwise decrease B then loop back to 30085 | ||
30094 | LD A,C | Load index of appropriate action flag into A | ||
30095 | ADD A,4 | Add 4, to restore original index value (i.e. reverse of instruction at 30077) | ||
At this point, A holds either the index of the appropriate action flag plus four, or the index of the originally selected menu item if less than 5. In either case, A contains the index of the command to initiate.
|
||||
30097 | LD HL,36749 | Point HL at list of command indices | ||
30100 | LD B,A | Load index of selected command into B, setting C to zero... | ||
30101 | LD C,0 | ... | ||
30103 | LD A,(HL) | If current entry in list of command indices is the same as the index of the selected command... | ||
30104 | CP B | ... | ||
30105 | JR Z,30111 | ...then skip ahead to 30111 | ||
30107 | INC C | Increase C (index of command index) | ||
30108 | INC HL | Advance HL to next command index in list | ||
30109 | JR 30103 | Loop back to 30103 | ||
30111 | PUSH BC | Store BC (B = selected command index, C = index of selected command index) | ||
30112 | CALL 35690 | Play upward scale sound | ||
30115 | POP BC | Restore BC (B = selected command index, C = index of selected command index) | ||
30116 | LD A,C | Load index (of selected command index) into A | ||
30117 | LD HL,36765 | Point HL at start of table of command routine addresses | ||
30120 | JP 55726 | Advance HL by A words, load HL with word at location HL as address and jump to it |
Prev: 29756 | Up: Map | Next: 30123 |