Prev: C0ED Up: Map Next: C152
C101: An antibody's strike that splits the monster in two: 1500 points
Meant, by the look of it, to copy the monster into an empty monster record and send the two off at right angles. What it does: the search loop tests IY for an empty record, but IY is the antibody's record (just made to burst) and then the records after it -- the second antibody, the finds, the bonus -- while IX, which the nearness test reads, stays on the first monster record. So the monster is copied into the first monster record, whatever is there -- another monster, the creature -- either when that record is not within a cell of the knight or, if it is, when the second antibody record or a find record is empty; only when none is does no split happen. A monster in the first record copies itself onto itself and its facing is turned one way and back: no split.
Measured, calling it with a monster in the fourth record: with a monster far off in the first, that monster was replaced by the copy; with one beside the knight in the first and the second antibody record empty, the same; with it beside him and the five records after the antibody's all busy, no copy, and 1500 all the same (the only run of that branch: no session reached it).
Input
IX the monster
IY the antibody
HIT_SPLITS C101 LD (IY+$00),$0C the antibody bursts
C105 PUSH IX IX = the first monster record (the struck one saved); six tries
C107 LD IX,MONSTERS
C10B LD DE,$0010
C10E LD B,$06
HIT_SPLITS_0 C110 LD A,(IY+$00) IY empty? split -- but IY is the antibody's record and those after it
C113 AND A
C114 JR Z,HIT_SPLITS_1
C116 LD C,$02 IX, the first monster record, not beside the knight? split
C118 CALL NEAR_KNIGHT
C11B JR NC,HIT_SPLITS_1
C11D ADD IY,DE the record after IY
C11F DJNZ HIT_SPLITS_0
C121 POP IX no split: 1500 (never ran in the sessions)
C123 LD BC,$0015
C126 JP ADD_SCORE
HIT_SPLITS_1 C129 PUSH IX the struck monster copied over the first monster record: IY the copy, IX the original
C12B POP DE
C12C PUSH DE
C12D POP IY
C12F POP HL
C130 PUSH HL
C131 POP IX
C133 LD BC,$0010
C136 LDIR
C138 LD A,(IX+$06) a quarter turn each way, with 31 turns before either turns again
C13B ADD A,$40
C13D OR $1F
C13F LD (IX+$06),A
C142 LD A,(IY+$06)
C145 SUB $40
C147 OR $1F
C149 LD (IY+$06),A
C14C LD BC,$0015 1500
C14F JP ADD_SCORE
Prev: C0ED Up: Map Next: C152