Prev: 47311 Up: Map Next: 47356
47323: 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 47323 PUSH HL Stash HL on the stack.
47324 INC DE Advance DE.
BuildShotPattern_Loop 47325 EX AF,AF' Switch to the alternate accumulator and flags.
47326 LD A,(DE) Read DE.
47327 LD C,A C=A.
47328 INC DE Advance DE.
47329 LD A,(DE) Read DE.
47330 INC DE Advance DE.
47331 LD B,4 B=4.
BuildShotPattern_Row 47333 LD (HL),C Write C where HL points.
47334 INC L Advance L.
47335 LD (HL),A Write A where HL points.
47336 INC L Advance L.
47337 DJNZ BuildShotPattern_Row Decrease B and jump to BuildShotPattern_Row until none remain.
47339 EX AF,AF' Switch to the alternate accumulator and flags.
47340 DEC A Step A back.
47341 JR NZ,BuildShotPattern_Loop Jump to BuildShotPattern_Loop if the zero flag is clear.
47343 POP DE Bring DE back off the stack.
47344 BIT 7,(IX+0) Return if bit 7 of offset 0 of IX is clear.
47348 RET Z
47349 BIT 0,(IX+14) Return if bit 0 of offset 14 of IX is clear.
47353 RET Z
47354 INC E Advance E.
47355 RET Return.
Prev: 47311 Up: Map Next: 47356