Prev: B8CF Up: Map Next: B8FC
B8DB: Build Shot Pattern
Used by the routine at MakeShotRow.
Builds the rows of a pattern in a buffer. The first byte of the pattern is the number of rows and each row is two bytes, which are repeated four times in the buffer. Returns with the start of the buffer in DE, which has one added to E if the shot is facing left and bit 0 of its length is set.
Input
A Number of rows
DE Address of the pattern
HL Address of the buffer
IX Address of the shot
Output
DE Address of the buffer
BuildShotPattern B8DB PUSH HL Stash HL on the stack.
B8DC INC DE Advance DE.
BuildShotPattern_Loop B8DD EX AF,AF' Switch to the alternate accumulator and flags.
B8DE LD A,(DE) Read DE.
B8DF LD C,A C=A.
B8E0 INC DE Advance DE.
B8E1 LD A,(DE) Read DE.
B8E2 INC DE Advance DE.
B8E3 LD B,$04 B=04.
BuildShotPattern_Row B8E5 LD (HL),C Write C where HL points.
B8E6 INC L Advance L.
B8E7 LD (HL),A Write A where HL points.
B8E8 INC L Advance L.
B8E9 DJNZ BuildShotPattern_Row Decrease B and jump to BuildShotPattern_Row until none remain.
B8EB EX AF,AF' Switch to the alternate accumulator and flags.
B8EC DEC A Step A back.
B8ED JR NZ,BuildShotPattern_Loop Jump to BuildShotPattern_Loop if the zero flag is clear.
B8EF POP DE Bring DE back off the stack.
B8F0 BIT 7,(IX+$00) Return if bit 7 of offset 00 of IX is clear.
B8F4 RET Z
B8F5 BIT 0,(IX+$0E) Return if bit 0 of offset 0E of IX is clear.
B8F9 RET Z
B8FA INC E Advance E.
B8FB RET Return.
Prev: B8CF Up: Map Next: B8FC