Routines |
Prev: 33593 | Up: Map | Next: 33770 |
33663 | LD A,(65533) | If Magic Knight can't move lift... | ||
33666 | BIT 0,A | ... | ||
33668 | JP Z,27189 | ...then jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command) | ||
33671 | CALL 38075 | Play upward scale sound | ||
33674 | CALL 37654 | Display / update command summary window at bottom of screen | ||
33677 | LD DE,51290 | Point DE at "MOVE LIFT" text... | ||
33680 | CALL 38693 | ...and print in command summary window at bottom of screen | ||
33683 | LD A,25 | Draw the "TAKE LIFT TO..." window... | ||
33685 | CALL 36979 | ... | ||
33688 | LD HL,51300 | Print "TAKE LIFT TO" + "A ROOF ... B 4TH FLOOR... etc." text ... | ||
33691 | CALL 36725 | ... | ||
33694 | CALL 37333 | Process input for menu, and load ASCII code of shortcut for selected (i.e. SPACE or fire pressed) item into A | ||
33697 | SUB 65 | Subtract 65 (ASCII code for "A") to leave index of floor selected | ||
33699 | LD (33740),A | Load selected floor into instruction at 33739 | ||
33702 | LD HL,51354 | Point HL at start of first entry in list of floor names | ||
33705 | LD B,A | Load selected floor number into B | ||
33706 | CALL 34845 | Advance HL to B-th entry in list of zero-terminated strings | ||
33709 | EX DE,HL | Swap DE (now points to name of floor of interest) and HL (now undefined) | ||
33710 | CALL 38693 | ...and print in command summary window at bottom of screen | ||
33713 | CALL 38725 | Display execute / reject command window and return if execute chosen, else exit | ||
33716 | LD A,(23411) | If lift-fixed flag is set... | ||
33719 | AND 1 | ... | ||
33721 | JR NZ,33736 | ...then skip over "lift is broken" section of routine | ||
33723 | LD A,(33740) | Load selected floor from instruction at 33739 into A | ||
33726 | CP 5 | If Ground Floor is selected then... | ||
33728 | JP Z,34730 | ...display "THE LIFT IS BROKEN" message and exit | ||
33731 | CP 6 | If Basement is selected then... | ||
33733 | JP Z,34730 | ...display "THE LIFT IS BROKEN" message and exit | ||
33736 | CALL 33770 | Set the lift as not being at any floor at all | ||
The operand of the instruction at 33739 represents the selected floor index stored previously. This is modified by the instruction at 33699.
|
||||
33739 | LD A,0 | Set lift control panel to show... | ||
33741 | LD (23382),A | ...lift as being at "current" floor | ||
33744 | ADD A,A | Multiply current floor number by eight... | ||
33745 | ADD A,A | ... | ||
33746 | ADD A,A | ... | ||
33747 | INC A | ...and add one to give index of room that the lift's exit will lead into | ||
33748 | LD (41712),A | Set this room as the one connected to the lift's right-exit | ||
33751 | ADD A,A | Double this room index... | ||
33752 | LD D,0 | ...and load into DE to give offset of room's left-exit in room connectivity table at 41711... | ||
33754 | LD E,A | ... | ||
33755 | LD HL,41711 | Point HL at room connectivity table at 41711 | ||
33758 | ADD HL,DE | Add offset in DE to pointer HL | ||
33759 | LD (HL),0 | Set the room referred to by the pointed-to entry to be the lift (i.e. set the room's left-exit to lead into the lift) | ||
33761 | CALL 33788 | Flash border and make sound (as in move lift) | ||
33764 | CALL 38175 | Play "LIFT HAS ARRIVED" sound | ||
33767 | JP 34552 | Display "THE LIFT HAS ARRIVED" window |
Prev: 33593 | Up: Map | Next: 33770 |