Prev: B8CF Up: Map Next: B8FC
B8DB: Expand a special beam frame into a pattern buffer
Used by the routines at old_beam_frame and new_beam_frame.
Reached by JP from old_beam_frame and new_beam_frame with DE the frame's graphic and HL the buffer (the one at the end of build_shifted_pieces for last pass's frame, sprite_buffer_two for this pass's). Each line's two bytes are repeated four times into an 8-byte row, for the frame's height, so draw_beam and erase_laser can take up to 8 cells of it. Then DE is the buffer, one byte on if the beam goes left and its length is odd, which keeps the pattern in step with the screen.
Input
A the frame's height
DE the frame's graphic
HL the buffer
IX the shot's record
Output
DE the buffer, adjusted
expand_beam_frame B8DB PUSH HL keep the buffer; A' = the lines; this line's two bytes in C and A; four copies
B8DC INC DE
expand_beam_frame_0 B8DD EX AF,AF'
B8DE LD A,(DE)
B8DF LD C,A
B8E0 INC DE
B8E1 LD A,(DE)
B8E2 INC DE
B8E3 LD B,$04
expand_beam_frame_1 B8E5 LD (HL),C into the row, two bytes a time
B8E6 INC L
B8E7 LD (HL),A
B8E8 INC L
B8E9 DJNZ expand_beam_frame_1
B8EB EX AF,AF' the next line
B8EC DEC A
B8ED JR NZ,expand_beam_frame_0
B8EF POP DE the buffer
B8F0 BIT 7,(IX+$00) going left with an odd length: a byte on
B8F4 RET Z
B8F5 BIT 0,(IX+$0E)
B8F9 RET Z
B8FA INC E
B8FB RET
Prev: B8CF Up: Map Next: B8FC