2 #include "../port/lib.h"
7 #include "../port/error.h"
17 * 170/220MHz High Performance Palette DAC.
19 * Assumes hooked up to an S3 Vision96[48].
28 enum { /* index registers */
51 * Lower 2-bits of indirect DAC register
54 static ushort dacxreg[4] = {
55 PaddrW, Pdata, Pixmask, PaddrR
63 rs2 = vgaxi(Crtx, 0x55);
64 vgaxo(Crtx, 0x55, (rs2 & 0xFC)|0x01);
70 rgb524xo(int index, uchar data)
72 vgao(dacxreg[IndexLo], index & 0xFF);
73 vgao(dacxreg[IndexHi], (index>>8) & 0xFF);
74 vgao(dacxreg[Data], data);
78 rgb524disable(VGAscr*)
83 rgb524xo(CursorCtl, 0x00);
84 vgaxo(Crtx, 0x55, rs2);
95 * Make sure cursor is off by initialising the cursor
96 * control to defaults.
98 rgb524xo(CursorCtl, 0x00);
101 * Cursor colour 1 (white),
102 * cursor colour 2 (black).
104 rgb524xo(CursorR1, Pwhite); rgb524xo(CursorG1, Pwhite); rgb524xo(CursorB1, Pwhite);
105 rgb524xo(CursorR2, Pblack); rgb524xo(CursorG2, Pblack); rgb524xo(CursorB2, Pblack);
108 * Enable the cursor, 32x32, mode 2.
110 rgb524xo(CursorCtl, 0x23);
112 vgaxo(Crtx, 0x55, rs2);
116 rgb524load(VGAscr*, Cursor* curs)
118 uchar p, p0, p1, rs2;
121 rs2 = rgb524setrs2();
124 * Make sure cursor is off by initialising the cursor
125 * control to defaults.
127 rgb524xo(CursorCtl, 0x00);
130 * Set auto-increment mode for index-register addressing
131 * and initialise the cursor array index.
133 vgao(dacxreg[IndexCtl], 0x01);
134 vgao(dacxreg[IndexLo], CursorArray & 0xFF);
135 vgao(dacxreg[IndexHi], (CursorArray>>8) & 0xFF);
138 * Initialise the 32x32 cursor RAM array. There are 2 planes,
139 * p0 and p1. Data is written 4 pixels per byte, with p1 the
140 * MS bit of each pixel.
141 * The cursor is set in X-Windows mode which gives the following
144 * 0 0 underlying pixel colour
145 * 0 1 underlying pixel colour
146 * 1 0 cursor colour 1
147 * 1 1 cursor colour 2
148 * Put the cursor into the top-left of the 32x32 array.
150 for(y = 0; y < 32; y++){
151 for(x = 0; x < 32/8; x++){
152 if(x < 16/8 && y < 16){
153 p0 = curs->clr[x+y*2];
154 p1 = curs->set[x+y*2];
173 vgao(dacxreg[Data], p);
192 vgao(dacxreg[Data], p);
195 vgao(dacxreg[Data], 0x00);
196 vgao(dacxreg[Data], 0x00);
202 * Initialise the cursor hotpoint,
203 * enable the cursor and restore state.
205 rgb524xo(CursorHotX, -curs->offset.x);
206 rgb524xo(CursorHotY, -curs->offset.y);
208 rgb524xo(CursorCtl, 0x23);
210 vgaxo(Crtx, 0x55, rs2);
214 rgb524move(VGAscr*, Point p)
218 rs2 = rgb524setrs2();
220 rgb524xo(CursorXLo, p.x & 0xFF);
221 rgb524xo(CursorXHi, (p.x>>8) & 0x0F);
222 rgb524xo(CursorYLo, p.y & 0xFF);
223 rgb524xo(CursorYHi, (p.y>>8) & 0x0F);
225 vgaxo(Crtx, 0x55, rs2);
230 VGAcur vgargb524cur = {