#!/bin/rc # # command: /bin/boddle /n/juke/plan_9/sys/src/cmd/aux/vga /sys/src/cmd/aux/vga # srcdir: /n/juke/plan_9/sys/src/cmd/aux/vga # version: 824494834 # date: Fri Feb 16 13:20:34 EST 1996 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 824494834 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/sys/src/cmd/aux/vga case 1 srcdir=$1 case * usage } if(! ~ $doextract yes){ echo This shell file contains a bundle of diffs representing changes echo to original source files in the Plan 9 distribution. It will run echo against the files in echo ' ' $srcdir echo '(unless overridden by the optional source directory argument)' echo and create a directory 824494834 containing the updated files. echo It will NOT automatically update the original files. echo echo Invoke with argument -X to perform the actual extraction. exit 0 } rm -rf 824494834 mkdir 824494834 target=824494834/att20c49x.c echo -n '824494834/att20c49x.c: ' if(! test -f $srcdir/att20c49x.c || ! test -r $srcdir/att20c49x.c){ echo $srcdir/att20c49x.c unreadable exit unreadable } sum=`{sum < $srcdir/att20c49x.c} if(! ~ a6531ae41610 $sum(1)^$sum(2)){ echo $srcdir/att20c49x.c is not the original distribution file exit original } cp $srcdir/att20c49x.c 824494834/att20c49x.c ed 824494834/att20c49x.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM att20c49x.c' 72a Ctlr att20c490 = { "att20c490", /* name */ 0, /* snarf */ 0, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; . 68,69d 66c dump(Vga*, Ctlr *ctlr) . 45,46d 19d 7c * ATT20C490 and ATT20C49[12] True-Color CMOS RAMDACs. . wq //GO.SYSIN DD VADIM att20c49x.c sum=`{sum < 824494834/att20c49x.c} if(~ 224678181687 $sum(1)^$sum(2)) echo if not{ echo 824494834/att20c49x.c checksum error creating updated file exit checksum } target=824494834/att21c498.c echo -n '824494834/att21c498.c: ' if(! test -f $srcdir/att21c498.c || ! test -r $srcdir/att21c498.c){ echo $srcdir/att21c498.c unreadable exit unreadable } sum=`{sum < $srcdir/att21c498.c} if(! ~ b350d1cd3369 $sum(1)^$sum(2)){ echo $srcdir/att21c498.c is not the original distribution file exit original } cp $srcdir/att21c498.c 824494834/att21c498.c ed 824494834/att21c498.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM att21c498.c' 153,154d 150c dump(Vga*, Ctlr *ctlr) . 127d 112c if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f > 80000000){ . 74d 62,64d 60c options(Vga*, Ctlr *ctlr) . 56c outportb(Pixmask, data); inportb(PaddrW); . 48c inportb(PaddrW); . 45,46c attdacio(reg); r = inportb(Pixmask); . 43c uchar r; . 36,37c inportb(Pixmask); . 33,34c inportb(PaddrW); . 25d 21c static void . wq //GO.SYSIN DD VADIM att21c498.c sum=`{sum < 824494834/att21c498.c} if(~ 989ba0963157 $sum(1)^$sum(2)) echo if not{ echo 824494834/att21c498.c checksum error creating updated file exit checksum } target=824494834/bt485.c echo -n '824494834/bt485.c: ' if(! test -f $srcdir/bt485.c || ! test -r $srcdir/bt485.c){ echo $srcdir/bt485.c unreadable exit unreadable } sum=`{sum < $srcdir/bt485.c} if(! ~ 525d85df4997 $sum(1)^$sum(2)){ echo $srcdir/bt485.c is not the original distribution file exit original } cp $srcdir/bt485.c 824494834/bt485.c ed 824494834/bt485.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM bt485.c' 219,220d 216c dump(Vga*, Ctlr *ctlr) . 149,150d 145c load(Vga*, Ctlr *ctlr) . 114d 102,105c ctlr->flag |= Hsid32|Hclk2|Hextsid|Henhanced|Foptions; . 100c options(Vga*, Ctlr *ctlr) . 46c error("%s: bad reg - 0x%X\n", bt485.name, reg); . wq //GO.SYSIN DD VADIM bt485.c sum=`{sum < 824494834/bt485.c} if(~ 703dc35e4852 $sum(1)^$sum(2)) echo if not{ echo 824494834/bt485.c checksum error creating updated file exit checksum } target=824494834/ch9294.c echo -n '824494834/ch9294.c: ' if(! test -f $srcdir/ch9294.c || ! test -r $srcdir/ch9294.c){ echo $srcdir/ch9294.c unreadable exit unreadable } sum=`{sum < $srcdir/ch9294.c} if(! ~ b751e3b81368 $sum(1)^$sum(2)){ echo $srcdir/ch9294.c is not the original distribution file exit original } cp $srcdir/ch9294.c 824494834/ch9294.c ed 824494834/ch9294.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ch9294.c' 63c if(fmin > (vga->f*5)/100) error("%s: can't find frequency %ld\n", ctlr->name, vga->f); ctlr->flag |= Finit; . 53,60c for(divisor = 1; divisor <= maxdivisor; divisor <<= 1){ f = vga->f - pattern->frequency[index]/divisor; if(f < 0) f = -f; if(f < fmin){ /*vga->f = pattern->frequency[index];*/ fmin = f; vga->d = divisor; vga->i = index; } . 51a maxdivisor = 1; if(vga->ctlr && (vga->ctlr->flag & Hclkdiv)) maxdivisor = 8; fmin = vga->f; . 32d 30c int f, fmin, index, divisor, maxdivisor; . 19a { "k", "K", /* Avance Logic */ 50350000, 56644000, 89800000, 72000000, 75000000, 65000000, 63000000, 80000000, 57272000, 85000000, 94000000, 96000000, 100000000, 108000000, 110000000, 77000000, }, . 16,17c { "e", "E", /* Tseng */ 50350000, 56644000, 65000000, 72000000, 80000000, 89800000, 63000000, 75000000, VgaFreq0, VgaFreq1, 31500000, 36000000, 40000000, 44900000, 50000000, 65000000, }, { "g", "G", /* S3, IIT */ VgaFreq0, VgaFreq1, 40000000, 72000000, 50000000, 77000000, 36000000, 44900000, . wq //GO.SYSIN DD VADIM ch9294.c sum=`{sum < 824494834/ch9294.c} if(~ fc42eda62062 $sum(1)^$sum(2)) echo if not{ echo 824494834/ch9294.c checksum error creating updated file exit checksum } target=824494834/clgd542x.c echo -n '824494834/clgd542x.c: ' if(! test -f $srcdir/clgd542x.c || ! test -r $srcdir/clgd542x.c){ echo $srcdir/clgd542x.c unreadable exit unreadable } sum=`{sum < $srcdir/clgd542x.c} if(! ~ f08f7c605224 $sum(1)^$sum(2)){ echo $srcdir/clgd542x.c is not the original distribution file exit original } cp $srcdir/clgd542x.c 824494834/clgd542x.c ed 824494834/clgd542x.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM clgd542x.c' 226,227d 224c load(Vga *vga, Ctlr*) . 172c gd542x = identify(vga, ctlr); . 169,170d 156c vga->f = (RefFreq*nmin)/(dmin*(1+p)); . 145c f = vga->f - (RefFreq*n)/(d*(1+p)); . 132c * vclk = (RefFreq*n)/(d*(1+p)); . 118c trace("%s->init->clock\n", ctlr->name); . 105c vga->vmz = 2048*1024; . 101c vga->vmz = 1024*1024; . 97c vga->vmz = 512*1024; . 93c vga->vmz = 256*1024; . 59,60d 44c error("%s: unknown chip id - 0x%2.2X\n", ctlr->name, vga->crt[0x27]); . 33c identify(Vga *vga, Ctlr *ctlr) . wq //GO.SYSIN DD VADIM clgd542x.c sum=`{sum < 824494834/clgd542x.c} if(~ 81852c545118 $sum(1)^$sum(2)) echo if not{ echo 824494834/clgd542x.c checksum error creating updated file exit checksum } target=824494834/data.c echo -n '824494834/data.c: ' if(! test -f $srcdir/data.c || ! test -r $srcdir/data.c){ echo $srcdir/data.c unreadable exit unreadable } sum=`{sum < $srcdir/data.c} if(! ~ 35c28d791035 $sum(1)^$sum(2)){ echo $srcdir/data.c is not the original distribution file exit original } cp $srcdir/data.c 824494834/data.c ed 824494834/data.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM data.c' 38a &vision964, /* ctlr */ &vision968, /* ctlr */ &w30c516, /* ctlr */ . 33a &trio64, /* ctlr */ . 26a &rgb524, /* ramdac */ &rgb524hwgc, /* hwgc */ . 23a &ics534x, /* gendac */ . 16a &ct65540, /* ctlr */ . 9a &ark2000pv, /* ctlr */ &ark2000pvhwgc, /* hwgc */ &att20c490, /* ramdac */ . wq //GO.SYSIN DD VADIM data.c sum=`{sum < 824494834/data.c} if(~ 339df7311331 $sum(1)^$sum(2)) echo if not{ echo 824494834/data.c checksum error creating updated file exit checksum } target=824494834/db.c echo -n '824494834/db.c: ' if(! test -f $srcdir/db.c || ! test -r $srcdir/db.c){ echo $srcdir/db.c unreadable exit unreadable } sum=`{sum < $srcdir/db.c} if(! ~ 6ed20a745454 $sum(1)^$sum(2)){ echo $srcdir/db.c is not the original distribution file exit original } cp $srcdir/db.c 824494834/db.c ed 824494834/db.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM db.c' 232a for(attr = mode->attr; attr; attr = attr->next) print("mode->attr: %s=%s\n", attr->attr, attr->val); . 228a print("shs=%d (0x%X), ehs=%d (0x%X)\n", mode->shs, mode->shs, mode->ehs, mode->ehs); . 222a print("dbdumpmode\n"); . 221c Attr *attr; . 147a else addattr(&mode->attr, t); . 142c else if(strcmp(t->attr, "include") == 0){ . 129a else if(strcmp(t->attr, "shs") == 0 && mode->shs == 0) mode->shs = strtol(t->val, 0, 0); else if(strcmp(t->attr, "ehs") == 0 && mode->ehs == 0) mode->ehs = strtol(t->val, 0, 0); . 91d 85a if(vga->bios == 0){ vga->bios = alloc(len+1); strncpy(vga->bios, bios, len); } . 84a else if(strcmp(t->attr, "linear") == 0) vga->linear = strtol(t->val, 0, 0); else if(strtol(t->attr, 0, 0) == 0) addattr(&vga->attr, t); . 73a addattr(&vga->attr, t); . 72c if(vga->bios == 0) readbios(bios, len, offset); . 68a if(vga->offset && offset != vga->offset) continue; . 67c if((offset = strtol(t->attr, 0, 0)) == 0) . 64a if(vga->bios) strcpy(bios, vga->bios); . 58,59c char bios[256], *string; . 48c error("dbctlr: unknown controller \"%s\" ctlr\n", val); . 17a static void addattr(Attr **app, Ndbtuple *t) { Attr *attr, *l; attr = alloc(sizeof(Attr)); attr->attr = alloc(strlen(t->attr)+1); strcpy(attr->attr, t->attr); attr->val = alloc(strlen(t->val)+1); strcpy(attr->val, t->val); for(l = *app; l; l = l->next) app = &l->next; *app = attr; } char* dbattr(Attr *ap, char *attr) { while(ap){ if(strcmp(ap->attr, attr) == 0) return ap->val; ap = ap->next; } return 0; } . wq //GO.SYSIN DD VADIM db.c sum=`{sum < 824494834/db.c} if(~ c1ce095e6749 $sum(1)^$sum(2)) echo if not{ echo 824494834/db.c checksum error creating updated file exit checksum } target=824494834/et4000.c echo -n '824494834/et4000.c: ' if(! test -f $srcdir/et4000.c || ! test -r $srcdir/et4000.c){ echo $srcdir/et4000.c unreadable exit unreadable } sum=`{sum < $srcdir/et4000.c} if(! ~ 6fe7954b6628 $sum(1)^$sum(2)){ echo $srcdir/et4000.c is not the original distribution file exit original } cp $srcdir/et4000.c 824494834/et4000.c ed 824494834/et4000.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM et4000.c' 196,197d 107,108c vga->crt[0x04] = (mode->shs/2)>>3; vga->crt[0x05] = ((mode->ehs/2)>>3) & 0x1F; . 97,98d 88c ctlr->flag |= Hclkdiv|Foptions; . 76,77d 68c vga->vmz *= 2; . 65c vga->vmz *= 2; . 60c vga->vmz = 1024*1024; . 56c vga->vmz = 512*1024; . 52c vga->vmz = 256*1024; . 32,33d wq //GO.SYSIN DD VADIM et4000.c sum=`{sum < 824494834/et4000.c} if(~ 38cf20896499 $sum(1)^$sum(2)) echo if not{ echo 824494834/et4000.c checksum error creating updated file exit checksum } target=824494834/et4000hwgc.c echo -n '824494834/et4000hwgc.c: ' if(! test -f $srcdir/et4000hwgc.c || ! test -r $srcdir/et4000hwgc.c){ echo $srcdir/et4000hwgc.c unreadable exit unreadable } sum=`{sum < $srcdir/et4000hwgc.c} if(! ~ bc5cecc1554 $sum(1)^$sum(2)){ echo $srcdir/et4000hwgc.c is not the original distribution file exit original } cp $srcdir/et4000hwgc.c 824494834/et4000hwgc.c ed 824494834/et4000hwgc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM et4000hwgc.c' 9d wq //GO.SYSIN DD VADIM et4000hwgc.c sum=`{sum < 824494834/et4000hwgc.c} if(~ 13e29a7a518 $sum(1)^$sum(2)) echo if not{ echo 824494834/et4000hwgc.c checksum error creating updated file exit checksum } target=824494834/ibm8514.c echo -n '824494834/ibm8514.c: ' if(! test -f $srcdir/ibm8514.c || ! test -r $srcdir/ibm8514.c){ echo $srcdir/ibm8514.c unreadable exit unreadable } sum=`{sum < $srcdir/ibm8514.c} if(! ~ 305a3cb62396 $sum(1)^$sum(2)){ echo $srcdir/ibm8514.c is not the original distribution file exit original } cp $srcdir/ibm8514.c 824494834/ibm8514.c ed 824494834/ibm8514.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ibm8514.c' 69,70d 67c dump(Vga*, Ctlr *ctlr) . 59c outportw(Multifunc, ScissorsB|(vga->vmz/vga->mode->x-1)); . 47,48d 45c load(Vga *vga, Ctlr*) . wq //GO.SYSIN DD VADIM ibm8514.c sum=`{sum < 824494834/ibm8514.c} if(~ 75deae342337 $sum(1)^$sum(2)) echo if not{ echo 824494834/ibm8514.c checksum error creating updated file exit checksum } target=824494834/icd2061a.c echo -n '824494834/icd2061a.c: ' if(! test -f $srcdir/icd2061a.c || ! test -r $srcdir/icd2061a.c){ echo $srcdir/icd2061a.c unreadable exit unreadable } sum=`{sum < $srcdir/icd2061a.c} if(! ~ 4e1c808e2086 $sum(1)^$sum(2)){ echo $srcdir/icd2061a.c is not the original distribution file exit original } cp $srcdir/icd2061a.c 824494834/icd2061a.c ed 824494834/icd2061a.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM icd2061a.c' 103d 99c vga->f = (Prescale*RefFreq*vga->n/vga->d); . 83c f = vga->f - (Prescale*RefFreq*n/d); . 77c * vga->f = (Prescale*RefFreq*n/d); . 71,72c d = RefFreq/1000000 > 3 ? RefFreq/1000000: 3; dmax = RefFreq/200000 < 129 ? RefFreq/200000: 129; . 64c * 200KHz <= RefFreq/d <= 1MHz . 42d wq //GO.SYSIN DD VADIM icd2061a.c sum=`{sum < 824494834/icd2061a.c} if(~ e39041dc1978 $sum(1)^$sum(2)) echo if not{ echo 824494834/icd2061a.c checksum error creating updated file exit checksum } target=824494834/ics2494.c echo -n '824494834/ics2494.c: ' if(! test -f $srcdir/ics2494.c || ! test -r $srcdir/ics2494.c){ echo $srcdir/ics2494.c unreadable exit unreadable } sum=`{sum < $srcdir/ics2494.c} if(! ~ 96bc40d71881 $sum(1)^$sum(2)){ echo $srcdir/ics2494.c is not the original distribution file exit original } cp $srcdir/ics2494.c 824494834/ics2494.c ed 824494834/ics2494.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ics2494.c' 58c for(divisor = 1; divisor <= maxdivisor; divisor <<= 1){ . 56a maxdivisor = 1; if(vga->ctlr && (vga->ctlr->flag & Hclkdiv)) maxdivisor = 8; . 37d 35c int f, index, divisor, maxdivisor; . wq //GO.SYSIN DD VADIM ics2494.c sum=`{sum < 824494834/ics2494.c} if(~ ed55f0021948 $sum(1)^$sum(2)) echo if not{ echo 824494834/ics2494.c checksum error creating updated file exit checksum } target=824494834/io.c echo -n '824494834/io.c: ' if(! test -f $srcdir/io.c || ! test -r $srcdir/io.c){ echo $srcdir/io.c unreadable exit unreadable } sum=`{sum < $srcdir/io.c} if(! ~ 57ea8f1a4930 $sum(1)^$sum(2)){ echo $srcdir/io.c is not the original distribution file exit original } cp $srcdir/io.c 824494834/io.c ed 824494834/io.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM io.c' 297,303c first = ' '; for(i = 31; i >= 0; i--){ if((flag & (1</dev/null >[2=1] <<'//GO.SYSIN DD VADIM mach32.c' 236d 168d 157,158d 155c options(Vga*, Ctlr *ctlr) . 147c vga->vmz = 4*1024*1024; . 143c vga->vmz = 2*1024*1024; . 139c vga->vmz = 1024*1024; . 135c vga->vmz = 512*1024; . 116,117d 84,88c atix = 0x1CE; . 79,82c * We could try to read in a part of the BIOS and try to determine * the extended register address, but since we can't determine the offset value, * we'll just have to assume the defaults all round. . 73c atixinit(Vga *vga, Ctlr*) . 57d wq //GO.SYSIN DD VADIM mach32.c sum=`{sum < 824494834/mach32.c} if(~ 653c7ed95900 $sum(1)^$sum(2)) echo if not{ echo 824494834/mach32.c checksum error creating updated file exit checksum } target=824494834/mach64.c echo -n '824494834/mach64.c: ' if(! test -f $srcdir/mach64.c || ! test -r $srcdir/mach64.c){ echo $srcdir/mach64.c unreadable exit unreadable } sum=`{sum < $srcdir/mach64.c} if(! ~ 636d2de78322 $sum(1)^$sum(2)){ echo $srcdir/mach64.c is not the original distribution file exit original } cp $srcdir/mach64.c 824494834/mach64.c ed 824494834/mach64.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mach64.c' 321,322d 313c vga->vmz = 1*1024*1024; . 226d 213c vga->vmz = 8*1024*1024; . 209c vga->vmz = 6*1024*1024; . 205c vga->vmz = 4*1024*1024; . 201c vga->vmz = 2*1024*1024; . 197c vga->vmz = 1024*1024; . 193c vga->vmz = 512*1024; . 175,176d 147d 133c atixinit(Vga *vga, Ctlr*) . wq //GO.SYSIN DD VADIM mach64.c sum=`{sum < 824494834/mach64.c} if(~ 370f088c8157 $sum(1)^$sum(2)) echo if not{ echo 824494834/mach64.c checksum error creating updated file exit checksum } target=824494834/main.c echo -n '824494834/main.c: ' if(! test -f $srcdir/main.c || ! test -r $srcdir/main.c){ echo $srcdir/main.c unreadable exit unreadable } sum=`{sum < $srcdir/main.c} if(! ~ b5a7a5cd3680 $sum(1)^$sum(2)){ echo $srcdir/main.c is not the original distribution file exit original } cp $srcdir/main.c 824494834/main.c ed 824494834/main.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM main.c' 212c trace("main->exits\n", 0); . 205a sequencer(vga, 1); . 200d 197a trace("%s->load\n", ctlr->name); . 194a linear(vga); /* * Turn off the display during the load. */ sequencer(vga, 0); . 186,188c strncpy(buf, vga->ctlr->name, p - vga->ctlr->name); buf[p - vga->ctlr->name] = 0; vgactlw("type", buf); . 178,182d 176c ctlr->name, vga->vmz); . 173,174c trace("main->load\n", 0); if(vga->vmz && (vga->mode->x*vga->mode->y*vga->mode->z/8 > vga->vmz)) . 165a trace("%s->init\n", ctlr->name); . 159a trace("%s->options\n", ctlr->name); . 155c error("main: %s@%s not in %s\n", type, size, monitordb); . 139a trace("%s->snarf\n", ctlr->name); . 136a if(nflag) vga->linear = 0; trace("main->snarf\n", 0); . 129c print("%s: controller not in %s\n", argv0, dbname); . 122a if(bios){ if((vga->offset = strtol(bios, &p, 0)) == 0 || *p++ != '=') error("main: bad BIOS string format - %s\n", bios); len = strlen(p); vga->bios = alloc(len+1); strncpy(vga->bios, p, len); trace("main->BIOS %s\n", bios); } . 104a case 'n': nflag = 1; break; . 88a case 'b': bios = ARGF(); break; . 82a bios = getenv("vgactlr"); . 79c char *bios, buf[256], *p, *size, *type; int len; . 75a static void linear(Vga *vga) { char buf[256]; /* * Set up for linear addressing: try to allocate the * kernel memory map then read the base-address back. * vga->linear is a compatibility hack. */ if(vga->linear == 0){ vga->ctlr->flag &= ~Ulinear; return; } if(vga->ctlr->flag & Ulinear){ sprint(buf, "0x%lux 0x%lux", vga->vmz, vga->vma); vgactlw("linear", buf); vgactlr("addr", buf); trace("linear->addr %s\n", buf); vga->vmb = strtoul(buf, 0, 0); } else vgactlw("linear", "0"); } . 73c state = on; trace("sequencer->leave %s\n", s); . 64,66c if(state == 0){ seq01 |= 0x01; vgaxo(Seqx, 0x01, seq01); vgaxo(Seqx, 0x00, 0x03); } . 60c if(on) s = "on"; else s = "off"; trace("sequencer->enter %s\n", s); . 58a static int state = 1; char *s; . 50a trace("%s->init\n", link->name); . 40c trace("%s->resyncinit\n", ctlr->name); . 27c printflag(ctlr->flag); print("\n"); . 24c trace("%s->dump\n", ctlr->name); . 6,7c static int iflag, lflag, nflag, pflag; static char *usage = "usage: %s [ -b bios-id ] [ -cdilnpv ] [ -m monitor ] [ mode ]\n"; . wq //GO.SYSIN DD VADIM main.c sum=`{sum < 824494834/main.c} if(~ f451ea614990 $sum(1)^$sum(2)) echo if not{ echo 824494834/main.c checksum error creating updated file exit checksum } target=824494834/mkfile echo -n '824494834/mkfile: ' if(! test -f $srcdir/mkfile || ! test -r $srcdir/mkfile){ echo $srcdir/mkfile unreadable exit unreadable } sum=`{sum < $srcdir/mkfile} if(! ~ d33a7c3e481 $sum(1)^$sum(2)){ echo $srcdir/mkfile is not the original distribution file exit original } cp $srcdir/mkfile 824494834/mkfile ed 824494834/mkfile >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mkfile' 37a vision964.$O\ vision968.$O\ w30c516.$O\ . 32a trio64.$O\ . 25a rgb524.$O\ . 20a ics534x.$O\ . 15a error$DIST.$O\ . 13a ct65540.$O\ . 8a ark2000pv.$O\ . 5a # # For systems based on the Plan 9 Distribution CD set # DIST=dist # DIST= . wq //GO.SYSIN DD VADIM mkfile sum=`{sum < 824494834/mkfile} if(~ a233086b682 $sum(1)^$sum(2)) echo if not{ echo 824494834/mkfile checksum error creating updated file exit checksum } target=824494834/palette.c echo -n '824494834/palette.c: ' if(! test -f $srcdir/palette.c || ! test -r $srcdir/palette.c){ echo $srcdir/palette.c unreadable exit unreadable } sum=`{sum < $srcdir/palette.c} if(! ~ e4e8953e2249 $sum(1)^$sum(2)){ echo $srcdir/palette.c is not the original distribution file exit original } cp $srcdir/palette.c 824494834/palette.c ed 824494834/palette.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM palette.c' 86,87d 58,59d 37,38d wq //GO.SYSIN DD VADIM palette.c sum=`{sum < 824494834/palette.c} if(~ 2d955ae12137 $sum(1)^$sum(2)) echo if not{ echo 824494834/palette.c checksum error creating updated file exit checksum } target=824494834/s3801.c echo -n '824494834/s3801.c: ' if(! test -f $srcdir/s3801.c || ! test -r $srcdir/s3801.c){ echo $srcdir/s3801.c unreadable exit unreadable } sum=`{sum < $srcdir/s3801.c} if(! ~ 67eff0401747 $sum(1)^$sum(2)){ echo $srcdir/s3801.c is not the original distribution file exit original } cp $srcdir/s3801.c 824494834/s3801.c ed 824494834/s3801.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3801.c' 60,61d 31,32d 20,22d 18c options(Vga*, Ctlr *ctlr) . 12,13d wq //GO.SYSIN DD VADIM s3801.c sum=`{sum < 824494834/s3801.c} if(~ 99b982d91578 $sum(1)^$sum(2)) echo if not{ echo 824494834/s3801.c checksum error creating updated file exit checksum } target=824494834/s3928.c echo -n '824494834/s3928.c: ' if(! test -f $srcdir/s3928.c || ! test -r $srcdir/s3928.c){ echo $srcdir/s3928.c unreadable exit unreadable } sum=`{sum < $srcdir/s3928.c} if(! ~ 3f9ce9152430 $sum(1)^$sum(2)){ echo $srcdir/s3928.c is not the original distribution file exit original } cp $srcdir/s3928.c 824494834/s3928.c ed 824494834/s3928.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3928.c' 94,95d 49,50c vga->crt[0x04] = (mode->shs/4)>>3; vga->crt[0x05] = ((mode->ehs/4)>>3) & 0x1F; . 32,33d 20,23c ctlr->flag |= Hlinear|Henhanced|Foptions; . 18c options(Vga*, Ctlr *ctlr) . 12,13d wq //GO.SYSIN DD VADIM s3928.c sum=`{sum < 824494834/s3928.c} if(~ bed599382284 $sum(1)^$sum(2)) echo if not{ echo 824494834/s3928.c checksum error creating updated file exit checksum } target=824494834/s3clock.c echo -n '824494834/s3clock.c: ' if(! test -f $srcdir/s3clock.c || ! test -r $srcdir/s3clock.c){ echo $srcdir/s3clock.c unreadable exit unreadable } sum=`{sum < $srcdir/s3clock.c} if(! ~ 5c89f9544780 $sum(1)^$sum(2)){ echo $srcdir/s3clock.c is not the original distribution file exit original } cp $srcdir/s3clock.c 824494834/s3clock.c ed 824494834/s3clock.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3clock.c' 167,168d 146,148d 144c if(vga->clock->init && (vga->clock->flag & Finit) == 0) . 142c error("%s: unknown clock \"%s\"\n", ctlr->name, vga->clock->name); . 125,126d 114,115c { "icd2061a", icd2061aload, }, { "ch9294", ch9294load, }, { "tvp3025clock", tvp3025load, }, . 109a static void tvp3025load(Vga *vga, Ctlr *ctlr) { uchar crt5c, x; trace("%s->clock->tvp3025load\n", ctlr->name); /* * Crt5C bit 5 is RS4. * Clear it to select TVP3025 registers for * the calls to tvp302xo(). */ crt5c = vgaxi(Crtx, 0x5C); vgaxo(Crtx, 0x5C, crt5c & ~0x20); tvp3020xo(0x2C, 0x00); tvp3020xo(0x2D, vga->d); tvp3020xo(0x2D, vga->n); tvp3020xo(0x2D, 0x08|vga->p); tvp3020xo(0x2F, 0x01); tvp3020xo(0x2F, 0x01); tvp3020xo(0x2F, vga->p); x = 0x54; if(vga->ctlr && (vga->ctlr->flag & Uenhanced)) x = 0xC4; tvp3020xo(0x1E, x); vgaxo(Crtx, 0x5C, crt5c); vgao(MiscW, vga->misc); ctlr->flag |= Fload; } . 105c trace("%s->clock->ch9294load\n", ctlr->name); . 26c trace("%s->clock->icd2061aload\n", ctlr->name); . 9c trace("%s->clock->setcrt42\n", ctlr->name); . wq //GO.SYSIN DD VADIM s3clock.c sum=`{sum < 824494834/s3clock.c} if(~ 510aedca5298 $sum(1)^$sum(2)) echo if not{ echo 824494834/s3clock.c checksum error creating updated file exit checksum } target=824494834/s3generic.c echo -n '824494834/s3generic.c: ' if(! test -f $srcdir/s3generic.c || ! test -r $srcdir/s3generic.c){ echo $srcdir/s3generic.c unreadable exit unreadable } sum=`{sum < $srcdir/s3generic.c} if(! ~ 6d7235b26285 $sum(1)^$sum(2)){ echo $srcdir/s3generic.c is not the original distribution file exit original } cp $srcdir/s3generic.c 824494834/s3generic.c ed 824494834/s3generic.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3generic.c' 233c * and the horizontal values have been divided by 4. . 191a . 188a if(ctlr->flag & Ulinear){ l = vga->vmb>>16; vga->crt[0x59] = (l>>8) & 0xFF; vga->crt[0x5A] = l & 0xFF; if(vga->vmz <= 1024*1024) vga->crt[0x58] |= 0x01; else if(vga->vmz <= 2*1024*1024) vga->crt[0x58] |= 0x02; else vga->crt[0x58] |= 0x03; } . 169a trace("%s->load->s3generic\n", ctlr->name); . 168c ulong l; . 134a if(vga->linear && (ctlr->flag & Hlinear)) ctlr->flag |= Ulinear; if(vga->vmz <= 1024*1024) vga->vma = 1024*1024; else if(vga->vmz <= 2*1024*1024) vga->vma = 2*1024*1024; else vga->vma = 8*1024*1024; } . 133c if(ctlr->flag & Uenhanced){ . 129,130c * Set up linear aperture. For the moment it's 64K at 0xA0000. * The real base address will be assigned before load is called. . 107a vga->crt[0x45] = 0x00; . 70c trace("%s->init->s3generic\n", ctlr->name); . 57c vga->vmz = 512*1024; . 53c vga->vmz = 1*1024*1024; . 49c vga->vmz = 2*1024*1024; . 45c vga->vmz = 3*1024*1024; . 41c vga->vmz = 4*1024*1024; . 25c trace("%s->snarf->s3generic\n", ctlr->name); . wq //GO.SYSIN DD VADIM s3generic.c sum=`{sum < 824494834/s3generic.c} if(~ ddf46a056865 $sum(1)^$sum(2)) echo if not{ echo 824494834/s3generic.c checksum error creating updated file exit checksum } target=824494834/s3hwgc.c echo -n '824494834/s3hwgc.c: ' if(! test -f $srcdir/s3hwgc.c || ! test -r $srcdir/s3hwgc.c){ echo $srcdir/s3hwgc.c unreadable exit unreadable } sum=`{sum < $srcdir/s3hwgc.c} if(! ~ 0e12618e1105 $sum(1)^$sum(2)){ echo $srcdir/s3hwgc.c is not the original distribution file exit original } cp $srcdir/s3hwgc.c 824494834/s3hwgc.c ed 824494834/s3hwgc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3hwgc.c' 40a 0, /* snarf */ 0, /* options */ 0, /* init */ 0, /* load */ 0, /* dump */ }; Ctlr rgb524hwgc = { "rgb524hwgc", /* name */ . 27d 9d wq //GO.SYSIN DD VADIM s3hwgc.c sum=`{sum < 824494834/s3hwgc.c} if(~ 03f4368a1179 $sum(1)^$sum(2)) echo if not{ echo 824494834/s3hwgc.c checksum error creating updated file exit checksum } target=824494834/sc15025.c echo -n '824494834/sc15025.c: ' if(! test -f $srcdir/sc15025.c || ! test -r $srcdir/sc15025.c){ echo $srcdir/sc15025.c unreadable exit unreadable } sum=`{sum < $srcdir/sc15025.c} if(! ~ 25231c031997 $sum(1)^$sum(2)){ echo $srcdir/sc15025.c is not the original distribution file exit original } cp $srcdir/sc15025.c 824494834/sc15025.c ed 824494834/sc15025.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM sc15025.c' 107,108d 103c dump(Vga*, Ctlr *ctlr) . 89d 86,87d 82c load(Vga*, Ctlr*) . 60d 48,50d 46c options(Vga*, Ctlr *ctlr) . wq //GO.SYSIN DD VADIM sc15025.c sum=`{sum < 824494834/sc15025.c} if(~ 0afe5b401830 $sum(1)^$sum(2)) echo if not{ echo 824494834/sc15025.c checksum error creating updated file exit checksum } target=824494834/stg1702.c echo -n '824494834/stg1702.c: ' if(! test -f $srcdir/stg1702.c || ! test -r $srcdir/stg1702.c){ echo $srcdir/stg1702.c unreadable exit unreadable } sum=`{sum < $srcdir/stg1702.c} if(! ~ 7ca6f4dc3348 $sum(1)^$sum(2)){ echo $srcdir/stg1702.c is not the original distribution file exit original } cp $srcdir/stg1702.c 824494834/stg1702.c ed 824494834/stg1702.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM stg1702.c' 162,163d 159c dump(Vga*, Ctlr *ctlr) . 133,134d 91d 80,82d 78c options(Vga*, Ctlr *ctlr) . wq //GO.SYSIN DD VADIM stg1702.c sum=`{sum < 824494834/stg1702.c} if(~ efb3bd643202 $sum(1)^$sum(2)) echo if not{ echo 824494834/stg1702.c checksum error creating updated file exit checksum } target=824494834/template.c echo -n '824494834/template.c: ' if(! test -f $srcdir/template.c || ! test -r $srcdir/template.c){ echo $srcdir/template.c unreadable exit unreadable } sum=`{sum < $srcdir/template.c} if(! ~ 2be7d811747 $sum(1)^$sum(2)){ echo $srcdir/template.c is not the original distribution file exit original } cp $srcdir/template.c 824494834/template.c ed 824494834/template.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM template.c' 37d 29d 21d 13d wq //GO.SYSIN DD VADIM template.c sum=`{sum < 824494834/template.c} if(~ 9be390a0599 $sum(1)^$sum(2)) echo if not{ echo 824494834/template.c checksum error creating updated file exit checksum } target=824494834/tvp3020.c echo -n '824494834/tvp3020.c: ' if(! test -f $srcdir/tvp3020.c || ! test -r $srcdir/tvp3020.c){ echo $srcdir/tvp3020.c unreadable exit unreadable } sum=`{sum < $srcdir/tvp3020.c} if(! ~ 95b7a1946049 $sum(1)^$sum(2)){ echo $srcdir/tvp3020.c is not the original distribution file exit original } cp $srcdir/tvp3020.c 824494834/tvp3020.c ed 824494834/tvp3020.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM tvp3020.c' 285,286d 281c dump(Vga*, Ctlr *ctlr) . 200d 165d 153,155d 151c options(Vga*, Ctlr *ctlr) . 85c error("%s: bad register index - 0x%2.2X\n", tvp3020.name, index); . 80c print("%s: unknown chip id - 0x%2.2X\n", tvp3020.name, id); . wq //GO.SYSIN DD VADIM tvp3020.c sum=`{sum < 824494834/tvp3020.c} if(~ 230356dd5938 $sum(1)^$sum(2)) echo if not{ echo 824494834/tvp3020.c checksum error creating updated file exit checksum } target=824494834/tvp3025.c echo -n '824494834/tvp3025.c: ' if(! test -f $srcdir/tvp3025.c || ! test -r $srcdir/tvp3025.c){ echo $srcdir/tvp3025.c unreadable exit unreadable } sum=`{sum < $srcdir/tvp3025.c} if(! ~ 97a5bc161322 $sum(1)^$sum(2)){ echo $srcdir/tvp3025.c is not the original distribution file exit original } cp $srcdir/tvp3025.c 824494834/tvp3025.c ed 824494834/tvp3025.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM tvp3025.c' 60a print("%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07)); . 59c printreg(clock[i] = tvp3020xi(0x2F)); . 55a print("%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07)); . 54c printreg(clock[i] = tvp3020xi(0x2E)); . 50a print("%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07)); . 49c printreg(clock[i] = tvp3020xi(0x2D)); . 40a ulong clock[4]; . 35a static ulong dumpclock(ulong d, ulong n, ulong p) { ulong f; f = RefFreq*((n+2)*8); f /= (d+2); f >>= p; return f; } . 33c tvp3020xo(0x0E, 0x00); (tvp3020.load)(vga, ctlr); if(ctlr->flag & Uenhanced) tvp3020xo(0x29, 0x01); ctlr->flag |= Fload; . 20a /* * Although the Tvp3025 has a higher default * speed-grade (135MHz), just use the 3020 code. */ . wq //GO.SYSIN DD VADIM tvp3025.c sum=`{sum < 824494834/tvp3025.c} if(~ 7a49b5931905 $sum(1)^$sum(2)) echo if not{ echo 824494834/tvp3025.c checksum error creating updated file exit checksum } target=824494834/tvp3025clock.c echo -n '824494834/tvp3025clock.c: ' if(! test -f $srcdir/tvp3025clock.c || ! test -r $srcdir/tvp3025clock.c){ echo $srcdir/tvp3025clock.c unreadable exit unreadable } sum=`{sum < $srcdir/tvp3025clock.c} if(! ~ 771255d71863 $sum(1)^$sum(2)){ echo $srcdir/tvp3025clock.c is not the original distribution file exit original } cp $srcdir/tvp3025clock.c 824494834/tvp3025clock.c ed 824494834/tvp3025clock.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM tvp3025clock.c' 98c 0, /* load */ . 69,92d 49c fvco = SCALE(RefFreq)*((n+2)*8)/(d+2); . 47c nmax = ((220000000+RefFreq)*(d+2))/(RefFreq*8) - 2; . 38c dmax = (RefFreq/1000000)-2; . 27c * RefFreq/(n+2) > 1MHz . 24c * Fvco = RefFreq*((n+2)*8)/(d+2) . 14d wq //GO.SYSIN DD VADIM tvp3025clock.c sum=`{sum < 824494834/tvp3025clock.c} if(~ 0f0063a41447 $sum(1)^$sum(2)) echo if not{ echo 824494834/tvp3025clock.c checksum error creating updated file exit checksum } target=824494834/vga.c echo -n '824494834/vga.c: ' if(! test -f $srcdir/vga.c || ! test -r $srcdir/vga.c){ echo $srcdir/vga.c unreadable exit unreadable } sum=`{sum < $srcdir/vga.c} if(! ~ 5822cbfc8220 $sum(1)^$sum(2)){ echo $srcdir/vga.c is not the original distribution file exit original } cp $srcdir/vga.c 824494834/vga.c ed 824494834/vga.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vga.c' 444a if(vga->vmz){ printitem(ctlr->name, "vmz"); print("%9ld\n", vga->vmz); } printitem(ctlr->name, "linear"); print("%9ld\n", vga->linear); for(attr = vga->attr; attr; attr = attr->next) print("%s->attr: %s=%s\n", ctlr->name, attr->attr, attr->val); . 441,443c if(vga->vma || vga->vmb){ printitem(ctlr->name, "vm a b"); print("%9ld %8ld\n", vga->vma, vga->vmb); . 437,438c printitem(ctlr->name, "clock d i m"); print("%9ld %8ld - %8ld\n", vga->d, vga->i, vga->m); printitem(ctlr->name, "clock n p r"); print("%9ld %8ld - %8ld\n", vga->n, vga->p, vga->r); . 408a Attr *attr; . 368d 346,347c for(tmp = 0; tmp < 0x10; tmp++) vga->attribute[tmp] = tmp; . 319c vga->crt[0x13] = tmp; . 317c tmp /= 2; . 313c tmp /= 4; . 311c else if(tmp >= 256){ . 309c tmp /= 8; . 306,307c tmp = ((mode->x*mode->z)/8); if(tmp >= 512){ . 294c if(tmp & 0x200) . 290,292c tmp = vde-1; vga->crt[0x12] = tmp; if(tmp & 0x100) . 285c if(tmp & 0x200) . 281,283c tmp = vrs; vga->crt[0x10] = tmp; if(tmp & 0x100) . 278c if(tmp & 0x200) . 274,276c tmp = vt-2; vga->crt[0x06] = tmp; if(tmp & 0x100) . 252a if(mode->shs == 0) mode->shs = mode->shb; vga->crt[0x04] = mode->shs>>3; if(mode->ehs == 0) mode->ehs = mode->ehb; vga->crt[0x05] |= ((mode->ehs>>3) & 0x1F); . 250,251d 246,248c tmp = mode->ehb>>3; vga->crt[0x03] = 0x80|(tmp & 0x1F); if(tmp & 0x20) . 187d 185c ulong tmp; . 149d wq //GO.SYSIN DD VADIM vga.c sum=`{sum < 824494834/vga.c} if(~ a0dbb7308659 $sum(1)^$sum(2)) echo if not{ echo 824494834/vga.c checksum error creating updated file exit checksum } target=824494834/vga.h echo -n '824494834/vga.h: ' if(! test -f $srcdir/vga.h || ! test -r $srcdir/vga.h){ echo $srcdir/vga.h unreadable exit unreadable } sum=`{sum < $srcdir/vga.h} if(! ~ f6e82ccb5750 $sum(1)^$sum(2)){ echo $srcdir/vga.h is not the original distribution file exit original } cp $srcdir/vga.h 824494834/vga.h ed 824494834/vga.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vga.h' 256a /* vision964.c */ extern Ctlr vision964; /* vision968.c */ extern Ctlr vision968; /* w30c516.c */ extern Ctlr w30c516; . 234a /* trio64.c */ extern Ctlr trio64; . 225a extern Ctlr rgb524hwgc; . 210a /* rgb524.c */ extern Ctlr rgb524; . 195c extern void printflag(ulong); extern int curprintindex; . 190d 178a /* ics534x.c */ extern Ctlr ics534x; . 162a /* error.c */ extern void error(char*, ...); extern void trace(char*, ...); extern int vflag; . 158a extern char* dbattr(Attr*, char*); . 151a /* ct65540.c */ extern Ctlr ct65540; . 132a extern Ctlr att20c490; . 131a /* ark2000pv.c */ extern Ctlr ark2000pv; extern Ctlr ark2000pvhwgc; . 127a int linear; Attr* attr; . 120a long offset; /* BIOS string offset */ char* bios; /* matching BIOS string */ . 119c ulong vma; /* video memory linear-address alignment */ ulong vmb; /* video memory linear-address base */ ulong vmz; /* video memory size */ . 117a ulong r; . 115a ulong m; . 93a Attr* attr; . 86a int shs; /* optional Start Horizontal Sync (Crt04) */ int ehs; /* optional End Horizontal Sync (Crt05) */ . 73a typedef struct Attr Attr; typedef struct Attr { char* attr; char* val; Attr* next; } Attr; . 71a Hlinear = 0x00040000, /* have linear-address mode */ Ulinear = 0x00080000, /* use linear-address mode */ Hclkdiv = 0x00100000, /* have a clock-divisor */ Uclkdiv = 0x00200000, /* use clock-divisor */ Hsid32 = 0x00400000, /* have a 32-bit (as opposed to 64-bit) SID */ . 56,60c Fsnarf = 0x00000001, /* snarf done */ Foptions = 0x00000002, /* options done */ Finit = 0x00000004, /* init done */ Fload = 0x00000008, /* snarf done */ Fdump = 0x00000010, /* dump done */ . 33c RefFreq = 14318180, /* External Reference Clock frequency */ . wq //GO.SYSIN DD VADIM vga.h sum=`{sum < 824494834/vga.h} if(~ b622ce747031 $sum(1)^$sum(2)) echo if not{ echo 824494834/vga.h checksum error creating updated file exit checksum } target=824494834/vision864.c echo -n '824494834/vision864.c: ' if(! test -f $srcdir/vision864.c || ! test -r $srcdir/vision864.c){ echo $srcdir/vision864.c unreadable exit unreadable } sum=`{sum < $srcdir/vision864.c} if(! ~ 50e9ea532047 $sum(1)^$sum(2)){ echo $srcdir/vision864.c is not the original distribution file exit original } cp $srcdir/vision864.c 824494834/vision864.c ed 824494834/vision864.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vision864.c' 80,81d 33,34d 22,25c ctlr->flag |= Hlinear|Hpclk2x8|Henhanced|Foptions; . 20c options(Vga*, Ctlr *ctlr) . 14,15d 7c * S3 Vision864 GUI Accelerator. . wq //GO.SYSIN DD VADIM vision864.c sum=`{sum < 824494834/vision864.c} if(~ 3aab95941886 $sum(1)^$sum(2)) echo if not{ echo 824494834/vision864.c checksum error creating updated file exit checksum } target=824494834/ark2000pv.c echo -n '824494834/ark2000pv.c (new): ' cat > 824494834/ark2000pv.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * ARK Logic ARK2000PV GUI accelerator. */ static void snarf(Vga *vga, Ctlr *ctlr) { int i; /* * Unlock access to the extended I/O registers. */ vgaxo(Seqx, 0x1D, 0x01); for(i = 0x10; i < 0x2E; i++) vga->sequencer[i] = vgaxi(Seqx, i); for(i = 0x40; i < 0x47; i++) vga->crt[i] = vgaxi(Crtx, i); vga->crt[0x50] = vgaxi(Crtx, 0x50); /* * A hidey-hole for the coprocessor status register. */ vga->crt[0xFF] = inportb(0x3CB); /* * Memory size. */ switch((vga->sequencer[0x10]>>6) & 0x03){ case 0x00: vga->vma = vga->vmz = 1*1024*1024; break; case 0x01: vga->vma = vga->vmz = 2*1024*1024; break; case 0x02: vga->vma = vga->vmz = 4*1024*1024; break; } ctlr->flag |= Fsnarf; } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hlinear|Hpclk2x8|Foptions; } static void init(Vga *vga, Ctlr *ctlr) { Mode *mode; ulong x; mode = vga->mode; vga->crt[0x46] = 0x00; if(ctlr->flag & Upclk2x8){ vga->crt[0x00] = ((mode->ht/2)>>3)-5; vga->crt[0x01] = ((mode->x/2)>>3)-1; vga->crt[0x02] = ((mode->shb/2)>>3)-1; x = (mode->ehb/2)>>3; vga->crt[0x03] = 0x80|(x & 0x1F); vga->crt[0x04] = (mode->shs/2)>>3; vga->crt[0x05] = ((mode->ehs/2)>>3) & 0x1F; if(x & 0x20) vga->crt[0x05] |= 0x80; vga->crt[0x13] = mode->x/8; vga->crt[0x46] |= 0x04; } /* * Overflow bits. */ vga->crt[0x40] = 0x00; if(vga->crt[0x18] & 0x400) vga->crt[0x40] |= 0x08; if(vga->crt[0x10] & 0x400) vga->crt[0x40] |= 0x10; if(vga->crt[0x15] & 0x400) vga->crt[0x40] |= 0x20; if(vga->crt[0x12] & 0x400) vga->crt[0x40] |= 0x40; if(vga->crt[0x06] & 0x400) vga->crt[0x40] |= 0x80; vga->crt[0x41] = 0x00; if(vga->crt[0x13] & 0x100) vga->crt[0x41] |= 0x08; if(vga->crt[0x04] & 0x100) vga->crt[0x41] |= 0x10; if(vga->crt[0x02] & 0x100) vga->crt[0x41] |= 0x20; if(vga->crt[0x01] & 0x100) vga->crt[0x41] |= 0x40; if(vga->crt[0x00] & 0x100) vga->crt[0x41] |= 0x80; /* * Interlace. */ vga->crt[0x42] = 0x00; vga->crt[0x44] = 0x00; if(mode->interlace){ vga->crt[0x42] = vga->crt[0]/2; vga->crt[0x44] |= 0x04; } vga->crt[0x45] = 0x00; /* * Memory configuration: * enable linear|coprocessor|VESA modes; * set aperture to 64Kb, 0xA0000; * set aperture index 0. * Bugs: 1024x768x1 doesn't work (aperture not set correctly?); * hwgc doesn't work in 1-bit modes (hardware?). */ vga->sequencer[0x10] &= ~0x3F; vga->sequencer[0x11] &= ~0x0F; switch(mode->z){ case 1: vga->sequencer[0x10] |= 0x03; vga->sequencer[0x11] |= 0x01; cflag = 1; break; case 8: vga->sequencer[0x10] |= 0x0F; vga->sequencer[0x11] |= 0x06; if(vga->linear && (ctlr->flag & Hlinear) && vga->vmz) ctlr->flag |= Ulinear; break; } vga->sequencer[0x12] &= ~0x03; vga->sequencer[0x13] = 0x0A; vga->sequencer[0x14] = 0x00; vga->sequencer[0x15] = 0x00; vga->sequencer[0x16] = 0x00; /* * Frame Buffer Pitch and FIFO control. * Set the FIFO to 32 deep and refill trigger when * 6 slots empty. */ vga->sequencer[0x17] = 0x00; vga->sequencer[0x18] = 0x13; if(mode->x <= 640) vga->sequencer[0x17] = 0x00; else if(mode->x <= 800) vga->sequencer[0x17] |= 0x01; else if(mode->x <= 1024) vga->sequencer[0x17] |= 0x02; else if(mode->x <= 1280) vga->sequencer[0x17] |= 0x04; else if(mode->x <= 1600) vga->sequencer[0x17] |= 0x05; else if(mode->x <= 2048) vga->sequencer[0x17] |= 0x06; /* * Clock select. */ vga->misc &= ~0x0C; vga->misc |= (vga->i & 0x03)<<2; vga->sequencer[0x11] &= ~0xC0; vga->sequencer[0x11] |= (vga->i & 0x0C)<<4; vga->attribute[0x11] = Pwhite; ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { ulong l; /* * Ensure there are no glitches when selecting a new * clock frequency. * The sequencer toggle seems to matter on the Hercules * Stingray 64/Video at 1280x1024x8. Without it the screen * is fuzzy; a second load clears it up and there's no * difference between the two register sets. A mystery. */ vgao(MiscW, vga->misc & ~0x0C); vgaxo(Seqx, 0x11, vga->sequencer[0x11]); vgao(MiscW, vga->misc); if(vga->ramdac && strncmp(vga->ramdac->name, "w30c516", 7) == 0){ sequencer(vga, 1); sleep(500); sequencer(vga, 0); } if(ctlr->flag & Ulinear){ vga->sequencer[0x10] |= 0x10; if(vga->vmz <= 1024*1024) vga->sequencer[0x12] |= 0x01; else if(vga->vmz <= 2*1024*1024) vga->sequencer[0x12] |= 0x02; else vga->sequencer[0x12] |= 0x03; l = vga->vmb>>16; vga->sequencer[0x13] = l & 0xFF; vga->sequencer[0x14] = (l>>8) & 0xFF; } vgaxo(Seqx, 0x10, vga->sequencer[0x10]); vgaxo(Seqx, 0x12, vga->sequencer[0x12]); vgaxo(Seqx, 0x13, vga->sequencer[0x13]); vgaxo(Seqx, 0x14, vga->sequencer[0x14]); vgaxo(Seqx, 0x15, vga->sequencer[0x15]); vgaxo(Seqx, 0x16, vga->sequencer[0x16]); vgaxo(Seqx, 0x17, vga->sequencer[0x17]); vgaxo(Seqx, 0x18, vga->sequencer[0x18]); vgaxo(Crtx, 0x40, vga->crt[0x40]); vgaxo(Crtx, 0x41, vga->crt[0x41]); vgaxo(Crtx, 0x42, vga->crt[0x42]); vgaxo(Crtx, 0x44, vga->crt[0x44]); vgaxo(Crtx, 0x45, vga->crt[0x45]); vgaxo(Crtx, 0x46, vga->crt[0x46]); ctlr->flag |= Fload; } static void dump(Vga *vga, Ctlr *ctlr) { int i; printitem(ctlr->name, "Seq10"); for(i = 0x10; i < 0x2E; i++) printreg(vga->sequencer[i]); printitem(ctlr->name, "Crt40"); for(i = 0x40; i < 0x47; i++) printreg(vga->crt[i]); printitem(ctlr->name, "Crt50"); printreg(vga->crt[0x50]); printitem(ctlr->name, "Cop status"); printreg(vga->crt[0xFF]); } Ctlr ark2000pv = { "ark2000pv", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; Ctlr ark2000pvhwgc = { "ark2000pvhwgc", /* name */ 0, /* snarf */ 0, /* options */ 0, /* init */ 0, /* load */ 0, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/ark2000pv.c} if(~ e180175f5831 $sum(1)^$sum(2)) echo if not{ echo 824494834/ark2000pv.c checksum error extracting new file exit checksum } target=824494834/ct65540.c echo -n '824494834/ct65540.c (new): ' cat > 824494834/ct65540.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" enum { X= 0x3D6, /* index reg */ D= 0x3D7, /* data reg */ }; static int misc[] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xE, 0x28, 0x29, 0x70, 0x72, 0x73, 0x7D, 0x7F, -1}; static int map[] = { 0x7, 0x8, 0xB, 0xC, 0x10, 0x11, -1}; static int flags[] = { 0xF, 0x2B, 0x44, 0x45, -1}; static int compat[] = { 0x14, 0x15, 0x1F, 0x7E, -1}; static int clock[] = { 0x30, 0x31, 0x32, 0x33, -1}; static int mm[] = { 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, -1}; static int alt[] = { 0x0D, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x24, 0x25, 0x26, 0x64, 0x65, 0x66, 0x67, -1}; static int flat[] = { 0x2C, 0x2D, 0x2E, 0x2F, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x68, 0x6C, 0x6E, 0x6F, -1}; typedef struct Group Group; struct Group { char *name; int *x; }; static Group group[] = { { "misc", misc, }, { "map", map, }, { "compatability", compat, }, { "clock", clock, }, { "multimedia", mm, }, { "alternate", alt, }, { "flat-panel", flat, }, { 0 }, }; static uchar greg[256]; static uchar ctxi(uchar index) { outportb(X, index); return inportb(D); } static void ctxo(uchar index, uchar data) { outportb(X, index); outportb(D, data); } /* * ct65540. */ static void snarf(Vga*, Ctlr *ctlr) { Group *g; int *xp; ctlr->flag |= Fsnarf; for(g = group; g->name; g++) for(xp = g->x; *xp >= 0; xp++) greg[*xp] = ctxi(*xp); } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hlinear|Foptions; } /* * brute force and ignorance */ static int setclock(Vga *vga) { ulong fvco, t; ulong m, n; ulong bestm, bestn, diff, bestdiff, lastdiff; ulong p; if(vga->mode->frequency > 220000000) return -1; vga->misc &= ~(3<<2); vga->feature &= ~3; greg[0x33] &= ~0x20; /* set VCLK not MCLK */ greg[0x33] &= ~0x80; /* clk0 & clk1 are 25.175 & 28.322 MHz */ vga->misc |= (2<<2); vga->feature |= 2; fvco = vga->mode->frequency; if(fvco == 0) return -1; p = 0; while(fvco < 100000000){ fvco *= 2; p++; } m = (1<<31)/(4*RefFreq); if(m > 127) m = 127; bestdiff = 1<<31; bestm = 3; bestn = 3; for(; m > 2; m--){ lastdiff = 1<<31; for(n = 3; n < 128; n++){ t = (RefFreq*4*m)/n; diff = abs(fvco-t); if(diff < bestdiff){ bestdiff = diff; bestm = m; bestn = n; } else { if(diff > lastdiff) break; } lastdiff = diff; } } greg[0x31] = bestm - 2; greg[0x32] = bestn - 2; greg[0x30] = (p<<1) | 1; return 0; } static void init(Vga *vga, Ctlr *ctlr) { int x; greg[0x15] = 0; /* allow writes to all registers */ if(vga->mode->z == 8){ if(vga->linear && (ctlr->flag & Hlinear)) ctlr->flag |= Ulinear; vga->vmz = 1024*1024; vga->vmb = 1024*1024; /* linear mapping - extension regs*/ greg[0x04] = (1<<2); /* enable CRTC bits 16 & 17, 32 bit mode */ greg[0x0b] = 0x15; /* linear addressing, > 256k, sequential addr */ greg[0x28] = 0x90; /* non-interlaced, 256 colors */ /* normal regs */ vga->sequencer[0x04] = 0x0A; /* sequential memory access */ vga->graphics[0x05] = 0x00; /* sequential access, shift out 8 bits at */ /* a time */ vga->attribute[0x10] &= ~(1<<6); /* 1 dot clock per pixel */ vga->crt[0x14] = 0x00; vga->crt[0x17] = 0xe3; /* always byte mode */ } else { /* mapped to 0xa0000 - extension regs*/ greg[0x04] = (1<<2); /* enable CRTC bits 16 & 17, 32 bit mode */ greg[0x0b] = 0x01; /* 0xA0000 - 0xAFFFF, planar addressing */ greg[0x28] = 0x80; /* non-interlaced, 16 colors */ } /* the extension registers have even more overflow bits */ x = 0; if(vga->mode->vt & (1<<10)) x |= (1<<0); if(vga->mode->vrs & (1<<10)) x |= (1<<2); greg[0x16] = x; x = 0; if(vga->mode->ht & (1<<(8+3))) x |= (1<<0); if(vga->mode->shb & (1<<(8+3))) x |= (1<<4); if(vga->mode->ehb & (1<<(6+3))) x |= (1<<5); greg[0x17] = x; if(vga->mode->y > 480) vga->misc &= 0x3F; setclock(vga); ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { Group *g; int *xp; if(ctlr->flag & Ulinear) greg[0x8] = vga->vmb>>20; /* must be first */ ctxo(0x15, greg[0x15]); /* write protect */ ctxo(0x33, greg[0x33]); /* select clock */ /* only write what changed */ for(g = group; g->name; g++) for(xp = g->x; *xp >= 0; xp++) ctxo(*xp, greg[*xp]); ctlr->flag |= Fload; } static void dump(Vga*, Ctlr *ctlr) { Group *g; int *xp; char *name; int lastx; char item[32]; name = ctlr->name; for(g = group; g->name; g++){ lastx = -2; for(xp = g->x; *xp >= 0; xp++){ if(*xp != lastx+1){ sprint(item, "%s %2.2ux:", g->name, *xp); printitem(name, item); } lastx = *xp; printreg(greg[*xp]); } } } Ctlr ct65540 = { "ct65540", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/ct65540.c} if(~ b99088944911 $sum(1)^$sum(2)) echo if not{ echo 824494834/ct65540.c checksum error extracting new file exit checksum } target=824494834/error.c echo -n '824494834/error.c (new): ' cat > 824494834/error.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" int vflag; void error(char *format, ...) { char buf[512]; va_list arg; int n; sequencer(0, 1); n = sprint(buf, "%s: ", argv0); va_start(arg, format); doprint(buf+n, buf+sizeof(buf)-n, format, arg); va_end(arg); if(vflag) print(buf+n); fprint(2, buf); exits("error"); } void trace(char *format, ...) { char buf[512]; va_list arg; if(vflag){ if(curprintindex){ curprintindex = 0; print("\n"); } va_start(arg, format); doprint(buf, buf+sizeof(buf), format, arg); va_end(arg); print(buf); } } //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/error.c} if(~ 38a5417f580 $sum(1)^$sum(2)) echo if not{ echo 824494834/error.c checksum error extracting new file exit checksum } target=824494834/errordist.c echo -n '824494834/errordist.c (new): ' cat > 824494834/errordist.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" int vflag; void error(char *format, ...) { char buf[512]; int n; sequencer(0, 1); n = sprint(buf, "%s: ", argv0); doprint(buf+n, buf+sizeof(buf)-n, format, (&format+1)); if(vflag) print(buf+n); fprint(2, buf); exits("error"); } void trace(char *format, ...) { char buf[512]; if(vflag){ if(curprintindex){ curprintindex = 0; print("\n"); } doprint(buf, buf+sizeof(buf), format, (&format+1)); print(buf); } } //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/errordist.c} if(~ ea404234490 $sum(1)^$sum(2)) echo if not{ echo 824494834/errordist.c checksum error extracting new file exit checksum } target=824494834/ics534x.c echo -n '824494834/ics534x.c (new): ' cat > 824494834/ics534x.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * ICS534x GENDAC. * For now assumed to be hooked to either a Tseng Labs ET4000-W32p * (Hercules Dynamite Power, the Hercules generates RS2 using CLK3) * or an ARK2000pv (Diamond Stealth64 Graphics 2001). */ static uchar setrs2(Vga *vga, Ctlr *ctlr) { uchar rs2; rs2 = 0; if(strncmp(vga->ctlr->name, "et4000-w32", 10) == 0){ rs2 = vgaxi(Crtx, 0x31); vgaxo(Crtx, 0x31, 0x40|rs2); } else if(strncmp(vga->ctlr->name, "ark2000pv", 9) == 0){ rs2 = vgaxi(Seqx, 0x1C); vgaxo(Seqx, 0x1C, 0x80|rs2); } else error("%s: not configured for %s\n", vga->ctlr->name, ctlr->name); return rs2; } static void restorers2(Vga *vga, uchar rs2) { if(strncmp(vga->ctlr->name, "et4000-w32", 10) == 0) vgaxo(Crtx, 0x31, rs2); else if(strncmp(vga->ctlr->name, "ark2000pv", 9) == 0) vgaxo(Seqx, 0x1C, rs2); } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hpclk2x8|Foptions; } static void clock(Vga *vga, Ctlr *ctlr) { ulong f, m, n, r; double fmin, fmax, t, tok; /* * The PLL frequency is defined by: * (M+2) * Fout = ------------ x Fref * (N+2) x 2**R * where M, N and R have the following contraints: * 1) 2MHz < Fref < 32MHz * 2) Fref * 600KHz < ----- <= 8Mhz * (N+2) * 3) (M+2) x Fref * 60MHz <= ------------ <= 270MHz * (N+2) * 4) Fout < 135MHz * 5) 1 <= M <= 127, 1 <= N <= 31, 0 <= R <= 3 * * First determine R by finding the highest value * for which * 2**R x Fout <= 270Mhz * The datasheet says that if the multiplexed 16-bit * pseudo-colour mode is used then N2 (vga->r) must * be 2. */ if(ctlr->flag & Upclk2x8) vga->r = 2; else{ vga->r = 4; for(r = 0; r <= 3; r++){ f = vga->f*(1<r = r; } if(vga->r > 3) error("%s: pclk %d out of range\n", ctlr->name, vga->f); } /* * Now find the closest match for M and N. * Lower values of M and N give better noise rejection. */ fmin = vga->f*0.995; fmax = vga->f*1.005; tok = 0.0; for(n = 31; n >= 1; n--){ t = RefFreq/(n+2); if(600000 >= t || t > 8000000) continue; t = vga->f*(n+2)*(1<r); t /= RefFreq; m = (t+0.5) - 2; if(m > 127) continue; t = (m+2)*RefFreq; t /= (n+2)*(1<r); if(fmin <= t && t < fmax){ vga->m = m; vga->n = n; tok = t; } } if(tok == 0.0) error("%s: pclk %d out of range\n", ctlr->name, vga->f); } static void init(Vga *vga, Ctlr *ctlr) { ulong pclk; char *p; /* * Part comes in -135, -110 and -80MHz speed-grades. */ pclk = 80000000; if(p = strrchr(ctlr->name, '-')) pclk = strtoul(p+1, 0, 0) * 1000000; /* * If we don't already have a desired pclk, * take it from the mode. * Check it's within range. */ if(vga->f == 0) vga->f = vga->mode->frequency; if(vga->f > pclk) error("%s: invalid pclk - %ld\n", ctlr->name, vga->f); /* * Determine whether to use 2x8-bit mode or not. * If yes and the clock has already been initialised, * initialise it again. */ if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f >= pclk/2){ vga->f /= 2; resyncinit(vga, ctlr, Upclk2x8, 0); } /* * Clock bits. If the desired video clock is * one of the two standard VGA clocks it can just be * set using bits <3:2> of vga->misc, otherwise we * need to programme the DCLK PLL. */ vga->misc &= ~0x0C; if(vga->f == VgaFreq0) vga->i = 0; else if(vga->f == VgaFreq1){ vga->misc |= 0x04; vga->i = 1; } else{ /* * Initialise the PLL parameters. * Use CLK0 f7 internal clock (there are only 3 * clock-select bits). */ clock(vga, ctlr); vga->i = 0x07; } ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { uchar rs2, mode, pll; rs2 = setrs2(vga, ctlr); /* * Put the chip into snooze mode, * colour mode 0. */ mode = 0x00; outportb(Pixmask, 0x01); if(ctlr->flag & Upclk2x8) mode = 0x10; /* * If necessary, set the PLL parameters for CLK0 f7 * and make sure the PLL control register selects the * correct clock. Preserve the memory clock setting. */ outportb(PaddrR, 0x0E); pll = inportb(Pdata) & 0x10; if(vga->i == 0x07){ outportb(PaddrW, vga->i); outportb(Pdata, vga->m); outportb(Pdata, (vga->r<<5)|vga->n); pll |= 0x27; } outportb(PaddrW, 0x0E); outportb(Pdata, pll); outportb(Pixmask, mode); restorers2(vga, rs2); ctlr->flag |= Fload; } static void dump(Vga *vga, Ctlr *ctlr) { int i; uchar rs2, m, n; char buf[32]; ulong f; rs2 = setrs2(vga, ctlr); printitem(ctlr->name, "command"); printreg(inportb(Pixmask)); outportb(PaddrR, 0x00); for(i = 0; i < 0x0E; i++){ sprint(buf, "f%X m n", i); printitem(ctlr->name, buf); m = inportb(Pdata); printreg(m); n = inportb(Pdata); printreg(n); f = 14318180*(m+2); f /= (n & 0x1F)+2; f /= 1<<((n>>5) & 0x03); print("%12lud", f); } printitem(ctlr->name, "control"); printreg(inportb(Pdata)); restorers2(vga, rs2); } Ctlr ics534x = { "ics534x", /* name */ 0, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/ics534x.c} if(~ 7665f36f5177 $sum(1)^$sum(2)) echo if not{ echo 824494834/ics534x.c checksum error extracting new file exit checksum } target=824494834/rgb524.c echo -n '824494834/rgb524.c (new): ' cat > 824494834/rgb524.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * IBM RGB524. * 170/220MHz High Performance Palette DAC. * * Assumes hooked up to an S3 Vision96[48]. */ enum { IndexLo = 0x00, IndexHi = 0x01, Data = 0x02, IndexCtl = 0x03, }; enum { /* index registers */ MiscClock = 0x02, PixelFormat = 0x0A, PLLControl1 = 0x10, PLLControl2 = 0x11, PLLReference = 0x14, Frequency0 = 0x20, MiscControl1 = 0x70, MiscControl2 = 0x71, }; static uchar setrs2(void) { uchar rs2; rs2 = vgaxi(Crtx, 0x55); vgaxo(Crtx, 0x55, (rs2 & 0xFC)|0x01); return rs2; } static uchar rgb524xi(int index) { outportb(dacxreg[IndexLo], index & 0xFF); outportb(dacxreg[IndexHi], (index>>8) & 0xFF); return inportb(dacxreg[Data]); } static void rgb524xo(int index, uchar data) { outportb(dacxreg[IndexLo], index & 0xFF); outportb(dacxreg[IndexHi], (index>>8) & 0xFF); outportb(dacxreg[Data], data); } static void restorers2(uchar rs2) { vgaxo(Crtx, 0x55, rs2); } static void clock(Vga *vga, Ctlr *ctlr) { if(vga->f >= 16250000 && vga->f <= 32000000){ vga->f = (vga->f/250000)*250000; vga->d = (4*vga->f)/1000000 - 65; } else if(vga->f >= 32500000 && vga->f <= 64000000){ vga->f = (vga->f/500000)*500000; vga->d = 0x40|((2*vga->f)/1000000 - 65); } else if(vga->f >= 65000000 && vga->f <= 128000000){ vga->f = (vga->f/1000000)*1000000; vga->d = 0x80|(vga->f/1000000 - 65); } else if(vga->f >= 130000000 && vga->f <= 220000000){ vga->f = (vga->f/2000000)*2000000; vga->d = 0xC0|((vga->f/2)/1000000 - 65); } else error("%s: pclk %d out of range\n", ctlr->name, vga->f); } static void init(Vga *vga, Ctlr *ctlr) { ulong pclk; char *p; /* * Part comes in -170 and -220MHz speed-grades. */ pclk = 170000000; if(p = strrchr(ctlr->name, '-')) pclk = strtoul(p+1, 0, 0) * 1000000; /* * If we don't already have a desired pclk, * take it from the mode. * Check it's within range. */ if(vga->f == 0) vga->f = vga->mode->frequency; if(vga->f > pclk) error("%s: invalid pclk - %ld\n", ctlr->name, vga->f); /* * Determine whether to use clock-doubler or not. */ if((ctlr->flag & Uclk2) == 0 && vga->mode->z == 8) resyncinit(vga, ctlr, Uclk2, 0); /* * Clock bits. If the desired video clock is * one of the two standard VGA clocks it can just be * set using bits <3:2> of vga->misc, otherwise we * need to programme the PLL. */ vga->misc &= ~0x0C; if(vga->mode->z == 8 || (vga->f != VgaFreq0 && vga->f != VgaFreq1)){ /* * Initialise the PLL parameters. * Use internal FS3 fixed-reference divider. */ clock(vga, ctlr); vga->i = 0x03; } else if(vga->f == VgaFreq0) vga->i = 0; else if(vga->f == VgaFreq1){ vga->misc |= 0x04; vga->i = 1; } ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { uchar mc2, rs2, x; char *val; int f; rs2 = setrs2(); /* * Set VgaFreq[01]. */ rgb524xo(PLLControl1, 0x00); rgb524xo(Frequency0, 0x24); rgb524xo(Frequency0+1, 0x30); if(val = dbattr(vga->attr, "rgb524refclk")){ f = strtol(val, 0, 0); if(f > 1000000) f /= 1000000; rgb524xo(PLLReference, f/2); } /* * Enable pixel programming and clock divide * factor. */ x = rgb524xi(MiscClock) & ~0x0E; x |= 0x01; if(ctlr->flag & Uclk2) x |= 0x02; rgb524xo(MiscClock, x); if(vga->mode->z == 1) rgb524xo(PixelFormat, 0x02); else if(vga->mode->z == 8) rgb524xo(PixelFormat, 0x03); x = rgb524xi(MiscControl1) & ~0x41; x |= 0x01; rgb524xo(MiscControl1, x); mc2 = rgb524xi(MiscControl2) & ~0x41; vga->crt[0x22] &= ~0x08; if(vga->i == 3){ rgb524xo(Frequency0+3, vga->d); rgb524xo(PLLControl1, 0x02); rgb524xo(PLLControl2, vga->i); mc2 |= 0x41; vga->crt[0x22] |= 0x08; } rgb524xo(MiscControl2, mc2); vgaxo(Crtx, 0x22, vga->crt[0x22]); restorers2(rs2); ctlr->flag |= Fload; } static void dump(Vga*, Ctlr *ctlr) { uchar rs2, r, x[256]; char buf[32]; int df, i, maxf, vcodc, vf; rs2 = setrs2(); printitem(ctlr->name, "index00"); for(i = 0x00; i < 0x0F; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index10"); for(i = 0x10; i < 0x17; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index20"); for(i = 0x20; i < 0x30; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index30"); for(i = 0x30; i < 0x37; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index40"); for(i = 0x40; i < 0x49; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index60"); for(i = 0x60; i < 0x63; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index70"); for(i = 0x70; i < 0x73; i++){ x[i] = rgb524xi(i); printreg(x[i]); } printitem(ctlr->name, "index8E"); for(i = 0x8E; i < 0x92; i++){ x[i] = rgb524xi(i); printreg(x[i]); } restorers2(rs2); /* * x[0x10] pixel clock frequency selection * 0, 2 for direct programming * x[0x20-0x2F] pixel frequency 0-15 */ printitem(ctlr->name, "refclk"); print("%12lud\n", x[PLLReference]*2*1000000); if((i = (x[0x10] & 0x07)) == 0x00 || i == 0x02){ /* * Direct programming, external frequency select. * F[0-4] are probably tied directly to the 2 clock-select * bits in the VGA Misc register. */ if(i == 0) maxf = 4; else maxf = 16; for(i = 0; i < maxf; i++){ if((r = x[0x20+i]) == 0) continue; sprint(buf, "direct F%X", i); printitem(ctlr->name, buf); df = (r>>6) & 0x03; vcodc = r & 0x3F; vf = 0; switch(df){ case 0: vf = (vcodc+65)/4; break; case 1: vf = (vcodc+65)/2; break; case 2: vf = (vcodc+65); break; case 3: vf = (vcodc+65)*2; break; } print("%12lud\n", vf); } } } Ctlr rgb524 = { "rgb524", /* name */ 0, /* snarf */ 0, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/rgb524.c} if(~ ee9556355877 $sum(1)^$sum(2)) echo if not{ echo 824494834/rgb524.c checksum error extracting new file exit checksum } target=824494834/trio64.c echo -n '824494834/trio64.c (new): ' cat > 824494834/trio64.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * S3 Trio64. */ static void snarf(Vga *vga, Ctlr *ctlr) { int i; /* * The Trio has some extra sequencer registers which * need to be unlocked for access. */ vgaxo(Seqx, 0x08, 0x06); for(i = 0x08; i < 0x19; i++) vga->sequencer[i] = vgaxi(Seqx, i); vga->crt[0x2D] = vgaxi(Crtx, 0x2D); vga->crt[0x2E] = vgaxi(Crtx, 0x2E); vga->crt[0x2F] = vgaxi(Crtx, 0x2F); (*s3generic.snarf)(vga, ctlr); ctlr->flag |= Fsnarf; } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hlinear|Hpclk2x8|Henhanced|Foptions; } static void clock(Vga *vga, Ctlr *ctlr) { int d; ulong f, fmax, fmin, n, m, r; double trouble; /* * The PLL frequency is defined by the following equation: * (M+2) * Fout = ------------- x Fref * (N+2) x 2**R * where M, N and R have the following contraints: * 1) (M+2) x Fref * 135MHz <= ------------ <= 270MHz * (N+2) * 2) 1 <= M <= 127 * 3) 1 <= N <= 31 * 4) 0 <= R <= 3 * * First determine R: * 135MHz < 2**R x Fout <= 270Mhz */ vga->r = 4; for(r = 0; r <= 3; r++){ f = vga->f*(1<r = r; } if(vga->r > 3) error("%s: pclk %d out of range\n", ctlr->name, vga->f); /* * Now find the closest match for M and N. */ vga->d = vga->f+1; for(n = 1; n <= 31; n++){ trouble = vga->f*(n+2)*(1<r); trouble /= RefFreq; m = (trouble+0.5) - 2; if(m > 127) continue; trouble = (m+2)*RefFreq; trouble /= (n+2)*(1<r); f = trouble+0.5; d = vga->f - f; if(d < 0) d = -d; if(d <= vga->d){ vga->m = m; vga->n = n; vga->d = d; } } trouble = vga->f*1.005; fmax = trouble; trouble = vga->f*0.995; fmin = trouble; trouble = (vga->m+2)*RefFreq; trouble /= (vga->n+2)*(1<r); f = trouble+0.5; if(fmin >= f || f >= fmax) error("%s: pclk %d out of range\n", ctlr->name, vga->f); } static void init(Vga *vga, Ctlr *ctlr) { ulong pclk, x; (*s3generic.init)(vga, ctlr); /* * Clock bits. If the desired video clock is * one of the two standard VGA clocks it can just be * set using bits <3:2> of vga->misc, otherwise we * need to programme the DCLK PLL. */ if(vga->f == 0) vga->f = vga->mode->frequency; vga->misc &= ~0x0C; if(vga->f == VgaFreq0) ; else if(vga->f == VgaFreq1) vga->misc |= 0x04; else{ /* * Part comes in -135MHz speed grade. In 8-bit mode * the maximum DCLK is 80MHz. In 2x8-bit mode the maximum * DCLK is 135MHz using the internal clock doubler. */ if((ctlr->flag & Hpclk2x8) && vga->mode->z == 8){ pclk = 135000000; if(vga->f > 80000000) ctlr->flag |= Upclk2x8; } else pclk = 80000000; if(vga->f > pclk) error("%s: invalid pclk - %ld\n", ctlr->name, vga->f); clock(vga, ctlr); vga->sequencer[0x12] = (vga->r<<5)|vga->n; vga->sequencer[0x13] = vga->m; vga->misc |= 0x0C; } /* * Internal clock generator. */ vga->sequencer[0x15] &= ~0x31; vga->sequencer[0x15] |= 0x02; vga->sequencer[0x18] &= ~0x80; vga->crt[0x67] &= ~0xF2; if(ctlr->flag & Upclk2x8){ vga->sequencer[0x15] |= 0x10; vga->sequencer[0x18] |= 0x80; /* * There's a little strip of the border * appears on the left in resolutions * 1280 and above if the 0x02 bit isn't * set (when it appears on the right...). * set. */ vga->crt[0x67] |= 0x10; } /* * VLB address latch delay. */ if((vga->crt[0x36] & 0x03) == 0x01) vga->crt[0x58] &= ~0x08; /* * Start display FIFO fetch. */ x = vga->crt[0]-5; vga->crt[0x3B] = x; if(x & 0x100) vga->crt[0x5D] |= 0x40; /* * Display memory access control. * Calculation of the M-parameter (Crt54) is * memory-system and dot-clock dependent, the * values below are guesses from dumping * registers. */ vga->crt[0x60] = 0xFF; if(vga->mode->x <= 800) vga->crt[0x54] = 0xE8; else if(vga->mode->x <= 1024) vga->crt[0x54] = 0xA8; else vga->crt[0x54] = 0x00/*0x48*/; ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { ushort advfunc; (*s3generic.load)(vga, ctlr); vgaxo(Crtx, 0x60, vga->crt[0x60]); vgaxo(Crtx, 0x67, vga->crt[0x67]); /* * Load the PLL registers if necessary. * Not sure if the variable-delay method of setting the * PLL will work without a write here to vga->misc, * so use the immediate-load method by toggling bit 5 * of Seq15 if necessary. */ vgaxo(Seqx, 0x12, vga->sequencer[0x12]); vgaxo(Seqx, 0x13, vga->sequencer[0x13]); if((vga->misc & 0x0C) == 0x0C) vgaxo(Seqx, 0x15, vga->sequencer[0x15]|0x20); vgaxo(Seqx, 0x15, vga->sequencer[0x15]); vgaxo(Seqx, 0x18, vga->sequencer[0x18]); advfunc = 0x0000; if(ctlr->flag & Uenhanced) advfunc = 0x0001; outportw(0x4AE8, advfunc); } static void dump(Vga *vga, Ctlr *ctlr) { int i; ulong dclk, m, n, r; (*s3generic.dump)(vga, ctlr); printitem(ctlr->name, "Seq08"); for(i = 0x08; i < 0x19; i++) printreg(vga->sequencer[i]); printitem(ctlr->name, "Crt2D"); printreg(vga->crt[0x2D]); printreg(vga->crt[0x2E]); printreg(vga->crt[0x2F]); n = vga->sequencer[0x12] & 0x1F; r = (vga->sequencer[0x12]>>5) & 0x03; m = vga->sequencer[0x13] & 0x7F; dclk = (m+2)*RefFreq; dclk /= (n+2)*(1<name, "dclk m n r"); print("%9ld %8ld - %8ld %8ld\n", dclk, m, n, r); } Ctlr trio64 = { "trio64", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/trio64.c} if(~ 41c12db35457 $sum(1)^$sum(2)) echo if not{ echo 824494834/trio64.c checksum error extracting new file exit checksum } target=824494834/vision964.c echo -n '824494834/vision964.c (new): ' cat > 824494834/vision964.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * S3 Vision964 GUI Accelerator. */ static void snarf(Vga *vga, Ctlr *ctlr) { (*s3generic.snarf)(vga, ctlr); vga->crt[0x22] = vgaxi(Crtx, 0x22); vga->crt[0x24] = vgaxi(Crtx, 0x24); vga->crt[0x26] = vgaxi(Crtx, 0x26); } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hlinear|Henhanced|Foptions; } static void init(Vga *vga, Ctlr *ctlr) { Mode *mode; ulong x; mode = vga->mode; if(vga->ramdac && (vga->ramdac->flag & Uclk2)){ resyncinit(vga, ctlr, Uenhanced, 0); vga->crt[0x00] = ((mode->ht/2)>>3)-5; vga->crt[0x01] = ((mode->x/2)>>3)-1; vga->crt[0x02] = ((mode->shb/2)>>3)-1; x = (mode->ehb/2)>>3; vga->crt[0x03] = 0x80|(x & 0x1F); vga->crt[0x04] = (mode->shs/2)>>3; vga->crt[0x05] = ((mode->ehs/2)>>3) & 0x1F; if(x & 0x20) vga->crt[0x05] |= 0x80; vga->crt[0x13] = mode->x/8; } else if(mode->z == 8) resyncinit(vga, ctlr, Uenhanced, 0); (*s3generic.init)(vga, ctlr); /* if((ctlr->flag & Uenhanced) == 0) vga->crt[0x33] &= ~0x20; */ vga->crt[0x3B] = (vga->crt[0]+vga->crt[4]+1)/2; if(vga->crt[0x3B] & 0x100) vga->crt[0x5D] |= 0x40; vga->crt[0x55] = 0x00; vga->crt[0x40] &= ~0x10; vga->crt[0x53] &= ~0x20; vga->crt[0x58] &= ~0x48; vga->crt[0x65] = 0x00; vga->crt[0x66] &= ~0x07; vga->crt[0x6D] = 0x00; if(ctlr->flag & Uenhanced){ vga->crt[0x40] |= 0x10; vga->crt[0x58] |= 0x40; if(vga->ramdac && (vga->ramdac->flag & Uclk2)){ vga->crt[0x66] |= 0x02; } else vga->crt[0x66] |= 0x03; vga->crt[0x65] |= 0x02; /* * Some heuristics (what part of aux/vga isn't?) * to prevent some of the right border appearing * on the left edge of the screen. */ if(mode->x > 1024) vga->crt[0x6D] = 0x01; else vga->crt[0x6D] = 0x03; } } static void load(Vga *vga, Ctlr *ctlr) { ushort advfunc; (*s3generic.load)(vga, ctlr); vgaxo(Crtx, 0x65, vga->crt[0x65]); vgaxo(Crtx, 0x66, vga->crt[0x66]); vgaxo(Crtx, 0x6D, vga->crt[0x6D]); advfunc = 0x0000; if(ctlr->flag & Uenhanced) advfunc = 0x0001; outportw(0x4AE8, advfunc); } static void dump(Vga *vga, Ctlr *ctlr) { (*s3generic.dump)(vga, ctlr); printitem(ctlr->name, "crt22"); printreg(vga->crt[0x22]); printitem(ctlr->name, "crt24"); printreg(vga->crt[0x24]); printitem(ctlr->name, "crt26"); printreg(vga->crt[0x26]); } Ctlr vision964 = { "vision964", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/vision964.c} if(~ f1d86ea52495 $sum(1)^$sum(2)) echo if not{ echo 824494834/vision964.c checksum error extracting new file exit checksum } target=824494834/vision968.c echo -n '824494834/vision968.c (new): ' cat > 824494834/vision968.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * S3 Vision968 GUI Accelerator. */ static void snarf(Vga *vga, Ctlr *ctlr) { (*s3generic.snarf)(vga, ctlr); vga->sequencer[0x09] = vgaxi(Seqx, 0x09); vga->sequencer[0x0A] = vgaxi(Seqx, 0x0A); vga->crt[0x22] = vgaxi(Crtx, 0x22); vga->crt[0x24] = vgaxi(Crtx, 0x24); vga->crt[0x26] = vgaxi(Crtx, 0x26); vga->crt[0x2D] = vgaxi(Crtx, 0x2D); vga->crt[0x2E] = vgaxi(Crtx, 0x2E); vga->crt[0x2F] = vgaxi(Crtx, 0x2F); } static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hlinear|Henhanced|Foptions; } static void init(Vga *vga, Ctlr *ctlr) { Mode *mode; ulong x; mode = vga->mode; if(vga->ramdac && (vga->ramdac->flag & Uclk2)){ resyncinit(vga, ctlr, Uenhanced, 0); vga->crt[0x00] = ((mode->ht/2)>>3)-5; vga->crt[0x01] = ((mode->x/2)>>3)-1; vga->crt[0x02] = ((mode->shb/2)>>3)-1; x = (mode->ehb/2)>>3; vga->crt[0x03] = 0x80|(x & 0x1F); vga->crt[0x04] = (mode->shs/2)>>3; vga->crt[0x05] = ((mode->ehs/2)>>3) & 0x1F; if(x & 0x20) vga->crt[0x05] |= 0x80; vga->crt[0x13] = mode->x/8; } else if(mode->z == 8) resyncinit(vga, ctlr, Uenhanced, 0); (*s3generic.init)(vga, ctlr); /* if((ctlr->flag & Uenhanced) == 0) vga->crt[0x33] &= ~0x20; */ vga->crt[0x3B] = (vga->crt[0]+vga->crt[4]+1)/2; if(vga->crt[0x3B] & 0x100) vga->crt[0x5D] |= 0x40; vga->crt[0x55] = 0x00; vga->crt[0x40] &= ~0x10; vga->crt[0x53] &= ~0x20; vga->crt[0x58] &= ~0x48; vga->crt[0x65] = 0x00; vga->crt[0x66] &= ~0x07; vga->crt[0x67] = 0x00; vga->crt[0x6D] = 0x00; if(ctlr->flag & Uenhanced){ vga->crt[0x40] |= 0x10; vga->crt[0x58] |= 0x40; /* * The test against 1376 is necessary for the STB * Velocity 64 Video, no idea it's relevant to other * cards. */ if(dbattr(vga->attr, "disa1sc") && mode->x <= 1376) vga->crt[0x65] |= 0x02; vga->crt[0x67] |= 0x10; } } static void load(Vga *vga, Ctlr *ctlr) { ushort advfunc; (*s3generic.load)(vga, ctlr); vgaxo(Crtx, 0x65, vga->crt[0x65]); vgaxo(Crtx, 0x66, vga->crt[0x66]); vgaxo(Crtx, 0x67, vga->crt[0x67]); vgaxo(Crtx, 0x6D, vga->crt[0x6D]); advfunc = 0x0000; if(ctlr->flag & Uenhanced) advfunc = 0x0001; outportw(0x4AE8, advfunc); } static void dump(Vga *vga, Ctlr *ctlr) { (*s3generic.dump)(vga, ctlr); printitem(ctlr->name, "Seq09"); printreg(vga->sequencer[0x09]); printreg(vga->sequencer[0x0A]); printitem(ctlr->name, "Crt22"); printreg(vga->crt[0x22]); printitem(ctlr->name, "Crt24"); printreg(vga->crt[0x24]); printitem(ctlr->name, "Crt26"); printreg(vga->crt[0x26]); printitem(ctlr->name, "Crt2D"); printreg(vga->crt[0x2D]); printreg(vga->crt[0x2E]); printreg(vga->crt[0x2F]); } Ctlr vision968 = { "vision968", /* name */ snarf, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/vision968.c} if(~ 630047982834 $sum(1)^$sum(2)) echo if not{ echo 824494834/vision968.c checksum error extracting new file exit checksum } target=824494834/w30c516.c echo -n '824494834/w30c516.c (new): ' cat > 824494834/w30c516.c >[2]/dev/null <<'//GO.SYSIN DD VADIM /sys/src/cmd/aux/vga' #include #include #include "vga.h" /* * IC Works W30C516 ZOOMDAC. * DSP-based Multimedia RAMDAC. */ enum { Cr0 = 0x00, /* Control register 0 */ Mid = 0x01, /* Manufacturer's identification register */ Did = 0x02, /* Device identification register */ Cr1 = 0x03, /* Control register 1 */ Reserve1 = 0x04, /* Reserved (16-bit) */ Reserve2 = 0x06, /* Reserved (16-bit) */ Reserve3 = 0x08, /* Reserved (16-bit) */ Reserve4 = 0x0A, /* Reserved (16-bit) */ IstartX = 0x0C, /* Image Start X (16-bit) */ IstartY = 0x0E, /* Image Start Y (16-bit) */ IendX = 0x10, /* Image End X (16-bit) */ IendY = 0x12, /* Image End Y (16-bit) */ RatioX = 0x14, /* Ratio X (16-bit) */ RatioY = 0x16, /* Ratio Y (16-bit) */ OffsetX = 0x18, /* Offset X (16-bit) */ OffsetY = 0x1A, /* Offset Y (16-bit) */ TestR = 0x1C, /* Red signature analysis register */ TestG = 0x1D, /* Green signature analysis register */ TestB = 0x1E, /* Blue signature analysis register */ Nir = 0x1F, /* number of indirect registers */ }; static void options(Vga*, Ctlr *ctlr) { ctlr->flag |= Hpclk2x8|Foptions; } static void init(Vga *vga, Ctlr *ctlr) { ulong grade, pclk; char *p; /* * Part comes in -170, -135 and -110MHz speed-grades. * In 8-bit mode the max. PCLK is 135MHz for the -170 part * and the speed-grade for the others. In 2x8-bit mode, the max. * PCLK is the speed-grade, using the 2x doubler. * Work out the part speed-grade from name. Name can have, * e.g. '-135' on the end for 135MHz part. */ grade = 110000000; if(p = strrchr(ctlr->name, '-')) grade = strtoul(p+1, 0, 0) * 1000000; if(grade == 170000000) pclk = 135000000; else pclk = grade; /* * If we don't already have a desired pclk, * take it from the mode. * Check it's within range. */ if(vga->f == 0) vga->f = vga->mode->frequency; /* * Determine whether to use 2x8-bit mode or not. * If yes and the clock has already been initialised, * initialise it again. There is no real frequency * restriction, it's really just a lower limit on what's * available in some clock generator chips. */ if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f >= 60000000){ vga->f /= 2; resyncinit(vga, ctlr, Upclk2x8, 0); } if(vga->f > pclk) error("%s: invalid pclk - %ld\n", ctlr->name, vga->f); ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { uchar mode, x; /* * Put the chip to sleep. */ attdaco(Cr0, 0x08); mode = 0x00; if(ctlr->flag & Upclk2x8) mode = 0x20; /* * Set the mode in the RAMDAC, setting 6/8-bit colour * as appropriate and waking the chip back up. */ if(vga->mode->z == 8 && 0) mode |= 0x02; x = attdaci(Cr1) & 0x80; attdaco(Cr1, x); attdaco(Cr0, mode); ctlr->flag |= Fload; } static void dump(Vga*, Ctlr *ctlr) { int i; printitem(ctlr->name, ""); for(i = 0; i < Nir; i++) printreg(attdaci(i)); } Ctlr w30c516 = { "w30c516", /* name */ 0, /* snarf */ options, /* options */ init, /* init */ load, /* load */ dump, /* dump */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 824494834/w30c516.c} if(~ e33e757c3106 $sum(1)^$sum(2)) echo if not{ echo 824494834/w30c516.c checksum error extracting new file exit checksum } echo obsolete files: /n/juke/plan_9/sys/src/cmd/aux/vga/vgadb