| plan 9 kernel history: overview | file list | diff list |
1992/1111/pc/vga.c (diff list | history)
| 1992/1111/sys/src/9/pc/vga.c:12,20 – 1992/1112/sys/src/9/pc/vga.c:12,17 (short | long | prev | next) | ||
| 1991/0730 | #define MINX 8 | |
| 1992/0208 |
| |
| 1991/0730 |
| |
| 1992/1111/sys/src/9/pc/vga.c:22,31 – 1992/1112/sys/src/9/pc/vga.c:19,30 | ||
| 1991/0730 | ||
| 1992/1106 | int islittle = 1; /* little endian bit ordering in bytes */ | |
| 1992/1112 | extern GSubfont defont0; GSubfont *defont; extern Cursor arrow; extern GBitmap cursorback; static Lock colorlock; /* color map lock */ | |
| 1992/1106 | ||
| 1991/0730 | /* * screen dimensions */ | |
| 1992/1111/sys/src/9/pc/vga.c:67,73 – 1992/1112/sys/src/9/pc/vga.c:66,72 | ||
| 1992/0414 | 0xff, /* attribute */ | |
| 1992/0418 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | |
| 1992/0423 |
| |
| 1992/1112 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, | |
| 1992/1015 | 0x01, 0x10, 0x0f, 0x00, 0x00, | |
| 1992/0414 | }; | |
| 1992/0418 | ||
| 1992/1111/sys/src/9/pc/vga.c:238,244 – 1992/1112/sys/src/9/pc/vga.c:237,242 | ||
| 1992/1106 | /* | |
| 1992/1109 | * zero hard screen and setup a bitmap for the new size | |
| 1992/1106 | */ | |
| 1992/1109 | if(ldepth == 3) vgascreen.ldepth = 3; else | |
| 1992/1111/sys/src/9/pc/vga.c:245,252 – 1992/1112/sys/src/9/pc/vga.c:243,251 | ||
| 1992/1109 | vgascreen.ldepth = 0; | |
| 1992/1106 | vgascreen.base = (void*)SCREENMEM; | |
| 1992/1110 | vgascreen.width = (maxx*(1<<vgascreen.ldepth))/32; | |
| 1992/1112 | vgascreen.r.min = Pt(0, 0); | |
| 1992/1106 | vgascreen.r.max = Pt(maxx, maxy); | |
| 1992/1112 | vgascreen.clipr = vgascreen.r; | |
| 1992/1106 | /* | |
| 1992/1109 | * setup new soft screen, free memory for old screen | |
| 1992/1111/sys/src/9/pc/vga.c:253,276 – 1992/1112/sys/src/9/pc/vga.c:252,280 | ||
| 1992/1106 | */ gscreen.ldepth = ldepth; gscreen.width = (maxx*(1<<ldepth))/32; | |
| 1992/1112 | gscreen.r.min = Pt(0, 0); | |
| 1992/0603 | gscreen.r.max = Pt(maxx, maxy); | |
| 1992/0604 |
| |
| 1992/1112 | gscreen.clipr = gscreen.r; | |
| 1992/1110 | len = gscreen.width * BY2WD * maxy; | |
| 1992/1109 | if(gscreen.base){ free(gscreen.base); | |
| 1992/1111 |
| |
| 1992/1112 | p = smalloc(len + 2*1024); } else p = malloc(len + 2*1024); | |
| 1992/1111 | pad1 = p; | |
| 1992/1112 | pad2 = p + 1024 + len; | |
| 1992/1111 | memset(pad1, 0, 1024); memset(pad2, 0, 1024); | |
| 1992/1112 | gscreen.base = (ulong*)(p+1024); | |
| 1992/1107 | memset((char*)gscreen.base, 0xff, len); | |
| 1992/1112 | memset((void*)SCREENMEM, 0xff, vgascreen.width * BY2WD * maxy); | |
| 1992/1106 | /* | |
| 1992/1112 | * set depth of cursor backup area */ bitdepth(); /* | |
| 1992/1106 | * set string pointer to upper left */ | |
| 1992/0603 | out.pos.x = MINX; | |
| 1992/1111/sys/src/9/pc/vga.c:278,290 – 1992/1112/sys/src/9/pc/vga.c:282,287 | ||
| 1992/0603 | out.bwid = defont0.info[' '].width; } | |
| 1992/1111 |
| |
| 1992/0603 | void | |
| 1991/0730 | screeninit(void) | |
| 1991/0723 | { | |
| 1992/1111/sys/src/9/pc/vga.c:322,341 – 1992/1112/sys/src/9/pc/vga.c:319,333 | ||
| 1992/1110 | /* | |
| 1992/1111 | * set up color map | |
| 1992/1110 | */ | |
| 1992/1112 | lock(&colorlock); | |
| 1992/1110 | outb(CMWX, 0); for(i = 0; i < 16; i++){ | |
| 1992/1111 |
| |
| 1992/1112 | x = (i*63)/15; outb(CM, x); outb(CM, x); outb(CM, x); | |
| 1992/1110 | } | |
| 1992/1111 |
| |
| 1992/1112 | unlock(&colorlock); | |
| 1991/0723 | } | |
| 1991/0727 | ||
| 1992/1106 | /* | |
| 1992/1111/sys/src/9/pc/vga.c:383,392 – 1992/1112/sys/src/9/pc/vga.c:375,393 | ||
| 1992/1108 | uchar *sp, *hp; | |
| 1992/1111 | int y, len, incs, inch, off, page, y2pg, ey; | |
| 1992/1108 | Rectangle r; | |
| 1992/1112 | static int nocheck; | |
| 1992/1108 | r = mbb; mbb = NULLMBB; | |
| 1992/1112 | if(nocheck==0 && memcmp(pad1, pad2, 1024)){ nocheck = 1; print("b: %d %d %d %d\n", r.min.x, r.min.y, r.max.x, r.max.y); nocheck = 0; memset(pad1, 0, 1024); memset(pad2, 0, 1024); } | |
| 1992/1108 | if(Dy(r) < 0) return; | |
| 1992/1111/sys/src/9/pc/vga.c:424,431 – 1992/1112/sys/src/9/pc/vga.c:425,432 | ||
| 1992/1111 | hp = (uchar*)(vgascreen.base+(r.min.y*vgascreen.width)) + off; sp = (uchar*)(gscreen.base+(r.min.y*gscreen.width)) + 2*off; len = (r.max.x + 15)/8 - r.min.x/8; | |
| 1992/1112 | if(len < 0) return; | |
| 1992/1111 | /* reverse the bits and split into 2 bit planes */ | |
| 1992/1108 | for (y = r.min.y; y < r.max.y; y++){ | |
| 1992/1111/sys/src/9/pc/vga.c:474,479 – 1992/1112/sys/src/9/pc/vga.c:475,488 | ||
| 1992/1111 | } break; | |
| 1992/1108 | } | |
| 1992/1112 | if(nocheck==0 && memcmp(pad1, pad2, 1024)){ nocheck = 1; print("a: %d %d %d %d\n", r.min.x, r.min.y, r.max.x, r.max.y); nocheck = 0; memset(pad1, 0, 1024); memset(pad2, 0, 1024); } | |
| 1992/1108 | } void | |
| 1992/1111/sys/src/9/pc/vga.c:548,574 – 1992/1112/sys/src/9/pc/vga.c:557,591 | ||
| 1992/1106 | screenupdate(); } | |
| 1992/1112 | static ulong expand(uchar x) { return (x<<(32-6))|(x<<(32-12))|(x<<(32-18))|(x<<(32-24)); } | |
| 1992/1106 | void | |
| 1991/0730 | getcolor(ulong p, ulong *pr, ulong *pg, ulong *pb) { | |
| 1991/0731 |
| |
| 1991/0730 |
| |
| 1992/1112 | p &= (1<<(1<<gscreen.ldepth))-1; lock(&colorlock); outb(CMRX, p); *pr = expand(inb(CM)); *pg = expand(inb(CM)); *pb = expand(inb(CM)); unlock(&colorlock); | |
| 1991/0730 | } | |
| 1992/0711 |
| |
| 1991/0730 |
| |
| 1992/1112 | p &= (1<<(1<<gscreen.ldepth))-1; lock(&colorlock); outb(CMWX, p); outb(CM, r>>(32-6)); outb(CM, g>>(32-6)); outb(CM, b>>(32-6)); unlock(&colorlock); return ~0; | |
| 1991/0730 | } int | |