![]() |
Routines |
| Prev: D9A3 | Up: Map | Next: DA7A |
|
The knight is two records: his legs (KNIGHT), which walk and turn (UPDATE_KNIGHT), and his top here (KNIGHT_TOP), drawn over them. The top follows the legs: it takes their place each turn, and a picture matching theirs -- graphic 32-37 for the walking frames 16-21 seen from behind, 40-45 for the ones from the front, 24-29, face showing. Now and then (one turn in 32 while he is not turning) it shows one of two other poses instead for two to nine turns: 38 or 39 from behind, 46 or 47 from the front.
When his legs meet a wall the top shows graphic 22 or 30, arms thrown out, with the bump sound (BUMP_SOUND), and stays where it is. From graphic 22 or 30 the table enters at the start and checks the wall first; from 32-47 it enters at offset 21 (TOP_FOLLOWS), which copies the place first.
|
||||||||
| UPDATE_TOP | D9EB | LD A,(IX-$09) | Did the legs meet a wall this turn? | |||||
| D9EE | BIT 0,A | |||||||
| D9F0 | JR Z,TOP_FOLLOWS | |||||||
| D9F2 | LD (IX+$07),A | Yes: the legs' flags, and graphic 22 or 30 by the legs' view (from behind or the front); stay put | ||||||
| D9F5 | LD A,(IX-$10) | |||||||
| D9F8 | AND $F8 | |||||||
| D9FA | OR $06 | |||||||
| D9FC | LD (IX+$00),A | |||||||
| D9FF | RET | |||||||
| TOP_FOLLOWS | DA00 | PUSH IX | Copy the legs' place and speed (+1 to +5): from 16 bytes before the top's own +1 | |||||
| DA02 | POP DE | |||||||
| DA03 | INC DE | |||||||
| DA04 | LD HL,$FFF0 | |||||||
| DA07 | ADD HL,DE | |||||||
| DA08 | LD BC,$0005 | |||||||
| DA0B | LDIR | |||||||
| DA0D | LD A,(IX-$0A) | Is he turning (the legs' turn delay)? If not, perhaps a pose | ||||||
| DA10 | AND $07 | |||||||
| DA12 | JR Z,UPDATE_TOP_2 | |||||||
| UPDATE_TOP_0 | DA14 | LD A,(IX-$10) | The picture that matches the legs' frame: 16-21 to 32-37, 24-29 to 40-45 | |||||
| DA17 | AND $0F | |||||||
| DA19 | OR $20 | |||||||
| DA1B | LD (IX+$00),A | |||||||
| DA1E | LD (IX+$06),$00 | No pose running; the legs' flags (the mirror) | ||||||
| DA22 | LD A,(IX-$09) | |||||||
| DA25 | LD (IX+$07),A | |||||||
| UPDATE_TOP_1 | DA28 | BIT 0,(IX-$09) | Done unless the legs met a wall | |||||
| DA2C | RET Z | |||||||
| DA2D | LD A,(IX+$00) | The bump, unless the top already had its arms out | ||||||
| DA30 | AND $07 | |||||||
| DA32 | CP $06 | |||||||
| DA34 | CALL NZ,BUMP_SOUND | |||||||
| DA37 | LD A,(IX-$10) | Arms out: graphic 22 or 30 | ||||||
| DA3A | AND $F8 | |||||||
| DA3C | OR $06 | |||||||
| DA3E | LD (IX+$00),A | |||||||
| DA41 | LD (IX+$06),$00 | |||||||
| DA45 | RET | |||||||
| UPDATE_TOP_2 | DA46 | LD A,(IX+$06) | A pose running? | |||||
| DA49 | AND A | |||||||
| DA4A | JR NZ,UPDATE_TOP_3 | |||||||
| DA4C | LD A,(RANDOM) | None: one turn in 32 start one, otherwise follow the legs | ||||||
| DA4F | CP $08 | |||||||
| DA51 | JR NC,UPDATE_TOP_0 | |||||||
| DA53 | AND $01 | Pose 38 or 39 from behind, 46 or 47 from the front | ||||||
| DA55 | LD C,A | |||||||
| DA56 | LD A,(IX-$10) | |||||||
| DA59 | AND $08 | |||||||
| DA5B | OR $26 | |||||||
| DA5D | OR C | |||||||
| DA5E | LD (IX+$00),A | |||||||
| DA61 | LD A,R | For two to nine turns | ||||||
| DA63 | AND $07 | |||||||
| DA65 | ADD A,$02 | |||||||
| DA67 | LD (IX+$06),A | |||||||
| DA6A | LD A,(IX-$09) | The legs' flags | ||||||
| DA6D | LD (IX+$07),A | |||||||
| DA70 | JR UPDATE_TOP_1 | |||||||
| UPDATE_TOP_3 | DA72 | DEC A | A pose running: count it down, and follow the legs again at the end | |||||
| DA73 | LD (IX+$06),A | |||||||
| DA76 | JR Z,UPDATE_TOP_0 | |||||||
| DA78 | JR UPDATE_TOP_1 | |||||||
| Prev: D9A3 | Up: Map | Next: DA7A |