From 2a56303226a559af00be8a0867e6c77389fee86d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 21 Dec 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-12-21 --- carrera/main.c | 10 +- carrera/mmu.c | 3 +- carrera/screen.c | 54 ++++----- pc/devvga.c | 302 +++++++++++++---------------------------------- pc/fns.h | 2 + pc/kbd.c | 6 +- pc/l.s | 42 ++----- port/portfns.h | 2 + 8 files changed, 127 insertions(+), 294 deletions(-) diff --git a/carrera/main.c b/carrera/main.c index 63fe1f939c80400e185944222a9869dd07715e86..d01425374fa385613c65538b004cf9154bfd245e 100644 --- a/carrera/main.c +++ b/carrera/main.c @@ -355,15 +355,21 @@ userinit(void) void exit(long type) { + uchar *vec; + USED(type); spllo(); print("cpu %d exiting\n", m->machno); while(consactive()) delay(10); + splhi(); - for(;;) - ; + /* Turn off the NMI hander for the debugger */ + vec = (uchar*)0xA0000420; + vec[0] = 0; + /* Call the prom */ + ((void(*)(void))0xBFC00000)(); } void diff --git a/carrera/mmu.c b/carrera/mmu.c index 534fb365dc09a18d40f2cf4c5773acfc251282a9..0599b90e6f9df07004bd1d03dbb3fdc5af541190 100644 --- a/carrera/mmu.c +++ b/carrera/mmu.c @@ -285,7 +285,8 @@ putmmu(ulong tlbvirt, ulong tlbphys, Page *pg) ctl = &pg->cachectl[m->machno]; switch(*ctl) { case PG_TXTFLUSH: - icflush((void*)pg->va, BY2PG); +cleancache(); /* Too expensive */ +/* icflush((void*)pg->va, BY2PG);*/ *ctl = PG_NOFLUSH; break; case PG_DATFLUSH: diff --git a/carrera/screen.c b/carrera/screen.c index 6c05f6ef2e6c716c9d53c1c238f4d81d4ffcf4c6..36675686c5d852dcdb95804861b25ecbda04d395 100644 --- a/carrera/screen.c +++ b/carrera/screen.c @@ -10,8 +10,6 @@ #include #include -#define MINX 8 - enum { EMISCR= 0x3CC, /* control sync polarity */ @@ -65,24 +63,24 @@ extern struct GBitmap gscreen; VGAmode dfltmode = { /* general */ - 0xef, 0x00, + 0x23, 0x00, /* sequence */ - 0x03, 0x01, 0x0f, 0x00, 0x0e, + 0x03, 0x01, 0x0f, 0x00, 0x06, /* crt */ - 0xa1, 0x7f, 0x7f, 0x85, 0x85, 0x96, 0x24, 0xf5, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x88, 0xff, 0x80, 0x60, 0xff, 0x25, 0xab, + 0xcb, 0x9f, 0xa0, 0x8e, 0xa9, 0x04, 0x4f, 0x52, + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x89, 0xff, 0x50, 0x00, 0x09, 0x46, 0xc3, 0xff, /* graphics */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff, /* attribute */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x01, 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x01, 0x00, 0x0f, 0x00, 0x00, /* special */ 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x28, 0x00, - 0x0a, 0x00, 0x43, 0x1f, + 0x0a, 0x9b, 0x43, 0x1f, }; extern GSubfont defont0; @@ -94,10 +92,10 @@ GBitmap gscreen = { 0, 0, - (1024*(1<<3))/32, - 3, - { 0, 0, 1024, 768 }, - { 0, 0, 1024, 768 }, + (1280*(1<<0))/32, + 0, + { 0, 0, 1280, 1024 }, + { 0, 0, 1280, 1024 }, 0 }; @@ -105,10 +103,10 @@ GBitmap vgascreen = { EISA(0xA0000), 0, - (1024*(1<<3))/32, - 3, - { 0, 0, 1024, 768 }, - { 0, 0, 1024, 768 }, + (1280*(1<<0))/32, + 0, + { 0, 0, 1280, 1024 }, + { 0, 0, 1280, 1024 }, 0 }; @@ -124,7 +122,6 @@ static int isscroll; void screenwin(void) { - memset(gscreen.base, 0xC0, gscreen.width*sizeof(ulong)*Dy(gscreen.r)); w = defont0.info[' '].width; h = defont0.height; defont = &defont0; @@ -454,17 +451,6 @@ setmode(VGAmode *v) #define swiz(s) (s<<24)|((s>>8)&0xff00)|((s<<8)&0xff0000)|(s>>24) -void -twizzle(uchar *f, uchar *t) -{ - ulong in1, in2; - - in1 = *(ulong*)f; - in2 = *(ulong*)(f+4); - *(ulong*)t = swiz(in2); - *(ulong*)(t+4) = swiz(in1); -} - void screenupdate(void) { @@ -561,7 +547,7 @@ screenload(Rectangle r, uchar *data, int tl, int l) /* may need to do bit insertion on edges */ if(l == 1){ /* all in one byte */ if(rpart) - m ^= 0xFF >> rpart; + m &= mr; for(y=r.min.y; y 2) + if(tl > 2) memmove(q+1, data+1, tl-2); q[tl-1] ^= (data[tl-1]^q[l-1]) & mr; q += gscreen.width*sizeof(ulong); diff --git a/pc/devvga.c b/pc/devvga.c index e8b043b3bd34e29fb72ebc874f3fba5c9fcbe6c6..29003240fa9065c20a9703832c91fcb3c0be79c1 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -183,7 +183,6 @@ static void scroll(void); static ulong x3to32(uchar); static ulong x6to32(uchar); void screenupdate(void); -void pixreverse(uchar*, int, int); void mbbrect(Rectangle); /* @@ -392,22 +391,12 @@ screeninit(void) ulong *l; /* - * arrow is defined as a big endian - */ - pixreverse(arrow.set, 2*16, 0); - pixreverse(arrow.clr, 2*16, 0); - - /* - * swizzle the font longs. we do both byte and bit swizzling - * since the font is initialized with big endian longs. + * swizzle the font longs. */ defont = &defont0; l = defont->bits->base; for(i = defont->bits->width*Dy(defont->bits->r); i > 0; i--, l++) *l = (*l<<24) | ((*l>>8)&0x0000ff00) | ((*l<<8)&0x00ff0000) | (*l>>24); - pixreverse((uchar*)defont->bits->base, - defont->bits->width*BY2WD*Dy(defont->bits->r), 0); - /* * start in CGA mode */ @@ -544,7 +533,7 @@ screenload(Rectangle r, uchar *data, int tl, int l) /* may need to do bit insertion on edges */ if(l == 1){ /* all in one byte */ if(rpart) - m ^= 0xFF >> rpart; + m &= mr; for(y=r.min.y; y 2) + if(tl > 2) memmove(q+1, data+1, tl-2); q[tl-1] ^= (data[tl-1]^q[l-1]) & mr; q += gscreen.width*sizeof(ulong); @@ -618,21 +607,21 @@ screenupdate(void) switch(gscreen.ldepth){ case 0: - r.min.x &= ~15; /* 16 pixel allignment for l0update() */ - f = l0update; + r.min.x &= ~15; /* 16 pixel alignment for l0update() */ + f = memmove; len = (r.max.x + 7)/8 - r.min.x/8; if(len & 1) - len++; /* 16 bit allignment for l0update() */ + len++; /* 16 bit alignment for l0update() */ break; case 1: - r.min.x &= ~15; /* 8 pixel allignment for l1update() */ + r.min.x &= ~15; /* 8 pixel alignment for l1update() */ f = l1update; len = (r.max.x + 7)/8 - r.min.x/8; if(len & 1) - len++; /* 8 pixel allignment for l1update() */ + len++; /* 8 pixel alignment for l1update() */ break; case 2: - r.min.x &= ~7; /* 8 pixel allignment for l2update() */ + r.min.x &= ~7; /* 8 pixel alignment for l2update() */ f = l2update; len = (r.max.x + 7)/8 - r.min.x/8; break; @@ -1107,53 +1096,53 @@ setcolor(ulong p, ulong r, ulong g, ulong b) } /* - * Table for separating and reversing bits in a ldepth 1 bitmap. - * This aids in coverting a little endian ldepth 1 bitmap into the + * Table for separating bits in a ldepth 1 bitmap. + * This aids in coverting a big-endian ldepth 1 bitmap into the * 2 big-endian ldepth 0 bitmaps used for the VGA bit planes. * * if the bits in uchar x are labeled * 76543210 - * then l1revsep[x] yields a ulong with bits - * ________1357________0246 + * then l1septab[x] yields a ulong with bits + * ________7531________6420 * where _ represents a bit whose value is 0. * * This table is used by l1update() in l.s. l1update is implemented * in assembler for speed. * */ -ulong l1revsep[] = { - 0x00000, 0x00008, 0x80000, 0x80008, 0x00004, 0x0000c, 0x80004, 0x8000c, - 0x40000, 0x40008, 0xc0000, 0xc0008, 0x40004, 0x4000c, 0xc0004, 0xc000c, - 0x00002, 0x0000a, 0x80002, 0x8000a, 0x00006, 0x0000e, 0x80006, 0x8000e, - 0x40002, 0x4000a, 0xc0002, 0xc000a, 0x40006, 0x4000e, 0xc0006, 0xc000e, - 0x20000, 0x20008, 0xa0000, 0xa0008, 0x20004, 0x2000c, 0xa0004, 0xa000c, - 0x60000, 0x60008, 0xe0000, 0xe0008, 0x60004, 0x6000c, 0xe0004, 0xe000c, - 0x20002, 0x2000a, 0xa0002, 0xa000a, 0x20006, 0x2000e, 0xa0006, 0xa000e, - 0x60002, 0x6000a, 0xe0002, 0xe000a, 0x60006, 0x6000e, 0xe0006, 0xe000e, - 0x00001, 0x00009, 0x80001, 0x80009, 0x00005, 0x0000d, 0x80005, 0x8000d, - 0x40001, 0x40009, 0xc0001, 0xc0009, 0x40005, 0x4000d, 0xc0005, 0xc000d, - 0x00003, 0x0000b, 0x80003, 0x8000b, 0x00007, 0x0000f, 0x80007, 0x8000f, - 0x40003, 0x4000b, 0xc0003, 0xc000b, 0x40007, 0x4000f, 0xc0007, 0xc000f, - 0x20001, 0x20009, 0xa0001, 0xa0009, 0x20005, 0x2000d, 0xa0005, 0xa000d, - 0x60001, 0x60009, 0xe0001, 0xe0009, 0x60005, 0x6000d, 0xe0005, 0xe000d, - 0x20003, 0x2000b, 0xa0003, 0xa000b, 0x20007, 0x2000f, 0xa0007, 0xa000f, - 0x60003, 0x6000b, 0xe0003, 0xe000b, 0x60007, 0x6000f, 0xe0007, 0xe000f, - 0x10000, 0x10008, 0x90000, 0x90008, 0x10004, 0x1000c, 0x90004, 0x9000c, - 0x50000, 0x50008, 0xd0000, 0xd0008, 0x50004, 0x5000c, 0xd0004, 0xd000c, - 0x10002, 0x1000a, 0x90002, 0x9000a, 0x10006, 0x1000e, 0x90006, 0x9000e, - 0x50002, 0x5000a, 0xd0002, 0xd000a, 0x50006, 0x5000e, 0xd0006, 0xd000e, - 0x30000, 0x30008, 0xb0000, 0xb0008, 0x30004, 0x3000c, 0xb0004, 0xb000c, - 0x70000, 0x70008, 0xf0000, 0xf0008, 0x70004, 0x7000c, 0xf0004, 0xf000c, - 0x30002, 0x3000a, 0xb0002, 0xb000a, 0x30006, 0x3000e, 0xb0006, 0xb000e, - 0x70002, 0x7000a, 0xf0002, 0xf000a, 0x70006, 0x7000e, 0xf0006, 0xf000e, - 0x10001, 0x10009, 0x90001, 0x90009, 0x10005, 0x1000d, 0x90005, 0x9000d, - 0x50001, 0x50009, 0xd0001, 0xd0009, 0x50005, 0x5000d, 0xd0005, 0xd000d, - 0x10003, 0x1000b, 0x90003, 0x9000b, 0x10007, 0x1000f, 0x90007, 0x9000f, - 0x50003, 0x5000b, 0xd0003, 0xd000b, 0x50007, 0x5000f, 0xd0007, 0xd000f, - 0x30001, 0x30009, 0xb0001, 0xb0009, 0x30005, 0x3000d, 0xb0005, 0xb000d, - 0x70001, 0x70009, 0xf0001, 0xf0009, 0x70005, 0x7000d, 0xf0005, 0xf000d, - 0x30003, 0x3000b, 0xb0003, 0xb000b, 0x30007, 0x3000f, 0xb0007, 0xb000f, - 0x70003, 0x7000b, 0xf0003, 0xf000b, 0x70007, 0x7000f, 0xf0007, 0xf000f, +ulong l1septab[] = { + 0x00000, 0x00001, 0x10000, 0x10001, 0x00002, 0x00003, 0x10002, 0x10003, + 0x20000, 0x20001, 0x30000, 0x30001, 0x20002, 0x20003, 0x30002, 0x30003, + 0x00004, 0x00005, 0x10004, 0x10005, 0x00006, 0x00007, 0x10006, 0x10007, + 0x20004, 0x20005, 0x30004, 0x30005, 0x20006, 0x20007, 0x30006, 0x30007, + 0x40000, 0x40001, 0x50000, 0x50001, 0x40002, 0x40003, 0x50002, 0x50003, + 0x60000, 0x60001, 0x70000, 0x70001, 0x60002, 0x60003, 0x70002, 0x70003, + 0x40004, 0x40005, 0x50004, 0x50005, 0x40006, 0x40007, 0x50006, 0x50007, + 0x60004, 0x60005, 0x70004, 0x70005, 0x60006, 0x60007, 0x70006, 0x70007, + 0x00008, 0x00009, 0x10008, 0x10009, 0x0000a, 0x0000b, 0x1000a, 0x1000b, + 0x20008, 0x20009, 0x30008, 0x30009, 0x2000a, 0x2000b, 0x3000a, 0x3000b, + 0x0000c, 0x0000d, 0x1000c, 0x1000d, 0x0000e, 0x0000f, 0x1000e, 0x1000f, + 0x2000c, 0x2000d, 0x3000c, 0x3000d, 0x2000e, 0x2000f, 0x3000e, 0x3000f, + 0x40008, 0x40009, 0x50008, 0x50009, 0x4000a, 0x4000b, 0x5000a, 0x5000b, + 0x60008, 0x60009, 0x70008, 0x70009, 0x6000a, 0x6000b, 0x7000a, 0x7000b, + 0x4000c, 0x4000d, 0x5000c, 0x5000d, 0x4000e, 0x4000f, 0x5000e, 0x5000f, + 0x6000c, 0x6000d, 0x7000c, 0x7000d, 0x6000e, 0x6000f, 0x7000e, 0x7000f, + 0x80000, 0x80001, 0x90000, 0x90001, 0x80002, 0x80003, 0x90002, 0x90003, + 0xa0000, 0xa0001, 0xb0000, 0xb0001, 0xa0002, 0xa0003, 0xb0002, 0xb0003, + 0x80004, 0x80005, 0x90004, 0x90005, 0x80006, 0x80007, 0x90006, 0x90007, + 0xa0004, 0xa0005, 0xb0004, 0xb0005, 0xa0006, 0xa0007, 0xb0006, 0xb0007, + 0xc0000, 0xc0001, 0xd0000, 0xd0001, 0xc0002, 0xc0003, 0xd0002, 0xd0003, + 0xe0000, 0xe0001, 0xf0000, 0xf0001, 0xe0002, 0xe0003, 0xf0002, 0xf0003, + 0xc0004, 0xc0005, 0xd0004, 0xd0005, 0xc0006, 0xc0007, 0xd0006, 0xd0007, + 0xe0004, 0xe0005, 0xf0004, 0xf0005, 0xe0006, 0xe0007, 0xf0006, 0xf0007, + 0x80008, 0x80009, 0x90008, 0x90009, 0x8000a, 0x8000b, 0x9000a, 0x9000b, + 0xa0008, 0xa0009, 0xb0008, 0xb0009, 0xa000a, 0xa000b, 0xb000a, 0xb000b, + 0x8000c, 0x8000d, 0x9000c, 0x9000d, 0x8000e, 0x8000f, 0x9000e, 0x9000f, + 0xa000c, 0xa000d, 0xb000c, 0xb000d, 0xa000e, 0xa000f, 0xb000e, 0xb000f, + 0xc0008, 0xc0009, 0xd0008, 0xd0009, 0xc000a, 0xc000b, 0xd000a, 0xd000b, + 0xe0008, 0xe0009, 0xf0008, 0xf0009, 0xe000a, 0xe000b, 0xf000a, 0xf000b, + 0xc000c, 0xc000d, 0xd000c, 0xd000d, 0xc000e, 0xc000f, 0xd000e, 0xd000f, + 0xe000c, 0xe000d, 0xf000c, 0xf000d, 0xe000e, 0xe000f, 0xf000e, 0xf000f, }; /* @@ -1163,175 +1152,46 @@ ulong l1revsep[] = { * * if the bits in uchar x are labeled * 76543210 - * then l1revsep[x] yields a ulongt with bits - * ______37______26______15______04 + * then l1septab[x] yields a ulongt with bits + * ______73______62______51______40 * where _ represents a bit whose value is 0. * * This table is used by l2update() in l.s. l2update is implemented * in assembler for speed. * */ -ulong l2revsep[] = { - 0x0000000, 0x0000002, 0x0000200, 0x0000202, 0x0020000, 0x0020002, 0x0020200, 0x0020202, - 0x2000000, 0x2000002, 0x2000200, 0x2000202, 0x2020000, 0x2020002, 0x2020200, 0x2020202, - 0x0000001, 0x0000003, 0x0000201, 0x0000203, 0x0020001, 0x0020003, 0x0020201, 0x0020203, - 0x2000001, 0x2000003, 0x2000201, 0x2000203, 0x2020001, 0x2020003, 0x2020201, 0x2020203, - 0x0000100, 0x0000102, 0x0000300, 0x0000302, 0x0020100, 0x0020102, 0x0020300, 0x0020302, - 0x2000100, 0x2000102, 0x2000300, 0x2000302, 0x2020100, 0x2020102, 0x2020300, 0x2020302, - 0x0000101, 0x0000103, 0x0000301, 0x0000303, 0x0020101, 0x0020103, 0x0020301, 0x0020303, - 0x2000101, 0x2000103, 0x2000301, 0x2000303, 0x2020101, 0x2020103, 0x2020301, 0x2020303, - 0x0010000, 0x0010002, 0x0010200, 0x0010202, 0x0030000, 0x0030002, 0x0030200, 0x0030202, - 0x2010000, 0x2010002, 0x2010200, 0x2010202, 0x2030000, 0x2030002, 0x2030200, 0x2030202, - 0x0010001, 0x0010003, 0x0010201, 0x0010203, 0x0030001, 0x0030003, 0x0030201, 0x0030203, - 0x2010001, 0x2010003, 0x2010201, 0x2010203, 0x2030001, 0x2030003, 0x2030201, 0x2030203, - 0x0010100, 0x0010102, 0x0010300, 0x0010302, 0x0030100, 0x0030102, 0x0030300, 0x0030302, - 0x2010100, 0x2010102, 0x2010300, 0x2010302, 0x2030100, 0x2030102, 0x2030300, 0x2030302, - 0x0010101, 0x0010103, 0x0010301, 0x0010303, 0x0030101, 0x0030103, 0x0030301, 0x0030303, - 0x2010101, 0x2010103, 0x2010301, 0x2010303, 0x2030101, 0x2030103, 0x2030301, 0x2030303, - 0x1000000, 0x1000002, 0x1000200, 0x1000202, 0x1020000, 0x1020002, 0x1020200, 0x1020202, - 0x3000000, 0x3000002, 0x3000200, 0x3000202, 0x3020000, 0x3020002, 0x3020200, 0x3020202, - 0x1000001, 0x1000003, 0x1000201, 0x1000203, 0x1020001, 0x1020003, 0x1020201, 0x1020203, - 0x3000001, 0x3000003, 0x3000201, 0x3000203, 0x3020001, 0x3020003, 0x3020201, 0x3020203, - 0x1000100, 0x1000102, 0x1000300, 0x1000302, 0x1020100, 0x1020102, 0x1020300, 0x1020302, - 0x3000100, 0x3000102, 0x3000300, 0x3000302, 0x3020100, 0x3020102, 0x3020300, 0x3020302, - 0x1000101, 0x1000103, 0x1000301, 0x1000303, 0x1020101, 0x1020103, 0x1020301, 0x1020303, - 0x3000101, 0x3000103, 0x3000301, 0x3000303, 0x3020101, 0x3020103, 0x3020301, 0x3020303, - 0x1010000, 0x1010002, 0x1010200, 0x1010202, 0x1030000, 0x1030002, 0x1030200, 0x1030202, - 0x3010000, 0x3010002, 0x3010200, 0x3010202, 0x3030000, 0x3030002, 0x3030200, 0x3030202, - 0x1010001, 0x1010003, 0x1010201, 0x1010203, 0x1030001, 0x1030003, 0x1030201, 0x1030203, - 0x3010001, 0x3010003, 0x3010201, 0x3010203, 0x3030001, 0x3030003, 0x3030201, 0x3030203, - 0x1010100, 0x1010102, 0x1010300, 0x1010302, 0x1030100, 0x1030102, 0x1030300, 0x1030302, - 0x3010100, 0x3010102, 0x3010300, 0x3010302, 0x3030100, 0x3030102, 0x3030300, 0x3030302, - 0x1010101, 0x1010103, 0x1010301, 0x1010303, 0x1030101, 0x1030103, 0x1030301, 0x1030303, - 0x3010101, 0x3010103, 0x3010301, 0x3010303, 0x3030101, 0x3030103, 0x3030301, 0x3030303, -}; - -/* - * reverse pixels into little endian order (also used by l0update) - */ -uchar revtab0[] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -}; -uchar revtab1[] = { - 0x00, 0x40, 0x80, 0xc0, 0x10, 0x50, 0x90, 0xd0, - 0x20, 0x60, 0xa0, 0xe0, 0x30, 0x70, 0xb0, 0xf0, - 0x04, 0x44, 0x84, 0xc4, 0x14, 0x54, 0x94, 0xd4, - 0x24, 0x64, 0xa4, 0xe4, 0x34, 0x74, 0xb4, 0xf4, - 0x08, 0x48, 0x88, 0xc8, 0x18, 0x58, 0x98, 0xd8, - 0x28, 0x68, 0xa8, 0xe8, 0x38, 0x78, 0xb8, 0xf8, - 0x0c, 0x4c, 0x8c, 0xcc, 0x1c, 0x5c, 0x9c, 0xdc, - 0x2c, 0x6c, 0xac, 0xec, 0x3c, 0x7c, 0xbc, 0xfc, - 0x01, 0x41, 0x81, 0xc1, 0x11, 0x51, 0x91, 0xd1, - 0x21, 0x61, 0xa1, 0xe1, 0x31, 0x71, 0xb1, 0xf1, - 0x05, 0x45, 0x85, 0xc5, 0x15, 0x55, 0x95, 0xd5, - 0x25, 0x65, 0xa5, 0xe5, 0x35, 0x75, 0xb5, 0xf5, - 0x09, 0x49, 0x89, 0xc9, 0x19, 0x59, 0x99, 0xd9, - 0x29, 0x69, 0xa9, 0xe9, 0x39, 0x79, 0xb9, 0xf9, - 0x0d, 0x4d, 0x8d, 0xcd, 0x1d, 0x5d, 0x9d, 0xdd, - 0x2d, 0x6d, 0xad, 0xed, 0x3d, 0x7d, 0xbd, 0xfd, - 0x02, 0x42, 0x82, 0xc2, 0x12, 0x52, 0x92, 0xd2, - 0x22, 0x62, 0xa2, 0xe2, 0x32, 0x72, 0xb2, 0xf2, - 0x06, 0x46, 0x86, 0xc6, 0x16, 0x56, 0x96, 0xd6, - 0x26, 0x66, 0xa6, 0xe6, 0x36, 0x76, 0xb6, 0xf6, - 0x0a, 0x4a, 0x8a, 0xca, 0x1a, 0x5a, 0x9a, 0xda, - 0x2a, 0x6a, 0xaa, 0xea, 0x3a, 0x7a, 0xba, 0xfa, - 0x0e, 0x4e, 0x8e, 0xce, 0x1e, 0x5e, 0x9e, 0xde, - 0x2e, 0x6e, 0xae, 0xee, 0x3e, 0x7e, 0xbe, 0xfe, - 0x03, 0x43, 0x83, 0xc3, 0x13, 0x53, 0x93, 0xd3, - 0x23, 0x63, 0xa3, 0xe3, 0x33, 0x73, 0xb3, 0xf3, - 0x07, 0x47, 0x87, 0xc7, 0x17, 0x57, 0x97, 0xd7, - 0x27, 0x67, 0xa7, 0xe7, 0x37, 0x77, 0xb7, 0xf7, - 0x0b, 0x4b, 0x8b, 0xcb, 0x1b, 0x5b, 0x9b, 0xdb, - 0x2b, 0x6b, 0xab, 0xeb, 0x3b, 0x7b, 0xbb, 0xfb, - 0x0f, 0x4f, 0x8f, 0xcf, 0x1f, 0x5f, 0x9f, 0xdf, - 0x2f, 0x6f, 0xaf, 0xef, 0x3f, 0x7f, 0xbf, 0xff, -}; -uchar revtab2[] = { - 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, - 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, - 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, - 0x81, 0x91, 0xa1, 0xb1, 0xc1, 0xd1, 0xe1, 0xf1, - 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72, - 0x82, 0x92, 0xa2, 0xb2, 0xc2, 0xd2, 0xe2, 0xf2, - 0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, - 0x83, 0x93, 0xa3, 0xb3, 0xc3, 0xd3, 0xe3, 0xf3, - 0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, - 0x84, 0x94, 0xa4, 0xb4, 0xc4, 0xd4, 0xe4, 0xf4, - 0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75, - 0x85, 0x95, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, - 0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76, - 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, - 0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, - 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, - 0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, - 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, 0xe8, 0xf8, - 0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, - 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xd9, 0xe9, 0xf9, - 0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, - 0x8a, 0x9a, 0xaa, 0xba, 0xca, 0xda, 0xea, 0xfa, - 0x0b, 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, - 0x8b, 0x9b, 0xab, 0xbb, 0xcb, 0xdb, 0xeb, 0xfb, - 0x0c, 0x1c, 0x2c, 0x3c, 0x4c, 0x5c, 0x6c, 0x7c, - 0x8c, 0x9c, 0xac, 0xbc, 0xcc, 0xdc, 0xec, 0xfc, - 0x0d, 0x1d, 0x2d, 0x3d, 0x4d, 0x5d, 0x6d, 0x7d, - 0x8d, 0x9d, 0xad, 0xbd, 0xcd, 0xdd, 0xed, 0xfd, - 0x0e, 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, - 0x8e, 0x9e, 0xae, 0xbe, 0xce, 0xde, 0xee, 0xfe, - 0x0f, 0x1f, 0x2f, 0x3f, 0x4f, 0x5f, 0x6f, 0x7f, - 0x8f, 0x9f, 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff, +ulong l2septab[] = { + 0x0000000, 0x0000001, 0x0000100, 0x0000101, 0x0010000, 0x0010001, 0x0010100, 0x0010101, + 0x1000000, 0x1000001, 0x1000100, 0x1000101, 0x1010000, 0x1010001, 0x1010100, 0x1010101, + 0x0000002, 0x0000003, 0x0000102, 0x0000103, 0x0010002, 0x0010003, 0x0010102, 0x0010103, + 0x1000002, 0x1000003, 0x1000102, 0x1000103, 0x1010002, 0x1010003, 0x1010102, 0x1010103, + 0x0000200, 0x0000201, 0x0000300, 0x0000301, 0x0010200, 0x0010201, 0x0010300, 0x0010301, + 0x1000200, 0x1000201, 0x1000300, 0x1000301, 0x1010200, 0x1010201, 0x1010300, 0x1010301, + 0x0000202, 0x0000203, 0x0000302, 0x0000303, 0x0010202, 0x0010203, 0x0010302, 0x0010303, + 0x1000202, 0x1000203, 0x1000302, 0x1000303, 0x1010202, 0x1010203, 0x1010302, 0x1010303, + 0x0020000, 0x0020001, 0x0020100, 0x0020101, 0x0030000, 0x0030001, 0x0030100, 0x0030101, + 0x1020000, 0x1020001, 0x1020100, 0x1020101, 0x1030000, 0x1030001, 0x1030100, 0x1030101, + 0x0020002, 0x0020003, 0x0020102, 0x0020103, 0x0030002, 0x0030003, 0x0030102, 0x0030103, + 0x1020002, 0x1020003, 0x1020102, 0x1020103, 0x1030002, 0x1030003, 0x1030102, 0x1030103, + 0x0020200, 0x0020201, 0x0020300, 0x0020301, 0x0030200, 0x0030201, 0x0030300, 0x0030301, + 0x1020200, 0x1020201, 0x1020300, 0x1020301, 0x1030200, 0x1030201, 0x1030300, 0x1030301, + 0x0020202, 0x0020203, 0x0020302, 0x0020303, 0x0030202, 0x0030203, 0x0030302, 0x0030303, + 0x1020202, 0x1020203, 0x1020302, 0x1020303, 0x1030202, 0x1030203, 0x1030302, 0x1030303, + 0x2000000, 0x2000001, 0x2000100, 0x2000101, 0x2010000, 0x2010001, 0x2010100, 0x2010101, + 0x3000000, 0x3000001, 0x3000100, 0x3000101, 0x3010000, 0x3010001, 0x3010100, 0x3010101, + 0x2000002, 0x2000003, 0x2000102, 0x2000103, 0x2010002, 0x2010003, 0x2010102, 0x2010103, + 0x3000002, 0x3000003, 0x3000102, 0x3000103, 0x3010002, 0x3010003, 0x3010102, 0x3010103, + 0x2000200, 0x2000201, 0x2000300, 0x2000301, 0x2010200, 0x2010201, 0x2010300, 0x2010301, + 0x3000200, 0x3000201, 0x3000300, 0x3000301, 0x3010200, 0x3010201, 0x3010300, 0x3010301, + 0x2000202, 0x2000203, 0x2000302, 0x2000303, 0x2010202, 0x2010203, 0x2010302, 0x2010303, + 0x3000202, 0x3000203, 0x3000302, 0x3000303, 0x3010202, 0x3010203, 0x3010302, 0x3010303, + 0x2020000, 0x2020001, 0x2020100, 0x2020101, 0x2030000, 0x2030001, 0x2030100, 0x2030101, + 0x3020000, 0x3020001, 0x3020100, 0x3020101, 0x3030000, 0x3030001, 0x3030100, 0x3030101, + 0x2020002, 0x2020003, 0x2020102, 0x2020103, 0x2030002, 0x2030003, 0x2030102, 0x2030103, + 0x3020002, 0x3020003, 0x3020102, 0x3020103, 0x3030002, 0x3030003, 0x3030102, 0x3030103, + 0x2020200, 0x2020201, 0x2020300, 0x2020301, 0x2030200, 0x2030201, 0x2030300, 0x2030301, + 0x3020200, 0x3020201, 0x3020300, 0x3020301, 0x3030200, 0x3030201, 0x3030300, 0x3030301, + 0x2020202, 0x2020203, 0x2020302, 0x2020303, 0x2030202, 0x2030203, 0x2030302, 0x2030303, + 0x3020202, 0x3020203, 0x3020302, 0x3020303, 0x3030202, 0x3030203, 0x3030302, 0x3030303, }; -void -pixreverse(uchar *p, int len, int ldepth) -{ - uchar *e; - uchar *tab; - - switch(ldepth){ - case 0: - tab = revtab0; - break; - case 1: - tab = revtab1; - break; - case 2: - tab = revtab2; - break; - default: - return; - } - - for(e = p + len; p < e; p++) - *p = tab[*p]; -} diff --git a/pc/fns.h b/pc/fns.h index 242f62e1a148b4d7ed840bec647e18bc854a2113..1f084f02b88c1c5b64a91f22dd8a011df9785393 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -91,3 +91,5 @@ void vgainit(void); #define PADDR(a) ((ulong)(a)&~KZERO) void NS16552special(int, int, Queue**, Queue**, int (*)(Queue*, int)); +int NS16552m3mouse(Queue*, int); +int NS16552mouse(Queue*, int); diff --git a/pc/kbd.c b/pc/kbd.c index 1e96e6adf1d0170d5166b6ba243d9f606009e0e4..ad68a077dc656ea1bd93bd3b369ea02f3e8ef7b2 100644 --- a/pc/kbd.c +++ b/pc/kbd.c @@ -130,8 +130,6 @@ enum Ckbdint= (1<<0), /* kbd interrupt enable */ }; -extern int m3mouseputc(IOQ*, int), mouseputc(IOQ*, int); - /* * wait for output no longer busy */ @@ -248,9 +246,9 @@ serialmouse(int port, char *type, int setspeed) if(setspeed) setspeed = 1200; if(type && *type == 'M') - NS16552special(port, setspeed, &mouseq, 0, m3mouseputc); + NS16552special(port, setspeed, &mouseq, 0, NS16552m3mouse); else - NS16552special(port, setspeed, &mouseq, 0, mouseputc); + NS16552special(port, setspeed, &mouseq, 0, NS16552mouse); mousetype = Mouseserial; } diff --git a/pc/l.s b/pc/l.s index 39aeb99b4c6f60b261d1319a28718ba21651f32a..7c079a0ccfcdd878c34550c900837573234437d9 100644 --- a/pc/l.s +++ b/pc/l.s @@ -613,34 +613,12 @@ TEXT config(SB),$0 OUTB RET -/* - * copy bitmap changes to screen memory for ldepth 0 screen. - * reverse the bits since the screen is big-endian - * and the bitmaps are little. - */ -TEXT l0update(SB),$0 - MOVL len+8(FP),CX - SHRL $1,CX - MOVL from+4(FP),SI - MOVL to+0(FP),DI - XORL AX,AX -l00: - MOVW -2(SI)(CX*2),DX - MOVB DH,AL - MOVB revtab0(SB)(AX*1),BX - SHLL $8,BX - MOVB DL,AL - ORB revtab0(SB)(AX*1),BX - MOVW BX,-2(DI)(CX*2) - LOOP l00 - RET - #define SRX 0x3C4 /* index to sequence registers */ #define SR 0x3C5 /* sequence registers */ #define Smmask 0x02 /* map mask */ /* - * same as l0update but for ldepth 1 (2 bit plane) screens + * separate ldepth 1 bitmap into 2 bit planes */ TEXT l1update(SB),$0 XORL AX,AX @@ -653,19 +631,19 @@ TEXT l1update(SB),$0 l10: MOVL -4(SI)(CX*2),DX MOVB DL,AL - MOVL l1revsep(SB)(AX*4),BX + MOVL l1septab(SB)(AX*4),BX SHLL $4,BX RORL $8,DX MOVB DL,AL - ORL l1revsep(SB)(AX*4),BX + ORL l1septab(SB)(AX*4),BX RORL $12,BX RORL $8,DX MOVB DL,AL - ORL l1revsep(SB)(AX*4),BX + ORL l1septab(SB)(AX*4),BX SHLL $4,BX RORL $8,DX MOVB DL,AL - ORL l1revsep(SB)(AX*4),BX + ORL l1septab(SB)(AX*4),BX ROLL $8,BX MOVW $(SR),DX MOVB $0x5,AL /* write lo order bits to bit planes 1 & 3 */ @@ -679,7 +657,7 @@ l10: RET /* - * same as l0update but for ldepth 2 (4 bit plane) screens + * separate ldepth 2 bitmap into 4 bit planes */ TEXT l2update(SB),$0 XORL AX,AX @@ -692,19 +670,19 @@ TEXT l2update(SB),$0 l20: MOVL -4(SI)(CX*4),DX MOVB DL,AL - MOVL l2revsep(SB)(AX*4),BX + MOVL l2septab(SB)(AX*4),BX SHLL $2,BX SHRL $8,DX MOVB DL,AL - ORL l2revsep(SB)(AX*4),BX + ORL l2septab(SB)(AX*4),BX SHLL $2,BX SHRL $8,DX MOVB DL,AL - ORL l2revsep(SB)(AX*4),BX + ORL l2septab(SB)(AX*4),BX SHLL $2,BX SHRL $8,DX MOVB DL,AL - ORL l2revsep(SB)(AX*4),BX + ORL l2septab(SB)(AX*4),BX MOVW $(SR),DX MOVB $0x1,AL /* plane 3 */ OUTB diff --git a/port/portfns.h b/port/portfns.h index c43ab493a93d5333096f7e56fb6588ff69bad30c..b83fb79b9ac4971a1557fc90e8b81f54465f1e9d 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -114,6 +114,7 @@ void links(void); void lock(Lock*); void lockinit(void); Page* lookpage(Image*, ulong); +int m3mouseputc(int); void machinit(void); void* malloc(ulong); void mbbpt(Point); @@ -123,6 +124,7 @@ void mmurelease(Proc*); void mmuswitch(Proc*); void mntdump(void); void mntrepl(char*); +int mouseputc(int); void mousetrack(int, int, int); int mount(Chan*, Chan*, int, char*); void mountfree(Mount*);