Prev: 6de9 Up: Map Next: 6e66
6e1b: Fire a laser beam.
Used by the routines at 63a3, 6a35, 6ab8, 6bf8, 6cbe and 6d9c.
Input
IX Alien object.
Output
C Is either $00 or $01.
HL Pointer to current active laser beam object.
6e1b ld de,$0008 offset
6e1e ld hl,$5d08 Laser beam objects
6e21 ld b,$04 Loop counter (4 laser beams)
6e23 push hl HL: += 8 after first iteration
6e24 ld a,(hl) If current laser beam is in use, try next one
6e25 and a
6e26 jr z,$6e5f
6e28 inc hl HL=Y position
6e29 inc hl HL=X position: pulse #1
6e2a inc hl HL=X position: pulse #2
6e2b ld a,(hl) A=pulse #2
6e2c dec hl HL=X position: pulse #1
6e2d bit 2,a Next iteration is bit-2 of pulse #2 is reset
6e2f jr z,$6e5f
6e31 and $f8
6e33 sub (ix+$01) Subtract alien X position from laser beam X position
6e36 jp p,$6e3f If positive number, check position and next iteration
6e39 neg
6e3b ld c,$08
6e3d jr $6e41
6e3f ld c,$20
6e41 cp c Next iteration if pulse X position is now >= 8/32
6e42 jr nc,$6e5f
6e44 dec hl HL=Y position
6e45 ld a,(hl)
6e46 sub (ix+$02) Subtract alien Y position from laser beam Y position
6e49 neg
6e4b jp m,$6e5f If subtraction was negative number, next iteration
6e4e add a,$0c else, add 12
6e50 cp (ix+$07) Next iteration if >= sprite height
6e53 jp nc,$6e5f
6e56 ld c,$01 else set return value to $01
6e58 inc hl Update X position: pulse #1
6e59 ld a,(hl)
6e5a and $f8
6e5c ld (hl),a
6e5d pop hl Set HL to first byte of current group
6e5e ret We're done here
6e5f pop hl Try next laser beam object
6e60 add hl,de
6e61 djnz $6e23
6e63 ld c,$00 Return $00
6e65 ret
Prev: 6de9 Up: Map Next: 6e66