diff --git a/doc/sigma_doc.doc b/doc/sigma_doc.doc new file mode 100644 index 00000000..40f24e77 Binary files /dev/null and b/doc/sigma_doc.doc differ diff --git a/sigma/sigma_cis.c b/sigma/sigma_cis.c index 112bc4ed..623e163b 100644 --- a/sigma/sigma_cis.c +++ b/sigma/sigma_cis.c @@ -1,6 +1,6 @@ /* 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 copy of this software and associated documentation files (the "Software"), @@ -26,6 +26,8 @@ Questions: 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" @@ -100,7 +102,7 @@ uint32 cis_dec (uint32 op, uint32 lnt, uint32 bva) { dstr_t src1, src2, src2x, dst; uint32 i, t, kint, ldivr, ldivd, ad, c, d, end; -int32 sc; +int32 sc, scmp; uint32 tr; if (lnt == 0) /* adjust length */ @@ -163,10 +165,10 @@ switch (op) { /* case on opcode */ if (src1.sign ^ src2.sign) /* signs differ? */ CC = src1.sign? CC4: CC3; /* set < or > */ else { /* same signs */ - int32 t = CmpDstr (&src1, &src2); /* compare strings */ - if (t < 0) + scmp = CmpDstr (&src1, &src2); /* compare strings */ + if (scmp < 0) CC = (src1.sign? CC3: CC4); - else if (t > 0) + else if (scmp > 0) CC = (src1.sign? CC4: CC3); else CC = 0; } @@ -720,11 +722,11 @@ return cy; void SubDstr (dstr_t *s1, dstr_t *s2, dstr_t *ds) { uint32 i; -dstr_t Compl; +dstr_t complm; for (i = 0; i < DSTRLNT; i++) /* 9's comp s2 */ - Compl.val[i] = 0x99999999 - s1->val[i]; -AddDstr (&Compl, s2, ds, 1); /* s1 + ~s2 + 1 */ + complm.val[i] = 0x99999999 - s1->val[i]; +AddDstr (&complm, s2, ds, 1); /* s1 + ~s2 + 1 */ return; } diff --git a/sigma/sigma_cpu.c b/sigma/sigma_cpu.c index 2ba09efa..87903d96 100644 --- a/sigma/sigma_cpu.c +++ b/sigma/sigma_cpu.c @@ -248,7 +248,7 @@ extern uint32 io_tio (uint32 rn, uint32 bva); extern uint32 io_tdv (uint32 rn, uint32 bva); extern uint32 io_hio (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_sclr_req (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 && sim_brk_test (PC, SWMASK ('E'))) { /* breakpoint? */ reason = STOP_IBKPT; /* stop simulation */ - sim_interval++; /* don't count non-executed instruction */ break; } if (PSW_QRX9 && (PC & PSW1_XA)) /* S9 real ext && ext? */ @@ -1124,7 +1123,7 @@ switch (op) { res = R[rn] | opnd; CC34_W (res); /* set CC's */ R[rn] = res; /* store */ - break; + break; case OP_EOR: /* xor */ if ((tr = Ea (IR, &bva, VR, WD)) != 0) /* get eff addr */ @@ -1134,7 +1133,7 @@ switch (op) { res = R[rn] ^ opnd; CC34_W (res); /* set CC's */ R[rn] = res; /* store */ - break; + break; /* Compares */ @@ -2705,7 +2704,7 @@ return SCPE_OK; t_stat cpu_show_addr (FILE *of, UNIT *uptr, int32 val, CONST void *desc) { t_stat r; -CONST char *cptr = (CONST char *) desc; +char *cptr = (char *) desc; uint32 ad, bpa, dlnt, virt; static const char *lnt_str[] = { "byte", @@ -2825,7 +2824,7 @@ t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc) { int32 k, di, lnt; t_stat r; -CONST char *cptr = (CONST char *) desc; +char *cptr = (char *) desc; InstHistory *h; if (hst_lnt == 0) /* enabled? */ diff --git a/sigma/sigma_defs.h b/sigma/sigma_defs.h index db50f14b..e2f85d3b 100644 --- a/sigma/sigma_defs.h +++ b/sigma/sigma_defs.h @@ -34,10 +34,6 @@ #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) #error "Sigma 32b does not support 64b values!" #endif diff --git a/sigma/sigma_doc.doc b/sigma/sigma_doc.doc deleted file mode 100644 index 0cfb805c..00000000 Binary files a/sigma/sigma_doc.doc and /dev/null differ diff --git a/sigma/sigma_dp.c b/sigma/sigma_dp.c index 1a3a4187..e493e58c 100644 --- a/sigma/sigma_dp.c +++ b/sigma/sigma_dp.c @@ -261,7 +261,7 @@ typedef struct { uint32 tpos; /* to position */ } DP_SNSTAB; -static char *dp_cname[] = { +static const char *dp_cname[] = { "7240", "7270", "7260", "7275", "7265", "T3281" }; @@ -1113,7 +1113,7 @@ t_stat dp_ioerr (UNIT *uptr) uint32 cidx = uptr->UCTX; uint32 dva = dp_dib[cidx].dva; -sim_perror ("DP I/O error"); +perror ("DP I/O error"); clearerr (uptr->fileref); dp_ctx[cidx].dp_flags |= DPF_DPE; /* set DPE flag */ chan_set_chf (dva, CHF_XMDE); diff --git a/sigma/sigma_lp.c b/sigma/sigma_lp.c index 9d96f9f0..6d579adc 100644 --- a/sigma/sigma_lp.c +++ b/sigma/sigma_lp.c @@ -356,7 +356,7 @@ if (skp && CHP (CH_TOF, lp_cct[lp_cctp])) /* skip, TOF? */ } uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - sim_perror ("Line printer I/O error"); + perror ("Line printer I/O error"); clearerr (uptr->fileref); chan_set_chf (lp_dib.dva, CHF_XMDE); 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 */ uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ - sim_perror ("Line printer I/O error"); + perror ("Line printer I/O error"); clearerr (uptr->fileref); chan_set_chf (lp_dib.dva, CHF_XMDE); return SCPE_IOERR; diff --git a/sigma/sigma_map.c b/sigma/sigma_map.c index cbd72b42..450e8f6c 100644 --- a/sigma/sigma_map.c +++ b/sigma/sigma_map.c @@ -529,8 +529,7 @@ if (QCPU_S89) ((R[rn] & S89_SR1_MARG) >> S89_SR1_MAROFF); break; case 0xB: /* read sr0, clr */ - mem_sr0[memu] = mem_sr1[memu] = 0; - /* fall through */ + mem_sr0[memu] = mem_sr1[memu] = 0; /* fall through */ case 0x8: /* read sr0 */ R[rn] = (wd & S89_SR0_RD) | (((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; break; case 0xC: /* read sr0, clr */ - mem_sr0[memu] = 0; /* clr */ - /* fall through */ + mem_sr0[memu] = 0; /* clr, fall through */ case 0x8: /* read sr0 */ R[rn] = S5X0_SR0_FIXED | (wd & S5X0_SR0_RD) | (((1u << (chan_num + 1)) - 1) << (S5X0_SR0_V_PORTS - (chan_num + 1))); diff --git a/sigma/sigma_mt.c b/sigma/sigma_mt.c index df153f3c..5dfa33c1 100644 --- a/sigma/sigma_mt.c +++ b/sigma/sigma_mt.c @@ -477,8 +477,7 @@ switch (st) { case MTSE_FMT: /* illegal fmt */ case MTSE_UNATT: /* not attached */ case MTSE_WRP: /* write protect */ - chan_set_chf (mt_dib.dva, CHF_XMME); /* set err */ - /* fall through */ + chan_set_chf (mt_dib.dva, CHF_XMME); /* set err, fall through */ case MTSE_OK: /* no error */ chan_uen (mt_dib.dva); /* uend */ return SCPE_IERR; @@ -647,4 +646,4 @@ if (!(uptr->flags & UNIT_ATTABLE)) uptr->UST = 0; sim_cancel (uptr + MT_REW); return sim_tape_detach (uptr); -} +} \ No newline at end of file diff --git a/sigma/sigma_pt.c b/sigma/sigma_pt.c index 9b6a6342..cbda3052 100644 --- a/sigma/sigma_pt.c +++ b/sigma/sigma_pt.c @@ -1,6 +1,6 @@ /* 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 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. pt 7060 paper-tape reader/punch + + 02-Jun-2018 RMS Defanged clang signed/unsigned whining (Mark Pizzolato) */ #include "sigma_io_defs.h" @@ -158,7 +160,7 @@ return 0; t_stat pt_svc (UNIT *uptr) { int32 c; -uint32 cmd; +uint32 uc, cmd; uint32 st; switch (pt_cmd) { /* case on state */ @@ -186,7 +188,7 @@ switch (pt_cmd) { /* case on state */ break; } else { /* real error */ - sim_perror ("PTR I/O error"); + perror ("PTR I/O error"); clearerr (uptr->fileref); chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */ return pt_chan_err (SCPE_IOERR); /* force uend */ @@ -196,7 +198,7 @@ switch (pt_cmd) { /* case on state */ if (c != 0) /* leader done? */ ptr_nzc = 1; /* set flag */ 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? */ return pt_chan_err (st); 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 */ if ((pt_unit[PTP].flags & UNIT_ATT) == 0) /* not attached? */ 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? */ return pt_chan_err (st); - if (putc (c, pt_unit[PTP].fileref) == EOF) { - sim_perror ("PTP I/O error"); + if (putc (((int32) uc), pt_unit[PTP].fileref) == EOF) { + perror ("PTP I/O error"); clearerr (pt_unit[PTP].fileref); chan_set_chf (pt_dib.dva, CHF_XMDE); /* data error */ return pt_chan_err (SCPE_IOERR); /* force uend */ diff --git a/sigma/sigma_tt.c b/sigma/sigma_tt.c index f595e02e..1c357d2a 100644 --- a/sigma/sigma_tt.c +++ b/sigma/sigma_tt.c @@ -1,6 +1,6 @@ /* 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 copy of this software and associated documentation files (the "Software"), @@ -30,6 +30,8 @@ CR input, mapped to NEWLINE and echoes CR-LF ^H input, mapped to EOM and not echoed 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" @@ -214,8 +216,8 @@ return SCPE_OK; t_stat tto_svc (UNIT *uptr) { -uint32 c, cmd; -uint32 st; +int32 c; +uint32 uc, cmd, st; switch (tt_cmd) { /* case on state */ @@ -231,10 +233,10 @@ switch (tt_cmd) { /* case on state */ break; 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? */ 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 */ sim_activate (uptr, uptr->wait); /* continue thread */ if (st == CHS_ZBC) /* st = zbc? */