From 8a1b63fe23b7d10774f06ac4923175de701c10fe Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 9 Nov 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-11-09 --- pc/devconfig.c | 10 ++++++---- pc/l.s | 24 ++++++++++-------------- pc/vga.c | 23 +++++++++++++++++------ 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/pc/devconfig.c b/pc/devconfig.c index c2a5bf25df3d851d4965d013cbad1de5eb9bf69d..64ecf65e3118088e15f28e6836d1c77d24fb7978 100644 --- a/pc/devconfig.c +++ b/pc/devconfig.c @@ -146,7 +146,7 @@ long configwrite(Chan *c, void *buf, long n, ulong offset) { char cbuf[20], *cp; - int port, maxx, maxy; + int port, maxx, maxy, ldepth; switch(c->qid.path&~CHDIR){ case Qdir: @@ -165,10 +165,12 @@ configwrite(Chan *c, void *buf, long n, ulong offset) cp = cbuf; maxx = strtoul(cp, &cp, 0); maxy = strtoul(cp, &cp, 0); - if (maxx == 0 || maxy == 0 || - maxx > 1280 || maxy > 1024) + ldepth = strtoul(cp, &cp, 0); + if(maxx == 0 || maxy == 0 + || maxx > 1280 || maxy > 1024 + || ldepth > 3 || ldepth < 0) error(Ebadarg); - setscreen(maxx, maxy, 1); + setscreen(maxx, maxy, ldepth); return n; case Qvgaport: cp = buf; diff --git a/pc/l.s b/pc/l.s index 87374d4bdd2f6204f78203f6f3e79e18f4039987..1c9d408f7302707a22d36806470364b60e35033b 100644 --- a/pc/l.s +++ b/pc/l.s @@ -662,25 +662,21 @@ TEXT l1update(SB),$0 MOVL from+0(FP),SI MOVL to+4(FP),DI MOVL len+8(FP),CX -l10: - XORL DX,DX - MOVB -2(SI)(CX*2),DL /* high order nibbles */ - MOVW l1revsep(SB)(DX*2),BX - SHLW $4,BX - MOVB -1(SI)(CX*2),DL /* low order nibbles */ - ORW l1revsep(SB)(DX*2),BX - MOVB $(Smmask),AL /* write hi order bits to bit planes 0 & 2 */ + MOVB $(Smmask),AL MOVW $(SRX),DX OUTB - MOVB $0xA,AL MOVW $(SR),DX +l10: + XORL AX,AX + MOVB -2(SI)(CX*2),AL /* high order nibbles */ + MOVW l1revsep(SB)(AX*2),BX + SHLW $4,BX + MOVB -1(SI)(CX*2),AL /* low order nibbles */ + ORW l1revsep(SB)(AX*2),BX + MOVB $0xA,AL /* write hi order bits to bit planes 0 & 2 */ OUTB MOVB BH,-1(DI)(CX*1) - MOVB $(Smmask),AL /* write lo order bits to bit planes 1 & 3 */ - MOVW $(SRX),DX - OUTB - MOVB $0x5,AL - MOVW $(SR),DX + MOVB $0x5,AL /* write lo order bits to bit planes 1 & 3 */ OUTB MOVB BL,-1(DI)(CX*1) LOOP l10 diff --git a/pc/vga.c b/pc/vga.c index a31944d6b4c0007370923d2818aed171f9d60f33..4d0993db091fe3524b25ac0948acc130778c0f5a 100644 --- a/pc/vga.c +++ b/pc/vga.c @@ -233,24 +233,31 @@ setscreen(int maxx, int maxy, int ldepth) mbb = NULLMBB; /* - * zero hard screen + * zero hard screen and setup a bitmap for the new size */ memset((void*)SCREENMEM, 0xff, 64*1024); - vgascreen.ldepth = 0; + if(ldepth == 3) + vgascreen.ldepth = 3; + else + vgascreen.ldepth = 0; vgascreen.base = (void*)SCREENMEM; vgascreen.width = (maxx*(1< gscreen.r.max.y) r.max.y = gscreen.r.max.y; + bits = 1<