Prev: AAB0 Up: Map Next: AB30
AAF4: 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 80 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 AAF4 PUSH AF Keep the controls on the stack.
AAF5 INC HL Make the length of the rope longer by two.
AAF6 INC HL
AAF7 LD A,L Copy the low byte of the length to A.
AAF8 AND %01111110 Keep only bits 1 to 6.
AAFA 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 80).
AAFC CALL Read_World_Map Read the world map entry of the room.
AAFF LD A,E Copy the room flags to A.
AB00 LD ($AAAC),A Store the room flags in Room_Flags.
AB03 BIT 4,E Jump to Lower_Rope_Lengthen if the room has no floor (bit 4 of the room flags is clear).
AB05 JR Z,Lower_Rope_Lengthen
AB07 DEC HL Make the length one shorter, as the floor stops the rope.
AB08 JR Lower_Rope_Store_Length Jump to Lower_Rope_Store_Length.
Lower_Rope_Lengthen AB0A INC HL Make the length longer by two, to lower the rope into the room below.
AB0B INC HL
AB0C LD ($AAA5),HL Store the new length of the rope.
AB0F ADD HL,HL Double the length.
AB10 LD A,H Copy the high byte (the number of the room along the rope) to A.
AB11 EX AF,AF' Stash it in AF'.
AB12 CALL Find_World_Map_Address Find the address of the world map entry of the room.
AB15 INC HL Point at the second byte of the entry.
AB16 EX AF,AF' Fetch the number of the room along the rope.
AB17 DEC A Subtract one.
AB18 OR %00001100 Set bits 2 and 3.
AB1A LD (HL),A Store the result in the second byte of the entry of the room.
AB1B LD BC,$0020 Set the offset to the room below (20).
AB1E ADD HL,BC Point at the entry of the room below.
AB1F INC A Add one to make the number of the room along the rope for the room below.
AB20 AND %11111011 Reset bit 2.
AB22 LD (HL),A Store it in the second byte of the entry of the room below.
AB23 INC (IX+$04) Move Sabreman down to the room below.
AB26 CALL Draw_Room Draw the new room.
AB29 POP AF Fetch the controls again from the stack.
AB2A RET Return.
This entry point is used by the routine at Raise_Rope.
Lower_Rope_Store_Length AB2B LD ($AAA5),HL Store the new length of the rope.
AB2E POP AF Fetch the controls again from the stack.
AB2F RET Return.
Prev: AAB0 Up: Map Next: AB30