~kris/9p

9hist

e5cde678b6855f39c412b2801c9763c33d5f7d8c — David du Colombier 33 years ago f1ef791
Plan 9 from Bell Labs 1992-11-07
8 files changed, 64 insertions(+), 13 deletions(-)

M gnot/screen.h
M pc/fns.h
M pc/l.s
M pc/screen.h
M pc/vga.c
M port/devbit.c
M port/devenv.c
M ss/screen.h
M gnot/screen.h => gnot/screen.h +1 -0
@@ 19,6 19,7 @@ struct Cursorinfo{
	Cursor;
	Lock;
	int	visible;	/* on screen */
	int	disable;	/* from being used */
	Rectangle r;		/* location */
};


M pc/fns.h => pc/fns.h +1 -0
@@ 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);

M pc/l.s => pc/l.s +15 -0
@@ 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

M pc/screen.h => pc/screen.h +1 -0
@@ 19,6 19,7 @@ struct Cursorinfo{
	Cursor;
	Lock;
	int	visible;	/* on screen */
	int	disable;	/* from being used */
	Rectangle r;		/* location */
};


M pc/vga.c => pc/vga.c +20 -9
@@ 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<<gscreen.ldepth) + 31)/32
		- (r.min.x * (1<<gscreen.ldepth))/32;
	len *= BY2WD;
	if(len <= 0)
		return;

	inc = gscreen.width * BY2WD - len;

	for (y = r.min.y; y < r.max.y; y++){
		for(se = sp + len; sp < se;)
			*hp++ = cswizzle[*sp++];
		sp += inc;
		hp += inc;
		l0update(sp, hp, len);
		sp += inc+len;
		hp += inc+len;
	}
	mbb = NULLMBB;
}

void

M port/devbit.c => port/devbit.c +22 -4
@@ 795,7 795,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset)
	ulong l, nw, ws, rv, q0, q1;
	ulong *lp;
	int off, isoff, i, j, ok;
	ulong *endscreen = gaddr(&gscreen, Pt(0, gscreen.r.max.y));
 	ulong *endscreen = gaddr(&gscreen, Pt(0, gscreen.r.max.y));
	Point pt, pt1, pt2;
	Rectangle rect;
	Cursor curs;


@@ 933,6 933,18 @@ bitwrite(Chan *c, void *va, long n, ulong offset)
				p += 1;
				break;
			}
			if(m == 2){
				if(p[1]){	/* make damn sure */
					cursor.disable = 0;
					isoff = 1;
				}else{
					cursoroff(1);
					cursor.disable = 1;
				}
				m -= 2;
				p += 2;
				break;
			}
			if(m < 73)
				error(Ebadblt);
			curs.offset.x = BGLONG(p+1);


@@ 1147,7 1159,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset)
				isoff = 1;
			}
			gsegment(dst, pt1, pt2, t, fc);
			if(dst->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;

M port/devenv.c => port/devenv.c +3 -0
@@ 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);

M ss/screen.h => ss/screen.h +1 -0
@@ 19,6 19,7 @@ struct Cursorinfo{
	Cursor;
	Lock;
	int	visible;	/* on screen */
	int	disable;	/* from being used */
	Rectangle r;		/* location */
};