2 #include "../port/lib.h"
7 #include "../port/error.h"
15 typedef struct Cursor546x Cursor546x;
30 clgd546xlinear(VGAscr* scr, int, int)
36 clgd546xenable(VGAscr* scr)
42 if((p = pcimatch(nil, 0x1013, 0)) == nil)
54 scr->mmio = vmap(p->mem[1].bar&~0x0F, p->mem[1].size);
57 addvgaseg("clgd546xmmio", p->mem[1].bar&~0x0F, p->mem[1].size);
61 clgd546xcurdisable(VGAscr* scr)
63 Cursor546x *cursor546x;
67 cursor546x = (Cursor546x*)((uchar*)scr->mmio+CursorMMIO);
68 cursor546x->enable = 0;
72 clgd546xcurload(VGAscr* scr, Cursor* curs)
76 Cursor546x *cursor546x;
80 cursor546x = (Cursor546x*)((uchar*)scr->mmio+CursorMMIO);
83 * Disable the cursor then change only the bits
86 cursor546x->enable = 0;
87 p = (uchar*)scr->vaddr + scr->storage;
88 for(y = 0; y < 16; y++){
91 for(i = 0; i < 8; i++){
96 c = curs->set[2*y + 1];
98 for(i = 0; i < 8; i++){
104 c = curs->set[2*y]|curs->clr[2*y];
106 for(i = 0; i < 8; i++){
111 c = curs->set[2*y + 1]|curs->clr[2*y + 1];
113 for(i = 0; i < 8; i++){
122 * Save the cursor hotpoint and enable the cursor.
124 scr->offset = curs->offset;
125 cursor546x->enable = 1;
129 clgd546xcurmove(VGAscr* scr, Point p)
132 Cursor546x *cursor546x;
136 cursor546x = (Cursor546x*)((uchar*)scr->mmio+CursorMMIO);
138 if((x = p.x+scr->offset.x) < 0){
144 if((y = p.y+scr->offset.y) < 0){
151 cursor546x->preset = (xo<<8)|yo;
159 clgd546xcurenable(VGAscr* scr)
162 Cursor546x *cursor546x;
167 cursor546x = (Cursor546x*)((uchar*)scr->mmio+CursorMMIO);
171 * Can't call setcolor here as cursor is already locked.
173 p = (uchar*)scr->mmio+PaletteState;
186 * Find a place for the cursor data in display memory.
187 * 2 cursor images might be needed, 1KB each so use the last
188 * 2KB of the framebuffer and initialise them to be
191 scr->storage = ((vgaxi(Seqx, 0x14) & 0x07)+1)*1024*1022;
192 cursor546x->addr = (scr->storage>>10)<<2;
193 memset((uchar*)scr->vaddr + scr->storage, 0, 2*64*16);
196 * Load, locate and enable the 64x64 cursor.
198 clgd546xcurload(scr, &arrow);
199 clgd546xcurmove(scr, ZP);
200 cursor546x->enable = 1;
203 VGAdev vgaclgd546xdev = {
212 VGAcur vgaclgd546xcur = {