![]() |
Routines |
| Prev: B6B1 | Up: Map | Next: B6F9 |
|
Handles a block that slides to and fro along the X axis. It works in the same way as HandleBlockMovingNorthSouth but with the X coordinate and the speed in X.
|
||||||||
| HandleBlockMovingEastWest | B6B9 | CALL PlaySoundFromXPosition | Play the sound of a block moving along the X axis. | |||||
| B6BC | LD HL,$0109 | Set H to the offset of the X coordinate and L to the offset of the speed in X. | ||||||
|
This entry point is used by the routine at HandleBlockMovingNorthSouth.
Modify the instructions that fetch the coordinate and store the speed.
|
||||||||
| HandleMovingBlock | B6BF | LD A,H | Fetch the offset of the coordinate. | |||||
| B6C0 | LD ($B6E0),A | Change the instruction at HandleMovingBlock_Coordinate to use it. | ||||||
| B6C3 | LD A,L | Fetch the offset of the speed. | ||||||
| B6C4 | LD ($B6F1),A | Change the instruction at HandleMovingBlock_Speed to use it. | ||||||
| B6C7 | CALL SetPixelAdjustments_Block | Set the pixel adjustments of a block. | ||||||
|
Work out where the block should be: a position from 00 to 0F that goes up and down with the frame counter. The two blocks of a room are half a cycle apart, depending on the address of the object.
|
||||||||
| B6CA | PUSH IX | Copy IX to BC (using the stack). | ||||||
| B6CC | POP BC | |||||||
| B6CD | LD A,C | Fetch the low byte of the address of the object. | ||||||
| B6CE | RRCA | Rotate it right. | ||||||
| B6CF | AND %00010000 | Keep the bit which is different for the neighbouring objects. | ||||||
| B6D1 | LD C,A | Stash it in C. | ||||||
| B6D2 | LD A,($5BA2) | Fetch the frame counter from FrameCounter. | ||||||
| B6D5 | ADD A,C | Add the offset of this block. | ||||||
| B6D6 | BIT 4,A | Jump to HandleMovingBlock_Target if bit 4, which is the direction of the wave, is clear. | ||||||
| B6D8 | JR Z,HandleMovingBlock_Target | |||||||
| B6DA | CPL | Invert the value, so that the wave goes down again. | ||||||
| HandleMovingBlock_Target | B6DB | AND %00001111 | Keep the lowest four bits as the position to go to. | |||||
| B6DD | LD C,A | Stash it in C. | ||||||
|
Compare the block with the target. Redraw it if it is already there, otherwise set a speed of 01 towards the target.
|
||||||||
| HandleMovingBlock_Coordinate | B6DE | LD A,(IX+$01) | Fetch the coordinate of the block. This is the instruction that is modified. | |||||
| B6E1 | ADD A,$08 | Add 08 to it. | ||||||
| B6E3 | AND %00001111 | Keep the position of the block within its 10 steps. | ||||||
| B6E5 | CP C | Compare it with the position that it should go to. | ||||||
| B6E6 | JP Z,SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags if it is already there. | ||||||
| B6E9 | LD A,$01 | Set the speed to 01. | ||||||
| B6EB | JR C,HandleMovingBlock_Speed | Jump to HandleMovingBlock_Speed if the block is below the position that it should go to. | ||||||
| B6ED | NEG | Make the speed negative. | ||||||
|
Set that speed, hold the block up, and move it.
|
||||||||
| HandleMovingBlock_Speed | B6EF | LD (IX+$09),A | Set the speed of the block. This is the instruction that is modified. | |||||
| B6F2 | LD (IX+$0B),$01 | Set the speed in Z to 01, so that the block does not fall. | ||||||
| B6F6 | JP MoveAndDrawObject | Move the block and flag it to be drawn again. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: B6B1 | Up: Map | Next: B6F9 |