Prev: D8A3 Up: Map Next: D909
D8C0: Draws an sprite
Draws an sprite with the information defined in the data buffer pointed by the address at SP Used by the routines at A1DB, A212 and E00B.
D8C0 LD ($A093),IX Save at A093 the current value of IX
D8C4 LD ($A095),IY Save at A095 the current value of IY
D8C8 POP IY Restore the base address of the data buffer for the sprite to display
D8CA LD L,(IY+$03) Set HL to the vertical position of the sprite
D8CD LD H,$00
D8CF ADD HL,HL Set HL the address location of the sprite in the display file lookup table
D8D0 LD DE,$ABDD
D8D3 ADD HL,DE
D8D4 PUSH HL Copy HL to IX
D8D5 POP IX
D8D7 LD L,(IY+$00) Set HL to point to address of the graphic data for the sprite
D8DA LD H,(IY+$01)
D8DD LD B,(IY+$05) Set B the height of the sprite
D8E0 PUSH BC Save BC
D8E1 LD A,(IX+$00) Set A to the lower byte of the address to the display file where draw the sprite
D8E4 LD D,(IX+$01) Set D to the high byte of the address to the display file where draw the sprite
D8E7 ADD A,(IY+$02) Add the horizontal position to the lowe byte of the display file
D8EA LD E,A Set DE the address point in display file to draw the sprite
D8EB LD C,(IY+$04) Set BC to the width of the sprite
D8EE LD B,$00
D8F0 LDIR Copy to display file the graphics data of the sprite (a row of pixels)
D8F2 INC IX Points to the next address in the display file look up table
D8F4 INC IX
D8F6 POP BC Recover BC
D8F7 DJNZ $D8E0 Jump back if there are partial sprite to draw
D8F9 LD DE,$0006 Point IY to the end of the data buffer for the sprite. This will be the next instruction to execute when return from this routine
D8FC ADD IY,DE
D8FE PUSH IY Save IY
D900 LD IY,($A095) Restore IY and IX
D904 LD IX,($A093)
D908 RET Return to instruction pointed by IY
Prev: D8A3 Up: Map Next: D909