![]() |
Routines |
| Prev: AAAD | Up: Map | Next: AAF4 |
|
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 02. That is only done while the displacement of the rope (Rope_Displacement_Pixels) is not more than the length of the rope divided by 08 with a maximum of 08.
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 | AAB0 | CALL ReadControls | Read the controls. | |||||
| AAB3 | LD HL,$AAA2 | Point at the velocity of the end of the rope (Rope_Velocity). | ||||||
| AAB6 | EX AF,AF' | Keep the controls in AF'. | ||||||
| AAB7 | LD A,($AAA4) | Fetch the displacement of the end of the rope. | ||||||
| AABA | AND A | Jump to Update_Rope_Check_Displacement if the displacement is positive. | ||||||
| AABB | JP P,Update_Rope_Check_Displacement | |||||||
| AABE | NEG | Make the displacement positive. | ||||||
| Update_Rope_Check_Displacement | AAC0 | LD B,A | Keep the displacement in B. | |||||
| AAC1 | LD A,($AAA6) | Fetch the high byte of the length of the rope. | ||||||
| AAC4 | RRA | Rotate bit 0 of the high byte into the carry. | ||||||
| AAC5 | LD A,($AAA5) | Fetch the low byte of the length of the rope. | ||||||
| AAC8 | RRA | Divide the length by 08 to work out how far the rope may be pushed. | ||||||
| AAC9 | RRA | |||||||
| AACA | RRA | |||||||
| AACB | AND %00111111 | Keep only six bits. | ||||||
| AACD | CP $08 | Jump to Update_Rope_Check_Limit if the limit is less than 08. | ||||||
| AACF | JR C,Update_Rope_Check_Limit | |||||||
| AAD1 | LD A,$08 | Limit the push to 08. | ||||||
| Update_Rope_Check_Limit | AAD3 | CP B | Jump to Skip_Rope_Push if the displacement is larger than the limit, as the rope cannot be pushed any further. | |||||
| AAD4 | JR C,Skip_Rope_Push | |||||||
|
Use the left and right controls to push the end of the rope.
|
||||||||
| AAD6 | EX AF,AF' | Fetch the controls again from AF'. | ||||||
| AAD7 | BIT 0,A | Push the rope to the right if the right control is used (bit 0 of the controls is clear). | ||||||
| AAD9 | CALL Z,Push_Rope_Right | |||||||
| AADC | BIT 1,A | Push the rope to the left if the left control is used (bit 1 of the controls is clear). | ||||||
| AADE | 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 | AAE1 | LD HL,($AAA5) | Fetch the length of the rope. | |||||
| AAE4 | BIT 2,A | Lower the rope if the down control is used (bit 2 of the controls is clear). | ||||||
| AAE6 | CALL Z,Lower_Rope | |||||||
| AAE9 | BIT 3,A | Raise the rope if the up control is used (bit 3 of the controls is clear). | ||||||
| AAEB | CALL Z,Raise_Rope | |||||||
| AAEE | CALL Move_Rope | Move the rope (see Move_Rope). | ||||||
| AAF1 | JP Position_Rope_End | Jump to Position_Rope_End to work out the position of the end of the rope. | ||||||
| Prev: AAAD | Up: Map | Next: AAF4 |