![]() |
Routines |
| Prev: 43693 | Up: Map | Next: 43764 |
|
Used by the routines at Handle_Sabreman_On_Rope and Handle_Sabreman_Falling.
Reads the controls and updates the rope that Sabreman hangs from.
The left and right controls (bits 0 and 1 of the controls, which are clear when the control is used) push the end of the rope by changing the velocity in Rope_Velocity by 2. That is only done while the displacement of the rope (Rope_Displacement_Pixels) is not more than the length of the rope divided by 8 with a maximum of 8.
The down and up controls (bits 2 and 3) make the rope longer, which lowers Sabreman, and shorter, which raises him. Then Move_Rope moves the rope and Position_Rope_End works out where its end is.
|
||||||||
|
Read the controls and find out whether the rope may be pushed.
|
||||||||
| Update_Rope | 43696 | CALL ReadControls | Read the controls. | |||||
| 43699 | LD HL,43682 | Point at the velocity of the end of the rope (Rope_Velocity). | ||||||
| 43702 | EX AF,AF' | Keep the controls in AF'. | ||||||
| 43703 | LD A,(43684) | Fetch the displacement of the end of the rope. | ||||||
| 43706 | AND A | Jump to Update_Rope_Check_Displacement if the displacement is positive. | ||||||
| 43707 | JP P,Update_Rope_Check_Displacement | |||||||
| 43710 | NEG | Make the displacement positive. | ||||||
| Update_Rope_Check_Displacement | 43712 | LD B,A | Keep the displacement in B. | |||||
| 43713 | LD A,(43686) | Fetch the high byte of the length of the rope. | ||||||
| 43716 | RRA | Rotate bit 0 of the high byte into the carry. | ||||||
| 43717 | LD A,(43685) | Fetch the low byte of the length of the rope. | ||||||
| 43720 | RRA | Divide the length by 8 to work out how far the rope may be pushed. | ||||||
| 43721 | RRA | |||||||
| 43722 | RRA | |||||||
| 43723 | AND %00111111 | Keep only six bits. | ||||||
| 43725 | CP 8 | Jump to Update_Rope_Check_Limit if the limit is less than 8. | ||||||
| 43727 | JR C,Update_Rope_Check_Limit | |||||||
| 43729 | LD A,8 | Limit the push to 8. | ||||||
| Update_Rope_Check_Limit | 43731 | CP B | Jump to Skip_Rope_Push if the displacement is larger than the limit, as the rope cannot be pushed any further. | |||||
| 43732 | JR C,Skip_Rope_Push | |||||||
|
Use the left and right controls to push the end of the rope.
|
||||||||
| 43734 | EX AF,AF' | Fetch the controls again from AF'. | ||||||
| 43735 | BIT 0,A | Push the rope to the right if the right control is used (bit 0 of the controls is clear). | ||||||
| 43737 | CALL Z,Push_Rope_Right | |||||||
| 43740 | BIT 1,A | Push the rope to the left if the left control is used (bit 1 of the controls is clear). | ||||||
| 43742 | CALL Z,Push_Rope_Left | |||||||
|
This entry point is used by the routine at Skip_Rope_Push.
Use the down and up controls to change the length of the rope.
|
||||||||
| Update_Rope_Fetch_Length | 43745 | LD HL,(43685) | Fetch the length of the rope. | |||||
| 43748 | BIT 2,A | Lower the rope if the down control is used (bit 2 of the controls is clear). | ||||||
| 43750 | CALL Z,Lower_Rope | |||||||
| 43753 | BIT 3,A | Raise the rope if the up control is used (bit 3 of the controls is clear). | ||||||
| 43755 | CALL Z,Raise_Rope | |||||||
| 43758 | CALL Move_Rope | Move the rope (see Move_Rope). | ||||||
| 43761 | JP Position_Rope_End | Jump to Position_Rope_End to work out the position of the end of the rope. | ||||||
| Prev: 43693 | Up: Map | Next: 43764 |