The Plus [[ASIC]] hardware sprite format is different to the standard CPC sprite format, so sprites have to be converted if you want to use them as hardware sprites on the Plus.
== The formats ==
Plus hardware sprites are 16x16 pixels in size and have 16 colours, with colour PEN 0 always being transparent. Therefore, when converting standard CPC sprites it is easiest to convert them from MODE 0 because this mode supports a colour depth of 16 and two pixels are stored in one byte.
The pixel data in MODE 0 on the standard CPC is stored in an awkward manner and a byte is organised as follows:
[[File:Pixels.png]]
== Conversion ==
To convert a sprite, you can use the converter utility on download the DSK image below which contains a converter utility (to load type RUN”DISC”use RUN"DISC") which or you can be downloaded belowuse the source code provided on this page.
To use the converter utility, you must have first capture captured your standard CPC sprite (you can use the SPRITER utility on the discto do this) which must be 16 x 16 in size (8 bytes wide by 16 lines high). The converter utility will then display the sprites original and convert them converted sprite before saving the converted sprite to the disk.
== Download ==
== Source code ==
The source code for the converter (which will assemble in WinAPE [[WinApe]] and [[Maxam]]) is as follows:
<pre>
<geshi lang=Z80>
;Convert CPC sprite to Plus sprite
;Public Domain
org &82008000
ld b,16 ;loop counter, sprite is 16 lines high
ld a,(hl) ;and load data from it into A
bit 7,a ;does bit 0 equal 1? if so, reset Z
ld b,&1 ;pixel 0, bit 0 = &1
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
bit 3,a ;does bit 0 equal 1? if so, reset Z
ld b,&2 ;pixel 0, bit 1 (%0010) = &2
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
bit 5,a ;does bit 0 equal 1? if so, reset Z
ld b,&4 ;pixel 0, bit 2 (%0100) = &4
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
bit 1,a ;does bit 0 equal 1? if so, reset Z
ld b,&8 ;pixel 0, bit 3 (%1000) = &8
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
call storeit ;store pixel at sprite address
ld a,(hl) ;and load it into A
bit 6,a ;does bit 0 equal 1? if so, reset Z
ld b,&1 ;pixel 1, bit 0 (%0001) = &1
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
bit 2,a ;does bit 0 equal 1? if so, reset Z
ld b,&2 ;pixel 1, bit 1 (%0010) = &2
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
bit 4,a ;does bit 0 equal 1? if so, reset Z
ld b,&4 ;pixel 1, bit 2 (%0100) = &4
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
bit 0,a ;does bit 0 equal 1? if so, reset Z
ld b,&8 ;pixel 1, bit 3 (%1000) = &8
call nz,addbit ;and write it out add the bit to sprite memoryour pixel
call storeit ;store pixel at sprite address
ret
scraddr: dw &C000 ;screen address to grab CPC sprite from
pixel: db &0 ;pixel store
spraddr: dw &9000 ;address Plus sprite is stored (&100 bytes in length)
</geshi>
</pre>
== See also ==