Prev: 43696 Up: Map Next: 43824
43764: Lower Rope
Used by the routine at Update_Rope.
Makes the rope longer by two, which lowers Sabreman.
When the length reaches a multiple of 128 he is at the bottom of the room. If the room has a floor he cannot go on and the length is only made longer by one. Otherwise the length is made longer by two more, the world map entries of the room and of the room below are given the second byte that marks where the rope runs (see Set_Up_Rope), Sabreman moves down to the room below and the room is drawn.
Input
A Controls
HL Length of the rope
IX Object record of Sabreman
Lower_Rope 43764 PUSH AF Keep the controls on the stack.
43765 INC HL Make the length of the rope longer by two.
43766 INC HL
43767 LD A,L Copy the low byte of the length to A.
43768 AND %01111110 Keep only bits 1 to 6.
43770 JR NZ,Lower_Rope_Store_Length Jump to Lower_Rope_Store_Length if the rope has not reached the bottom of the room (the length is not a multiple of 128).
43772 CALL Read_World_Map Read the world map entry of the room.
43775 LD A,E Copy the room flags to A.
43776 LD (43692),A Store the room flags in Room_Flags.
43779 BIT 4,E Jump to Lower_Rope_Lengthen if the room has no floor (bit 4 of the room flags is clear).
43781 JR Z,Lower_Rope_Lengthen
43783 DEC HL Make the length one shorter, as the floor stops the rope.
43784 JR Lower_Rope_Store_Length Jump to Lower_Rope_Store_Length.
Lower_Rope_Lengthen 43786 INC HL Make the length longer by two, to lower the rope into the room below.
43787 INC HL
43788 LD (43685),HL Store the new length of the rope.
43791 ADD HL,HL Double the length.
43792 LD A,H Copy the high byte (the number of the room along the rope) to A.
43793 EX AF,AF' Stash it in AF'.
43794 CALL Find_World_Map_Address Find the address of the world map entry of the room.
43797 INC HL Point at the second byte of the entry.
43798 EX AF,AF' Fetch the number of the room along the rope.
43799 DEC A Subtract one.
43800 OR %00001100 Set bits 2 and 3.
43802 LD (HL),A Store the result in the second byte of the entry of the room.
43803 LD BC,32 Set the offset to the room below (32).
43806 ADD HL,BC Point at the entry of the room below.
43807 INC A Add one to make the number of the room along the rope for the room below.
43808 AND %11111011 Reset bit 2.
43810 LD (HL),A Store it in the second byte of the entry of the room below.
43811 INC (IX+4) Move Sabreman down to the room below.
43814 CALL Draw_Room Draw the new room.
43817 POP AF Fetch the controls again from the stack.
43818 RET Return.
This entry point is used by the routine at Raise_Rope.
Lower_Rope_Store_Length 43819 LD (43685),HL Store the new length of the rope.
43822 POP AF Fetch the controls again from the stack.
43823 RET Return.
Prev: 43696 Up: Map Next: 43824