z88dk SP1 software sprite library

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
bob_fossil
Manic Miner
Posts: 654
Joined: Mon Nov 13, 2017 6:09 pm

Re: z88dk SP1 software sprite library

Post by bob_fossil »

I think the stack pointer is important as SP1 uses dynamic memory. The source for the Blackstar example has the following comment in it's zpragma.inc:

Code: Select all

#pragma output REGISTER_SP = 0xd000 // typical stack location when using sp1
Digging into the include file sp1.h, SP1_DRAW_LOAD and so on appear to be function pointers:

Code: Select all

extern void    SP1_DRAW_LOAD1(void);        // load sprite 1-byte definition graph only no mask; sw rotation will use LOAD1_NR if no rotation necessary
extern void    SP1_DRAW_LOAD1NR(void);      // load sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary
extern void    SP1_DRAW_LOAD1LB(void);      // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite only
extern void    SP1_DRAW_LOAD1RB(void);      // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite only
So it looks like when you call sp1_AddColSpr you specify a drawing method in the parameters. Don't know if this makes it any clearer? :) I've found that poorly updated documentation is the curse of the z88dk. Your best bet would be to get into contact with Alvin as he is the font of all z88dk knowledge - or even better, somehow get him to register on this forum. I think he's busy with development on the ZX Spectrum Next these days but I've learnt more about using the z88dk in forum posts with him than I have from anywhere else.

I'm using R-Tape's posted beginners sprite code to write myself a basic sprite handling routine from C that I can understand.
Post Reply