Last modified on 4 August 2006, at 12:41

Talk:Programming:Fast Sprites

Revision as of 12:41, 4 August 2006 by Prodatron (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If you have enough memory, the fastest way to plot sprites is to use the "direct addressing" methode: Here is a small example:

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

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.

Return to "Programming:Fast Sprites" page.