1 /*----------------------------------------------------------------------
\r
7 ; ****** XLIB - Mode X graphics library ****************
\r
8 ; ****** ****************
\r
9 ; ****** Written By Themie Gouthas ****************
\r
11 ; egg@dstos3.dsto.gov.au
\r
12 ; teg@bart.dsto.gov.au
\r
14 ; Header file contributed by Darren Lyon (darren@nicky.DIALix.oz.au)
\r
17 ; Terminology & notes:
\r
19 ; SRAM == System RAM
\r
20 ; X coordinates are in pixels unless explicitly stated
\r
22 ;----------------------------------------------------------------------*/
\r
27 #define BYTE unsigned char
\r
28 #define WORD unsigned int
\r
31 #define X_MODE_320x200 0
\r
32 #define X_MODE_320x240 1
\r
33 #define X_MODE_360x200 2
\r
34 #define X_MODE_360x240 3
\r
35 #define X_MODE_376x282 4
\r
36 #define X_MODE_320x400 5
\r
37 #define X_MODE_320x480 6
\r
38 #define X_MODE_360x400 7
\r
39 #define X_MODE_360x480 8
\r
40 #define X_MODE_360x360 9
\r
41 #define X_MODE_376x308 10
\r
42 #define X_MODE_376x564 11
\r
43 #define X_MODE_256x400 12
\r
44 #define X_MODE_256x480 13
\r
50 #define X_MODE_INVALID -1
\r
54 /* FUNCTIONS =========================================================== */
\r
61 WORD mode, /* Initialize x mode */
\r
62 WORD WidthInPixels);
\r
64 void x_select_default_plane( /*Enables Read/Write access to a */
\r
65 BYTE plane); /* a specified plane */
\r
67 void x_set_splitscreen( /* set the split screen start */
\r
68 WORD line); /*scan line (initialize) */
\r
70 void x_set_start_addr(
\r
71 WORD X, /* Set the screen start */
\r
72 WORD Y); /* address in video ram */
\r
74 void x_hide_splitscreen(void); /* Disable the split screen (Split */
\r
75 /* Screen RAM remains reserved) */
\r
77 void x_show_splitscreen(void); /* Enable the split screen (given it */
\r
78 /* was previously "hidden") */
\r
81 void x_adjust_splitscreen( /* Adjust the start scan line of the */
\r
82 WORD line); /* split screen */
\r
85 WORD x_set_doublebuffer( /* Enable double buffering with a */
\r
86 WORD PageHeight); /* specified page height */
\r
88 WORD x_set_tripplebuffer( /* Enable tripple buffering with a */
\r
89 WORD PageHeight); /* specified page height */
\r
92 void x_page_flip( /* Swap visible page (only when double */
\r
93 WORD X, /* buffering is active) & sets virt start*/
\r
96 void x_set_cliprect( /* Define the clipping rectangle */
\r
97 WORD left, /* NOTE: left and right are in bytes */
\r
102 void x_text_mode(void); /* return to text mode */
\r
103 void x_wait_vsync(void); /* wait for vsync */
\r
110 /* VARIABLES =========================================================== */
\r
112 extern BYTE InGraphics; /* non zero if in X graphics mode */
\r
113 extern WORD CurrXMode; /* contains current X graphics mode id */
\r
114 extern WORD ScrnPhysicalByteWidth; /* Physical screen width in bytes */
\r
115 extern WORD ScrnPhysicalPixelWidth; /* Physical screen width in pixels */
\r
116 extern WORD ScrnPhysicalHeight; /* Physical screen height in pixels */
\r
117 extern WORD ErrorValue; /* Error return value */
\r
118 extern WORD SplitScrnOffs; /* Offset in VRAM of split screen */
\r
119 extern WORD SplitScrnScanLine; /* Scan line split screen starts at */
\r
120 /* initially. Resizing the split scrn */
\r
121 /* using the other functions does not */
\r
122 /* change this value */
\r
123 extern WORD SplitScrnVisibleHeight; /* Height of the visible portion of the*/
\r
124 /* split screen. */
\r
125 extern WORD Page0_Offs; /* Offset in VRAM of main virt. screen */
\r
126 extern WORD Page1_Offs; /* Offset in VRAM of 2nd virt. screen */
\r
127 extern WORD Page2_Offs; /* Offset in VRAM of 3rd virt. screen */
\r
128 extern WORD ScrnLogicalByteWidth; /* Virtual screen width in bytes */
\r
129 extern WORD ScrnLogicalPixelWidth; /* Virtual screen width in pixels */
\r
130 extern WORD ScrnLogicalHeight; /* Virtual screen height in pixels */
\r
131 extern WORD MaxScrollX; /* Max X position of physical screen */
\r
132 /* within virtual screen */
\r
133 extern WORD MaxScrollY; /* Max Y position of physical screen */
\r
134 /* within virtual screen */
\r
135 extern WORD DoubleBufferActive; /* Indicates whether double buffering */
\r
137 extern WORD TrippleBufferActive; /* Indicates whether tripple */
\r
138 /* buffering is active */
\r
139 extern WORD VisiblePageIdx; /* Index number of visible page 0 or 1 */
\r
140 extern WORD HiddenPageOffs; /* Offset of Hidden Pg | only valid */
\r
141 extern WORD VisiblePageOffs; /* Offset of Visible Pg| for D.B. mode */
\r
142 extern WORD WaitingPageOffs; /* Offset of Waiting Pg| for T.B. mode */
\r
143 extern WORD NonVisual_Offs; /* Offset of first non-visible VRAM */
\r
145 extern WORD StartAddressFlag;
\r
147 extern WORD TopClip; /* Clipping rectangle */
\r
148 extern WORD BottomClip;
\r
149 extern WORD LeftClip;
\r
150 extern WORD RightClip;
\r
152 extern WORD PhysicalStartPixelX; /* Coordinates of physical (visible) */
\r
153 extern WORD PhysicalStartByteX; /* screen relative to the virtual */
\r
154 extern WORD PhysicalStartY; /* screen's U.L. corner */
\r
156 extern char* VsyncPaletteBuffer;
\r