~kris/9p

9hist

c3eb994b1c642a341b7ba3b0ab4eba5905568ea1 — David du Colombier 33 years ago 8a1b63f
Plan 9 from Bell Labs 1992-11-10
5 files changed, 30 insertions(+), 15 deletions(-)

M pc/fns.h
M pc/l.s
M pc/main.c
M pc/vga.c
M pc/vga.h
M pc/fns.h => pc/fns.h +1 -0
@@ 35,6 35,7 @@ void	insl(int, void*, int);
ulong	isamem(int);
void	kbdinit(void);
void	l0update(uchar*, uchar*, int);
void	l1update(uchar*, uchar*, int);
void	mathinit(void);
void	mmuinit(void);
int	modem(int);

M pc/l.s => pc/l.s +4 -4
@@ 642,12 642,12 @@ TEXT	config(SB),$0
TEXT	l0update(SB),$0
	XORL	AX,AX
	MOVL	len+8(FP),CX
	MOVL	from+0(FP),BX
	MOVL	to+4(FP),DX
	MOVL	from+0(FP),SI
	MOVL	to+4(FP),DI
l00:
	MOVB	-1(BX)(CX*1),AL
	MOVB	-2(SI)(CX*2),AL
	MOVB	bitrevtab(SB)(AX*1),AL
	MOVB	AL,-1(DX)(CX*1)
	MOVB	AL,-1(DI)(CX*1)
	LOOP	l00
	RET


M pc/main.c => pc/main.c +1 -0
@@ 271,6 271,7 @@ confinit(void)
	conf.npage1 = (i*MB - conf.base1)/BY2PG;
	conf.npage = conf.npage0 + conf.npage1;

	conf.ldepth = 1;
	pcnt = screenbits()-1;		/* Calculate % of memory for page pool */
	pcnt = 70 - (pcnt*10);
	conf.upages = (conf.npage*pcnt)/100;

M pc/vga.c => pc/vga.c +21 -11
@@ 241,7 241,7 @@ setscreen(int maxx, int maxy, int ldepth)
	else
		vgascreen.ldepth = 0;
	vgascreen.base = (void*)SCREENMEM;
	vgascreen.width = (maxx*(1<<ldepth))/32;
	vgascreen.width = (maxx*(1<<vgascreen.ldepth))/32;
	vgascreen.r.max = Pt(maxx, maxy);
	vgascreen.clipr.max = vgascreen.r.max;



@@ 252,7 252,7 @@ setscreen(int maxx, int maxy, int ldepth)
	gscreen.width = (maxx*(1<<ldepth))/32;
	gscreen.r.max = Pt(maxx, maxy);
	gscreen.clipr.max = gscreen.r.max;
	len = gscreen.width * 4 * maxy;
	len = gscreen.width * BY2WD * maxy;
	if(gscreen.base){
		free(gscreen.base);
		gscreen.base = ((ulong*)smalloc(len+2*1024))+256;


@@ 271,7 271,7 @@ setscreen(int maxx, int maxy, int ldepth)
void
screeninit(void)
{
	int i;
	int i, x;
	ulong *l;

	setmode(&mode12);


@@ 300,8 300,18 @@ screeninit(void)
		conf.maxx = MAXX;
	if(conf.maxy == 0)
		conf.maxy = MAXY;

	setscreen(conf.maxx, conf.maxy, conf.ldepth);

	/*
	 *  set up default grey scale color map
	 */
	outb(CMWX, 0);
	for(i = 0; i < 16; i++){
		x = (i*63)/15;
		outb(CM, x);
		outb(CM, x);
		outb(CM, x);
	}
}

/*


@@ 341,7 351,7 @@ void
screenupdate(void)
{
	uchar *sp, *hp;
	int y, len, incs, inch, bits;
	int y, len, incs, inch, bits, off;
	Rectangle r;

	r = mbb;


@@ 360,10 370,11 @@ screenupdate(void)
		r.max.y = gscreen.r.max.y;

	bits = 1<<vgascreen.ldepth;
	sp = (uchar*)gaddr(&gscreen, r.min);
	hp = (uchar*)gaddr(&vgascreen, r.min);
	len = (r.max.x*bits + 31)/32 - (r.min.x*bits)/32;
	len *= BY2WD;
	off = (r.min.x*bits)>>(3-vgascreen.ldepth);
	hp = (uchar*)(vgascreen.base+(r.min.y*vgascreen.width)) + off;
	off <<= gscreen.ldepth - vgascreen.ldepth;
	sp = (uchar*)(gscreen.base+(r.min.y*gscreen.width)) + off;
	len = (r.max.x*bits + 7)/8 - (r.min.x*bits)/8;
	if(len <= 0)
		return;



@@ 446,7 457,6 @@ screenputs(char *s, int n)
		}
	}
	rs.max = Pt(gscreen.r.max.x, out.pos.y+defont0.height);
	unlock(&screenlock);
	mbbrect(rs);
	screenupdate();
}


@@ 454,7 464,7 @@ screenputs(char *s, int n)
int
screenbits(void)
{
	return 1;	/* bits per pixel */
	return 1<<gscreen.ldepth;	/* bits per pixel */
}



M pc/vga.h => pc/vga.h +3 -0
@@ 15,6 15,9 @@ enum
	 Cvre=		 0x11,		/*  vertical retrace end */
	ARW=		0x3C0,		/* attribute registers (writing) */
	ARR=		0x3C1,		/* attribute registers (reading) */
	CMRX=		0x3C7,		/* color map read index */
	CMWX=		0x3C8,		/* color map write index */
	CM=		0x3C9,		/* color map data reg */
};

#define SCREENMEM	(0xA0000 | KZERO)