From 54e4676a0be40e4fdc56bd4427695ae3935113af Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 8 Nov 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-11-08 --- pc/l.s | 41 +++++++++++++- pc/vga.c | 146 +++++++++++++++++++++++++++++++++++--------------- port/devbit.c | 6 +-- 3 files changed, 145 insertions(+), 48 deletions(-) diff --git a/pc/l.s b/pc/l.s index 9492a7ba1f98e50496e6435f18daf49aec85a5c1..87374d4bdd2f6204f78203f6f3e79e18f4039987 100644 --- a/pc/l.s +++ b/pc/l.s @@ -635,7 +635,9 @@ TEXT config(SB),$0 RET /* - * copy bytes to screen memory for ldepth 0 screen + * 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 XORL AX,AX @@ -644,7 +646,42 @@ TEXT l0update(SB),$0 MOVL to+4(FP),DX l00: MOVB -1(BX)(CX*1),AL - MOVB cswizzle(SB)(AX*1),AL + MOVB bitrevtab(SB)(AX*1),AL MOVB AL,-1(DX)(CX*1) 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 + */ +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 */ + MOVW $(SRX),DX + OUTB + MOVB $0xA,AL + MOVW $(SR),DX + 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 + OUTB + MOVB BL,-1(DI)(CX*1) + LOOP l10 + RET diff --git a/pc/vga.c b/pc/vga.c index 8038d8776365802dd2f719c7f25119e501cd26ba..a31944d6b4c0007370923d2818aed171f9d60f33 100644 --- a/pc/vga.c +++ b/pc/vga.c @@ -327,6 +327,59 @@ mbbpt(Point p) mbb.max.y = p.y+1; } +/* + * copy litte endian soft screen to big endian hard screen + */ +void +screenupdate(void) +{ + uchar *sp, *hp; + int y, len, incs, inch; + 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 + 31)/32 - r.min.x/32; + len *= BY2WD; + if(len <= 0) + return; + + incs = gscreen.width * BY2WD; + inch = vgascreen.width * BY2WD; + + switch(gscreen.ldepth){ + case 0: + for (y = r.min.y; y < r.max.y; y++){ + l0update(sp, hp, len); + sp += incs; + hp += inch; + } + break; + case 1: + for (y = r.min.y; y < r.max.y; y++){ + l1update(sp, hp, len); + sp += incs; + hp += inch; + } + break; + } +} + void screenputnl(void) { @@ -394,49 +447,6 @@ screenbits(void) } -/* - * copy litte endian soft screen to big endian hard screen - */ -void -screenupdate(void) -{ - uchar *sp, *hp, *se; - int y, len, inc; - 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<