From 1a7f3cb8773a2dc0685edd5c8b1e6d82d97a9c7c Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 20 May 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-05-20 --- carrera/l.s | 4 ---- carrera/main.c | 1 - carrera/screen.c | 25 +++++++++++++++++-------- carrera/screen.h | 2 +- carrera/segment.h | 1 + pc/dat.h | 1 - pc/devvga.c | 20 ++++++++++++++++---- pc/fns.h | 3 --- pc/screen.h | 1 + port/devmouse.c | 16 +--------------- port/portfns.h | 1 - 11 files changed, 37 insertions(+), 38 deletions(-) diff --git a/carrera/l.s b/carrera/l.s index a7f2192b5816cbc7d5a027695e46c214fa342b74..ea07a3e4611695c8302adffd0f0ae3d10ef59968 100644 --- a/carrera/l.s +++ b/carrera/l.s @@ -835,7 +835,3 @@ frloop: SRLV $32, R6 XOR R6, R1 RET - -TEXT getprid(SB), $0 - MOVW M(PRID), R1 - RET diff --git a/carrera/main.c b/carrera/main.c index eeb98432a5a27efc261c15bd6f46e4cc8c461d63..8cd55c76cdc5eba4ca67a4fff49129e1c98e1300 100644 --- a/carrera/main.c +++ b/carrera/main.c @@ -55,7 +55,6 @@ main(void) vecinit(); screeninit(); iprint("\n\nBrazil\n"); - iprint("M(PRID) = 0x%.8lux\n", getprid()); pageinit(); procinit0(); initseg(); diff --git a/carrera/screen.c b/carrera/screen.c index 0bc520d91b70c80bcbe28463aa10dba5833f3323..9f1f11d8dfa8de6f5305af7b79a398418a0a80a8 100644 --- a/carrera/screen.c +++ b/carrera/screen.c @@ -103,7 +103,7 @@ screenwin(void) Dac *d; Point p; int i, y; - ulong zbuf[16]; + Cursor zero; memset((void*)Screenvirt, 0xff, 3*1024*1024); @@ -149,8 +149,8 @@ screenwin(void) d->cr2 = 0; d->cr2 = 0; /* initialize with all-transparent cursor */ - memset(zbuf, 0, sizeof zbuf); - setcursor(zbuf, zbuf, 0, 0); + memset(&zero, 0, sizeof zero); + setcursor(&zero); /* enable both planes of cursor */ d->cr1 = 0x03; d->cr0 = 0x00; @@ -407,19 +407,28 @@ rep(ulong v, int n) } void -setcursor(ulong *s, ulong *c, int offx, int offy) +setcursor(Cursor *curs) { Dac *d; - int x, y; + int x, y, i; Point org; - uchar ylow, yhigh; + uchar ylow, yhigh, *p; ulong spix, cpix, dpix; - + ulong s[16], c[16]; + + for(i=0; i<16; i++){ + p = (uchar*)&s[i]; + *p = curs->set[2*i]; + *(p+1) = curs->set[2*i+1]; + p = (uchar*)&c[i]; + *p = curs->clr[2*i]; + *(p+1) = curs->clr[2*i+1]; + } hwcursor.base = (ulong *)malloc(1024); if(hwcursor.base == 0) error(Enomem); /* hw cursor is 64x64 with hot point at (32,32) */ - org = add(Pt(32,32), Pt(offx,offy)); + org = add(Pt(32,32), curs->offset); for(x = 0; x < 16; x++) for(y = 0; y < 16; y++) { spix = (s[y]>>(31-(x&0x1F)))&1; diff --git a/carrera/screen.h b/carrera/screen.h index 5f189e08c7930ecb0ac6744a33fe27e7dc6df71b..64d33762f32f17c2b4d99fbbe0fd70320eb02222 100644 --- a/carrera/screen.h +++ b/carrera/screen.h @@ -13,4 +13,4 @@ extern void cursoron(int); #define cursoroff(x) #define mousectl(s) extern Point mousexy(void); -#define hwscreenwrite(a, b) +void setcursor(Cursor*); diff --git a/carrera/segment.h b/carrera/segment.h index 1f8609e35099aee77ec4451d801f55ecbc8207bb..86af5480493a3717886739913f423a0718db4d17 100644 --- a/carrera/segment.h +++ b/carrera/segment.h @@ -9,5 +9,6 @@ Physseg physseg[] = { SG_PHYSICAL, "eisaio", Eisaphys, 64*1024, 0, 0 }, { SG_PHYSICAL, "eisavga", Eisavgaphys, 128*1024, 0, 0 }, { SG_PHYSICAL, "bootrom", 0x1fc00000, 256*1024, 0, 0 }, + { SG_PHYSICAL, "nvram", 0xe0009000, 12*1024, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, }; diff --git a/pc/dat.h b/pc/dat.h index 00612a42be56e014a651d8d0c917e9a07f1eb3ee..112913d43fb64a3a49df2999ea10d83e71f6d7f2 100644 --- a/pc/dat.h +++ b/pc/dat.h @@ -190,7 +190,6 @@ struct ISAConf { #define MAXPCMCIA 8 /* maximum number of PCMCIA cards */ #define BOOTLINE ((char *)0x80000100) /* bootline passed by boot program */ -extern int flipD[]; /* for flipping bitblt destination polarity */ extern PCArch *arch; /* PC architecture */ extern int cpuflag; /* true if this is a CPU */ diff --git a/pc/devvga.c b/pc/devvga.c index cf68789c62b402cac199ea83a355b5f154b961e5..03ccde15adfc869869831c54ac8984e91835cb5e 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -1307,6 +1307,10 @@ cursorinit(void) cursor.l = cursorwork.width*BY2WD; if(!already){ + set.base = malloc(16*sizeof(ulong)); + clr.base = malloc(16*sizeof(ulong)); + if(set.base == 0 || clr.base == 0) + panic("cursorinit"); cursor.disable--; already = 1; } @@ -1315,11 +1319,19 @@ cursorinit(void) } void -setcursor(ulong *setbits, ulong *clrbits, int offx, int offy) +setcursor(Cursor *curs) { - USED(offx, offy); - set.base = setbits; - clr.base = clrbits; + uchar *p; + int i; + + for(i=0; i<16; i++){ + p = (uchar*)&set.base[i]; + *p = curs->set[2*i]; + *(p+1) = curs->set[2*i+1]; + p = (uchar*)&clr.base[i]; + *p = curs->clr[2*i]; + *(p+1) = curs->clr[2*i+1]; + } } void diff --git a/pc/fns.h b/pc/fns.h index 1917d71bb2cb64265988772664dd99f688ed5dd8..e1d6920b62fd722017cdddedf5965d3fa145233e 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -42,9 +42,6 @@ int iprint(char*, ...); int isaconfig(char*, int, ISAConf*); ulong isamem(int); void kbdinit(void); -void* l0update(uchar*, uchar*, long); -void* l1update(uchar*, uchar*, long); -void* l2update(uchar*, uchar*, long); long* mapaddr(ulong); void mathinit(void); void meminit(void); diff --git a/pc/screen.h b/pc/screen.h index be8f0980350bddec67df1796f54c62eabc984549..976cdc322bda2876af7449499ff52b5b4868a65a 100644 --- a/pc/screen.h +++ b/pc/screen.h @@ -18,3 +18,4 @@ extern void cursoron(int); extern void cursoroff(int); extern Point mousexy(void); extern void cursorinit(void); +extern void setcursor(Cursor*); diff --git a/port/devmouse.c b/port/devmouse.c index e2a272f57f5f6dbed7b289304c713e0dfb1bb889..a0a35f33c891229a9bd2f22ca0186cec1564e28f 100644 --- a/port/devmouse.c +++ b/port/devmouse.c @@ -51,9 +51,6 @@ Cursor arrow = } }; -ulong setbits[16]; -ulong clrbits[16]; - void Cursortocursor(Cursor*); int mousechanged(void*); @@ -303,20 +300,9 @@ mousewrite(Chan *c, void *va, long n, ulong offset) void Cursortocursor(Cursor *c) { - int i; - uchar *p; - lock(&cursor); memmove(&cursor.Cursor, c, sizeof(Cursor)); - for(i=0; i<16; i++){ - p = (uchar*)&setbits[i]; - *p = c->set[2*i]; - *(p+1) = c->set[2*i+1]; - p = (uchar*)&clrbits[i]; - *p = c->clr[2*i]; - *(p+1) = c->clr[2*i+1]; - } - setcursor(setbits, clrbits, cursor.offset.x, cursor.offset.y); + setcursor(c); unlock(&cursor); } diff --git a/port/portfns.h b/port/portfns.h index aa48bb362b46425505124c8caf96e1da5adadf83..f7fca4e44eaec9a5667dcccfae0916696f5c6aac 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -226,7 +226,6 @@ long seconds(void); ulong segattach(Proc*, ulong, char *, ulong, ulong); void segpage(Segment*, Page*); int setcolor(ulong, ulong, ulong, ulong); -void setcursor(ulong*, ulong*, int, int); void setkernur(Ureg*, Proc*); int setlabel(Label*); void setregisters(Ureg*, char*, char*, int);