1
0
mirror of https://github.com/prirun/p50em.git synced 2026-01-13 15:17:32 +00:00

- 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
This commit is contained in:
Jim 2011-11-15 14:01:58 -05:00
parent 4b75d003bd
commit 83e05663cb
7 changed files with 59 additions and 52 deletions

View File

@ -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<MAXBOARDS; i++)
for (lx=0; lx<16; lx++) {
for (lx=0; lx<AMLCLINESPERBOARD; lx++) {
/* NOTE: don't allow connections on clock line */
if (lx == 15 && (i+1 == MAXBOARDS || !dc[i+1].deviceid))
break;
@ -862,8 +870,9 @@ int devamlc (int class, int func, int device) {
}
endconnect:
if (allbusy) {
warn("No free AMLC connection");
write(fd, "\rAll AMLC lines are in use!\r\n", 29);
//warn("No free AMLC connection");
strcpy(buf,"\r\nAll available connections are in use.\r\n\n");
write(fd, buf, strlen(buf));
close(fd);
} else {
int optval, tsflags;
@ -1296,4 +1305,3 @@ dorecv:
}
}
}
#endif

View File

@ -200,8 +200,6 @@
*/
#ifndef HOBBY
/* PNC poll rate in ms, mostly for connecting to new nodes */
#define PNCPOLL 1000
@ -266,7 +264,12 @@
#define MAXPNCBYTES MAXPNCWORDS*2 /* same in bytes */
#define MAXPKTBYTES (MAXPNCBYTES+4) /* adds 16-bit length word to each end */
#define MAXNODEID 254 /* 0 is a dummy, 255 is broadcast */
#ifdef DEMO
#define MAXNODEID 2 /* 0 is a dummy, 255 is broadcast */
#else
#define MAXNODEID 254 /* 0 is a dummy, 255 is broadcast */
#endif
#define MAXHOSTLEN 64 /* max length of remote host name */
#define MAXUIDLEN 16 /* max length of unique id/password */
@ -1254,9 +1257,3 @@ intrexit:
fatal("Bad func in devpcn");
}
}
#else
int devpnc (int class, int func, int device) {
return -1;
}
#endif

View File

@ -1,6 +1,6 @@
#define IMM_EA 0x80000000
static inline ea_t ea32i (ea_t earp, unsigned short inst, unsigned long *immu32, unsigned long long *immu64) {
static inline ea_t ea32i (ea_t earp, unsigned short inst, unsigned int *immu32, unsigned long long *immu64) {
int tm, sr, br, ring;
unsigned short d;

19
em.c
View File

@ -764,7 +764,7 @@ int readlicense(int first) {
if (first)
license = newlicense;
#ifndef HOBBY
#ifndef DEMO
if ((licensefile = fopen("license", "r")) == NULL) {
printf("em: no license file.\n");
@ -1767,7 +1767,7 @@ static int devpoll[64] = {0};
/* I/O device map table, containing function pointers to handle device I/O */
#ifdef HOBBY
#ifdef DEMO
/* this is the "hobby system" controller configuration:
@ -1776,6 +1776,7 @@ static int devpoll[64] = {0};
'14 = devmt: mag tape controller (4 drives)
'20 = devcp: clock / VCP / SOC
'26 = devdisk: 1st disk controller
'54 = devamlc: 1st AMLC (16 lines)
*/
static int (*devmap[64])(int, int, int) = {
@ -1784,12 +1785,11 @@ static int (*devmap[64])(int, int, int) = {
/* '2x */ devcp,devnone,devnone,devnone,devnone,devnone,devdisk,devnone,
/* '3x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone,
/* '4x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone,
/* '5x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone,
/* '5x */ devnone,devnone,devnone,devnone,devamlc,devnone,devnone,devnone,
/* '6x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone,
/* '7x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone};
#else
#if 0
#elif 0
/* this is the "full system" configuration supported by the emulator */
@ -1847,7 +1847,6 @@ static int (*devmap[64])(int, int, int) = {
/* '6x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone,
/* '7x */ devnone,devnone,devnone,devnone,devnone,devnone,devnone,devnone};
#endif
#endif
static void warn(char *msg) {
@ -1935,6 +1934,7 @@ static void fatal(char *msg) {
#endif
if (lseek(2, 0, SEEK_END) > 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) {

34
emdev.h
View File

@ -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;

9
geom.h
View File

@ -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

View File

@ -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