From ead28738afe0faf30c193353a154448a62c6b503 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 16 Dec 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-12-16 --- pc/devfloppy.c | 10 ++++++++-- pc/devvga.c | 27 ++++++++++++++++++++++----- port/devbit.c | 2 -- port/portfns.h | 2 ++ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/pc/devfloppy.c b/pc/devfloppy.c index 1dae23bd010fb58c7b6cd10ac889ba3c4177eba3..6937f0c138f6b0a912d5150ec97a84807561a6a0 100644 --- a/pc/devfloppy.c +++ b/pc/devfloppy.c @@ -392,6 +392,7 @@ changed(Chan *c, Drive *dp) * if floppy has changed or first time through */ if((inb(Pdir)&Fchange) || dp->vers == 0){ +DPRINT("changed: msr %ux dir %ux\n", inb(Pmsr), inb(Pdir)); dp->vers++; setdef(dp); start = dp->t; @@ -406,9 +407,9 @@ changed(Chan *c, Drive *dp) break; } floppydir[NFDIR*dp->dev].length = dp->t->cap; + floppyon(dp); if(dp->t == start) nexterror(); - floppyon(dp); DPRINT("changed: trying %s\n", dp->t->name); } floppyxfer(dp, Fread, dp->cache, 0, dp->t->tsize); @@ -751,6 +752,8 @@ static void floppywait(void) { tsleep(&fl.r, cmddone, 0, 2000); + if(!cmddone(0)) + floppyintr(0); } /* @@ -762,6 +765,7 @@ floppyrecal(Drive *dp) dp->ccyl = -1; dp->cyl = -1; +DPRINT("floppyrecal: msr %ux dir %ux\n", inb(Pmsr), inb(Pdir)); fl.ncmd = 0; fl.cmd[fl.ncmd++] = Frecal; fl.cmd[fl.ncmd++] = dp->dev; @@ -803,6 +807,7 @@ floppyrevive(void) * reset the controller if it's confused */ if(fl.confused){ +DPRINT("floppyrevive: msr %ux dir %ux\n", inb(Pmsr), inb(Pdir)); /* reset controller and turn all motors off */ splhi(); fl.cmd[0] = 0; @@ -816,7 +821,8 @@ floppyrevive(void) floppywait(); fl.confused = 0; outb(Pdsr, 0); - fl.rate = -1; + fl.rate = 0; +DPRINT("floppyrevive: msr %ux dir %ux\n", inb(Pmsr), inb(Pdir)); } } diff --git a/pc/devvga.c b/pc/devvga.c index 3129a75c5bd1b43545bf99e6492307b2251311bb..cba7dc4d699b8d836a333e1c3edc1495e6324851 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -102,7 +102,8 @@ VGAmode mode13 = static Rectangle mbb; static Rectangle NULLMBB = {10000, 10000, -10000, -10000}; -static void nopage(int), tsengpage(int), parapage(int); +static void nopage(int), tsengpage(int), tridentpage(int), parapage(int); +static void vgaupdate(void); /* * definitions of known cards @@ -116,17 +117,19 @@ struct Vgacard enum { - Tseng, /* tseng labs te4000 */ + Ati, /* ATI */ Pvga1a, /* paradise */ - Ati, + Trident, /* Trident 8900 */ + Tseng, /* tseng labs te4000 */ Generic, }; Vgacard vgacards[] = { +[Ati] { "ati", nopage, }, [Pvga1a] { "pvga1a", parapage, }, +[Trident] { "trident", tridentpage, }, [Tseng] { "tseng", tsengpage, }, -[Ati] { "ati", nopage, }, [Generic] { "generic", nopage, }, { 0, 0, }, }; @@ -221,8 +224,10 @@ vgaread(Chan *c, void *buf, long n, ulong offset) case Qvgatype: return readstr(offset, buf, n, vgacard->name); case Qvgaport: + /* at the moment, I need freedom for the ATI card - ches if (offset + n >= 0x8000 || offset < 0x300) error(Ebadarg); + */ for (port=offset; port 1280 || maxy > 1024 || ldepth > 3 || ldepth < 0) error(Ebadarg); + cursoroff(1); setscreen(maxx, maxy, ldepth); + cursoron(1); return n; case Qvgaport: cp = buf; @@ -498,7 +505,6 @@ setscreen(int maxx, int maxy, int ldepth) vgascreen.r.min = Pt(0, 0); vgascreen.r.max = Pt(maxx, vgamaxy); vgascreen.clipr = vgascreen.r; - memset(vgascreen.base, 0xff, vgascreen.width * BY2WD * vgamaxy); /* * setup new soft screen, free memory for old screen @@ -545,6 +551,12 @@ setscreen(int maxx, int maxy, int ldepth) break; } cga = 0; + + /* + * clear screen + */ + mbb = gscreen.r; + vgaupdate(); } void @@ -614,6 +626,11 @@ nopage(int page) USED(page); } static void +tridentpage(int page) +{ + srout(0x0e, page^0x02); /* yes, the page bit needs to be toggled! */ +} +static void tsengpage(int page) { outb(0x3cd, (page<<4)|page); diff --git a/port/devbit.c b/port/devbit.c index 4a24b4b62b32211839aa20b3fecaea615cf8068c..795a89cc5ee00902a149bc28231452b619174fc2 100644 --- a/port/devbit.c +++ b/port/devbit.c @@ -159,8 +159,6 @@ GBitmap cursorback = }; void Cursortocursor(Cursor*); -void cursoron(int); -void cursoroff(int); int mousechanged(void*); enum{ diff --git a/port/portfns.h b/port/portfns.h index ce3f54168ce55ad546407e08190a73230f3eacf9..ae6c9d40b1e7940e58c73a435d9c3039c7e374ae 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -33,6 +33,8 @@ int consactive(void); void consdebug(void); Block* copyb(Block*, int); void copypage(Page*, Page*); +void cursoron(int); +void cursoroff(int); Segment* data2txt(Segment*); int decref(Ref*); int decrypt(void*, void*, int);