Prev: D675 Up: Map Next: D6BB
D677: Copy a sprite's data to a graphic buffer
Used by the routine at E544.
Input
DE The sprite data
HL The buffer to copy the data to
D677 LD A,(DE) Get the first byte
D678 AND $0C Extract bits 2-3 (the height) and store it C.
D67A RRCA
D67B RRCA
D67C LD C,A
D67D INC A Copy this plus one into the graphic data.
D67E LD (HL),A
D67F INC HL Move to the next position in the buffer.
D680 LD A,(DE) Extract bits 0-2 (the width) into B
D681 AND $03
D683 LD B,A
D684 LD (HL),A Copy this into the graphic data.
D685 SLA C Multiply C by 8 and store it in A.
D687 SLA C
D689 SLA C
D68B XOR A
D68C ADD A,C
D68D DJNZ $D68C Loop back while there is more to do.
D68F LD C,A Put the height in BC.
D690 LD B,$00
D692 LD ($D675),BC Store this in D675.
D696 INC HL Move to the next position in the buffer and store it.
D697 PUSH HL
D698 LD B,$F0 Initialize the next F0 bytes in the buffer with 0.L
D69A XOR A
D69B LD (HL),A
D69C INC HL
D69D DJNZ $D69B
D69F POP HL Restore HL which points to the next place in the buffer.
D6A0 PUSH HL Store this.
D6A1 LD BC,$0018 Increment by 18 for each iteration.
D6A4 ADD HL,BC Add the next offset.
D6A5 INC DE Move to the next byte in the sprite data.
D6A6 EX DE,HL Copy from the sprite data to the buffer.
D6A7 LD BC,($D675) Get the length.
D6AB LDIR Do the copy.
D6AD EX DE,HL Make DE the next place to copy from.
D6AE POP HL Restore HL.
D6AF LD BC,$0090 Increment by 90 for each iteration.
D6B2 ADD HL,BC Add the next offset.
D6B3 EX DE,HL Copy from the sprite data to the buffer.
D6B4 LD BC,($D675) Get the length.
D6B8 LDIR Do the copy and return.
D6BA RET
Prev: D675 Up: Map Next: D6BB