sigma: New simulator (from beta)

This commit is contained in:
Bob Supnik 2018-06-03 17:37:24 -07:00 committed by Mark Pizzolato
parent e3cdbed45f
commit 54516bb175
11 changed files with 39 additions and 41 deletions

BIN
doc/sigma_doc.doc Normal file

Binary file not shown.

View file

@ -1,6 +1,6 @@
/* sigma_cis.c: Sigma decimal instructions /* sigma_cis.c: Sigma decimal instructions
Copyright (c) 2007-2008, Robert M Supnik Copyright (c) 2007-2018, Robert M Supnik
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
@ -26,6 +26,8 @@
Questions: Questions:
1. On the Sigma 9, in ASCII mode, is an ASCII blank used in EBS? 1. On the Sigma 9, in ASCII mode, is an ASCII blank used in EBS?
02-Jun-2018 RMS Fixed unsigned < 0 in decimal compare (Mark Pizzolato)
*/ */
#include "sigma_defs.h" #include "sigma_defs.h"
@ -100,7 +102,7 @@ uint32 cis_dec (uint32 op, uint32 lnt, uint32 bva)
{ {
dstr_t src1, src2, src2x, dst; dstr_t src1, src2, src2x, dst;
uint32 i, t, kint, ldivr, ldivd, ad, c, d, end; uint32 i, t, kint, ldivr, ldivd, ad, c, d, end;
int32 sc; int32 sc, scmp;
uint32 tr; uint32 tr;
if (lnt == 0) /* adjust length */ if (lnt == 0) /* adjust length */
@ -163,10 +165,10 @@ switch (op) { /* case on opcode */
if (src1.sign ^ src2.sign) /* signs differ? */ if (src1.sign ^ src2.sign) /* signs differ? */
CC = src1.sign? CC4: CC3; /* set < or > */ CC = src1.sign? CC4: CC3; /* set < or > */
else { /* same signs */ else { /* same signs */
int32 t = CmpDstr (&src1, &src2); /* compare strings */ scmp = CmpDstr (&src1, &src2); /* compare strings */
if (t < 0) if (scmp < 0)
CC = (src1.sign? CC3: CC4); CC = (src1.sign? CC3: CC4);
else if (t > 0) else if (scmp > 0)
CC = (src1.sign? CC4: CC3); CC = (src1.sign? CC4: CC3);
else CC = 0; else CC = 0;
} }
@ -720,11 +722,11 @@ return cy;
void SubDstr (dstr_t *s1, dstr_t *s2, dstr_t *ds) void SubDstr (dstr_t *s1, dstr_t *s2, dstr_t *ds)
{ {
uint32 i; uint32 i;
dstr_t Compl; dstr_t complm;
for (i = 0; i < DSTRLNT; i++) /* 9's comp s2 */ for (i = 0; i < DSTRLNT; i++) /* 9's comp s2 */
Compl.val[i] = 0x99999999 - s1->val[i]; complm.val[i] = 0x99999999 - s1->val[i];
AddDstr (&Compl, s2, ds, 1); /* s1 + ~s2 + 1 */ AddDstr (&complm, s2, ds, 1); /* s1 + ~s2 + 1 */
return; return;
} }

View file

@ -248,7 +248,7 @@ extern uint32 io_tio (uint32 rn, uint32 bva);
extern uint32 io_tdv (uint32 rn, uint32 bva); extern uint32 io_tdv (uint32 rn, uint32 bva);
extern uint32 io_hio (uint32 rn, uint32 bva); extern uint32 io_hio (uint32 rn, uint32 bva);
extern uint32 io_aio (uint32 rn, uint32 bva); extern uint32 io_aio (uint32 rn, uint32 bva);
extern t_stat int_reset (DEVICE *dev); extern uint32 int_reset (DEVICE *dev);
extern void io_set_eimax (uint32 lnt); extern void io_set_eimax (uint32 lnt);
extern void io_sclr_req (uint32 inum, uint32 val); extern void io_sclr_req (uint32 inum, uint32 val);
extern void io_sclr_arm (uint32 inum, uint32 val); extern void io_sclr_arm (uint32 inum, uint32 val);
@ -476,7 +476,6 @@ while (reason == 0) { /* loop until stop */
if (sim_brk_summ && if (sim_brk_summ &&
sim_brk_test (PC, SWMASK ('E'))) { /* breakpoint? */ sim_brk_test (PC, SWMASK ('E'))) { /* breakpoint? */
reason = STOP_IBKPT; /* stop simulation */ reason = STOP_IBKPT; /* stop simulation */
sim_interval++; /* don't count non-executed instruction */
break; break;
} }
if (PSW_QRX9 && (PC & PSW1_XA)) /* S9 real ext && ext? */ if (PSW_QRX9 && (PC & PSW1_XA)) /* S9 real ext && ext? */
@ -2705,7 +2704,7 @@ return SCPE_OK;
t_stat cpu_show_addr (FILE *of, UNIT *uptr, int32 val, CONST void *desc) t_stat cpu_show_addr (FILE *of, UNIT *uptr, int32 val, CONST void *desc)
{ {
t_stat r; t_stat r;
CONST char *cptr = (CONST char *) desc; char *cptr = (char *) desc;
uint32 ad, bpa, dlnt, virt; uint32 ad, bpa, dlnt, virt;
static const char *lnt_str[] = { static const char *lnt_str[] = {
"byte", "byte",
@ -2825,7 +2824,7 @@ t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
{ {
int32 k, di, lnt; int32 k, di, lnt;
t_stat r; t_stat r;
CONST char *cptr = (CONST char *) desc; char *cptr = (char *) desc;
InstHistory *h; InstHistory *h;
if (hst_lnt == 0) /* enabled? */ if (hst_lnt == 0) /* enabled? */

View file

@ -34,10 +34,6 @@
#include "sim_defs.h" /* simulator defns */ #include "sim_defs.h" /* simulator defns */
/* Rename of global PC variable to avoid namespace conflicts on some platforms */
#define PC PC_Global
#if defined(USE_INT64) || defined(USE_ADDR64) #if defined(USE_INT64) || defined(USE_ADDR64)
#error "Sigma 32b does not support 64b values!" #error "Sigma 32b does not support 64b values!"
#endif #endif

Binary file not shown.

View file

@ -261,7 +261,7 @@ typedef struct {
uint32 tpos; /* to position */ uint32 tpos; /* to position */
} DP_SNSTAB; } DP_SNSTAB;
static char *dp_cname[] = { static const char *dp_cname[] = {
"7240", "7270", "7260", "7275", "7265", "T3281" "7240", "7270", "7260", "7275", "7265", "T3281"
}; };
@ -1113,7 +1113,7 @@ t_stat dp_ioerr (UNIT *uptr)
uint32 cidx = uptr->UCTX; uint32 cidx = uptr->UCTX;
uint32 dva = dp_dib[cidx].dva; uint32 dva = dp_dib[cidx].dva;
sim_perror ("DP I/O error"); perror ("DP I/O error");
clearerr (uptr->fileref); clearerr (uptr->fileref);
dp_ctx[cidx].dp_flags |= DPF_DPE; /* set DPE flag */ dp_ctx[cidx].dp_flags |= DPF_DPE; /* set DPE flag */
chan_set_chf (dva, CHF_XMDE); chan_set_chf (dva, CHF_XMDE);

View file

@ -356,7 +356,7 @@ if (skp && CHP (CH_TOF, lp_cct[lp_cctp])) /* skip, TOF? */
} }
uptr->pos = ftell (uptr->fileref); /* update position */ uptr->pos = ftell (uptr->fileref); /* update position */
if (ferror (uptr->fileref)) { /* error? */ if (ferror (uptr->fileref)) { /* error? */
sim_perror ("Line printer I/O error"); perror ("Line printer I/O error");
clearerr (uptr->fileref); clearerr (uptr->fileref);
chan_set_chf (lp_dib.dva, CHF_XMDE); chan_set_chf (lp_dib.dva, CHF_XMDE);
return SCPE_IOERR; return SCPE_IOERR;
@ -391,7 +391,7 @@ if ((lp_model == LP_7440) || lp_pass) { /* ready to print? */
fputc (lp_inh? '\r': '\n', uptr->fileref); /* cr or nl */ fputc (lp_inh? '\r': '\n', uptr->fileref); /* cr or nl */
uptr->pos = ftell (uptr->fileref); /* update position */ uptr->pos = ftell (uptr->fileref); /* update position */
if (ferror (uptr->fileref)) { /* error? */ if (ferror (uptr->fileref)) { /* error? */
sim_perror ("Line printer I/O error"); perror ("Line printer I/O error");
clearerr (uptr->fileref); clearerr (uptr->fileref);
chan_set_chf (lp_dib.dva, CHF_XMDE); chan_set_chf (lp_dib.dva, CHF_XMDE);
return SCPE_IOERR; return SCPE_IOERR;

View file

@ -529,8 +529,7 @@ if (QCPU_S89)
((R[rn] & S89_SR1_MARG) >> S89_SR1_MAROFF); ((R[rn] & S89_SR1_MARG) >> S89_SR1_MAROFF);
break; break;
case 0xB: /* read sr0, clr */ case 0xB: /* read sr0, clr */
mem_sr0[memu] = mem_sr1[memu] = 0; mem_sr0[memu] = mem_sr1[memu] = 0; /* fall through */
/* fall through */
case 0x8: /* read sr0 */ case 0x8: /* read sr0 */
R[rn] = (wd & S89_SR0_RD) | R[rn] = (wd & S89_SR0_RD) |
(((1u << (chan_num + 1)) - 1) << (S89_SR0_V_PORTS - (chan_num + 1))); (((1u << (chan_num + 1)) - 1) << (S89_SR0_V_PORTS - (chan_num + 1)));
@ -559,8 +558,7 @@ else switch (CC) { /* 5X0 */
mmc_wlk[ppag | 1] = R[rn] & 0xF; mmc_wlk[ppag | 1] = R[rn] & 0xF;
break; break;
case 0xC: /* read sr0, clr */ case 0xC: /* read sr0, clr */
mem_sr0[memu] = 0; /* clr */ mem_sr0[memu] = 0; /* clr, fall through */
/* fall through */
case 0x8: /* read sr0 */ case 0x8: /* read sr0 */
R[rn] = S5X0_SR0_FIXED | (wd & S5X0_SR0_RD) | R[rn] = S5X0_SR0_FIXED | (wd & S5X0_SR0_RD) |
(((1u << (chan_num + 1)) - 1) << (S5X0_SR0_V_PORTS - (chan_num + 1))); (((1u << (chan_num + 1)) - 1) << (S5X0_SR0_V_PORTS - (chan_num + 1)));

View file

@ -477,8 +477,7 @@ switch (st) {
case MTSE_FMT: /* illegal fmt */ case MTSE_FMT: /* illegal fmt */
case MTSE_UNATT: /* not attached */ case MTSE_UNATT: /* not attached */
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
chan_set_chf (mt_dib.dva, CHF_XMME); /* set err */ chan_set_chf (mt_dib.dva, CHF_XMME); /* set err, fall through */
/* fall through */
case MTSE_OK: /* no error */ case MTSE_OK: /* no error */
chan_uen (mt_dib.dva); /* uend */ chan_uen (mt_dib.dva); /* uend */
return SCPE_IERR; return SCPE_IERR;

View file

@ -1,6 +1,6 @@
/* sigma_pt.c: Sigma 7060 paper tape reader/punch /* sigma_pt.c: Sigma 7060 paper tape reader/punch
Copyright (c) 2007-2008, Robert M. Supnik Copyright (c) 2007-2018, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
@ -24,6 +24,8 @@
in this Software without prior written authorization from Robert M Supnik. in this Software without prior written authorization from Robert M Supnik.
pt 7060 paper-tape reader/punch pt 7060 paper-tape reader/punch
02-Jun-2018 RMS Defanged clang signed/unsigned whining (Mark Pizzolato)
*/ */
#include "sigma_io_defs.h" #include "sigma_io_defs.h"
@ -158,7 +160,7 @@ return 0;
t_stat pt_svc (UNIT *uptr) t_stat pt_svc (UNIT *uptr)
{ {
int32 c; int32 c;
uint32 cmd; uint32 uc, cmd;
uint32 st; uint32 st;
switch (pt_cmd) { /* case on state */ switch (pt_cmd) { /* case on state */
@ -186,7 +188,7 @@ switch (pt_cmd) { /* case on state */
break; break;
} }
else { /* real error */ else { /* real error */
sim_perror ("PTR I/O error"); perror ("PTR I/O error");
clearerr (uptr->fileref); clearerr (uptr->fileref);
chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */ chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */
return pt_chan_err (SCPE_IOERR); /* force uend */ return pt_chan_err (SCPE_IOERR); /* force uend */
@ -196,7 +198,7 @@ switch (pt_cmd) { /* case on state */
if (c != 0) /* leader done? */ if (c != 0) /* leader done? */
ptr_nzc = 1; /* set flag */ ptr_nzc = 1; /* set flag */
if ((pt_cmd == PTS_READI) || ptr_nzc) { if ((pt_cmd == PTS_READI) || ptr_nzc) {
st = chan_WrMemB (pt_dib.dva, c); /* write to memory */ st = chan_WrMemB (pt_dib.dva, ((uint32) c));/* write to memory */
if (CHS_IFERR (st)) /* channel error? */ if (CHS_IFERR (st)) /* channel error? */
return pt_chan_err (st); return pt_chan_err (st);
if (st == CHS_ZBC) /* bc == 0? */ if (st == CHS_ZBC) /* bc == 0? */
@ -208,11 +210,11 @@ switch (pt_cmd) { /* case on state */
sim_activate (uptr, pt_unit[PTP].wait); /* continue thread */ sim_activate (uptr, pt_unit[PTP].wait); /* continue thread */
if ((pt_unit[PTP].flags & UNIT_ATT) == 0) /* not attached? */ if ((pt_unit[PTP].flags & UNIT_ATT) == 0) /* not attached? */
return ptp_stopioe? SCPE_UNATT: SCPE_OK; return ptp_stopioe? SCPE_UNATT: SCPE_OK;
st = chan_RdMemB (pt_dib.dva, (uint32 *)&c); /* read from channel */ st = chan_RdMemB (pt_dib.dva, &uc); /* read from channel */
if (CHS_IFERR (st)) /* channel error? */ if (CHS_IFERR (st)) /* channel error? */
return pt_chan_err (st); return pt_chan_err (st);
if (putc (c, pt_unit[PTP].fileref) == EOF) { if (putc (((int32) uc), pt_unit[PTP].fileref) == EOF) {
sim_perror ("PTP I/O error"); perror ("PTP I/O error");
clearerr (pt_unit[PTP].fileref); clearerr (pt_unit[PTP].fileref);
chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */ chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */
return pt_chan_err (SCPE_IOERR); /* force uend */ return pt_chan_err (SCPE_IOERR); /* force uend */

View file

@ -1,6 +1,6 @@
/* sigma_tt.c: Sigma 7012 console teletype /* sigma_tt.c: Sigma 7012 console teletype
Copyright (c) 2007-2008, Robert M. Supnik Copyright (c) 2007-2018, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
@ -30,6 +30,8 @@
CR input, mapped to NEWLINE and echoes CR-LF CR input, mapped to NEWLINE and echoes CR-LF
^H input, mapped to EOM and not echoed ^H input, mapped to EOM and not echoed
HT input or output, simulates tabbing with fixed 8 character stops HT input or output, simulates tabbing with fixed 8 character stops
02-Jun-2018 RMS Defanged clang signed/unsigned whining (Mark Pizzolato)
*/ */
#include "sigma_io_defs.h" #include "sigma_io_defs.h"
@ -214,8 +216,8 @@ return SCPE_OK;
t_stat tto_svc (UNIT *uptr) t_stat tto_svc (UNIT *uptr)
{ {
uint32 c, cmd; int32 c;
uint32 st; uint32 uc, cmd, st;
switch (tt_cmd) { /* case on state */ switch (tt_cmd) { /* case on state */
@ -231,10 +233,10 @@ switch (tt_cmd) { /* case on state */
break; break;
case TTS_WRITE: /* char output */ case TTS_WRITE: /* char output */
st = chan_RdMemB (tt_dib.dva, &c); /* get char */ st = chan_RdMemB (tt_dib.dva, &uc); /* get char */
if (CHS_IFERR (st)) /* channel error? */ if (CHS_IFERR (st)) /* channel error? */
return tt_chan_err (st); return tt_chan_err (st);
c = ebcdic_to_ascii[c & 0xFF]; /* convert to ASCII */ c = ebcdic_to_ascii[uc & 0xFF]; /* convert to ASCII */
tto_echo (c); /* echo character */ tto_echo (c); /* echo character */
sim_activate (uptr, uptr->wait); /* continue thread */ sim_activate (uptr, uptr->wait); /* continue thread */
if (st == CHS_ZBC) /* st = zbc? */ if (st == CHS_ZBC) /* st = zbc? */