| plan 9 kernel history: overview | file list | diff list |
1995/0516/pc/vgaark2000pv.c (diff list | history)
| 1995/0512/sys/src/9/pc/vgaark2000pv.c:9,21 – 1995/0516/sys/src/9/pc/vgaark2000pv.c:9,205 (short | long) | ||
| 1995/0512 | #include "screen.h" #include "vga.h" | |
| 1995/0516 | extern Bitmap gscreen; extern Cursor curcursor; static Lock ark2000pvlock; static ulong storage; static Point hotpoint; | |
| 1995/0512 | static void | |
| 1995/0516 | setark2000pvpage(int page) | |
| 1995/0512 | { vgaxo(Seqx, 0x15, page); vgaxo(Seqx, 0x16, page); } | |
| 1995/0516 | static void disable(void) { uchar seq20; seq20 = vgaxi(Seqx, 0x20) & ~0x08; vgaxo(Seqx, 0x20, seq20); } static void enable(void) { uchar seq20; /* * Disable the cursor then configure for X-Windows style, * 64x64 and 4/8-bit colour depth. * Set cursor colours for 4/8-bit. */ seq20 = vgaxi(Seqx, 0x20) & ~0x1F; vgaxo(Seqx, 0x20, seq20); seq20 |= 0x1C; vgaxo(Seqx, 0x26, Pwhite); vgaxo(Seqx, 0x27, Pwhite); vgaxo(Seqx, 0x28, Pwhite); vgaxo(Seqx, 0x29, Pblack); vgaxo(Seqx, 0x2A, Pblack); vgaxo(Seqx, 0x2B, Pblack); /* * Cursor storage is a 1Kb block located in the last 16Kb * of video memory. Crt25 is the index of which 1Kb block. */ storage = (vgaxi(Seqx, 0x10)>>6) & 0x03; storage = (1024*1024)<<storage; storage -= 1024; vgaxo(Seqx, 0x25, 0x3C); /* * Enable the cursor. */ vgaxo(Seqx, 0x20, seq20); } static void load(Cursor *c) { uchar *p, seq20; int x, y; /* * Lock the display memory so we can update the * cursor bitmap if necessary. * If it's the same as the last cursor we loaded, * just make sure it's enabled. */ seq20 = vgaxi(Seqx, 0x20); lock(&ark2000pvlock); if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ vgaxo(Seqx, 0x20, 0x80|seq20); unlock(&ark2000pvlock); return; } memmove(&curcursor, c, sizeof(Cursor)); /* * Is linear addressing turned on? This will determine * how we access the cursor storage. */ if(vgaxi(Seqx, 0x10) & 0x10) p = ((uchar*)gscreen.base) + storage; else { setark2000pvpage(storage>>16); p = ((uchar*)gscreen.base) + (storage & 0xFFFF); } /* * The cursor is set in X11 mode which gives the following * truth table: * and xor colour * 0 0 underlying pixel colour * 0 1 underlying pixel colour * 1 0 background colour * 1 1 foreground colour * Put the cursor into the top-left of the 64x64 array. * The manual doesn't say what the data layout in memory is - * this worked out by trial and error. */ for(y = 0; y < 64; y++){ for(x = 0; x < 64/8; x++){ if(x < 16/8 && y < 16){ *p++ = c->clr[2*y + x]|c->set[2*y + x]; *p++ = c->set[2*y + x]; } else { *p++ = 0x00; *p++ = 0x00; } } } /* * Set the cursor hotpoint and enable the cursor. */ hotpoint = c->offset; vgaxo(Seqx, 0x20, 0x80|seq20); unlock(&ark2000pvlock); } static int move(Point p) { int x, xo, y, yo; if(canlock(&ark2000pvlock) == 0) return 1; /* * Mustn't position the cursor offscreen even partially, * or it might disappear. Therefore, if x or y is -ve, adjust the * cursor origins instead. */ if((x = p.x+hotpoint.x) < 0){ xo = -x; x = 0; } else xo = 0; if((y = p.y+hotpoint.y) < 0){ yo = -y; y = 0; } else yo = 0; /* * Load the new values. */ vgaxo(Seqx, 0x2C, xo); vgaxo(Seqx, 0x2D, yo); vgaxo(Seqx, 0x21, (x>>8) & 0x0F); vgaxo(Seqx, 0x22, x & 0xFF); vgaxo(Seqx, 0x23, (y>>8) & 0x0F); vgaxo(Seqx, 0x24, y & 0xFF); unlock(&ark2000pvlock); return 0; } Hwgc ark2000pvhwgc = { "ark2000pvhwgc", enable, load, move, disable, 0, }; static void ark2000pvpage(int page) { /* * Shouldn't need to lock if linear addressing * is enabled. */ if((vgaxi(Seqx, 0x10) & 0x10) == 0 && hwgc == &ark2000pvhwgc){ lock(&ark2000pvlock); setark2000pvpage(page); unlock(&ark2000pvlock); } else setark2000pvpage(page); } | |
| 1995/0512 | static Vgac ark2000pv = { "ark2000pv", ark2000pvpage, | |
| 1995/0512/sys/src/9/pc/vgaark2000pv.c:27,30 – 1995/0516/sys/src/9/pc/vgaark2000pv.c:211,215 | ||
| 1995/0512 | vgaark2000pvlink(void) { addvgaclink(&ark2000pv); | |
| 1995/0516 | addhwgclink(&ark2000pvhwgc); | |
| 1995/0512 | } | |
| 1995/0516/sys/src/9/pc/vgaark2000pv.c:80,94 – 1995/0623/sys/src/9/pc/vgaark2000pv.c:80,95 (short | long) | ||
| 1995/0516 | * If it's the same as the last cursor we loaded, * just make sure it's enabled. */ | |
| 1995/0623 | seq20 = vgaxi(Seqx, 0x20); | |
| 1995/0516 | if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ | |
| 1995/0623 | vgaxo(Seqx, 0x20, seq20|0x08); | |
| 1995/0516 | unlock(&ark2000pvlock); return; } memmove(&curcursor, c, sizeof(Cursor)); | |
| 1995/0623 | vgaxo(Seqx, 0x20, seq20 & ~0x08); | |
| 1995/0516 | /* * Is linear addressing turned on? This will determine * how we access the cursor storage. | |
| 1995/0516/sys/src/9/pc/vgaark2000pv.c:129,135 – 1995/0623/sys/src/9/pc/vgaark2000pv.c:130,136 | ||
| 1995/0516 | * Set the cursor hotpoint and enable the cursor. */ hotpoint = c->offset; | |
| 1995/0623 | vgaxo(Seqx, 0x20, seq20|0x08); | |
| 1995/0516 | unlock(&ark2000pvlock); } | |
| 1995/0623/sys/src/9/pc/vgaark2000pv.c:120,127 – 1995/0624/sys/src/9/pc/vgaark2000pv.c:120,127 (short | long) | ||
| 1995/0516 | *p++ = c->set[2*y + x]; } else { | |
| 1995/0624 | *p++ = 0xAA; *p++ = 0x55; | |
| 1995/0516 | } } } | |
| 1995/0624/sys/src/9/pc/vgaark2000pv.c:89,95 – 1995/0808/sys/src/9/pc/vgaark2000pv.c:89,97 (short | long) | ||
| 1995/0516 | } memmove(&curcursor, c, sizeof(Cursor)); | |
| 1995/0808 | #ifdef notdef | |
| 1995/0623 | vgaxo(Seqx, 0x20, seq20 & ~0x08); | |
| 1995/0808 | #endif | |
| 1995/0516 | /* * Is linear addressing turned on? This will determine * how we access the cursor storage. | |
| 1995/0624/sys/src/9/pc/vgaark2000pv.c:120,127 – 1995/0808/sys/src/9/pc/vgaark2000pv.c:122,129 | ||
| 1995/0516 | *p++ = c->set[2*y + x]; } else { | |
| 1995/0624 |
| |
| 1995/0808 | *p++ = 0x00; *p++ = 0x00; | |
| 1995/0516 | } } } | |
| 1995/0624/sys/src/9/pc/vgaark2000pv.c:130,136 – 1995/0808/sys/src/9/pc/vgaark2000pv.c:132,140 | ||
| 1995/0516 | * Set the cursor hotpoint and enable the cursor. */ hotpoint = c->offset; | |
| 1995/0808 | #ifdef notdef | |
| 1995/0623 | vgaxo(Seqx, 0x20, seq20|0x08); | |
| 1995/0808 | #endif | |
| 1995/0516 | unlock(&ark2000pvlock); } | |
| 1995/0808/sys/src/9/pc/vgaark2000pv.c:154,169 – 1995/0812/sys/src/9/pc/vgaark2000pv.c:154,169 (short | long) | ||
| 1995/0516 | */ if((x = p.x+hotpoint.x) < 0){ xo = -x; | |
| 1995/0812 | x = 1; | |
| 1995/0516 | } else | |
| 1995/0812 | xo = 1; | |
| 1995/0516 | if((y = p.y+hotpoint.y) < 0){ yo = -y; | |
| 1995/0812 | y = 1; | |
| 1995/0516 | } else | |
| 1995/0812 | yo = 1; | |
| 1995/0516 | /* * Load the new values. | |
| 1995/0812/sys/src/9/pc/vgaark2000pv.c:154,169 – 1995/0822/sys/src/9/pc/vgaark2000pv.c:154,169 (short | long) | ||
| 1995/0516 | */ if((x = p.x+hotpoint.x) < 0){ xo = -x; | |
| 1995/0812 |
| |
| 1995/0822 | x = 0; | |
| 1995/0516 | } else | |
| 1995/0812 |
| |
| 1995/0822 | xo = 0; | |
| 1995/0516 | if((y = p.y+hotpoint.y) < 0){ yo = -y; | |
| 1995/0812 |
| |
| 1995/0822 | y = 0; | |
| 1995/0516 | } else | |
| 1995/0812 |
| |
| 1995/0822 | yo = 0; | |
| 1995/0516 | /* * Load the new values. | |
| 1995/0822/sys/src/9/pc/vgaark2000pv.c:179,185 – 1996/0215/sys/src/9/pc/vgaark2000pv.c:179,185 (short | long) | ||
| 1995/0516 | return 0; } | |
| 1996/0215 | static Hwgc ark2000pvhwgc = { | |
| 1995/0516 | "ark2000pvhwgc", enable, load, | |
| 1996/0215/sys/src/9/pc/vgaark2000pv.c:39,50 – 1996/0216/sys/src/9/pc/vgaark2000pv.c:39,50 (short | long) | ||
| 1995/0516 | /* * Disable the cursor then configure for X-Windows style, | |
| 1996/0216 | * 32x32 and 4/8-bit colour depth. | |
| 1995/0516 | * Set cursor colours for 4/8-bit. */ seq20 = vgaxi(Seqx, 0x20) & ~0x1F; vgaxo(Seqx, 0x20, seq20); | |
| 1996/0216 | seq20 |= 0x18; | |
| 1995/0516 | vgaxo(Seqx, 0x26, Pwhite); vgaxo(Seqx, 0x27, Pwhite); | |
| 1996/0215/sys/src/9/pc/vgaark2000pv.c:54,66 – 1996/0216/sys/src/9/pc/vgaark2000pv.c:54,66 | ||
| 1995/0516 | vgaxo(Seqx, 0x2B, Pblack); /* | |
| 1996/0216 | * Cursor storage is a 256 byte or 1Kb block located in the last * 16Kb of video memory. Crt25 is the index of which block. | |
| 1995/0516 | */ storage = (vgaxi(Seqx, 0x10)>>6) & 0x03; storage = (1024*1024)<<storage; | |
| 1996/0216 | storage -= 256; vgaxo(Seqx, 0x25, 0x3F); | |
| 1995/0516 | /* * Enable the cursor. | |
| 1996/0215/sys/src/9/pc/vgaark2000pv.c:71,77 – 1996/0216/sys/src/9/pc/vgaark2000pv.c:71,77 | ||
| 1995/0516 | static void load(Cursor *c) { | |
| 1996/0216 | uchar *p; | |
| 1995/0516 | int x, y; /* | |
| 1996/0215/sys/src/9/pc/vgaark2000pv.c:81,97 – 1996/0216/sys/src/9/pc/vgaark2000pv.c:81,93 | ||
| 1995/0516 | * just make sure it's enabled. */ lock(&ark2000pvlock); | |
| 1995/0623 |
| |
| 1995/0516 | if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ | |
| 1995/0623 |
| |
| 1996/0216 | vgaxo(Seqx, 0x20, vgaxi(Seqx, 0x20)|0x08); | |
| 1995/0516 | unlock(&ark2000pvlock); return; } memmove(&curcursor, c, sizeof(Cursor)); | |
| 1995/0808 |
| |
| 1995/0623 |
| |
| 1995/0808 |
| |
| 1995/0516 | /* * Is linear addressing turned on? This will determine * how we access the cursor storage. | |
| 1996/0215/sys/src/9/pc/vgaark2000pv.c:111,122 – 1996/0216/sys/src/9/pc/vgaark2000pv.c:107,118 | ||
| 1995/0516 | * 0 1 underlying pixel colour * 1 0 background colour * 1 1 foreground colour | |
| 1996/0216 | * Put the cursor into the top-left of the 32x32 array. | |
| 1995/0516 | * The manual doesn't say what the data layout in memory is - * this worked out by trial and error. */ | |
| 1996/0216 | for(y = 0; y < 32; y++){ for(x = 0; x < 32/8; x++){ | |
| 1995/0516 | if(x < 16/8 && y < 16){ *p++ = c->clr[2*y + x]|c->set[2*y + x]; *p++ = c->set[2*y + x]; | |
| 1996/0215/sys/src/9/pc/vgaark2000pv.c:132,140 – 1996/0216/sys/src/9/pc/vgaark2000pv.c:128,133 | ||
| 1995/0516 | * Set the cursor hotpoint and enable the cursor. */ hotpoint = c->offset; | |
| 1995/0808 |
| |
| 1995/0623 |
| |
| 1995/0808 |
| |
| 1995/0516 | unlock(&ark2000pvlock); } | |
| 1996/0216/sys/src/9/pc/vgaark2000pv.c:28,35 – 1997/0327/sys/src/9/pc/vgaark2000pv.c:28,39 (short | long) | ||
| 1995/0516 | { uchar seq20; | |
| 1997/0327 | lock(&ark2000pvlock); | |
| 1995/0516 | seq20 = vgaxi(Seqx, 0x20) & ~0x08; vgaxo(Seqx, 0x20, seq20); | |
| 1997/0327 | unlock(&ark2000pvlock); | |
| 1995/0516 | } static void | |
| 1996/0216/sys/src/9/pc/vgaark2000pv.c:37,42 – 1997/0327/sys/src/9/pc/vgaark2000pv.c:41,48 | ||
| 1995/0516 | { uchar seq20; | |
| 1997/0327 | lock(&ark2000pvlock); | |
| 1995/0516 | /* * Disable the cursor then configure for X-Windows style, | |
| 1996/0216 | * 32x32 and 4/8-bit colour depth. | |
| 1996/0216/sys/src/9/pc/vgaark2000pv.c:66,71 – 1997/0327/sys/src/9/pc/vgaark2000pv.c:72,79 | ||
| 1995/0516 | * Enable the cursor. */ vgaxo(Seqx, 0x20, seq20); | |
| 1997/0327 | unlock(&ark2000pvlock); | |
| 1995/0516 | } static void | |
| 1996/0216/sys/src/9/pc/vgaark2000pv.c:185,201 – 1997/0327/sys/src/9/pc/vgaark2000pv.c:193,201 | ||
| 1995/0516 | static void ark2000pvpage(int page) { | |
| 1997/0327 | lock(&ark2000pvlock); setark2000pvpage(page); unlock(&ark2000pvlock); | |
| 1995/0516 | } | |
| 1995/0512 | static Vgac ark2000pv = { | |
| 1997/0327/sys/src/9/pc/vgaark2000pv.c:5,48 – 1997/1101/sys/src/9/pc/vgaark2000pv.c:5,50 (short | long) | ||
| 1995/0512 | #include "fns.h" #include "../port/error.h" | |
| 1997/1101 | #define Image IMAGE #include <draw.h> #include <memdraw.h> | |
| 1995/0512 | #include "screen.h" | |
| 1995/0516 |
| |
| 1997/1101 | static int ark2000pvpageset(VGAscr*, int page) { uchar seq15; | |
| 1995/0516 |
| |
| 1997/1101 | seq15 = vgaxi(Seqx, 0x15); vgaxo(Seqx, 0x15, page); vgaxo(Seqx, 0x16, page); | |
| 1995/0516 | ||
| 1997/1101 | return seq15; } | |
| 1995/0512 | static void | |
| 1995/0516 |
| |
| 1997/1101 | ark2000pvpage(VGAscr* scr, int page) | |
| 1995/0512 | { | |
| 1997/1101 | lock(&scr->devlock); ark2000pvpageset(scr, page); unlock(&scr->devlock); | |
| 1995/0512 | } | |
| 1995/0516 | static void | |
| 1997/1101 | ark2000pvdisable(VGAscr*) | |
| 1995/0516 | { uchar seq20; | |
| 1997/0327 |
| |
| 1995/0516 | seq20 = vgaxi(Seqx, 0x20) & ~0x08; vgaxo(Seqx, 0x20, seq20); | |
| 1997/0327 |
| |
| 1995/0516 | } static void | |
| 1997/1101 | ark2000pvenable(VGAscr* scr) | |
| 1995/0516 | { uchar seq20; | |
| 1997/1101 | ulong storage; | |
| 1995/0516 | ||
| 1997/0327 |
| |
| 1995/0516 | /* * Disable the cursor then configure for X-Windows style, | |
| 1996/0216 | * 32x32 and 4/8-bit colour depth. | |
| 1997/0327/sys/src/9/pc/vgaark2000pv.c:66,71 – 1997/1101/sys/src/9/pc/vgaark2000pv.c:68,74 | ||
| 1995/0516 | storage = (vgaxi(Seqx, 0x10)>>6) & 0x03; storage = (1024*1024)<<storage; | |
| 1996/0216 | storage -= 256; | |
| 1997/1101 | scr->storage = storage; | |
| 1996/0216 | vgaxo(Seqx, 0x25, 0x3F); | |
| 1995/0516 | /* | |
| 1997/0327/sys/src/9/pc/vgaark2000pv.c:72,111 – 1997/1101/sys/src/9/pc/vgaark2000pv.c:75,101 | ||
| 1995/0516 | * Enable the cursor. */ vgaxo(Seqx, 0x20, seq20); | |
| 1997/0327 |
| |
| 1995/0516 | } static void | |
| 1997/1101 | ark2000pvload(VGAscr* scr, Cursor* curs) | |
| 1995/0516 | { | |
| 1996/0216 |
| |
| 1995/0516 |
| |
| 1997/1101 | uchar *p, seq10; int opage, x, y; | |
| 1995/0516 | /* | |
| 1996/0216 |
| |
| 1995/0516 |
| |
| 1997/1101 | seq10 = vgaxi(Seqx, 0x10); opage = 0; p = KADDR(scr->aperture); if(!(seq10 & 0x10)){ opage = ark2000pvpageset(scr, scr->storage>>16); p += (scr->storage & 0xFFFF); | |
| 1995/0516 | } | |
| 1997/1101 | else p += scr->storage; | |
| 1995/0516 | /* * The cursor is set in X11 mode which gives the following | |
| 1997/0327/sys/src/9/pc/vgaark2000pv.c:122,129 – 1997/1101/sys/src/9/pc/vgaark2000pv.c:112,119 | ||
| 1996/0216 | for(y = 0; y < 32; y++){ for(x = 0; x < 32/8; x++){ | |
| 1995/0516 | if(x < 16/8 && y < 16){ | |
| 1997/1101 | *p++ = curs->clr[2*y + x]|curs->set[2*y + x]; *p++ = curs->set[2*y + x]; | |
| 1995/0516 | } else { | |
| 1995/0808 | *p++ = 0x00; | |
| 1997/0327/sys/src/9/pc/vgaark2000pv.c:132,165 – 1997/1101/sys/src/9/pc/vgaark2000pv.c:122,155 | ||
| 1995/0516 | } } | |
| 1997/1101 | if(!(seq10 & 0x10)){ ark2000pvpageset(scr, opage); unlock(&scr->devlock); } | |
| 1995/0516 | /* | |
| 1997/1101 | * Save the cursor hotpoint. | |
| 1995/0516 | */ | |
| 1997/1101 | scr->offset = curs->offset; | |
| 1995/0516 | } static int | |
| 1997/1101 | ark2000pvmove(VGAscr* scr, Point p) | |
| 1995/0516 | { int x, xo, y, yo; | |
| 1997/1101 | if((x = p.x+scr->offset.x) < 0){ | |
| 1995/0516 | xo = -x; | |
| 1995/0822 | x = 0; | |
| 1995/0516 | } else | |
| 1995/0822 | xo = 0; | |
| 1995/0516 |
| |
| 1997/1101 | if((y = p.y+scr->offset.y) < 0){ | |
| 1995/0516 | yo = -y; | |
| 1995/0822 | y = 0; | |
| 1995/0516 | } | |
| 1997/0327/sys/src/9/pc/vgaark2000pv.c:176,213 – 1997/1101/sys/src/9/pc/vgaark2000pv.c:166,188 | ||
| 1995/0516 | vgaxo(Seqx, 0x23, (y>>8) & 0x0F); vgaxo(Seqx, 0x24, y & 0xFF); | |
| 1996/0215 |
| |
| 1995/0516 |
| |
| 1997/1101 | VGAdev vgaark2000pvdev = { "ark2000pv", | |
| 1995/0516 | 0, | |
| 1997/0327 |
| |
| 1995/0516 |
| |
| 1995/0512 |
| |
| 1997/1101 | 0, | |
| 1995/0512 | ark2000pvpage, | |
| 1995/0516 |
| |
| 1995/0512 |
| |
| 1997/1101 | VGAcur vgaark2000pvcur = { "ark2000pvhwgc", ark2000pvenable, ark2000pvdisable, ark2000pvload, ark2000pvmove, }; | |
| 1997/1101/sys/src/9/pc/vgaark2000pv.c:91,96 – 1998/0116/sys/src/9/pc/vgaark2000pv.c:91,97 (short | long) | ||
| 1997/1101 | opage = 0; p = KADDR(scr->aperture); if(!(seq10 & 0x10)){ | |
| 1998/0116 | lock(&scr->devlock); | |
| 1997/1101 | opage = ark2000pvpageset(scr, scr->storage>>16); p += (scr->storage & 0xFFFF); | |
| 1995/0516 | } | |
| 1998/0116/sys/src/9/pc/vgaark2000pv.c:8,13 – 1999/0119/sys/src/9/pc/vgaark2000pv.c:8,14 (short | long) | ||
| 1997/1101 | #define Image IMAGE #include <draw.h> #include <memdraw.h> | |
| 1999/0119 | #include <cursor.h> | |
| 1995/0512 | #include "screen.h" | |
| 1997/1101 | static int | |
| 1999/0119/sys/src/9/pc/vgaark2000pv.c:55,66 – 1999/1005/sys/src/9/pc/vgaark2000pv.c:55,66 (short | long) | ||
| 1995/0516 | vgaxo(Seqx, 0x20, seq20); | |
| 1996/0216 | seq20 |= 0x18; | |
| 1995/0516 |
| |
| 1999/1005 | vgaxo(Seqx, 0x26, 0x00); vgaxo(Seqx, 0x27, 0x00); vgaxo(Seqx, 0x28, 0x00); vgaxo(Seqx, 0x29, 0xFF); vgaxo(Seqx, 0x2A, 0xFF); vgaxo(Seqx, 0x2B, 0xFF); | |
| 1995/0516 | /* | |
| 1996/0216 | * Cursor storage is a 256 byte or 1Kb block located in the last | |