2 #include "../port/lib.h"
7 #include "../port/error.h"
16 Xrx = 0x3D6, /* Configuration Extensions Index */
20 hiqvideoxi(long port, uchar index)
31 hiqvideoxo(long port, uchar index, uchar data)
38 hiqvideolinear(VGAscr*, int, int)
43 hiqvideoenable(VGAscr* scr)
49 * Only once, can't be disabled for now.
54 if(p == nil || p->vid != 0x102C)
57 case 0x00C0: /* 69000 HiQVideo */
60 case 0x00E0: /* 65550 HiQV32 */
61 case 0x00E4: /* 65554 HiQV32 */
62 case 0x00E5: /* 65555 HiQV32 */
63 switch((hiqvideoxi(Xrx, 0x43)>>1) & 0x03){
79 addvgaseg("hiqvideoscreen", scr->paddr, scr->apsize);
82 * Find a place for the cursor data in display memory.
83 * Must be on a 4096-byte boundary.
84 * scr->mmio holds the virtual address of the cursor
85 * storage area in the framebuffer region.
87 scr->storage = vmsize-4096;
88 scr->mmio = (ulong*)((uchar*)scr->vaddr+scr->storage);
92 hiqvideocurdisable(VGAscr*)
94 hiqvideoxo(Xrx, 0xA0, 0x10);
98 hiqvideocurload(VGAscr* scr, Cursor* curs)
104 * Disable the cursor.
106 hiqvideocurdisable(scr);
110 p = (uchar*)scr->mmio;
112 for(y = 0; y < 16; y += 2){
113 *p++ = ~(curs->clr[2*y]|curs->set[2*y]);
114 *p++ = ~(curs->clr[2*y+1]|curs->set[2*y+1]);
117 *p++ = ~(curs->clr[2*y+2]|curs->set[2*y+2]);
118 *p++ = ~(curs->clr[2*y+3]|curs->set[2*y+3]);
121 *p++ = curs->set[2*y];
122 *p++ = curs->set[2*y+1];
125 *p++ = curs->set[2*y+2];
126 *p++ = curs->set[2*y+3];
131 for(x = 0; x < 64; x += 8)
133 for(x = 0; x < 64; x += 8)
139 * Save the cursor hotpoint and enable the cursor.
141 scr->offset = curs->offset;
142 hiqvideoxo(Xrx, 0xA0, 0x11);
146 hiqvideocurmove(VGAscr* scr, Point p)
153 if((x = p.x+scr->offset.x) < 0)
154 x = 0x8000|(-x & 0x07FF);
155 if((y = p.y+scr->offset.y) < 0)
156 y = 0x8000|(-y & 0x07FF);
158 hiqvideoxo(Xrx, 0xA4, x & 0xFF);
159 hiqvideoxo(Xrx, 0xA5, (x>>8) & 0xFF);
160 hiqvideoxo(Xrx, 0xA6, y & 0xFF);
161 hiqvideoxo(Xrx, 0xA7, (y>>8) & 0xFF);
167 hiqvideocurenable(VGAscr* scr)
176 * Disable the cursor.
178 hiqvideocurdisable(scr);
182 * Can't call setcolor here as cursor is already locked.
183 * When done make sure the cursor enable in Xr80 is set.
185 xr80 = hiqvideoxi(Xrx, 0x80);
186 hiqvideoxo(Xrx, 0x80, xr80|0x01);
194 hiqvideoxo(Xrx, 0x80, xr80|0x10);
196 hiqvideoxo(Xrx, 0xA2, (scr->storage>>12)<<4);
197 hiqvideoxo(Xrx, 0xA3, (scr->storage>>16) & 0x3F);
200 * Load, locate and enable the 32x32 cursor.
201 * Cursor enable in Xr80 better be set already.
203 hiqvideocurload(scr, &arrow);
204 hiqvideocurmove(scr, ZP);
205 hiqvideoxo(Xrx, 0xA0, 0x11);
208 VGAdev vgahiqvideodev = {
211 hiqvideoenable, /* enable */
214 hiqvideolinear, /* linear */
217 VGAcur vgahiqvideocur = {
220 hiqvideocurenable, /* enable */
221 hiqvideocurdisable, /* disable */
222 hiqvideocurload, /* load */
223 hiqvideocurmove, /* move */