From 83e05663cb45a3b707c4b4ea38e3dfae93a3ca32 Mon Sep 17 00:00:00 2001 From: Jim Date: Tue, 15 Nov 2011 14:01:58 -0500 Subject: [PATCH] - Replace HOBBY #ifdef with DEMO, - Remove long integers so x86_64, where long is 8 bytes, is like i686 compile, where long is 4 bytes. - Dont' handle xon/xoff on sys console in full duplex - Add geom hash for DEMO emulator - Add -mmacosx-version-min=10.4 option for DEMO emulator - Add 1-line AMLC and 2-node PNC to DEMO emulator --- devamlc.h | 22 +++++++++++++++------- devpnc.h | 15 ++++++--------- ea32i.h | 2 +- em.c | 19 ++++++++----------- emdev.h | 34 +++++++++++++++++----------------- geom.h | 9 +++++++-- makefile | 10 +++++----- 7 files changed, 59 insertions(+), 52 deletions(-) diff --git a/devamlc.h b/devamlc.h index d608c11..953026c 100644 --- a/devamlc.h +++ b/devamlc.h @@ -1,4 +1,3 @@ -#ifndef HOBBY /* Implements the AMLC subsystem for Primos. In earlier versions (r186), a more hardware-centric implementation was used that closely @@ -162,8 +161,15 @@ AMLC status word (from AMLCT5): int devamlc (int class, int func, int device) { -#define MAXLINES 128 -#define MAXBOARDS 8 +#ifdef DEMO + #define AMLCLINESPERBOARD 1 + #define MAXLINES 1 + #define MAXBOARDS 1 +#else + #define AMLCLINESPERBOARD 16 + #define MAXLINES 128 + #define MAXBOARDS 8 +#endif /* check for 1 new connection every .1 seconds */ @@ -276,6 +282,7 @@ int devamlc (int class, int func, int device) { switch (device) { case 054: dx = 0; break; +#ifndef DEMO case 053: dx = 1; break; case 052: dx = 2; break; case 035: dx = 3; break; @@ -283,6 +290,7 @@ int devamlc (int class, int func, int device) { case 016: dx = 5; break; case 017: dx = 6; break; case 032: dx = 7; break; +#endif default: fprintf(stderr, "devamlc: non-AMLC device id '%o ignored\n", device); return -1; @@ -843,7 +851,7 @@ int devamlc (int class, int func, int device) { allbusy = 1; for (j=!haveob; j<2; j++) for (i=0; dc[i].deviceid && i 0) printf("Check error.log for more information\n"); + printf("\n"); exit(1); } @@ -2565,7 +2565,6 @@ static unsigned short dumppcb(unsigned short pcb) { static ea_t stex(unsigned int framesize) { short stackrootseg, stackseg; - unsigned long utempl; ea_t stackfp, fpva; if (framesize > 0xFFFF) @@ -2836,7 +2835,7 @@ static argt() { static pcl (ea_t ecbea) { short i,j; - unsigned long utempl; + unsigned int utempl; unsigned short access; unsigned short ecb[9]; short bit; /* bit offset for args */ @@ -4401,7 +4400,7 @@ main (int argc, char **argv) { unsigned short trapvalue; ea_t trapaddr; unsigned short access; - unsigned long immu32; + unsigned int immu32; unsigned long long immu64; short fcode; unsigned short zresult, zclen1, zclen2, zaccess; @@ -4628,14 +4627,12 @@ main (int argc, char **argv) { } else fatal("-nport needs an argument\n"); -#ifndef HOBBY } else if (strcmp(argv[i],"-tport") == 0) { if (i+1 < argc && argv[i+1][0] != '-') { sscanf(argv[++i],"%d", &templ); tport = templ; } else fatal("-tport needs an argument\n"); -#endif #ifndef NOTRACE } else if (strcmp(argv[i],"-trace") == 0) { diff --git a/emdev.h b/emdev.h index 1777037..e6e4ba7 100644 --- a/emdev.h +++ b/emdev.h @@ -493,21 +493,21 @@ readasr: } #endif - /* do xon/xoff processing here, because if Unix does it, the - emulator might block. It would be nice to pass these onto - Primos so that Emacs could use them, but at older revs, the - system console didn't support xon/xoff. If they are passed - on, then the next command usually fails because the flow - control characters are stored in the command line. */ + /* if doing local echo, do xon/xoff processing here. If Unix + does it, the emulator might block on a console write. If + the console is running full-duplex (no local echo), we can + pass xon & xoff onto Primos */ - if (ch == '') { - xoff = 1; - goto readasr; - } else if (ch == '') { - xoff = 0; - goto readasr; + if (terminfo.c_lflag & ECHO) { + if (ch == '') { + xoff = 1; + goto readasr; + } else if (ch == '') { + xoff = 0; + goto readasr; + } + xoff = 0; /* enable output if any characters typed */ } - xoff = 0; /* enable output if any characters typed */ if (func >= 010) putcrs16(A, 0); putcrs16(A, getcrs16(A) | ch); @@ -942,7 +942,7 @@ int devmt (int class, int func, int device) { unsigned short dmxreg; /* DMA/C register address */ short dmxnch; /* number of DMX channels - 1 */ unsigned int dmxaddr; - unsigned long dmcpair; + unsigned int dmcpair; short dmxnw, dmxtotnw; int i,n; char reclen[4]; @@ -1776,7 +1776,7 @@ int devdisk (int class, int func, int device) { switch (device) { case 026: dx = 0; break; -#ifndef HOBBY +#ifndef DEMO case 027: dx = 1; break; case 022: dx = 2; break; case 023: dx = 3; break; @@ -1803,7 +1803,7 @@ int devdisk (int class, int func, int device) { dc[dx].state = S_HALT; dc[dx].status = 0100000; dc[dx].usel = -1; -#ifdef HOBBY +#ifdef DEMO if (geomcksum != geomhash((char *)geom, sizeof(geom))) RP=MAKEVA(01000,0); #endif @@ -2106,7 +2106,7 @@ int devdisk (int class, int func, int device) { break; } if (u == 1) u = 0; -#ifndef HOBBY +#ifndef DEMO else if (u == 2) u = 1; else if (u == 4) u = 2; else if (u == 8) u = 3; diff --git a/geom.h b/geom.h index 8b80362..0d54633 100644 --- a/geom.h +++ b/geom.h @@ -1,6 +1,6 @@ /* static structure for disk file suffixes and config data */ -#ifdef HOBBY +#ifdef DEMO #define MAXDRIVES 1 #define MAXCTRL 1 /* 1 controller supported at device address '26 */ @@ -22,7 +22,12 @@ 12, "120M", 8, 7, 1020, /* MODEL_4715 */ }; - static int geomcksum = 359381910; +#ifdef __LITTLE_ENDIAN__ + static int geomcksum = 0x15488c73; +#else + static int geomcksum = 0x156bbb96; +#endif + #else #define NUMGEOM 25 diff --git a/makefile b/makefile index 8c9fb8e..e099a0c 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,7 @@ REV=${shell hg id -n} -.PHONY: broken em emp debug debugp trace tracep vfy vfyp fixed fixedp hobby hobbyp dongle lmserver magrst parts smad smag mtread mtwrite +.PHONY: broken em emp debug debugp trace tracep vfy vfyp fixed fixedp demo demop dongle lmserver magrst parts smad smag mtread mtwrite em: # production (Intel) @@ -63,15 +63,15 @@ fixedp: # fixed clock rate, gdb (PowerPC) rm em.o -hobby: # hobby (limited: no amlc, 1 disk drive up to 160MB, no PNC) (Intel) +demo: # demo (limited: 1-2 amlc, 1 disk drive up to 160MB, one PNC node) (Intel) - cc -arch i686 -DREV=\"${REV}\" -DNOREGS -DHOBBY -DNOTRACE -DFAST -O em.c -fobey-inline -mdynamic-no-pic -o em + cc -DREV=\"${REV}\" -DNOREGS -DDEMO -DNOTRACE -DFAST -O em.c -fobey-inline -mdynamic-no-pic -o em strip em -hobbyp: # hobby (limited: no amlc, 1 disk drive up to 160MB, no PNC) (PowerPC) +demop: # demo (PowerPC) - cc -arch ppc -DREV=\"${REV}\" -DHOBBY -DNOTRACE -DFAST -O em.c -fobey-inline -mdynamic-no-pic -o em + cc -mmacosx-version-min=10.4 -fno-stack-protector -arch ppc -DREV=\"${REV}\" -DNOREGS -DDEMO -DNOTRACE -DFAST -O em.c -fobey-inline -mdynamic-no-pic -o em strip em