1 
2 // automatically generated by m4 from headers in proto subdir
3 
4 
5 #ifndef __SP1_ZX_H__
6 #define __SP1_ZX_H__
7 
8 ///////////////////////////////////////////////////////////
9 //                  SPRITE PACK v3.0                     //
10 //             Sinclair Spectrum Version                 //
11 //            aralbrec - April / May 2006                //
12 ///////////////////////////////////////////////////////////
13 //                                                       //
14 //    Software sprite engine for bitmapped displays      //
15 //                                                       //
16 //    * Differential screen update                       //
17 //    * Any number and any size of sprites               //
18 //    * Clipping to character cell boundaries            //
19 //    * Background tile animation                        //
20 //                                                       //
21 //       See the wiki for documentation details          //
22 //             http://www.z88dk.org/wiki                 //
23 //                                                       //
24 ///////////////////////////////////////////////////////////
25 
26 #include <stdint.h>
27 
28 ///////////////////////////////////////////////////////////
29 //                  DATA STRUCTURES                      //
30 ///////////////////////////////////////////////////////////
31 
32 struct sp1_Rect {
33 
34    uint8_t row;
35    uint8_t col;
36    uint8_t width;
37    uint8_t height;
38 
39 };
40 
41 struct sp1_update;
42 struct sp1_ss;
43 struct sp1_cs;
44 
45 struct sp1_update {                   // "update structs" - 10 bytes - Every tile in the display area managed by SP1 is described by one of these
46 
47    uint8_t              nload;          // +0 bit 7 = 1 for invalidated, bit 6 = 1 for removed, bits 5:0 = number of occluding sprites present + 1
48    uint8_t              colour;         // +1 background tile attribute
49    uint16_t             tile;           // +2 background 16-bit tile code (if MSB != 0 taken as address of graphic, else lookup in tile array)
50    struct sp1_cs       *slist;          // +4 BIG ENDIAN ; list of sprites occupying this tile (MSB = 0 if none) points at struct sp1_cs.attr_mask
51    struct sp1_update   *ulist;          // +6 BIG ENDIAN ; next update struct in list of update structs queued for draw (MSB = 0 if none)
52    uint8_t             *screen;         // +8 address in display file where this tile is drawn
53 
54 };
55 
56 struct sp1_ss {                       // "sprite structs" - 20 bytes - Every sprite is described by one of these
57 
58    uint8_t              row;            // +0  current y tile-coordinate
59    uint8_t              col;            // +1  current x tile-coordinate
60    uint8_t              width;          // +2  width of sprite in tiles
61    uint8_t              height;         // +3  height of sprite in tiles
62 
63    uint8_t              vrot;           // +4  bit 7 = 1 for 2-byte graphical definition else 1-byte, bits 2:0 = current vertical rotation (0..7)
64    uint8_t              hrot;           // +5  current horizontal rotation (0..7)
65 
66    uint8_t             *frame;          // +6  current sprite frame address added to graphic pointers
67 
68    uint8_t              res0;           // +8  "LD A,n" opcode
69    uint8_t              e_hrot;         // +9  effective horizontal rotation = MSB of rotation table to use
70    uint8_t              res1;           // +10 "LD BC,nn" opcode
71    uint16_t             e_offset;       // +11 effective offset to add to graphic pointers, equals result of vertical rotation + frame addr
72    uint8_t              res2;           // +13 "EX DE,HL" opcode
73    uint8_t              res3;           // +14 "JP (HL)" opcode
74 
75    struct sp1_cs     *first;          // +15 BIG ENDIAN ; first struct sp1_cs of this sprite
76 
77    uint8_t              xthresh;        // +17 hrot must be at least this number of pixels for last column of sprite to be drawn (1 default)
78    uint8_t              ythresh;        // +18 vrot must be at least this number of pixels for last row of sprite to be drawn (1 default)
79    uint8_t              nactive;        // +19 number of struct sp1_cs cells on display (written by sp1_MoveSpr*)
80 
81 };
82 
83 struct sp1_cs {                       // "char structs" - 24 bytes - Every sprite is broken into pieces fitting into a tile, each of which is described by one of these
84 
85    struct sp1_cs     *next_in_spr;    // +0  BIG ENDIAN ; next sprite char within same sprite in row major order (MSB = 0 if none)
86 
87    struct sp1_update *update;         // +2  BIG ENDIAN ; tile this sprite char currently occupies (MSB = 0 if none)
88 
89    uint8_t              plane;          // +4  plane sprite occupies, 0 = closest to viewer
90    uint8_t              type;           // +5  bit 7 = 1 occluding, bit 6 = 1 last column, bit 5 = 1 last row, bit 4 = 1 clear pixelbuffer
91    uint8_t              attr_mask;      // +6  attribute mask logically ANDed with underlying attribute, default = 0xff for transparent
92    uint8_t              attr;           // +7  sprite colour, logically ORed to form final colour, default = 0 for transparent
93 
94    void                *ss_draw;        // +8  struct sp1_ss + 8 bytes ; points at code embedded in sprite struct sp1_ss
95 
96    uint8_t              res0;           // +10 typically "LD HL,nn" opcode
97    uint8_t             *def;            // +11 graphic definition pointer
98    uint8_t              res1;           // +13 typically "LD IX,nn" opcode
99    uint8_t              res2;           // +14
100    uint8_t             *l_def;          // +15 graphic definition pointer for sprite character to left of this one
101    uint8_t              res3;           // +17 typically "CALL nn" opcode
102    void                *draw;           // +18 & draw function for this sprite char
103 
104    struct sp1_cs       *next_in_upd;    // +20 BIG ENDIAN ; & sp1_cs.attr_mask of next sprite occupying the same tile (MSB = 0 if none)
105    struct sp1_cs       *prev_in_upd;    // +22 BIG ENDIAN ; & sp1_cs.next_in_upd of previous sprite occupying the same tile
106 
107 };
108 
109 struct sp1_ap {                       // "attribute pairs" - 2 bytes - A struct to hold sprite attribute and mask pairs
110 
111    uint8_t              attr_mask;      // +0 attribute mask logically ANDed with underlying attribute = 0xff for transparent
112    uint8_t              attr;           // +1 sprite colour, logically ORed to form final colour = 0 for transparent
113 
114 };
115 
116 struct sp1_tp {                       // "tile pairs" - 3 bytes - A struct to hold background colour and tile pairs
117 
118    uint8_t              attr;           // +0 colour
119    uint16_t             tile;           // +1 tile code
120 
121 };
122 
123 struct sp1_pss {                      // "print string struct" - 11 bytes - A struct holding print state information
124 
125    struct sp1_Rect     *bounds;         // +0 rectangular boundary within which printing will be allowed
126    uint8_t              flags;          // +2 bit 0=invalidate?, 1=xwrap?, 2=yinc?, 3=ywrap?
127    uint8_t              x;              // +3 current x coordinate of cursor with respect to top left corner of bounds
128    uint8_t              y;              // +4 current y coordinate of cursor with respect to top left corner of bounds
129    uint8_t              attr_mask;      // +5 current attribute mask
130    uint8_t              attr;           // +6 current attribute
131    struct sp1_update   *pos;            // +7 RESERVED struct sp1_update associated with current cursor coordinates
132    void                *visit;          // +9 void (*visit)(struct sp1_update *) function, set to 0 for none
133 
134 };
135 
136 ///////////////////////////////////////////////////////////
137 //                      SPRITES                          //
138 ///////////////////////////////////////////////////////////
139 
140 // sprite type bits
141 
142 #define SP1_TYPE_OCCLUDE   0x80       // background and sprites underneath will not be drawn
143 #define SP1_TYPE_BGNDCLR   0x10       // for occluding sprites, copy background tile into pixel buffer before draw
144 
145 #define SP1_TYPE_2BYTE     0x40       // sprite graphic consists of (mask,graph) pairs, valid only in sp1_CreateSpr()
146 #define SP1_TYPE_1BYTE     0x00       // sprite graphic consists of graph only, valid only in sp1_CreateSpr()
147 
148 // sprite attribute masks, logically AND together if necessary
149 // zx.h contains defines for INK and PAPER colours
150 
151 #define SP1_AMASK_TRANS    0xff       // attribute mask for a transparent-colour sprite
152 #define SP1_AMASK_INK      0xf8       // attribute mask for an ink-only sprite
153 #define SP1_AMASK_PAPER    0xc7       // attribute mask for a paper-only sprite
154 #define SP1_AMASK_NOFLASH  0x7f       // attribute mask for no-flash
155 #define SP1_AMASK_NOBRIGHT 0xbf       // attribute mask for no-bright
156 #define SP1_ATTR_TRANS     0x00       // attribute for a transparent-colour sprite
157 
158 // prototype struct_sp1_ss and struct_sp1_cs that can be used to initialize empty structures
159 
160 extern struct sp1_cs  sp1_struct_cs_prototype;
161 extern struct sp1_ss  sp1_struct_ss_prototype;
162 
163 // draw functions for sprites with two-byte graphical definitions, ie (mask,graphic) pairs
164 
165 extern void    SP1_DRAW_MASK2(void);        // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation will use MASK2_NR if no rotation necessary
166 extern void    SP1_DRAW_MASK2NR(void);      // masked sprite 2-byte definition (mask,graph) pairs ; no rotation applied, graphic always drawn at exact tile boundary
167 extern void    SP1_DRAW_MASK2LB(void);      // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for left boundary of sprite only
168 extern void    SP1_DRAW_MASK2RB(void);      // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for right boundary of sprite only
169 
170 extern void    SP1_DRAW_LOAD2(void);        // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use LOAD2_NR if no rotation necessary
171 extern void    SP1_DRAW_LOAD2NR(void);      // load sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary
172 extern void    SP1_DRAW_LOAD2LB(void);      // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite only
173 extern void    SP1_DRAW_LOAD2RB(void);      // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite only
174 
175 extern void    SP1_DRAW_OR2(void);          // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use OR2_NR if no rotation necessary
176 extern void    SP1_DRAW_OR2NR(void);        // or sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary
177 extern void    SP1_DRAW_OR2LB(void);        // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for left boundary of sprite only
178 extern void    SP1_DRAW_OR2RB(void);        // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for right boundary of sprite only
179 
180 extern void    SP1_DRAW_XOR2(void);         // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use XOR2_NR if no rotation necessary
181 extern void    SP1_DRAW_XOR2NR(void);       // xor sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary
182 extern void    SP1_DRAW_XOR2LB(void);       // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for left boundary of sprite only
183 extern void    SP1_DRAW_XOR2RB(void);       // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for right boundary of sprite only
184 
185 extern void    SP1_DRAW_LOAD2LBIM(void);    // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite w/ implied mask
186 extern void    SP1_DRAW_LOAD2RBIM(void);    // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite w/ implied mask
187 
188 // draw functions for sprites with one-byte graphical definitions, ie no mask just graphics
189 
190 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
191 extern void    SP1_DRAW_LOAD1NR(void);      // load sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary
192 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
193 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
194 
195 extern void    SP1_DRAW_OR1(void);          // or sprite 1-byte definition graph only no mask; sw rotation will use OR1_NR if no rotation necessary
196 extern void    SP1_DRAW_OR1NR(void);        // or sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary
197 extern void    SP1_DRAW_OR1LB(void);        // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for left boundary of sprite only
198 extern void    SP1_DRAW_OR1RB(void);        // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for right boundary of sprite only
199 
200 extern void    SP1_DRAW_XOR1(void);         // xor sprite 1-byte definition graph only no mask; sw rotation will use XOR1_NR if no rotation necessary
201 extern void    SP1_DRAW_XOR1NR(void);       // xor sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary
202 extern void    SP1_DRAW_XOR1LB(void);       // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for left boundary of sprite only
203 extern void    SP1_DRAW_XOR1RB(void);       // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for right boundary of sprite only
204 
205 extern void    SP1_DRAW_LOAD1LBIM(void);    // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite with implied mask
206 extern void    SP1_DRAW_LOAD1RBIM(void);    // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite with implied mask
207 
208 // draw functions for sprites without graphics
209 
210 extern void    SP1_DRAW_ATTR(void);         // pixels are not drawn, only attributes
211 
212 // void *hook1  <->  void [ __FASTCALL__ ] (*hook1)(uint count, struct sp1_cs *c)      // if __FASTCALL__ only struct sp1_cs* passed
213 // void *hook2  <->  void [ __FASTCALL__ ] (*hook2)(uint count, struct sp1_update *u)  // if __FASTCALL__ only struct sp1_update* passed
214 //
215 // void *drawf  <->  void (*drawf)(void)     // sprite draw function containing draw code and data for struct_sp1_cs
216 
217 extern struct sp1_ss *sp1_CreateSpr(void *drawf,uint16_t type,uint16_t height,int graphic,uint16_t plane);
218 extern struct sp1_ss *sp1_CreateSpr_callee(void *drawf,uint16_t type,uint16_t height,int graphic,uint16_t plane) __z88dk_callee;
219 #define sp1_CreateSpr(a,b,c,d,e) sp1_CreateSpr_callee(a,b,c,d,e)
220 
221 
222 extern uint16_t sp1_AddColSpr(struct sp1_ss *s,void *drawf,uint16_t type,int graphic,uint16_t plane);
223 extern uint16_t sp1_AddColSpr_callee(struct sp1_ss *s,void *drawf,uint16_t type,int graphic,uint16_t plane) __z88dk_callee;
224 #define sp1_AddColSpr(a,b,c,d,e) sp1_AddColSpr_callee(a,b,c,d,e)
225 
226 
227 extern void sp1_ChangeSprType(struct sp1_cs *c,void *drawf);
228 extern void sp1_ChangeSprType_callee(struct sp1_cs *c,void *drawf) __z88dk_callee;
229 #define sp1_ChangeSprType(a,b) sp1_ChangeSprType_callee(a,b)
230 
231 
232 extern void sp1_DeleteSpr(struct sp1_ss *s);
233 extern void sp1_DeleteSpr_fastcall(struct sp1_ss *s) __z88dk_fastcall;
234 #define sp1_DeleteSpr(a) sp1_DeleteSpr_fastcall(a)
235 
236 // only call after sprite is removed from screen
237 
238 extern void sp1_MoveSprAbs(struct sp1_ss *s,struct sp1_Rect *clip,void *frame,uint16_t row,uint16_t col,uint16_t vrot,uint16_t hrot);
239 extern void sp1_MoveSprAbs_callee(struct sp1_ss *s,struct sp1_Rect *clip,void *frame,uint16_t row,uint16_t col,uint16_t vrot,uint16_t hrot) __z88dk_callee;
240 #define sp1_MoveSprAbs(a,b,c,d,e,f,g) sp1_MoveSprAbs_callee(a,b,c,d,e,f,g)
241 
242 
243 extern void sp1_MoveSprRel(struct sp1_ss *s,struct sp1_Rect *clip,void *frame,int rel_row,int rel_col,int rel_vrot,int rel_hrot);
244 extern void sp1_MoveSprRel_callee(struct sp1_ss *s,struct sp1_Rect *clip,void *frame,int rel_row,int rel_col,int rel_vrot,int rel_hrot) __z88dk_callee;
245 #define sp1_MoveSprRel(a,b,c,d,e,f,g) sp1_MoveSprRel_callee(a,b,c,d,e,f,g)
246 
247 
248 extern void sp1_MoveSprPix(struct sp1_ss *s,struct sp1_Rect *clip,void *frame,uint16_t x,uint16_t y);
249 extern void sp1_MoveSprPix_callee(struct sp1_ss *s,struct sp1_Rect *clip,void *frame,uint16_t x,uint16_t y) __z88dk_callee;
250 #define sp1_MoveSprPix(a,b,c,d,e) sp1_MoveSprPix_callee(a,b,c,d,e)
251 
252 
253 
254 extern void sp1_IterateSprChar(struct sp1_ss *s,void *hook1);
255 extern void sp1_IterateSprChar_callee(struct sp1_ss *s,void *hook1) __z88dk_callee;
256 #define sp1_IterateSprChar(a,b) sp1_IterateSprChar_callee(a,b)
257 
258 
259 extern void sp1_IterateUpdateSpr(struct sp1_ss *s,void *hook2);
260 extern void sp1_IterateUpdateSpr_callee(struct sp1_ss *s,void *hook2) __z88dk_callee;
261 #define sp1_IterateUpdateSpr(a,b) sp1_IterateUpdateSpr_callee(a,b)
262 
263 
264 
265 extern void sp1_GetSprClrAddr(struct sp1_ss *s,uint8_t **sprdest);
266 extern void sp1_GetSprClrAddr_callee(struct sp1_ss *s,uint8_t **sprdest) __z88dk_callee;
267 #define sp1_GetSprClrAddr(a,b) sp1_GetSprClrAddr_callee(a,b)
268 
269 
270 extern void sp1_PutSprClr(uint8_t **sprdest,struct sp1_ap *src,uint16_t n);
271 extern void sp1_PutSprClr_callee(uint8_t **sprdest,struct sp1_ap *src,uint16_t n) __z88dk_callee;
272 #define sp1_PutSprClr(a,b,c) sp1_PutSprClr_callee(a,b,c)
273 
274 
275 extern void sp1_GetSprClr(uint8_t **sprsrc,struct sp1_ap *dest,uint16_t n);
276 extern void sp1_GetSprClr_callee(uint8_t **sprsrc,struct sp1_ap *dest,uint16_t n) __z88dk_callee;
277 #define sp1_GetSprClr(a,b,c) sp1_GetSprClr_callee(a,b,c)
278 
279 
280 
281 extern void *sp1_PreShiftSpr(uint16_t flag,uint16_t height,uint16_t width,void *srcframe,void *destframe,uint16_t rshift);
282 extern void *sp1_PreShiftSpr_callee(uint16_t flag,uint16_t height,uint16_t width,void *srcframe,void *destframe,uint16_t rshift) __z88dk_callee;
283 #define sp1_PreShiftSpr(a,b,c,d,e,f) sp1_PreShiftSpr_callee(a,b,c,d,e,f)
284 
285 
286 
287 // some functions for displaying independent struct_sp1_cs not connected with any sprites; useful as foreground elements
288 // if not using a no-rotate (NR) type sprite draw function, must manually init the sp1_cs.ldef member after calling sp1_InitCharStruct()
289 
290 extern void sp1_InitCharStruct(struct sp1_cs *cs,void *drawf,uint16_t type,void *graphic,uint16_t plane);
291 extern void sp1_InitCharStruct_callee(struct sp1_cs *cs,void *drawf,uint16_t type,void *graphic,uint16_t plane) __z88dk_callee;
292 #define sp1_InitCharStruct(a,b,c,d,e) sp1_InitCharStruct_callee(a,b,c,d,e)
293 
294 
295 extern void sp1_InsertCharStruct(struct sp1_update *u,struct sp1_cs *cs);
296 extern void sp1_InsertCharStruct_callee(struct sp1_update *u,struct sp1_cs *cs) __z88dk_callee;
297 #define sp1_InsertCharStruct(a,b) sp1_InsertCharStruct_callee(a,b)
298 
299 
300 extern void sp1_RemoveCharStruct(struct sp1_cs *cs);
301 extern void sp1_RemoveCharStruct_fastcall(struct sp1_cs *cs) __z88dk_fastcall;
302 #define sp1_RemoveCharStruct(a) sp1_RemoveCharStruct_fastcall(a)
303 
304 
305 
306 ///////////////////////////////////////////////////////////
307 //                       TILES                           //
308 ///////////////////////////////////////////////////////////
309 
310 #define SP1_RFLAG_TILE          0x01
311 #define SP1_RFLAG_COLOUR        0x02
312 #define SP1_RFLAG_SPRITE        0x04
313 
314 #define SP1_PSSFLAG_INVALIDATE  0x01
315 #define SP1_PSSFLAG_XWRAP       0x02
316 #define SP1_PSSFLAG_YINC        0x04
317 #define SP1_PSSFLAG_YWRAP       0x08
318 
319 extern void *sp1_TileEntry(uint16_t c,void *def);
320 extern void *sp1_TileEntry_callee(uint16_t c,void *def) __z88dk_callee;
321 #define sp1_TileEntry(a,b) sp1_TileEntry_callee(a,b)
322 
323 
324 
325 extern void sp1_PrintAt(uint16_t row,uint16_t col,uint16_t colour,uint16_t tile);
326 extern void sp1_PrintAt_callee(uint16_t row,uint16_t col,uint16_t colour,uint16_t tile) __z88dk_callee;
327 #define sp1_PrintAt(a,b,c,d) sp1_PrintAt_callee(a,b,c,d)
328 
329 
330 extern void sp1_PrintAtInv(uint16_t row,uint16_t col,uint16_t colour,uint16_t tile);
331 extern void sp1_PrintAtInv_callee(uint16_t row,uint16_t col,uint16_t colour,uint16_t tile) __z88dk_callee;
332 #define sp1_PrintAtInv(a,b,c,d) sp1_PrintAtInv_callee(a,b,c,d)
333 
334 
335 extern uint16_t sp1_ScreenStr(uint16_t row,uint16_t col) __preserves_regs(b,c);
336 extern uint16_t sp1_ScreenStr_callee(uint16_t row,uint16_t col) __preserves_regs(b,c) __z88dk_callee;
337 #define sp1_ScreenStr(a,b) sp1_ScreenStr_callee(a,b)
338 
339 
340 extern uint16_t sp1_ScreenAttr(uint16_t row,uint16_t col) __preserves_regs(b,c);
341 extern uint16_t sp1_ScreenAttr_callee(uint16_t row,uint16_t col) __preserves_regs(b,c) __z88dk_callee;
342 #define sp1_ScreenAttr(a,b) sp1_ScreenAttr_callee(a,b)
343 
344 
345 
346 extern void sp1_PrintString(struct sp1_pss *ps,uint8_t *s);
347 extern void sp1_PrintString_callee(struct sp1_pss *ps,uint8_t *s) __z88dk_callee;
348 #define sp1_PrintString(a,b) sp1_PrintString_callee(a,b)
349 
350 
351 extern void sp1_SetPrintPos(struct sp1_pss *ps,uint16_t row,uint16_t col);
352 extern void sp1_SetPrintPos_callee(struct sp1_pss *ps,uint16_t row,uint16_t col) __z88dk_callee;
353 #define sp1_SetPrintPos(a,b,c) sp1_SetPrintPos_callee(a,b,c)
354 
355 
356 
357 extern void sp1_GetTiles(struct sp1_Rect *r,struct sp1_tp *dest);
358 extern void sp1_GetTiles_callee(struct sp1_Rect *r,struct sp1_tp *dest) __z88dk_callee;
359 #define sp1_GetTiles(a,b) sp1_GetTiles_callee(a,b)
360 
361 
362 extern void sp1_PutTiles(struct sp1_Rect *r,struct sp1_tp *src);
363 extern void sp1_PutTiles_callee(struct sp1_Rect *r,struct sp1_tp *src) __z88dk_callee;
364 #define sp1_PutTiles(a,b) sp1_PutTiles_callee(a,b)
365 
366 
367 extern void sp1_PutTilesInv(struct sp1_Rect *r,struct sp1_tp *src);
368 extern void sp1_PutTilesInv_callee(struct sp1_Rect *r,struct sp1_tp *src) __z88dk_callee;
369 #define sp1_PutTilesInv(a,b) sp1_PutTilesInv_callee(a,b)
370 
371 
372 
373 extern void sp1_ClearRect(struct sp1_Rect *r,uint16_t colour,uint16_t tile,uint16_t rflag);
374 extern void sp1_ClearRect_callee(struct sp1_Rect *r,uint16_t colour,uint16_t tile,uint16_t rflag) __z88dk_callee;
375 #define sp1_ClearRect(a,b,c,d) sp1_ClearRect_callee(a,b,c,d)
376 
377 
378 extern void sp1_ClearRectInv(struct sp1_Rect *r,uint16_t colour,uint16_t tile,uint16_t rflag);
379 extern void sp1_ClearRectInv_callee(struct sp1_Rect *r,uint16_t colour,uint16_t tile,uint16_t rflag) __z88dk_callee;
380 #define sp1_ClearRectInv(a,b,c,d) sp1_ClearRectInv_callee(a,b,c,d)
381 
382 
383 
384 ///////////////////////////////////////////////////////////
385 //                      UPDATER                          //
386 ///////////////////////////////////////////////////////////
387 
388 #define SP1_IFLAG_MAKE_ROTTBL      0x01
389 #define SP1_IFLAG_OVERWRITE_TILES  0x02
390 #define SP1_IFLAG_OVERWRITE_DFILE  0x04
391 
392 // void *hook  <->  void [ __FASTCALL__ ] (*hook)(struct sp1_update *u)
393 
394 extern void sp1_Initialize(uint16_t iflag,uint16_t colour,uint16_t tile);
395 extern void sp1_Initialize_callee(uint16_t iflag,uint16_t colour,uint16_t tile) __z88dk_callee;
396 #define sp1_Initialize(a,b,c) sp1_Initialize_callee(a,b,c)
397 
398 
399 extern void sp1_UpdateNow(void);
400 
401 
402 extern struct sp1_update *sp1_GetUpdateStruct(uint16_t row,uint16_t col) __preserves_regs(b,c);
403 extern struct sp1_update *sp1_GetUpdateStruct_callee(uint16_t row,uint16_t col) __preserves_regs(b,c) __z88dk_callee;
404 #define sp1_GetUpdateStruct(a,b) sp1_GetUpdateStruct_callee(a,b)
405 
406 
407 extern void sp1_IterateUpdateArr(struct sp1_update **ua,void *hook);
408 extern void sp1_IterateUpdateArr_callee(struct sp1_update **ua,void *hook) __z88dk_callee;
409 #define sp1_IterateUpdateArr(a,b) sp1_IterateUpdateArr_callee(a,b)
410 
411 // zero terminated array
412 extern void sp1_IterateUpdateRect(struct sp1_Rect *r,void *hook);
413 extern void sp1_IterateUpdateRect_callee(struct sp1_Rect *r,void *hook) __z88dk_callee;
414 #define sp1_IterateUpdateRect(a,b) sp1_IterateUpdateRect_callee(a,b)
415 
416 
417 
418 extern void sp1_InvUpdateStruct(struct sp1_update *u);
419 extern void sp1_InvUpdateStruct_fastcall(struct sp1_update *u) __z88dk_fastcall;
420 #define sp1_InvUpdateStruct(a) sp1_InvUpdateStruct_fastcall(a)
421 
422 
423 extern void sp1_ValUpdateStruct(struct sp1_update *u) __preserves_regs(b,c,d,e);
424 extern void sp1_ValUpdateStruct_fastcall(struct sp1_update *u) __preserves_regs(a,b,c,d,e,h,l) __z88dk_fastcall;
425 #define sp1_ValUpdateStruct(a) sp1_ValUpdateStruct_fastcall(a)
426 
427 
428 
429 extern void sp1_DrawUpdateStructIfInv(struct sp1_update *u);
430 extern void sp1_DrawUpdateStructIfInv_fastcall(struct sp1_update *u) __z88dk_fastcall;
431 #define sp1_DrawUpdateStructIfInv(a) sp1_DrawUpdateStructIfInv_fastcall(a)
432 
433 
434 extern void sp1_DrawUpdateStructIfVal(struct sp1_update *u);
435 extern void sp1_DrawUpdateStructIfVal_fastcall(struct sp1_update *u) __z88dk_fastcall;
436 #define sp1_DrawUpdateStructIfVal(a) sp1_DrawUpdateStructIfVal_fastcall(a)
437 
438 
439 extern void sp1_DrawUpdateStructIfNotRem(struct sp1_update *u);
440 extern void sp1_DrawUpdateStructIfNotRem_fastcall(struct sp1_update *u) __z88dk_fastcall;
441 #define sp1_DrawUpdateStructIfNotRem(a) sp1_DrawUpdateStructIfNotRem_fastcall(a)
442 
443 
444 extern void sp1_DrawUpdateStructAlways(struct sp1_update *u);
445 extern void sp1_DrawUpdateStructAlways_fastcall(struct sp1_update *u) __z88dk_fastcall;
446 #define sp1_DrawUpdateStructAlways(a) sp1_DrawUpdateStructAlways_fastcall(a)
447 
448 
449 
450 extern void sp1_RemoveUpdateStruct(struct sp1_update *u) __preserves_regs(b,c);
451 extern void sp1_RemoveUpdateStruct_fastcall(struct sp1_update *u) __preserves_regs(b,c) __z88dk_fastcall;
452 #define sp1_RemoveUpdateStruct(a) sp1_RemoveUpdateStruct_fastcall(a)
453 
454 
455 extern void sp1_RestoreUpdateStruct(struct sp1_update *u) __preserves_regs(b,c,d,e);
456 extern void sp1_RestoreUpdateStruct_fastcall(struct sp1_update *u) __preserves_regs(a,b,c,d,e,h,l) __z88dk_fastcall;
457 #define sp1_RestoreUpdateStruct(a) sp1_RestoreUpdateStruct_fastcall(a)
458 
459 
460 
461 extern void sp1_Invalidate(struct sp1_Rect *r);
462 extern void sp1_Invalidate_fastcall(struct sp1_Rect *r) __z88dk_fastcall;
463 #define sp1_Invalidate(a) sp1_Invalidate_fastcall(a)
464 
465 
466 extern void sp1_Validate(struct sp1_Rect *r);
467 extern void sp1_Validate_fastcall(struct sp1_Rect *r) __z88dk_fastcall;
468 #define sp1_Validate(a) sp1_Validate_fastcall(a)
469 
470 
471 
472 #endif
473