1 /*
2  * UAE - The U*nix Amiga Emulator
3  *
4  * Picasso96 Support Module Header
5  *
6  * Copyright 1997 Brian King <Brian_King@Mitel.com, Brian_King@Cloanto.com>
7  */
8 
9 #if defined PICASSO96_SUPPORTED
10 
11 #define PICASSO96
12 
13 #define JAM1 0
14 #define JAM2 1
15 #define COMP 2
16 #define INVERS 4
17 
18 typedef enum {
19     BLIT_FALSE,
20     BLIT_NOR,
21     BLIT_ONLYDST,
22     BLIT_NOTSRC,
23     BLIT_ONLYSRC,
24     BLIT_NOTDST,
25     BLIT_EOR,
26     BLIT_NAND,
27     BLIT_AND,
28     BLIT_NEOR,
29     BLIT_DST,
30     BLIT_NOTONLYSRC,
31     BLIT_SRC,
32     BLIT_NOTONLYDST,
33     BLIT_OR,
34     BLIT_TRUE,
35     BLIT_LAST
36 } BLIT_OPCODE;
37 
38 /************************************************************************/
39 /* Types for BoardType Identification
40  */
41 typedef enum {
42 	BT_NoBoard,
43 	BT_oMniBus,
44 	BT_Graffity,
45 	BT_CyberVision,
46 	BT_Domino,
47 	BT_Merlin,
48 	BT_PicassoII,
49 	BT_Piccolo,
50 	BT_RetinaBLT,
51 	BT_Spectrum,
52 	BT_PicassoIV,
53 	BT_PiccoloSD64,
54 	BT_A2410,
55 	BT_Pixel64,
56 	BT_uaegfx,
57 	BT_CVision3D,
58 	BT_Altais,
59 	BT_Prototype1,
60 	BT_Prototype2,
61 	BT_Prototype3,
62 	BT_Prototype4,
63 	BT_Prototype5,
64 	BT_MaxBoardTypes
65 } BTYPE;
66 
67 struct ScreenResolution
68 {
69     uae_u32 width;  /* in pixels */
70     uae_u32 height; /* in pixels */
71 };
72 
73 #define MAX_PICASSO_MODES 64
74 
75 struct PicassoResolution
76 {
77     struct Resolutions *next;
78     struct ScreenResolution res;
79     int depth;
80     int refresh;
81     char name[25];
82 };
83 extern struct PicassoResolution DisplayModes[MAX_PICASSO_MODES];
84 
85 
86 /* Types for RGBFormat used */
87 typedef enum {
88     RGBFB_NONE,		/* no valid RGB format (should not happen) */
89     RGBFB_CLUT,		/* palette mode, set colors when opening screen using
90 			   tags or use SetRGB32/LoadRGB32(...) */
91     RGBFB_R8G8B8,	/* TrueColor RGB (8 bit each) */
92     RGBFB_B8G8R8,	/* TrueColor BGR (8 bit each) */
93     RGBFB_R5G6B5PC,	/* HiColor16 (5 bit R, 6 bit G, 5 bit B),
94 			   format: gggbbbbbrrrrrggg */
95     RGBFB_R5G5B5PC,	/* HiColor15 (5 bit each), format: gggbbbbb0rrrrrgg */
96     RGBFB_A8R8G8B8,	/* 4 Byte TrueColor ARGB (A unused alpha channel) */
97     RGBFB_A8B8G8R8,	/* 4 Byte TrueColor ABGR (A unused alpha channel) */
98     RGBFB_R8G8B8A8,	/* 4 Byte TrueColor RGBA (A unused alpha channel) */
99     RGBFB_B8G8R8A8,	/* 4 Byte TrueColor BGRA (A unused alpha channel) */
100     RGBFB_R5G6B5,	/* HiColor16 (5 bit R, 6 bit G, 5 bit B),
101 			   format: rrrrrggggggbbbbb */
102     RGBFB_R5G5B5,	/* HiColor15 (5 bit each), format: 0rrrrrgggggbbbbb */
103     RGBFB_B5G6R5PC,	/* HiColor16 (5 bit R, 6 bit G, 5 bit B),
104 			   format: gggrrrrrbbbbbggg */
105     RGBFB_B5G5R5PC,	/* HiColor15 (5 bit each), format: gggrrrrr0bbbbbbgg */
106 
107     /* By now, the following formats are for use with a hardware window only
108        (bitmap operations may be implemented incompletely) */
109 
110     RGBFB_Y4U2V2,	/* 2 Byte TrueColor YUV (CCIR recommendation CCIR601).
111 			   Each two-pixel unit is stored as one longword
112 			   containing luminance (Y) for each of the two pixels,
113 			   and chrominance (U,V) for alternate pixels.
114 			   The missing chrominance values are generated by
115 			   interpolation. (Y1-U0-Y0-V0) */
116     RGBFB_Y4U1V1,	/* 1 Byte TrueColor ACCUPAK. Four adjacent pixels form
117 			   a packet of 5 bits Y (luminance) each pixel and 6 bits
118 			   U and V (chrominance) shared by the four pixels */
119 
120     RGBFB_MaxFormats
121 } RGBFTYPE;
122 
123 #define RGBFF_NONE	(1<<RGBFB_NONE)
124 #define RGBFF_CLUT	(1<<RGBFB_CLUT)
125 #define RGBFF_R8G8B8	(1<<RGBFB_R8G8B8)
126 #define RGBFF_B8G8R8	(1<<RGBFB_B8G8R8)
127 #define RGBFF_R5G6B5PC	(1<<RGBFB_R5G6B5PC)
128 #define RGBFF_R5G5B5PC	(1<<RGBFB_R5G5B5PC)
129 #define RGBFF_A8R8G8B8	(1<<RGBFB_A8R8G8B8)
130 #define RGBFF_A8B8G8R8	(1<<RGBFB_A8B8G8R8)
131 #define RGBFF_R8G8B8A8	(1<<RGBFB_R8G8B8A8)
132 #define RGBFF_B8G8R8A8	(1<<RGBFB_B8G8R8A8)
133 #define RGBFF_R5G6B5	(1<<RGBFB_R5G6B5)
134 #define RGBFF_R5G5B5	(1<<RGBFB_R5G5B5)
135 #define RGBFF_B5G6R5PC	(1<<RGBFB_B5G6R5PC)
136 #define RGBFF_B5G5R5PC	(1<<RGBFB_B5G5R5PC)
137 #define RGBFF_Y4U2V2	(1<<RGBFB_Y4U2V2)
138 #define RGBFF_Y4U1V1	(1<<RGBFB_Y4U1V1)
139 
140 #define RGBMASK_8BIT RGBFF_CLUT
141 #define RGBMASK_16BIT (RGBFF_R5G6B5PC | RGBFF_B5G6R5PC | RGBFF_R5G6B5)
142 #define RGBMASK_15BIT (RGBFF_R5G5B5PC | RGBFF_B5G5R5PC | RGBFF_R5G5B5)
143 #define RGBMASK_24BIT (RGBFF_R8G8B8 | RGBFF_B8G8R8)
144 #define RGBMASK_32BIT (RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8)
145 
146 /************************************************************************/
147 
148 #define RGBFF_PLANAR	RGBFF_NONE
149 #define RGBFF_CHUNKY	RGBFF_CLUT
150 
151 #define RGBFB_PLANAR	RGBFB_NONE
152 #define RGBFB_CHUNKY	RGBFB_CLUT
153 
154 /************************************************************************/
155 
156 enum {
157     PLANAR,
158     CHUNKY,
159     HICOLOR,
160     TRUECOLOR,
161     TRUEALPHA,
162     MAXMODES
163 };
164 
165 /************************************************************************/
166 struct MyCLUTEntry {
167     uae_u8 Red;
168     uae_u8 Green;
169     uae_u8 Blue;
170     uae_u8 Pad;
171 };
172 
173 struct ColorIndexMapping {
174     uae_u32 ColorMask;
175     uae_u32 Colors[256];
176 };
177 
178 struct CLUTEntry {
179     uae_u8 Red;
180     uae_u8 Green;
181     uae_u8 Blue;
182 };
183 
184 #define PSSO_BitMap_BytesPerRow 0
185 #define PSSO_BitMap_Rows 2
186 #define PSSO_BitMap_Flags 4
187 #define PSSO_BitMap_Depth 5
188 #define PSSO_BitMap_pad 6
189 #define PSSO_BitMap_Planes 8
190 #define PSSO_BitMap_sizeof 40
191 
192 struct BitMap
193 {
194     uae_u16 BytesPerRow;
195     uae_u16 Rows;
196     uae_u8 Flags;
197     uae_u8 Depth;
198     uae_u16 pad;
199     uae_u8 *Planes[8];
200 };
201 
202 /************************************************************************/
203 
204 #define SETTINGSNAMEMAXCHARS		30
205 #define BOARDNAMEMAXCHARS		30
206 
207 struct Settings {
208     uae_u32					BoardType;
209     /* a value discribing assignment to nth board local to boardtype
210      * to be used for reassignment when boards are added or removed.  */
211     uae_u16					LocalOrdering;
212     uae_s16					LastSelected;
213     char					NameField[SETTINGSNAMEMAXCHARS];
214     /* neu! */
215     char					*BoardName;
216 };
217 
218 #define MAXRESOLUTIONNAMELENGTH 22
219 
220 /********************************
221  * only used within rtg.library *
222  ********************************/
223 
224 #define PSSO_LibResolution_P96ID 14
225 #define PSSO_LibResolution_Name 20
226 #define PSSO_LibResolution_DisplayID 42 /* Name + MAXRESOLUTIONNAMELENGTH */
227 #define PSSO_LibResolution_Width 46
228 #define PSSO_LibResolution_Height 48
229 #define PSSO_LibResolution_Flags 50
230 #define PSSO_LibResolution_Modes 52
231 #define PSSO_LibResolution_BoardInfo (52 + MAXMODES*4)
232 #define PSSO_LibResolution_sizeof (60 + MAXMODES*4)
233 
234 struct LibResolution {
235     char P96ID[6];
236     char Name[MAXRESOLUTIONNAMELENGTH];
237     uae_u32 DisplayID;
238     uae_u16 Width;
239     uae_u16 Height;
240     uae_u16 Flags;
241     uaecptr Modes[MAXMODES];
242     uaecptr BoardInfo;
243 };
244 
245 #define P96B_FAMILY	0			/* obsolete (Resolution is an entire family) */
246 #define P96B_PUBLIC	1			/* Resolution should be added to the public */
247 #define P96B_MONITOOL	2
248 
249 #define P96F_FAMILY	(1<<P96B_FAMILY)	/* obsolete */
250 #define P96F_PUBLIC	(1<<P96B_PUBLIC)
251 #define P96F_MONITOOL	(1<<P96B_MONITOOL)
252 
253 #define PSSO_ModeInfo_OpenCount 14
254 #define PSSO_ModeInfo_Active 16
255 #define PSSO_ModeInfo_Width 18
256 #define PSSO_ModeInfo_Height 20
257 #define PSSO_ModeInfo_Depth 22
258 #define PSSO_ModeInfo_Flags 23
259 #define PSSO_ModeInfo_HorTotal 24
260 #define PSSO_ModeInfo_HorBlankSize 26
261 #define PSSO_ModeInfo_HorSyncStart 28
262 #define PSSO_ModeInfo_HorSyncSize 30
263 #define PSSO_ModeInfo_HorSyncSkew 32
264 #define PSSO_ModeInfo_HorEnableSkew 33
265 #define PSSO_ModeInfo_VerTotal 34
266 #define PSSO_ModeInfo_VerBlankSize 36
267 #define PSSO_ModeInfo_VerSyncStart 38
268 #define PSSO_ModeInfo_VerSyncSize 40
269 #define PSSO_ModeInfo_first_union 42
270 #define PSSO_ModeInfo_second_union 43
271 #define PSSO_ModeInfo_PixelClock 44
272 #define PSSO_ModeInfo_sizeof 48
273 
274 #define PSSO_RenderInfo_Memory 0
275 #define PSSO_RenderInfo_BytesPerRow 4
276 #define PSSO_RenderInfo_pad 6
277 #define PSSO_RenderInfo_RGBFormat 8
278 #define PSSO_RenderInfo_sizeof 12
279 
280 struct RenderInfo {
281     uae_u8 *Memory;
282     uae_s16 BytesPerRow;
283     uae_s16 pad;
284     RGBFTYPE RGBFormat;
285 };
286 
287 #define PSSO_Pattern_Memory 0
288 #define PSSO_Pattern_XOffset 4
289 #define PSSO_Pattern_YOffset 6
290 #define PSSO_Pattern_FgPen 8
291 #define PSSO_Pattern_BgPen 12
292 #define PSSO_Pattern_Size 16
293 #define PSSO_Pattern_DrawMode 17
294 #define PSSO_Pattern_sizeof 18
295 struct Pattern {
296     uae_u8 *Memory;
297     uae_u16 XOffset, YOffset;
298     uae_u32 FgPen, BgPen;
299     uae_u8 Size;					/* Width: 16, Height: (1<<pat_Size) */
300     uae_u8 DrawMode;
301 };
302 
303 #define PSSO_Template_Memory 0
304 #define PSSO_Template_BytesPerRow 4
305 #define PSSO_Template_XOffset 6
306 #define PSSO_Template_DrawMode 7
307 #define PSSO_Template_FgPen 8
308 #define PSSO_Template_BgPen 12
309 #define PSSO_Template_sizeof 16
310 
311 struct Template {
312     uae_u8 *Memory;
313     uae_s16 BytesPerRow;
314     uae_u8 XOffset;
315     uae_u8 DrawMode;
316     uae_u32 FgPen;
317     uae_u32 BgPen;
318 };
319 
320 #define PSSO_BitMapExtra_BoardNode	  0
321 #define PSSO_BitMapExtra_HashChain	  8 /* BoardNode is 8-bytes */
322 #define PSSO_BitMapExtra_Match		 12
323 #define PSSO_BitMapExtra_BitMap		 16
324 #define PSSO_BitMapExtra_BoardInfo	 20
325 #define PSSO_BitMapExtra_MemChunk	 24
326 #define PSSO_BitMapExtra_RenderInfo	 28
327 #define PSSO_BitMapExtra_Width		 40 /* RenderInfo is 12-bytes */
328 #define PSSO_BitMapExtra_Height		 42
329 #define PSSO_BitMapExtra_Flags		 44
330 #define PSSO_BitMapExtra_BaseLevel	 46
331 #define PSSO_BitMapExtra_CurrentLevel	 48
332 #define PSSO_BitMapExtra_CompanionMaster 50
333 #define PSSO_BitMapExtra_Last		 54
334 
335 #define PSSO_BoardInfo_RegisterBase		   0
336 #define PSSO_BoardInfo_MemoryBase		   PSSO_BoardInfo_RegisterBase + 4
337 #define PSSO_BoardInfo_MemoryIOBase		   PSSO_BoardInfo_MemoryBase + 4
338 #define PSSO_BoardInfo_MemorySize		   PSSO_BoardInfo_MemoryIOBase + 4
339 #define PSSO_BoardInfo_BoardName		   PSSO_BoardInfo_MemorySize + 4
340 #define PSSO_BoardInfo_VBIName			   PSSO_BoardInfo_BoardName + 4
341 #define PSSO_BoardInfo_CardBase			   PSSO_BoardInfo_VBIName + 32
342 #define PSSO_BoardInfo_ChipBase			   PSSO_BoardInfo_CardBase + 4
343 #define PSSO_BoardInfo_ExecBase			   PSSO_BoardInfo_ChipBase + 4
344 #define PSSO_BoardInfo_UtilBase			   PSSO_BoardInfo_ExecBase + 4
345 #define PSSO_BoardInfo_HardInterrupt		   PSSO_BoardInfo_UtilBase + 4
346 #define PSSO_BoardInfo_SoftInterrupt		   PSSO_BoardInfo_HardInterrupt + 22 /* The HardInterrupt is 22-bytes */
347 #define PSSO_BoardInfo_BoardLock		   PSSO_BoardInfo_SoftInterrupt + 22 /* The SoftInterrupt is 22-bytes */
348 #define PSSO_BoardInfo_ResolutionsList		   PSSO_BoardInfo_BoardLock + 46 /* On the BoardLock, we were having some fun... */
349 #define PSSO_BoardInfo_BoardType		   PSSO_BoardInfo_ResolutionsList + 12 /* The ResolutionsList is 12-bytes */
350 #define PSSO_BoardInfo_PaletteChipType		   PSSO_BoardInfo_BoardType + 4
351 #define PSSO_BoardInfo_GraphicsControllerType	   PSSO_BoardInfo_PaletteChipType + 4
352 #define PSSO_BoardInfo_MoniSwitch		   PSSO_BoardInfo_GraphicsControllerType + 4
353 #define PSSO_BoardInfo_BitsPerCannon		   PSSO_BoardInfo_MoniSwitch + 2
354 #define PSSO_BoardInfo_Flags			   PSSO_BoardInfo_BitsPerCannon + 2
355 #define PSSO_BoardInfo_SoftSpriteFlags		   PSSO_BoardInfo_Flags + 4
356 #define PSSO_BoardInfo_ChipFlags		   PSSO_BoardInfo_SoftSpriteFlags + 2
357 #define PSSO_BoardInfo_CardFlags		   PSSO_BoardInfo_ChipFlags + 2
358 #define PSSO_BoardInfo_BoardNum			   PSSO_BoardInfo_CardFlags + 4
359 #define PSSO_BoardInfo_RGBFormats		   PSSO_BoardInfo_BoardNum + 2
360 #define PSSO_BoardInfo_MaxHorValue		   PSSO_BoardInfo_RGBFormats + 2
361 #define PSSO_BoardInfo_MaxVerValue		   PSSO_BoardInfo_MaxHorValue + MAXMODES*2
362 #define PSSO_BoardInfo_MaxHorResolution		   PSSO_BoardInfo_MaxVerValue + MAXMODES*2
363 #define PSSO_BoardInfo_MaxVerResolution		   PSSO_BoardInfo_MaxHorResolution + MAXMODES*2
364 #define PSSO_BoardInfo_MaxMemorySize		   PSSO_BoardInfo_MaxVerResolution + MAXMODES*2
365 #define PSSO_BoardInfo_MaxChunkSize		   PSSO_BoardInfo_MaxMemorySize + 4
366 #define PSSO_BoardInfo_MemoryClock		   PSSO_BoardInfo_MaxChunkSize + 4
367 #define PSSO_BoardInfo_PixelClockCount		   PSSO_BoardInfo_MemoryClock + 4
368 #define PSSO_BoardInfo_AllocCardMem		   PSSO_BoardInfo_PixelClockCount + MAXMODES*4
369 #define PSSO_BoardInfo_SpecialFeatures		   PSSO_BoardInfo_AllocCardMem + 68*4 /* 68 function pointers */
370 #define PSSO_BoardInfo_ModeInfo			   PSSO_BoardInfo_SpecialFeatures + 12 /* SpecialFeatures is 12-bytes */
371 #define PSSO_BoardInfo_RGBFormat		   PSSO_BoardInfo_ModeInfo + 4
372 #define PSSO_BoardInfo_XOffset			   PSSO_BoardInfo_RGBFormat + 4
373 #define PSSO_BoardInfo_YOffset			   PSSO_BoardInfo_XOffset + 2
374 #define PSSO_BoardInfo_Depth			   PSSO_BoardInfo_YOffset + 2
375 #define PSSO_BoardInfo_ClearMask		   PSSO_BoardInfo_Depth + 1
376 #define PSSO_BoardInfo_Border			   PSSO_BoardInfo_ClearMask + 1
377 #define PSSO_BoardInfo_Mask			   PSSO_BoardInfo_Border + 2 /* BOOL type is only 2-bytes! */
378 #define PSSO_BoardInfo_CLUT			   PSSO_BoardInfo_Mask + 4
379 #define PSSO_BoardInfo_ViewPort			   PSSO_BoardInfo_CLUT + 3*256
380 #define PSSO_BoardInfo_VisibleBitMap		   PSSO_BoardInfo_ViewPort + 4
381 #define PSSO_BoardInfo_BitMapExtra		   PSSO_BoardInfo_VisibleBitMap + 4
382 #define PSSO_BoardInfo_BitMapList		   PSSO_BoardInfo_BitMapExtra + 4
383 #define PSSO_BoardInfo_MemList			   PSSO_BoardInfo_BitMapList + 12 /* BitMapList is 12-bytes */
384 #define PSSO_BoardInfo_MouseX			   PSSO_BoardInfo_MemList + 12 /* MemList is 12-bytes */
385 #define PSSO_BoardInfo_MouseY			   PSSO_BoardInfo_MouseX + 2
386 #define PSSO_BoardInfo_MouseWidth		   PSSO_BoardInfo_MouseY + 2
387 #define PSSO_BoardInfo_MouseHeight		   PSSO_BoardInfo_MouseWidth + 1
388 #define PSSO_BoardInfo_MouseXOffset		   PSSO_BoardInfo_MouseHeight + 1
389 #define PSSO_BoardInfo_MouseYOffset		   PSSO_BoardInfo_MouseXOffset + 1
390 #define PSSO_BoardInfo_MouseImage		   PSSO_BoardInfo_MouseYOffset + 1
391 #define PSSO_BoardInfo_MousePens		   PSSO_BoardInfo_MouseImage + 4
392 #define PSSO_BoardInfo_MouseRect		   PSSO_BoardInfo_MousePens + 4
393 #define PSSO_BoardInfo_MouseChunky		   PSSO_BoardInfo_MouseRect + 8 /* MouseRect is 8-bytes */
394 #define PSSO_BoardInfo_MouseRendered		   PSSO_BoardInfo_MouseChunky + 4
395 #define PSSO_BoardInfo_MouseSaveBuffer		   PSSO_BoardInfo_MouseRendered + 4
396 
397 struct BoardInfo {
398     uae_u8 *RegisterBase, *MemoryBase, *MemoryIOBase;
399     uae_u32 MemorySize;
400     char *BoardName, VBIName[32];
401 
402     uae_u16 MoniSwitch;
403     uae_u16 BitsPerCannon;
404     uae_u32 Flags;
405     uae_u16 SoftSpriteFlags;
406     uae_u16 ChipFlags;	/* private, chip specific, not touched by RTG */
407     uae_u32 CardFlags;	/* private, card specific, not touched by RTG */
408 
409     uae_u16 BoardNum;
410     uae_s16 RGBFormats;
411 
412     uae_u16 MaxHorValue[MAXMODES];
413     uae_u16 MaxVerValue[MAXMODES];
414     uae_u16 MaxHorResolution[MAXMODES];
415     uae_u16 MaxVerResolution[MAXMODES];
416     uae_u32 MaxMemorySize, MaxChunkSize;
417 };
418 
419 /* BoardInfo flags */
420 /*  0-15: hardware flags */
421 /* 16-31: user flags */
422 #define BIB_HARDWARESPRITE	0	/* board has hardware sprite */
423 #define BIB_NOMEMORYMODEMIX	1	/* board does not support modifying planar bitmaps while displaying chunky and vice versa */
424 #define BIB_NEEDSALIGNMENT	2	/* bitmaps have to be aligned (not yet supported!) */
425 #define BIB_DBLSCANDBLSPRITEY	8	/* hardware sprite y position is doubled on doublescan display modes */
426 #define BIB_ILACEHALFSPRITEY	9	/* hardware sprite y position is halved on interlace display modes */
427 #define BIB_ILACEDBLROWOFFSET	10	/* doubled row offset in interlaced display modes needs additional horizontal bit */
428 
429 #define BIB_FLICKERFIXER	12	/* board can flicker fix Amiga RGB signal */
430 #define BIB_VIDEOCAPTURE	13	/* board can capture video data to a memory area */
431 #define BIB_VIDEOWINDOW		14	/* board can display a second mem area as a pip */
432 #define BIB_BLITTER		15	/* board has blitter */
433 
434 #define BIB_HIRESSPRITE		16	/* mouse sprite has double resolution */
435 #define BIB_BIGSPRITE		17	/* user wants big mouse sprite */
436 #define BIB_BORDEROVERRIDE	18	/* user wants to override system overscan border prefs */
437 #define BIB_BORDERBLANK		19	/* user wants border blanking */
438 #define BIB_INDISPLAYCHAIN	20	/* board switches Amiga signal */
439 #define BIB_QUIET		21	/* not yet implemented */
440 #define BIB_NOMASKBLITS		22	/* perform blits without taking care of mask */
441 #define BIB_NOC2PBLITS		23	/* use CPU for planar to chunky conversions */
442 #define BIB_NOBLITTER		24	/* disable all blitter functions */
443 
444 #define BIB_IGNOREMASK	BIB_NOMASKBLITS
445 
446 #define BIF_HARDWARESPRITE	(1<<BIB_HARDWARESPRITE)
447 #define BIF_NOMEMORYMODEMIX	(1<<BIB_NOMEMORYMODEMIX)
448 #define BIF_NEEDSALIGNMENT	(1<<BIB_NEEDSALIGNMENT)
449 #define BIF_DBLSCANDBLSPRITEY	(1<<BIB_DBLSCANDBLSPRITEY)
450 #define BIF_ILACEHALFSPRITEY	(1<<BIB_ILACEHALFSPRITEY)
451 #define BIF_ILACEDBLROWOFFSET	(1<<BIB_ILACEDBLROWOFFSET)
452 #define BIF_FLICKERFIXER	(1<<BIB_FLICKERFIXER)
453 #define BIF_VIDEOCAPTURE	(1<<BIB_VIDEOCAPTURE)
454 #define BIF_VIDEOWINDOW		(1<<BIB_VIDEOWINDOW)
455 #define BIF_BLITTER		(1<<BIB_BLITTER)
456 #define BIF_HIRESSPRITE		(1<<BIB_HIRESSPRITE)
457 #define BIF_BIGSPRITE		(1<<BIB_BIGSPRITE)
458 #define BIF_BORDEROVERRIDE	(1<<BIB_BORDEROVERRIDE)
459 #define BIF_BORDERBLANK		(1<<BIB_BORDERBLANK)
460 #define BIF_INDISPLAYCHAIN	(1<<BIB_INDISPLAYCHAIN)
461 #define BIF_QUIET		(1<<BIB_QUIET)
462 #define BIF_NOMASKBLITS		(1<<BIB_NOMASKBLITS)
463 #define BIF_NOC2PBLITS		(1<<BIB_NOC2PBLITS)
464 #define BIF_NOBLITTER		(1<<BIB_NOBLITTER)
465 
466 #define BIF_IGNOREMASK	BIF_NOMASKBLITS
467 
468 /************************************************************************/
469 struct picasso96_state_struct
470 {
471     uae_u32		RGBFormat;   /* true-colour, CLUT, hi-colour, etc. */
472     struct MyCLUTEntry	CLUT[256];   /* Duh! */
473     uaecptr		Address;     /* Active screen address (Amiga-side) */
474     uaecptr		Extent;	     /* End address of screen (Amiga-side) */
475     uae_u16		Width;	     /* Active display width  (From SetGC) */
476     uae_u16		VirtualWidth;/* Total screen width (From SetPanning) */
477     uae_u16		BytesPerRow; /* Total screen width in bytes (From SetGC) */
478     uae_u16		Height;	     /* Active display height (From SetGC) */
479     uae_u16		VirtualHeight; /* Total screen height */
480     uae_u8		GC_Depth;    /* From SetGC() */
481     uae_u8		GC_Flags;    /* From SetGC() */
482     long		XOffset;     /* From SetPanning() */
483     long		YOffset;     /* From SetPanning() */
484     uae_u8		SwitchState; /* From SetSwitch() - 0 is Amiga, 1 is Picasso */
485     uae_u8		BytesPerPixel;
486     uae_u8		CardFound;
487 };
488 
489 extern void InitPicasso96 (void);
490 
491 extern uae_u32 picasso_SetDisplay (void);
492 extern uae_u32 picasso_WaitVerticalSync (void);
493 extern uae_u32 picasso_CalculateBytesPerRow (void);
494 extern uae_u32 picasso_FillRect (void);
495 extern uae_u32 picasso_BlitRect (void);
496 extern uae_u32 picasso_InvertRect (void);
497 extern uae_u32 picasso_SetPanning (void);
498 extern uae_u32 picasso_SetGC (void);
499 extern uae_u32 picasso_SetDAC (void);
500 extern uae_u32 picasso_SetColorArray (void);
501 extern uae_u32 picasso_SetSwitch (void);
502 extern uae_u32 picasso_SetSwitch (void);
503 extern uae_u32 picasso_FindCard (void);
504 extern uae_u32 picasso_InitCard (void);
505 extern uae_u32 picasso_BlitPlanar2Chunky (void);
506 extern uae_u32 picasso_BlitPlanar2Direct (void);
507 extern uae_u32 picasso_BlitTemplate (void);
508 extern uae_u32 picasso_BlitPattern (void);
509 extern uae_u32 picasso_BlitRectNoMaskComplete (void);
510 
511 extern uae_u32 gfxmem_mask;
512 extern uae_u8 *gfxmemory;
513 
514 extern int uaegfx_card_found;
515 
516 extern struct picasso96_state_struct picasso96_state;
517 
518 #ifdef _WIN32
519 extern unsigned int timer_id;
520 #endif
521 
522 extern int DX_FillRect (uaecptr mem, uae_u16 X, uae_u16 Y, uae_u16 Width, uae_u16 Height, uae_u32 Pen, uae_u8 Bpp);
523 extern void DX_BlitRect (struct RenderInfo *ri, uae_u16 srcx, uae_u16 srcy, uae_u16 dstx, uae_u16 dsty, uae_u16 w, uae_u16 h);
524 extern void DX_BlitRectFromBuffer (struct RenderInfo *ri, uae_u8* buffer, uae_u16 dstx, uae_u16 dsty, uae_u16 w, uae_u16 h);
525 extern void DX_InvertRect (struct RenderInfo *ri, uae_u16 X, uae_u16 Y, uae_u16 Width, uae_u16 Height);
526 extern void DX_SetPalette (int start, int count);
527 extern int DX_FillResolutions (uae_u16 *);
528 extern int DX_BitsPerCannon (void);
529 extern void DX_Invalidate (int first, int last);
530 extern void picasso_enablescreen (int on);
531 extern void picasso_refresh (void);
532 extern void picasso_handle_vsync (void);
533 
534 extern uae_u8 *gfxmemory;
535 
536 /* This structure describes the UAE-side framebuffer for the Picasso
537  * screen.  */
538 struct picasso_vidbuf_description {
539     int width, height, depth;
540     int rowbytes, pixbytes;
541     int extra_mem; /* nonzero if there's a second buffer that must be updated */
542     uae_u32 rgbformat;
543     uae_u32 selected_rgbformat;
544     uae_u32 clut[256];
545 };
546 
547 extern struct picasso_vidbuf_description picasso_vidinfo;
548 
549 extern int screen_is_picasso;
550 
551 extern void gfx_set_picasso_modeinfo (int w, int h, int d, int rgbfmt);
552 extern void gfx_set_picasso_baseaddr (uaecptr);
553 extern void gfx_set_picasso_state (int on);
554 extern uae_u8 *gfx_lock_picasso (void);
555 extern void gfx_unlock_picasso (void);
556 extern int picasso_display_mode_index (uae_u32 x, uae_u32 y, uae_u32 d);
557 extern int picasso_nr_resolutions (void);
558 extern void picasso_clip_mouse (int *, int *);
559 
560 #endif
561