|  | Routines | 
| Prev: 41578 | Up: Map | Next: 41915 | 
| 
Used by the routine at 64623.
 | ||||
| 41748 | CALL 45641 | Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty | ||
| 41751 | JP Z,41742 | If Magic Knight's inventory (carrying) is empty then return to game | ||
| 41754 | LD IX,24848 | Point IX at start of Magic Knight's current inventory (carrying) | ||
| 41758 | LD B,5 | Load B with 5 (five inventory slots) | ||
| 41760 | LD HL,51920 | Point HL at "[Current Command] WHICH OBJECT ?" text | ||
| 41763 | LD DE,51928 | Point DE at "[Current Command] THE " text | ||
| 41766 | CALL 45809 | Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index | ||
| 41769 | LD HL,24848 | Point HL at start of Magic Knight's current inventory (carrying) | ||
| 41772 | CALL 45766 | Print name of selected object in Magic Knight's current inventory (carrying) in command summary window | ||
| 41775 | CALL 64207 | Display execute / reject command window and return here if execute chosen, else exit to main game loop | ||
| 
The operand of the instruction at 41778 represents the index of the Current Object used in multiple routines. This is modified by the instructions at 41668 and 45771.
 | ||||
| 41778 | LD A,0 | Load index of Current Object into A | ||
| 41780 | LD HL,51933 | Point HL at "THE [name of Current Object] BLEW UP..." text | ||
| 41783 | CP 5 | If Current Object is 5 (Stick of Dynamite)... | ||
| 41785 | JP Z,64582 | ...then jump to "game over" window routine and return to control selection menu | ||
| 41788 | CALL 45685 | If Current Object is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed | ||
| 41791 | LD E,0 | Load E with 0 (prepare to check drop-status flag) | ||
| 41793 | CALL 45390 | Point HL to byte 0 of the A-th record in object properties table | ||
| 41796 | BIT 4,(HL) | Reset zero flag if object's drop-status flag is set | ||
| 41798 | LD HL,51970 | Point HL at "YOU CANNOT [Current Command] THE [name of Current Object]" text | ||
| 41801 | JP NZ,64261 | ...then display "YOU CANNOT [Current Command] THE [object]" window (13) and return to game | ||
| 41804 | LD A,(41779) | Load A with index of Current Object | ||
| 41807 | LD C,A | Copy into C | ||
| 41808 | LD B,5 | Load B with 5 (five inventory slots) | ||
| 41810 | LD HL,24848 | Point HL at start of Magic Knight's current inventory (carrying) | ||
| 41813 | CALL 48341 | Remove object C from Magic Knight's current inventory (carrying) | ||
| 41816 | LD A,(23702) | Load A with Magic Knight's current room | ||
| 41819 | CP 2 | If room is not 2 (Outdoors, 1, Bearwoolf's Cave)... | ||
| 41821 | JR NZ,41850 | ...then skip ahead to 41850 | ||
| 41823 | LD A,(41779) | Load A with index of Current Object | ||
| 41826 | LD C,A | Multiply object index by 3... | ||
| 41827 | ADD A,A | ... | ||
| 41828 | ADD A,C | ... | ||
| 41829 | LD C,A | ...and load into C | ||
| 41830 | LD B,0 | Load B with zero | ||
| 41832 | LD HL,24922 | Point HL at start of objects' current positions table at 24922 | ||
| 41835 | ADD HL,BC | Add three times Current Object's index as offset to point HL at position data of current object | ||
| 41836 | XOR A | Set object's current room... | ||
| 41837 | LD (HL),A | ...to be zero (Limbo) | ||
| 41838 | INC HL | Advance HL to x-coordinate of object... | ||
| 41839 | LD (HL),15 | ...and set to 15 | ||
| 41841 | INC HL | Advance HL to y-coordinate of object... | ||
| 41842 | LD (HL),22 | ...and set to 22 | ||
| 41844 | LD HL,51981 | Display "THE MAD JANITOR..." window (12) and return to game... | ||
| 41847 | JP 64297 | ... | ||
| 41850 | LD A,(41779) | Load C with index of Current Object... | ||
| 41853 | LD C,A | ... | ||
| 41854 | CP 20 | If Current Object is 20 (Mirror)... | ||
| 41856 | CALL Z,41915 | ...then load C with 7 (index of Broken Glass) | ||
| 41859 | CP 17 | If Current Object is 17 (Bottle of Liquid)... | ||
| 41861 | CALL Z,41918 | ...then load C with 8 (index of Broken Glass) | ||
| 41864 | CP 18 | If Current Object is 18 (Bottle of Liquid)... | ||
| 41866 | CALL Z,41921 | ...then load C with 9 (index of Broken Glass) | ||
| 41869 | CP 28 | If Current Object is 28 (Empty Bottle)... | ||
| 41871 | CALL Z,41918 | ...then load C with 8 (index of Broken Glass) | ||
| 41874 | CP 29 | If Current Object is 29 (Empty Bottle)... | ||
| 41876 | CALL Z,41921 | ...then load C with 9 (index of Broken Glass) | ||
| 41879 | LD A,C | Load object's index into A | ||
| 41880 | ADD A,A | Multiply object index by 3... | ||
| 41881 | ADD A,C | ... | ||
| 41882 | LD C,A | ...and load back into C | ||
| 41883 | LD B,0 | Load B with zero | ||
| 41885 | LD HL,24922 | Point HL at start of objects' current positions table at 24922 | ||
| 41888 | ADD HL,BC | Add three times Current Object's index as offset to point HL at position data of current object | ||
| 41889 | LD A,(23702) | Load A with Magic Knight's current room | ||
| 41892 | LD (HL),A | Set object's current room to be same as Magic Knight's | ||
| 41893 | INC HL | Advance HL to x-coordinate of object | ||
| 41894 | LD B,0 | Set B to zero | ||
| 41896 | LD A,(24840) | Load A with Magic Knight's current x-coordinate (pixels) | ||
| 41899 | AND 7 | Get x-coordinate in terms of pixels within current character block (i.e. lowest 3 bits of x-coordinate) | ||
| 41901 | JR Z,41904 | If this is zero (i.e. Magic Knight at left-most pixel in character block) then skip ahead to 41904... | ||
| 41903 | INC B | ...else increase B | ||
| 41904 | CALL 45584 | Load Magic Knight's coordinates (in characters) into DE | ||
| 41907 | LD A,B | Load B into A | ||
| 41908 | ADD A,E | Add Magic Knight's x-coordinate to A | ||
| 41909 | LD (HL),A | Set this as object's x-coordinate | ||
| 41910 | INC HL | Advance HL to y-coordinate of object | ||
| 41911 | LD (HL),D | Set this to same as Magic Knight's y-coordinate | ||
| 41912 | JP 41727 | Show Magic Knight's current inventory and jump back to main game loop | ||
| Prev: 41578 | Up: Map | Next: 41915 |