![]() |
Routines |
| Prev: B21C | Up: Map | Next: B267 |
|
Object template 13. The block follows the turn counter: folding its low five bits at bit 4 gives a triangle wave, 0 up to 15 and back over 32 turns, and the block steps one unit a turn towards that place in a span of 16. The blocks in odd-numbered records add 16 first, so they run half a cycle out of step with those in even-numbered ones. Knight Lore's shuttle_block, with the same trick of one routine for both axes: the two IX displacements of the read of the position and the write of the step are patched before they run.
The position used is 8 more than the block's own, because a block stands on the centre line of a cell, 8 past a multiple of 16. Its Z step is set to 1 so that the move's fall (DEC_DZ_AND_UPDATE_UVZ) leaves it at 0: a shuttling block never falls.
|
||||||||
| SHUTTLE_U | B224 | CALL BEEP_BY_U | a note pitched by U | |||||
| B227 | LD HL,$0109 | H = 1 (U), L = 9 (its step) | ||||||
|
This entry point is used by the routine at SHUTTLE_V.
|
||||||||
| SHUTTLE_BLOCK | B22A | LD A,H | patch the displacements of the read below and of the write of the step | |||||
| B22B | LD ($B24B),A | |||||||
| B22E | LD A,L | |||||||
| B22F | LD ($B25C),A | |||||||
| B232 | CALL DRAW_AT_L16_D9 | the drawing nudge | ||||||
| B235 | PUSH IX | C = 16 in an odd-numbered record, 0 in an even one (bit 5 of the record's address) | ||||||
| B237 | POP BC | |||||||
| B238 | LD A,C | |||||||
| B239 | RRCA | |||||||
| B23A | AND $10 | |||||||
| B23C | LD C,A | |||||||
| B23D | LD A,(TURNS) | the turn counter plus C, folded at bit 4: the place to be, 0 to 15 | ||||||
| B240 | ADD A,C | |||||||
| B241 | BIT 4,A | |||||||
| B243 | JR Z,SHUTTLE_U_0 | |||||||
| B245 | CPL | |||||||
| SHUTTLE_U_0 | B246 | AND $0F | ||||||
| B248 | LD C,A | |||||||
| B249 | LD A,(IX+$01) | where it is now in its span: U or V (the displacement patched) plus 8, modulo 16 | ||||||
| B24C | ADD A,$08 | |||||||
| B24E | AND $0F | |||||||
| B250 | CP C | there: stand still, but redraw it | ||||||
| B251 | JP Z,SET_WIPE_AND_DRAW_FLAGS | |||||||
| B254 | LD A,$01 | one unit towards it: plus if short of it, minus if past it, as its U or V step (patched) | ||||||
| B256 | JR C,SHUTTLE_U_1 | |||||||
| B258 | NEG | |||||||
| SHUTTLE_U_1 | B25A | LD (IX+$09),A | ||||||
| B25D | LD (IX+$0B),$01 | a Z step of 1, which the fall makes 0 | ||||||
| B261 | CALL DEC_DZ_AND_UPDATE_UVZ | move, and redraw it | ||||||
| B264 | JP SET_WIPE_AND_DRAW_FLAGS | |||||||
| Prev: B21C | Up: Map | Next: B267 |