Changes

Talk:Programming:Fast Sprites

709 bytes added, 09:57, 7 May 2007
Reverted edits by [[Special:Contributions/Gryzor|Gryzor]] ([[User_talk:Gryzor|Talk]]); changed back to last version by [[User:Prodatron|Prodatron]]
If you have enough memory, the fastest way to plot sprites is to use the "direct addressing" methode:
Here is a small example:
<pre>
LD HL,screen address
LD BC,#800+[most used byte]
LD DE,#C050
LD (HL),byte1:INC HL ;plot line 1
LD (HL),byte2:INC HL
LD (HL),C
LD A,H:ADD B:LD H,A
JR NC,line2
ADD HL,DE
.line2
LD (HL),byte6:DEC HL ;plot line 2
LD (HL),C :DEC HL
LD (HL),byte4
LD A,H:ADD B:LD H,A
JR NC,line3
ADD HL,DE
.line3
LD A,(HL):AND #55:OR byte7:LD (HL),A:INC HL ;plot line 3 (contains transparent areas)
LD (HL),byte8:INC HL
LD A,(HL):AND #AA:OR byte9:LD (HL),A
RET
</pre>
 
In mode 0 you will need two routines for every sprite, but I think there is no faster way to plot sprites on the CPC.