From e5cde678b6855f39c412b2801c9763c33d5f7d8c Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 7 Nov 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-11-07 --- gnot/screen.h | 1 + pc/fns.h | 1 + pc/l.s | 15 +++++++++++++++ pc/screen.h | 1 + pc/vga.c | 29 ++++++++++++++++++++--------- port/devbit.c | 26 ++++++++++++++++++++++---- port/devenv.c | 3 +++ ss/screen.h | 1 + 8 files changed, 64 insertions(+), 13 deletions(-) diff --git a/gnot/screen.h b/gnot/screen.h index 04fd048b804c96347861a49ecae322422183ad7f..f7c92d1c1306c0819fc85c7ab4006538f645beea 100644 --- a/gnot/screen.h +++ b/gnot/screen.h @@ -19,6 +19,7 @@ struct Cursorinfo{ Cursor; Lock; int visible; /* on screen */ + int disable; /* from being used */ Rectangle r; /* location */ }; diff --git a/pc/fns.h b/pc/fns.h index 853a1b447134bc2c4aac1ab4816357eed074e5c8..2f53c8efda62be0cd98d8198355818e5b7f0dbe0 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -34,6 +34,7 @@ void inss(int, void*, int); void insl(int, void*, int); ulong isamem(int); void kbdinit(void); +void l0update(uchar*, uchar*, int); void mathinit(void); void mmuinit(void); int modem(int); diff --git a/pc/l.s b/pc/l.s index d2bf38e15ee9960166757e8bef1f9b96ca0fe125..9492a7ba1f98e50496e6435f18daf49aec85a5c1 100644 --- a/pc/l.s +++ b/pc/l.s @@ -633,3 +633,18 @@ TEXT config(SB),$0 OUTB OUTB RET + +/* + * copy bytes to screen memory for ldepth 0 screen + */ +TEXT l0update(SB),$0 + XORL AX,AX + MOVL len+8(FP),CX + MOVL from+0(FP),BX + MOVL to+4(FP),DX +l00: + MOVB -1(BX)(CX*1),AL + MOVB cswizzle(SB)(AX*1),AL + MOVB AL,-1(DX)(CX*1) + LOOP l00 + RET diff --git a/pc/screen.h b/pc/screen.h index a3dd699a525856e050fc5a74688ba926b93df537..8a58efe952162df5f165aa48efa4bb6d6fd0de46 100644 --- a/pc/screen.h +++ b/pc/screen.h @@ -19,6 +19,7 @@ struct Cursorinfo{ Cursor; Lock; int visible; /* on screen */ + int disable; /* from being used */ Rectangle r; /* location */ }; diff --git a/pc/vga.c b/pc/vga.c index 685425a2392327545fc1042f7d6c88d738291f1b..8038d8776365802dd2f719c7f25119e501cd26ba 100644 --- a/pc/vga.c +++ b/pc/vga.c @@ -250,8 +250,8 @@ setscreen(int maxx, int maxy, int ldepth) gscreen.r.max = Pt(maxx, maxy); gscreen.clipr.max = gscreen.r.max; len = gscreen.width * 4 * maxy; - gscreen.base = malloc(len); - memset((void*)gscreen.base, 0xff, len); + gscreen.base = ((ulong*)malloc(len+2*1024))+256; + memset((char*)gscreen.base, 0xff, len); /* * set string pointer to upper left @@ -325,7 +325,6 @@ mbbpt(Point p) mbb.max.x = p.x+1; if (p.y >= mbb.max.y) mbb.max.y = p.y+1; - screenupdate(); } void @@ -403,27 +402,39 @@ screenupdate(void) { uchar *sp, *hp, *se; int y, len, inc; - Rectangle r=mbb; + Rectangle r; + + r = mbb; + mbb = NULLMBB; if(Dy(r) < 0) return; + if(r.min.x < 0) + r.min.x = 0; + if(r.min.y < 0) + r.min.y = 0; + if(r.max.x > gscreen.r.max.x) + r.max.x = gscreen.r.max.x; + if(r.max.y > gscreen.r.max.y) + r.max.y = gscreen.r.max.y; + sp = (uchar*)gaddr(&gscreen, r.min); hp = (uchar*)gaddr(&vgascreen, r.min); len = (r.max.x * (1<base < endscreen) { + if(dst->base < endscreen){ mbbpt(pt1); mbbpt(pt2); } @@ -1574,9 +1586,9 @@ bitwrite(Chan *c, void *va, long n, ulong offset) } poperror(); + screenupdate(); if(isoff) cursoron(1); - screenupdate(); qunlock(&bit); return n; } @@ -1917,6 +1929,8 @@ Cursortocursor(Cursor *c) void cursoron(int dolock) { + if(cursor.disable) + return; if(dolock) lock(&cursor); if(cursor.visible++ == 0){ @@ -1929,6 +1943,7 @@ cursoron(int dolock) gbitblt(&gscreen, cursor.r.min, &set, Rect(0, 0, 16, 16), flipping? flipD[S|D] : S|D); mbbrect(cursor.r); + screenupdate(); } if(dolock) unlock(&cursor); @@ -1937,11 +1952,14 @@ cursoron(int dolock) void cursoroff(int dolock) { + if(cursor.disable) + return; if(dolock) lock(&cursor); if(--cursor.visible == 0) { gbitblt(&gscreen, cursor.r.min, &cursorback, Rect(0, 0, 16, 16), S); mbbrect(cursor.r); + screenupdate(); } if(dolock) unlock(&cursor); @@ -2068,7 +2086,7 @@ mouseputc(IOQ *q, int c) if(c & 0x80) msg[nb] |= ~0xFF; /* sign extend */ if(++nb == 5){ - mouse.newbuttons = b[((msg[0]&7)^7) | (mouseshifted ? 2 : 0)]; + mouse.newbuttons = b[((msg[0]&7)^7) | (mouseshifted ? 8 : 0)]; mouse.dx = msg[1]+msg[3]; mouse.dy = -(msg[2]+msg[4]); mouse.track = 1; diff --git a/port/devenv.c b/port/devenv.c index dffe3b039b052d0a9e2d66f29014e8ed18e3c9c6..462d1c43645fcf2903c9d9e074c29f387cd56137 100644 --- a/port/devenv.c +++ b/port/devenv.c @@ -264,10 +264,13 @@ void envcpy(Egrp *to, Egrp *from) { Evalue **l, *ne, *e; + char *p; l = &to->entries; qlock(from); for(e = from->entries; e; e = e->link) { +if(e->name == 0) panic("e->name == 0"); +for(p = e->name; *p; p++) if(p - e->name >= NAMELEN) panic("e->name %.*s", NAMELEN, e->name); ne = smalloc(sizeof(Evalue)); ne->name = smalloc(strlen(e->name)+1); strcpy(ne->name, e->name); diff --git a/ss/screen.h b/ss/screen.h index 04fd048b804c96347861a49ecae322422183ad7f..f7c92d1c1306c0819fc85c7ab4006538f645beea 100644 --- a/ss/screen.h +++ b/ss/screen.h @@ -19,6 +19,7 @@ struct Cursorinfo{ Cursor; Lock; int visible; /* on screen */ + int disable; /* from being used */ Rectangle r; /* location */ };