2 #include "../port/lib.h"
7 #include "../port/error.h"
16 * TVP3020 Viewpoint Video Interface Pallette.
17 * Assumes hooked up to an S3 86C928.
20 Index = 0x06, /* Index register */
21 Data = 0x07, /* Data register */
25 * Lower 2-bits of indirect DAC register
28 static ushort dacxreg[4] = {
29 PaddrW, Pdata, Pixmask, PaddrR
33 tvp3020io(uchar reg, uchar data)
37 crt55 = vgaxi(Crtx, 0x55) & 0xFC;
38 vgaxo(Crtx, 0x55, crt55|((reg>>2) & 0x03));
39 vgao(dacxreg[reg & 0x03], data);
45 tvp3020xo(uchar index, uchar data)
49 crt55 = tvp3020io(Index, index);
50 vgao(dacxreg[Data & 0x03], data);
51 vgaxo(Crtx, 0x55, crt55);
55 tvp3020disable(VGAscr*)
62 * cursor control enable for Bt485 DAC (!);
63 * the hardware cursor external operation mode.
65 tvp3020xo(0x06, 0x10); /* Cursor Control Register */
67 r = vgaxi(Crtx, 0x45) & ~0x20;
70 r = vgaxi(Crtx, 0x55) & ~0x20;
75 tvp3020enable(VGAscr*)
80 * Make sure cursor is off by initialising the cursor
81 * control to defaults + X-Windows cursor mode.
83 tvp3020xo(0x06, 0x10); /* Cursor Control Register */
87 * cursor colour 1 (white),
88 * cursor colour 2 (black).
90 tvp3020xo(0x20, Pwhite); tvp3020xo(0x21, Pwhite); tvp3020xo(0x22, Pwhite);
91 tvp3020xo(0x23, Pwhite); tvp3020xo(0x24, Pwhite); tvp3020xo(0x25, Pwhite);
92 tvp3020xo(0x26, Pblack); tvp3020xo(0x27, Pblack); tvp3020xo(0x28, Pblack);
96 * the hardware cursor external operation mode;
97 * cursor control enable for Bt485 DAC (!).
99 r = vgaxi(Crtx, 0x55)|0x20;
100 vgaxo(Crtx, 0x55, r);
102 r = vgaxi(Crtx, 0x45)|0x20;
103 vgaxo(Crtx, 0x45, r);
107 tvp3020load(VGAscr*, Cursor* curs)
113 * Make sure cursor is off by initialising the cursor
114 * control to defaults + X-Windows cursor mode.
116 tvp3020xo(0x06, 0x10); /* Cursor Control Register */
119 * Initialise the cursor RAM LS and MS address
120 * (LS must be first).
122 tvp3020xo(0x08, 0x00); /* Cursor RAM LS Address */
123 tvp3020xo(0x09, 0x00); /* Cursor RAM MS Address */
126 * Initialise the 64x64 cursor RAM array. There are 2 planes,
127 * p0 and p1. Data is written 4 pixels per byte, with p1 the
128 * MS bit of each pixel.
129 * The cursor is set in X-Windows mode which gives the following
132 * 0 0 underlying pixel colour
133 * 0 1 underlying pixel colour
134 * 1 0 cursor colour 1
135 * 1 1 cursor colour 2
136 * Put the cursor into the top-left of the 64x64 array.
138 for(y = 0; y < 64; y++){
139 for(x = 0; x < 64/8; x++){
140 if(x < 16/8 && y < 16){
141 p0 = curs->clr[x+y*2];
142 p1 = curs->set[x+y*2];
161 tvp3020xo(0x0A, p); /* Cursor RAM Data */
180 tvp3020xo(0x0A, p); /* Cursor RAM Data */
183 tvp3020xo(0x0A, 0x00); /* Cursor RAM Data */
184 tvp3020xo(0x0A, 0x00);
190 * Initialise the cursor hotpoint
191 * and enable the cursor.
193 tvp3020xo(0x04, -curs->offset.x); /* Sprite Origin X */
194 tvp3020xo(0x05, -curs->offset.y); /* Sprite Origin Y */
196 tvp3020xo(0x06, 0x40|0x10); /* Cursor Control Register */
200 tvp3020move(VGAscr*, Point p)
202 tvp3020xo(0x00, p.x & 0xFF); /* Cursor Position X LSB */
203 tvp3020xo(0x01, (p.x>>8) & 0x0F); /* Cursor Position X MSB */
204 tvp3020xo(0x02, p.y & 0xFF); /* Cursor Position Y LSB */
205 tvp3020xo(0x03, (p.y>>8) & 0x0F); /* Cursor Position Y MSB */
210 VGAcur vgatvp3020cur = {