@@ 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));
}
}
@@ 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<offset+n; port++)
*cp++ = inb(port);
return n;
@@ 286,7 291,9 @@ vgawrite(Chan *c, void *buf, long n, ulong offset)
|| maxx > 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);