![]() |
Routines |
| Prev: DA7A | Up: Map | Next: DB68 |
|
Used by the routine at UPDATE_KNIGHT.
Fire throws what the knight took up last: the carried things (CARRIED) are searched from the eleventh back. An antibody (thing 5-8) goes into a free antibody record (ANTIBODIES) as graphic 80, 84, 88 or 92; with both in use, the record THROW_TOGGLE points at is ended instead if it is still an antibody in flight, and the throw waits for the next press. An object (thing 1-4) goes into its own record, record 4 minus the thing (so the pairs of OBJECT_FLIGHT hold), as graphic 8-11. Either way the thrown thing is a copy of the legs' record -- his place, facing and flags -- given speed 12, half-size 16 and a drawing offset; the thing's place on the panel is redrawn empty, and the throw's sound plays. Two turns must pass before the next throw.
|
||||||||
| KNIGHT_THROWS | DAB7 | LD HL,FIRE_DELAY | Still waiting after the last throw: count down | |||||
| DABA | LD A,(HL) | |||||||
| DABB | AND A | |||||||
| DABC | JR Z,KNIGHT_THROWS_0 | |||||||
| DABE | DEC (HL) | |||||||
| DABF | RET | |||||||
| KNIGHT_THROWS_0 | DAC0 | BIT 3,E | Fire? | |||||
| DAC2 | RET Z | |||||||
| DAC3 | LD HL,CARRIED_LAST | Find the last thing carried; B: its place plus one | ||||||
| DAC6 | LD B,$0B | |||||||
| KNIGHT_THROWS_1 | DAC8 | LD A,(HL) | ||||||
| DAC9 | AND A | |||||||
| DACA | JR NZ,KNIGHT_THROWS_2 | |||||||
| DACC | DEC HL | |||||||
| DACD | DJNZ KNIGHT_THROWS_1 | |||||||
| DACF | RET | |||||||
| KNIGHT_THROWS_2 | DAD0 | CP $05 | Things 1-4 are the objects | |||||
| DAD2 | JR C,KNIGHT_THROWS_6 | |||||||
| DAD4 | LD IY,ANTIBODIES | An antibody: a free antibody record? | ||||||
| DAD8 | LD DE,$0010 | |||||||
| DADB | LD C,$02 | |||||||
| KNIGHT_THROWS_3 | DADD | LD A,(IY+$00) | ||||||
| DAE0 | AND A | |||||||
| DAE1 | JR Z,KNIGHT_THROWS_4 | |||||||
| DAE3 | ADD IY,DE | |||||||
| DAE5 | DEC C | |||||||
| DAE6 | JR NZ,KNIGHT_THROWS_3 | |||||||
| DAE8 | LD HL,ANTIBODIES | Both in use: the one THROW_TOGGLE points at... | ||||||
| DAEB | LD A,(THROW_TOGGLE) | |||||||
| DAEE | AND $10 | |||||||
| DAF0 | LD C,A | |||||||
| DAF1 | LD B,$00 | |||||||
| DAF3 | ADD HL,BC | |||||||
| DAF4 | LD A,(HL) | ...if it is still flying (graphic 80-95)... | ||||||
| DAF5 | SUB $50 | |||||||
| DAF7 | CP $10 | |||||||
| DAF9 | RET NC | |||||||
| DAFA | LD (HL),$0C | ...vanishes; the thing is kept for the next press | ||||||
| DAFC | RET | |||||||
| KNIGHT_THROWS_4 | DAFD | LD A,(THROW_TOGGLE) | Flip which record a full pair loses next | |||||
| DB00 | XOR $10 | |||||||
| DB02 | LD (THROW_TOGGLE),A | |||||||
| DB05 | PUSH BC | Take the thing out of its place | ||||||
| DB06 | PUSH HL | |||||||
| DB07 | LD A,(HL) | |||||||
| DB08 | LD (HL),$00 | |||||||
| DB0A | LD HL,KNIGHT | The antibody record: a copy of the legs' | ||||||
| DB0D | PUSH IY | |||||||
| DB0F | POP DE | |||||||
| DB10 | LD BC,$0010 | |||||||
| DB13 | LDIR | |||||||
| DB15 | ADD A,A | Graphic 4 times the thing plus 60: 80, 84, 88, 92 | ||||||
| DB16 | ADD A,A | |||||||
| DB17 | ADD A,$3C | |||||||
| KNIGHT_THROWS_5 | DB19 | LD (IY+$00),A | The graphic; shared with the objects | |||||
| DB1C | LD (IY+$05),$0C | Speed 12 | ||||||
| DB20 | LD A,$10 | Half-size 16 each way | ||||||
| DB22 | LD (IY+$08),A | |||||||
| DB25 | LD (IY+$09),A | |||||||
| DB28 | LD (IY+$0C),$F8 | The drawing offset | ||||||
| DB2C | LD (IY+$0D),$04 | |||||||
| DB30 | LD A,$02 | Two turns before the next throw | ||||||
| DB32 | LD (FIRE_DELAY),A | |||||||
| DB35 | POP HL | Redraw the place it was carried in, now empty (PICK_UP_THING counts the places from the other end) | ||||||
| DB36 | POP BC | |||||||
| DB37 | LD A,B | |||||||
| DB38 | NEG | |||||||
| DB3A | ADD A,$0C | |||||||
| DB3C | LD B,A | |||||||
| DB3D | CALL DRAW_CARRIED | |||||||
| DB40 | JP FIRE_SOUND | The throw's sound | ||||||
| KNIGHT_THROWS_6 | DB43 | PUSH BC | An object: take it out of its place | |||||
| DB44 | PUSH HL | |||||||
| DB45 | PUSH AF | |||||||
| DB46 | LD (HL),$00 | |||||||
| DB48 | NEG | Its own record: OBJECTS plus 16 times (4 minus the thing) | ||||||
| DB4A | ADD A,$04 | |||||||
| DB4C | ADD A,A | |||||||
| DB4D | ADD A,A | |||||||
| DB4E | ADD A,A | |||||||
| DB4F | ADD A,A | |||||||
| DB50 | LD HL,OBJECTS | |||||||
| DB53 | CALL ADD_HL_A | |||||||
| DB56 | PUSH HL | A copy of the legs' record | ||||||
| DB57 | PUSH HL | |||||||
| DB58 | POP IY | |||||||
| DB5A | POP DE | |||||||
| DB5B | LD HL,KNIGHT | |||||||
| DB5E | LD BC,$0010 | |||||||
| DB61 | LDIR | |||||||
| DB63 | POP AF | Graphic the thing plus 7: 8-11, and on as for an antibody | ||||||
| DB64 | ADD A,$07 | |||||||
| DB66 | JR KNIGHT_THROWS_5 | |||||||
| Prev: DA7A | Up: Map | Next: DB68 |