#!/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: 816368816 # date: Tue Nov 14 12:06:56 EST 1995 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 816368816 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 816368816 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 816368816 mkdir 816368816 target=816368816/att20c49x.c echo -n '816368816/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 816368816/att20c49x.c ed 816368816/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 < 816368816/att20c49x.c} if(~ 224678181687 $sum(1)^$sum(2)) echo if not{ echo 816368816/att20c49x.c checksum error creating updated file exit checksum } target=816368816/att21c498.c echo -n '816368816/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 816368816/att21c498.c ed 816368816/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 < 816368816/att21c498.c} if(~ 989ba0963157 $sum(1)^$sum(2)) echo if not{ echo 816368816/att21c498.c checksum error creating updated file exit checksum } target=816368816/bt485.c echo -n '816368816/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 816368816/bt485.c ed 816368816/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,104d 100c options(Vga*, Ctlr *ctlr) . wq //GO.SYSIN DD VADIM bt485.c sum=`{sum < 816368816/bt485.c} if(~ 3b087d934836 $sum(1)^$sum(2)) echo if not{ echo 816368816/bt485.c checksum error creating updated file exit checksum } target=816368816/ch9294.c echo -n '816368816/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 816368816/ch9294.c ed 816368816/ch9294.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM ch9294.c' 59,60c ctlr->flag |= Finit; return; } . 53,57c for(divisor = 1; divisor <= maxdivisor; divisor <<= 1){ f = vga->f - pattern->frequency[index]/divisor; if(f < 0) f = -f; if(f < 1000000){ /*vga->f = pattern->frequency[index];*/ vga->d = divisor; vga->i = index; . 51a maxdivisor = 1; if(vga->ctlr && (vga->ctlr->flag & Hclkdiv)) maxdivisor = 8; . 32d 30c int f, 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 < 816368816/ch9294.c} if(~ 7e97abcb2016 $sum(1)^$sum(2)) echo if not{ echo 816368816/ch9294.c checksum error creating updated file exit checksum } target=816368816/clgd542x.c echo -n '816368816/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 816368816/clgd542x.c ed 816368816/clgd542x.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM clgd542x.c' 226,227d 224c load(Vga *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)); . 105c vga->vmz = 2048*1024; . 101c vga->vmz = 1024*1024; . 97c vga->vmz = 512*1024; . 93c vga->vmz = 256*1024; . 59,60d wq //GO.SYSIN DD VADIM clgd542x.c sum=`{sum < 816368816/clgd542x.c} if(~ b7f21e495101 $sum(1)^$sum(2)) echo if not{ echo 816368816/clgd542x.c checksum error creating updated file exit checksum } target=816368816/data.c echo -n '816368816/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 816368816/data.c ed 816368816/data.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM data.c' 38a &vision964, /* ctlr */ &w30c516, /* ctlr */ . 33a &trio64, /* ctlr */ . 23a &ics534x, /* gendac */ . 16a &ct65540, /* ctlr */ . 9a &ark2000pv, /* ctlr */ &att20c490, /* ramdac */ . wq //GO.SYSIN DD VADIM data.c sum=`{sum < 816368816/data.c} if(~ ebe12f321219 $sum(1)^$sum(2)) echo if not{ echo 816368816/data.c checksum error creating updated file exit checksum } target=816368816/db.c echo -n '816368816/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 816368816/db.c ed 816368816/db.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM db.c' 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); . 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; . wq //GO.SYSIN DD VADIM db.c sum=`{sum < 816368816/db.c} if(~ afa0c3ab5755 $sum(1)^$sum(2)) echo if not{ echo 816368816/db.c checksum error creating updated file exit checksum } target=816368816/et4000.c echo -n '816368816/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 816368816/et4000.c ed 816368816/et4000.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM et4000.c' 196,197d 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 < 816368816/et4000.c} if(~ 68c203166484 $sum(1)^$sum(2)) echo if not{ echo 816368816/et4000.c checksum error creating updated file exit checksum } target=816368816/et4000hwgc.c echo -n '816368816/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 816368816/et4000hwgc.c ed 816368816/et4000hwgc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM et4000hwgc.c' 9d wq //GO.SYSIN DD VADIM et4000hwgc.c sum=`{sum < 816368816/et4000hwgc.c} if(~ 13e29a7a518 $sum(1)^$sum(2)) echo if not{ echo 816368816/et4000hwgc.c checksum error creating updated file exit checksum } target=816368816/ibm8514.c echo -n '816368816/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 816368816/ibm8514.c ed 816368816/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 < 816368816/ibm8514.c} if(~ 75deae342337 $sum(1)^$sum(2)) echo if not{ echo 816368816/ibm8514.c checksum error creating updated file exit checksum } target=816368816/icd2061a.c echo -n '816368816/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 816368816/icd2061a.c ed 816368816/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 < 816368816/icd2061a.c} if(~ e39041dc1978 $sum(1)^$sum(2)) echo if not{ echo 816368816/icd2061a.c checksum error creating updated file exit checksum } target=816368816/ics2494.c echo -n '816368816/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 816368816/ics2494.c ed 816368816/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 < 816368816/ics2494.c} if(~ ed55f0021948 $sum(1)^$sum(2)) echo if not{ echo 816368816/ics2494.c checksum error creating updated file exit checksum } target=816368816/io.c echo -n '816368816/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 816368816/io.c ed 816368816/io.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM io.c' 289a } static char *flagname[32] = { [0x00] "Fsnarf", [0x01] "Foptions", [0x02] "Finit", [0x03] "Fload", [0x04] "Fdump", [0x08] "Hpclk2x8", [0x09] "Upclk2x8", [0x0A] "Henhanced", [0x0B] "Uenhanced", [0x0C] "Hpvram", [0x0D] "Upvram", [0x0E] "Hextsid", [0x0F] "Uextsid", [0x10] "Hclk2", [0x11] "Uclk2", [0x12] "Hlinear", [0x13] "Ulinear", [0x14] "Hclkdiv", [0x15] "Uclkdiv", }; void printflag(ulong flag) { int i; char first; 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 < 816368816/mach32.c} if(~ 653c7ed95900 $sum(1)^$sum(2)) echo if not{ echo 816368816/mach32.c checksum error creating updated file exit checksum } target=816368816/mach64.c echo -n '816368816/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 816368816/mach64.c ed 816368816/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 < 816368816/mach64.c} if(~ 370f088c8157 $sum(1)^$sum(2)) echo if not{ echo 816368816/mach64.c checksum error creating updated file exit checksum } target=816368816/main.c echo -n '816368816/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 816368816/main.c ed 816368816/main.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM main.c' 205a sequencer(vga, 1); . 200d 197a verbose("%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); . 174c if(vga->vmz && (vga->mode->x*vga->mode->y*vga->mode->z/8 > vga->vmz)) . 165a verbose("%s->init\n", ctlr->name); . 159a verbose("%s->options\n", ctlr->name); . 139a verbose("%s->snarf\n", ctlr->name); . 136a if(nflag) vga->linear = 0; verbose("snarf\n"); . 122a if(bios){ if((vga->offset = strtol(bios, &p, 0)) == 0 || *p++ != '=') error("bad BIOS string format - %s\n", bios); len = strlen(p); vga->bios = alloc(len+1); strncpy(vga->bios, p, len); verbose("BIOS override: %s: offset 0x%lux, string %s\n", bios, vga->offset, vga->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); verbose("linear addr %s\n", buf); vga->vmb = strtoul(buf, 0, 0); } else vgactlw("linear", "0"); } . 50a verbose("%s->init\n", link->name); . 27c printflag(ctlr->flag); print("\n"); . 6,7c static int iflag, lflag, nflag, pflag; static char *usage = "usage: %s [ -cdfilmnpv ] [ mode ]\n"; . wq //GO.SYSIN DD VADIM main.c sum=`{sum < 816368816/main.c} if(~ 9b214a264875 $sum(1)^$sum(2)) echo if not{ echo 816368816/main.c checksum error creating updated file exit checksum } target=816368816/mkfile echo -n '816368816/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 816368816/mkfile ed 816368816/mkfile >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mkfile' 37a vision964.$O\ w30c516.$O\ . 32a trio64.$O\ . 20a ics534x.$O\ . 13a ct65540.$O\ . 8a ark2000pv.$O\ . wq //GO.SYSIN DD VADIM mkfile sum=`{sum < 816368816/mkfile} if(~ b0524022562 $sum(1)^$sum(2)) echo if not{ echo 816368816/mkfile checksum error creating updated file exit checksum } target=816368816/palette.c echo -n '816368816/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 816368816/palette.c ed 816368816/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 < 816368816/palette.c} if(~ 2d955ae12137 $sum(1)^$sum(2)) echo if not{ echo 816368816/palette.c checksum error creating updated file exit checksum } target=816368816/s3801.c echo -n '816368816/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 816368816/s3801.c ed 816368816/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 < 816368816/s3801.c} if(~ 99b982d91578 $sum(1)^$sum(2)) echo if not{ echo 816368816/s3801.c checksum error creating updated file exit checksum } target=816368816/s3928.c echo -n '816368816/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 816368816/s3928.c ed 816368816/s3928.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3928.c' 94,95d 32,33d 20,22d 18c options(Vga*, Ctlr *ctlr) . 12,13d wq //GO.SYSIN DD VADIM s3928.c sum=`{sum < 816368816/s3928.c} if(~ 8edde1e12261 $sum(1)^$sum(2)) echo if not{ echo 816368816/s3928.c checksum error creating updated file exit checksum } target=816368816/s3clock.c echo -n '816368816/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 816368816/s3clock.c ed 816368816/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) . 125,126d 114,115c { "icd2061a", icd2061aload, }, { "ch9294", ch9294load, }, { "tvp3025clock", tvp3025load, }, . 109a static void tvp3025load(Vga *vga, Ctlr *ctlr) { uchar crt5c, x; verbose("%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; } . wq //GO.SYSIN DD VADIM s3clock.c sum=`{sum < 816368816/s3clock.c} if(~ 5dc85c305300 $sum(1)^$sum(2)) echo if not{ echo 816368816/s3clock.c checksum error creating updated file exit checksum } target=816368816/s3generic.c echo -n '816368816/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 816368816/s3generic.c ed 816368816/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; } . 167a 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; . 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; . wq //GO.SYSIN DD VADIM s3generic.c sum=`{sum < 816368816/s3generic.c} if(~ a022f19e6871 $sum(1)^$sum(2)) echo if not{ echo 816368816/s3generic.c checksum error creating updated file exit checksum } target=816368816/s3hwgc.c echo -n '816368816/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 816368816/s3hwgc.c ed 816368816/s3hwgc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM s3hwgc.c' 27d 9d wq //GO.SYSIN DD VADIM s3hwgc.c sum=`{sum < 816368816/s3hwgc.c} if(~ 31b94adf1033 $sum(1)^$sum(2)) echo if not{ echo 816368816/s3hwgc.c checksum error creating updated file exit checksum } target=816368816/sc15025.c echo -n '816368816/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 816368816/sc15025.c ed 816368816/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 < 816368816/sc15025.c} if(~ 0afe5b401830 $sum(1)^$sum(2)) echo if not{ echo 816368816/sc15025.c checksum error creating updated file exit checksum } target=816368816/stg1702.c echo -n '816368816/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 816368816/stg1702.c ed 816368816/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 < 816368816/stg1702.c} if(~ efb3bd643202 $sum(1)^$sum(2)) echo if not{ echo 816368816/stg1702.c checksum error creating updated file exit checksum } target=816368816/template.c echo -n '816368816/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 816368816/template.c ed 816368816/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 < 816368816/template.c} if(~ 9be390a0599 $sum(1)^$sum(2)) echo if not{ echo 816368816/template.c checksum error creating updated file exit checksum } target=816368816/tvp3020.c echo -n '816368816/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 816368816/tvp3020.c ed 816368816/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) . wq //GO.SYSIN DD VADIM tvp3020.c sum=`{sum < 816368816/tvp3020.c} if(~ b9feb4f35904 $sum(1)^$sum(2)) echo if not{ echo 816368816/tvp3020.c checksum error creating updated file exit checksum } target=816368816/tvp3025.c echo -n '816368816/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 816368816/tvp3025.c ed 816368816/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 < 816368816/tvp3025.c} if(~ 7a49b5931905 $sum(1)^$sum(2)) echo if not{ echo 816368816/tvp3025.c checksum error creating updated file exit checksum } target=816368816/tvp3025clock.c echo -n '816368816/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 816368816/tvp3025clock.c ed 816368816/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 < 816368816/tvp3025clock.c} if(~ 0f0063a41447 $sum(1)^$sum(2)) echo if not{ echo 816368816/tvp3025clock.c checksum error creating updated file exit checksum } target=816368816/vga.c echo -n '816368816/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 816368816/vga.c ed 816368816/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); . 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); . 368d 187d 149d wq //GO.SYSIN DD VADIM vga.c sum=`{sum < 816368816/vga.c} if(~ 965e34588372 $sum(1)^$sum(2)) echo if not{ echo 816368816/vga.c checksum error creating updated file exit checksum } target=816368816/vga.h echo -n '816368816/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 816368816/vga.h ed 816368816/vga.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vga.h' 256a /* vision964.c */ extern Ctlr vision964; /* w30c516.c */ extern Ctlr w30c516; . 234a /* trio64.c */ extern Ctlr trio64; . 194a extern void printflag(ulong); . 178a /* ics534x.c */ extern Ctlr ics534x; . 151a /* ct65540.c */ extern Ctlr ct65540; . 132a extern Ctlr att20c490; . 131a /* ark2000pv.c */ extern Ctlr ark2000pv; . 127a int linear; . 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; . 71a Hlinear = 0x00040000, /* have linear-address mode */ Ulinear = 0x00080000, /* use linear-address mode */ Hclkdiv = 0x00100000, /* have a clock-divisor */ Uclkdiv = 0x00200000, /* use clock-divisor */ . 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 < 816368816/vga.h} if(~ 922cc2986491 $sum(1)^$sum(2)) echo if not{ echo 816368816/vga.h checksum error creating updated file exit checksum } target=816368816/vgadb echo -n '816368816/vgadb: ' if(! test -f $srcdir/vgadb || ! test -r $srcdir/vgadb){ echo $srcdir/vgadb unreadable exit unreadable } sum=`{sum < $srcdir/vgadb} if(! ~ 7997b81e7926 $sum(1)^$sum(2)){ echo $srcdir/vgadb is not the original distribution file exit original } cp $srcdir/vgadb 816368816/vgadb ed 816368816/vgadb >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vgadb' 82a ctlr 0xC0083="Hercules Stingray 64(tm)" # Hercules Stingray 64/Video link=vga clock=ch9294-g ramdac=w30c516-135 ctlr=ark2000pv linear=1 ctlr 0xC0083="Stealth64 Graphics 2001" # Diamond Stealth64 Graphics 2001 link=vga ramdac=ics534x-135 ctlr=ark2000pv linear=1 ctlr 0xE0090="Chips 65540" # Globalyst 250 0xC008D="Chips 65540 VGA 32KB BIOS" # ARM TS30 link=vga ctlr=ct65540 linear=1 . 80a 0xC00E7="MACH64GXP" # AT&T Globalyst 600 . 68a 0xC0039="CL-GD5422" . 66a ctlr 0xC0189="Hercules PCI Bus Dynamite(tm) BIOS. Ver. 8.00N-D2g(11/28/94)" 0xC01AD="Ver. 8.00N-D2h(05/31/95)" 0xC0076="Tseng Laboratories, Inc. 06/28/94 V1.0CN" # Cardex Challenger link=vga ramdac=ics534x-135 ctlr=et4000-w32p hwgc=et4000hwgc . 63c clock=ics2494-304 ramdac=att20c491-90 # really a MUSIC MU9C4910 ctlr=et4000-w32i hwgc=et4000hwgc ctlr 0xC0189="Hercules PCI Bus Dynamite(tm) BIOS. Ver. 8.00N-B1a(03/30/94)" link=vga clock=ics2494-324 . 61c 0xC0189="Hercules ISA Bus Dynamite(tm) BIOS. Ver. 8.00N-A2b(04/29/94)" . 54a 0xC0094="#9-964 BIOS Version 1.03.03" # #9GXE64pro 0xC0094="#9-964 BIOS Version 1.03.11h" # #9GXE64pro link=vga hwgc=tvp3020hwgc ctlr=vision964 link=ibm8514 ramdac=tvp3025-170 link=s3clock clock=tvp3025clock ctlr 0xC0045="Stealth 64 DRAM Vers. 2.02" # Diamond Stealth 64 DRAM 0xC0045="Stealth SE DRAM Vers. 1.01" # Diamond Stealth SE DRAM 0xC0044="Phoenix S3 TRIO32 Enhanced VGA BIOS. Version 1.3-08-12-57MHz" 0xC0044="Phoenix S3 TRIO64 Enhanced VGA BIOS. Version 1.3-08" 0xC0044="Phoenix S3 TRIO64 Enhanced VGA BIOS. Version 1.00-06" link=vga hwgc=s3hwgc ctlr=trio64 link=ibm8514 ctlr . 48c 0xC012C="V864 PCI" # GIS Globalyst 550 . 27c 0XC004F="86C801" # Quadtel S3 86C801/805 link=vga . wq //GO.SYSIN DD VADIM vgadb sum=`{sum < 816368816/vgadb} if(~ fb0232509469 $sum(1)^$sum(2)) echo if not{ echo 816368816/vgadb checksum error creating updated file exit checksum } target=816368816/vision864.c echo -n '816368816/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 816368816/vision864.c ed 816368816/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 wq //GO.SYSIN DD VADIM vision864.c sum=`{sum < 816368816/vision864.c} if(~ 2a3158601886 $sum(1)^$sum(2)) echo if not{ echo 816368816/vision864.c checksum error creating updated file exit checksum } target=816368816/ark2000pv.c echo -n '816368816/ark2000pv.c (new): ' cat > 816368816/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->shb/2)>>3; vga->crt[0x05] = (x & 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. */ vga->sequencer[0x10] &= ~0x3F; vga->sequencer[0x11] &= ~0x0F; switch(mode->z){ case 1: vga->sequencer[0x10] |= 0x03; vga->sequencer[0x11] |= 0x01; 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. * The latter snarfed from running software * under another O/S. */ vga->sequencer[0x17] = 0x00; vga->sequencer[0x18] = 0x00; if(mode->x <= 640) vga->sequencer[0x18] = 0xB4; else if(mode->x <= 800){ vga->sequencer[0x17] |= 0x01; vga->sequencer[0x18] = 0xB1; } else if(mode->x <= 1024){ vga->sequencer[0x17] |= 0x02; vga->sequencer[0x18] = 0xB5; } else if(mode->x <= 1280){ vga->sequencer[0x17] |= 0x04; vga->sequencer[0x18] = 0x13; } else if(mode->x <= 1600){ vga->sequencer[0x17] |= 0x05; vga->sequencer[0x18] = 0x18; } else if(mode->x <= 2048){ vga->sequencer[0x17] |= 0x06; vga->sequencer[0x18] = 0x18; } /* * 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. */ vgao(MiscW, vga->misc & ~0x0C); 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, 0x11, vga->sequencer[0x11]); 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]); vgao(MiscW, vga->misc); 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 */ }; //GO.SYSIN DD VADIM /sys/src/cmd/aux/vga sum=`{sum < 816368816/ark2000pv.c} if(~ e800a00b5353 $sum(1)^$sum(2)) echo if not{ echo 816368816/ark2000pv.c checksum error extracting new file exit checksum } target=816368816/ct65540.c echo -n '816368816/ct65540.c (new): ' cat > 816368816/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 < 816368816/ct65540.c} if(~ b99088944911 $sum(1)^$sum(2)) echo if not{ echo 816368816/ct65540.c checksum error extracting new file exit checksum } target=816368816/ics534x.c echo -n '816368816/ics534x.c (new): ' cat > 816368816/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 < 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. */ clock(vga, ctlr); vga->i = 7; } ctlr->flag |= Finit; } static void load(Vga *vga, Ctlr *ctlr) { uchar rs2, mode; 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. */ if(vga->i == 7){ outportb(PaddrW, vga->i); outportb(Pdata, vga->m); outportb(Pdata, (vga->r<<5)|vga->n); } 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 < 816368816/ics534x.c} if(~ 3851ef3b4878 $sum(1)^$sum(2)) echo if not{ echo 816368816/ics534x.c checksum error extracting new file exit checksum } target=816368816/trio64.c echo -n '816368816/trio64.c (new): ' cat > 816368816/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 < 816368816/trio64.c} if(~ 41c12db35457 $sum(1)^$sum(2)) echo if not{ echo 816368816/trio64.c checksum error extracting new file exit checksum } target=816368816/vision964.c echo -n '816368816/vision964.c (new): ' cat > 816368816/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); } 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->shb/2)>>3; vga->crt[0x05] = (x & 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; 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); } 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 < 816368816/vision964.c} if(~ d71c2e4c2126 $sum(1)^$sum(2)) echo if not{ echo 816368816/vision964.c checksum error extracting new file exit checksum } target=816368816/w30c516.c echo -n '816368816/w30c516.c (new): ' cat > 816368816/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 dacio(uchar reg) { int i; /* * Access to the indirect registers is accomplished by reading * Pixmask 4 times, then subsequent reads cycle through the * indirect registers. Any I/O write to a direct register resets * the sequence. */ inportb(PaddrW); for(i = 0; i < 4+reg; i++) inportb(Pixmask); } static uchar daci(uchar reg) { uchar r; dacio(reg); r = inportb(Pixmask); inportb(PaddrW); return r; } static void daco(uchar reg, uchar data) { dacio(reg); vgao(Pixmask, data); } 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. */ if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f >= 80000000){ 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. */ x = daci(Cr0); daco(Cr0, x|0x04); 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; daco(Cr1, 0x00); daco(Cr0, mode); ctlr->flag |= Fload; } static void dump(Vga*, Ctlr *ctlr) { int i; printitem(ctlr->name, ""); dacio(Cr0); for(i = 0; i < Nir; i++) printreg(inportb(Pixmask)); } 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 < 816368816/w30c516.c} if(~ 18c38a6f3498 $sum(1)^$sum(2)) echo if not{ echo 816368816/w30c516.c checksum error extracting new file exit checksum }