diff --git a/I7000/i7000_chan.c b/I7000/i7000_chan.c index 9436af1f..aa1de25a 100644 --- a/I7000/i7000_chan.c +++ b/I7000/i7000_chan.c @@ -184,6 +184,8 @@ set_chan(UNIT * uptr, int32 val, CONST char *cptr, void *desc) return SCPE_IERR; chan = UNIT_G_CHAN(uptr->flags); + if (chan >= NUM_CHAN) + chan = 0; dibp = (DIB *) dptr->ctxt; if (dibp == NULL) diff --git a/I7000/i7000_com.c b/I7000/i7000_com.c index a05811f3..26d481a3 100644 --- a/I7000/i7000_com.c +++ b/I7000/i7000_com.c @@ -514,7 +514,7 @@ t_stat com_svc(UNIT * uptr) /* Grab next entry. */ in_head++; /* Wrap around end of ring */ - if (in_head >= (sizeof(in_buff)/sizeof(uint16))) + if (in_head >= (int)((sizeof(in_buff)/sizeof(uint16)))) in_head = 0; com_data = in_buff[in_head]; /* Check if end of current transfer */ @@ -1097,7 +1097,7 @@ com_post_eom() sim_debug(DEBUG_EXP, &com_dev, "inserting eom %d %d %d\n", in_head, in_tail, in_count); ent = in_tail + 1; - if (ent >= (sizeof(in_buff)/sizeof(uint16))) /* Wrap around */ + if (ent >= (int)((sizeof(in_buff)/sizeof(uint16)))) /* Wrap around */ ent = 0; if (ent != in_head) { /* If next element would be head, queue is full */ /* If we can't put one on, handler will do it for us */ @@ -1120,12 +1120,12 @@ com_inp_msg(uint32 ln, uint16 msg) sim_debug(DEBUG_EXP, &com_dev, "inserting %d %04o %d %d %d\n", ln, msg, in_head, in_tail, in_count); ent1 = in_tail + 1; - if (ent1 >= (sizeof(in_buff)/sizeof(uint16))) /* Wrap around */ + if (ent1 >= (int)((sizeof(in_buff)/sizeof(uint16)))) /* Wrap around */ ent1 = 0; if (ent1 == in_head) /* If next element would be head, queue is full */ return TRUE; ent2 = ent1 + 1; - if (ent2 >= (sizeof(in_buff)/sizeof(uint16))) /* Wrap around */ + if (ent2 >= (int)((sizeof(in_buff)/sizeof(uint16)))) /* Wrap around */ ent2 = 0; if (ent2 == in_head) /* If next element would be head, queue is full */ return TRUE; diff --git a/I7000/i7000_defs.h b/I7000/i7000_defs.h index a5293ebf..f74a1bd8 100644 --- a/I7000/i7000_defs.h +++ b/I7000/i7000_defs.h @@ -253,7 +253,7 @@ extern DEBTAB crd_debug[]; #define UNIT_V_CHAN (UNIT_V_SELECT + 1) /* 10 */ #define UNIT_CHAN (017 << UNIT_V_CHAN) /* 10-14 */ #define UNIT_S_CHAN(x) (UNIT_CHAN & ((x) << UNIT_V_CHAN)) -#define UNIT_G_CHAN(x) ((UNIT_CHAN & (x)) >> UNIT_V_CHAN) +#define UNIT_G_CHAN(x) ((int)((UNIT_CHAN & (x)) >> UNIT_V_CHAN)) #define UNIT_V_LOCAL (UNIT_V_UF + 0) /* 0 */ #define DEV_BUF_NUM(x) (((x) & 07) << DEV_V_UF) #define GET_DEV_BUF(x) (((x) >> DEV_V_UF) & 07) @@ -272,9 +272,9 @@ extern DEBTAB crd_debug[]; /* I/O routine functions */ /* Channel half of controls */ /* Channel status */ -extern uint32 chan_flags[NUM_CHAN]; /* Channel flags */ -extern const char *chname[11]; /* Channel names */ -extern int num_devs[NUM_CHAN]; /* Number devices per channel*/ +extern uint32 chan_flags[NUM_CHAN]; /* Channel flags */ +extern const char *chname[11]; /* Channel names */ +extern int num_devs[NUM_CHAN]; /* Number devices per channel*/ extern uint8 lpr_chan9[NUM_CHAN]; #ifdef I7010 extern uint8 lpr_chan12[NUM_CHAN]; diff --git a/I7000/i7000_dsk.c b/I7000/i7000_dsk.c index c9def519..fa7f307f 100644 --- a/I7000/i7000_dsk.c +++ b/I7000/i7000_dsk.c @@ -297,14 +297,12 @@ DEVICE dsk_dev = { uint32 dsk_cmd(UNIT * uptr, uint16 cmd, uint16 dev) { - int chan; int u = (uptr->u3 >> 8) & 0xf; - UNIT *base = &dsk_unit[u]; + int chan = UNIT_G_CHAN(dsk_unit[u].flags); +#ifdef I7010 int sel; - chan = UNIT_G_CHAN(dsk_unit[u].flags); - sel = (base->flags & UNIT_SELECT) ? 1 : 0; -#ifdef I7010 + sel = (dsk_unit[u].flags & UNIT_SELECT) ? 1 : 0; if (cmd & 0x100) sense[(chan * 2) + sel] |= STAT_SIXBIT; else diff --git a/I7000/i7000_lpr.c b/I7000/i7000_lpr.c index 21f7879e..01d281c3 100644 --- a/I7000/i7000_lpr.c +++ b/I7000/i7000_lpr.c @@ -134,7 +134,7 @@ lpr_setlpp(UNIT *uptr, int32 val, CONST char *cptr, void *desc) } if (i < 20 || i > 100) return SCPE_ARG; - uptr->capac = i; + uptr->u6 = i; uptr->u4 = 0; return SCPE_OK; } @@ -144,7 +144,7 @@ lpr_getlpp(FILE *st, UNIT *uptr, int32 v, CONST void *desc) { if (uptr == NULL) return SCPE_IERR; - fprintf(st, "linesperpage=%d", uptr->capac); + fprintf(st, "linesperpage=%d", uptr->u6); return SCPE_OK; } @@ -185,7 +185,7 @@ print_line(UNIT * uptr, int chan, int unit) case 1: case 9: if (uptr->u4 == 1) break; - i = uptr->capac - uptr->u4 + 1; break; + i = uptr->u6 - uptr->u4 + 1; break; } if (i == 0) break; @@ -231,7 +231,7 @@ print_line(UNIT * uptr, int chan, int unit) sim_putchar(out[j++]); } uptr->u4++; - if (uptr->u4 > (int32)uptr->capac) { + if (uptr->u4 > (int32)uptr->u6) { uptr->u4 = 1; } @@ -255,7 +255,7 @@ print_line(UNIT * uptr, int chan, int unit) sim_putchar('\n'); } uptr->u4++; - if (uptr->u4 > (int32)uptr->capac) { + if (uptr->u4 > (int32)uptr->u6) { uptr->u4 = 1; } } @@ -266,7 +266,7 @@ print_line(UNIT * uptr, int chan, int unit) if (uptr->u4 == 1) lpr_chan9[chan] = 1; #ifdef I7010 - if (uptr->u4 == uptr->capac) + if (uptr->u4 == uptr->u6) lpr_chan12[chan] = 1; #endif @@ -356,8 +356,8 @@ uint32 lpr_cmd(UNIT * uptr, uint16 cmd, uint16 dev) case 1: case 9: if (uptr->u4 == 1) break; - i = uptr->capac - uptr->u4 + 1; break; - case 12: i = (uptr->capac/2) - uptr->u4; break; + i = uptr->u6 - uptr->u4 + 1; break; + case 12: i = (uptr->u6/2) - uptr->u4; break; } if (i == 0) break; @@ -377,7 +377,7 @@ uint32 lpr_cmd(UNIT * uptr, uint16 cmd, uint16 dev) } break; } - if (uptr->u4 == uptr->capac) + if (uptr->u4 == uptr->u6) lpr_chan12[chan] = 1; #endif if (uptr->u4 == 1) diff --git a/I7000/i7000_mt.c b/I7000/i7000_mt.c index fa4ab9e9..62bbc3b4 100644 --- a/I7000/i7000_mt.c +++ b/I7000/i7000_mt.c @@ -849,7 +849,7 @@ t_stat mt_srv(UNIT * uptr) return mt_error(uptr, chan, MTSE_TMK, dptr); } /* If at end of record, fill buffer */ - if (uptr->u6 == uptr->hwmark) { + if (uptr->u6 == (int32)uptr->hwmark) { sim_debug(DEBUG_DETAIL, dptr, "Read unit=%d ", unit); uptr->u3 += GAP_LEN; if ((r = sim_tape_rdrecf(uptr, &mt_buffer[bufnum][0], &reclen, @@ -1044,7 +1044,7 @@ t_stat mt_srv(UNIT * uptr) return mt_error(uptr, chan, MTSE_TMK, dptr); } /* If at end of record, fill buffer */ - if (uptr->u6 == uptr->hwmark) { + if (uptr->u6 == (int32)uptr->hwmark) { sim_debug(DEBUG_DETAIL, dptr, "Read unit=%d ", unit); if ((r = sim_tape_rdrecr(uptr, &mt_buffer[bufnum][0], &reclen, BUFFSIZE)) != MTSE_OK) { diff --git a/I7000/i7010_cpu.c b/I7000/i7010_cpu.c index 3739fef6..6cb37822 100644 --- a/I7000/i7010_cpu.c +++ b/I7000/i7010_cpu.c @@ -562,12 +562,12 @@ sim_instr(void) t_stat reason; uint16 t; int temp; - int32 STAR; + int32 STAR = 0; uint8 op, op_info; int state; - uint8 ix; + uint8 ix = 0; uint8 br; - uint8 ar; + uint8 ar = 0; int sign, qsign; uint8 ch; int cy; @@ -3759,9 +3759,7 @@ do_divide() t_stat rtc_srv(UNIT * uptr) { - int32 t; - - t = sim_rtcn_calb (rtc_tps, TMR_RTC); + (void)sim_rtcn_calb (rtc_tps, TMR_RTC); sim_activate_after(uptr, 1000000/rtc_tps); if (timer_enable) { diff --git a/I7000/i7010_defs.h b/I7000/i7010_defs.h index 231935c9..147812ca 100644 --- a/I7000/i7010_defs.h +++ b/I7000/i7010_defs.h @@ -28,7 +28,7 @@ /* Memory */ #define AMASK 0x1ffff #define BBIT 0x80000000 -#define MEM_ADDR_OK(x) ((uint32)(x & AMASK) < MEMSIZE) +#define MEM_ADDR_OK(x) ((uint32)((x) & AMASK) < MEMSIZE) extern uint8 M[MAXMEMSIZE]; #define WM 0200 /* Word mark in memory */ diff --git a/I7000/i701_chan.c b/I7000/i701_chan.c index 9eafb9fc..9e4f4a59 100644 --- a/I7000/i701_chan.c +++ b/I7000/i701_chan.c @@ -151,7 +151,7 @@ int chan_cmd(uint16 dev, uint16 dcmd) { UNIT *uptr; - uint32 chan; + int32 chan; DEVICE **dptr; DIB *dibp; int j; diff --git a/I7000/i701_sys.c b/I7000/i701_sys.c index 0b3eb24c..2845ea75 100644 --- a/I7000/i701_sys.c +++ b/I7000/i701_sys.c @@ -398,7 +398,6 @@ t_stat parse_sym(CONST char *cptr, t_addr addr, UNIT * uptr, t_value * val, int32 sw) { int i; - int f; t_value d; t_addr tag; int sign; @@ -413,7 +412,6 @@ parse_sym(CONST char *cptr, t_addr addr, UNIT * uptr, t_value * val, int32 sw) i = 0; sign = 0; - f = 0; next: /* Skip blanks */ while (isspace(*cptr)) diff --git a/I7000/i7070_cpu.c b/I7000/i7070_cpu.c index 2ae5114c..da09ef8b 100644 --- a/I7000/i7070_cpu.c +++ b/I7000/i7070_cpu.c @@ -290,7 +290,7 @@ sim_instr(void) uint8 op2 = 0; int iowait = 0; /* Wait for IO to start */ int chwait = 0; /* Wait for channel to be inactive */ - int sign; + uint8 sign; int instr_count = 0; /* Number of instructions to execute */ if (sim_step != 0) { @@ -560,7 +560,7 @@ sim_instr(void) temp &= ldmask[f2-f1+1]; /* Compute final sign */ if ((opcode & 0x10f) == (OP_AAS1 & 0x10f)) { - sign = utmp; + sign = (uint8)(utmp & 0xf); } else if (sign & 0xc) { sign = ASIGN >> 40; } else if (sign & 2) { @@ -679,7 +679,7 @@ sim_instr(void) case OP_M: /* Multiplicand in AC[3] */ AC[1] = AC[2] = 0; - sign = (MBR & SMASK) >> 40; + sign = (uint8)(((MBR & SMASK) >> 40) & 0xf); MBR = (rdmask[f1] & MBR) >> ((9 - f2) * 4); sign = (((AC[3] & SMASK) >> 40) != sign) ? 6 : 9; /* Multiply MBR * AC[3] result to AC[1],AC[2] */ @@ -714,7 +714,7 @@ sim_instr(void) case OP_D: /* dividend AC[1],AC[2] */ /* divisor in MBR */ - sign = (MBR & SMASK) >> 40; + sign = (uint8)(((MBR & SMASK) >> 40) & 0xf); AC[3] = (rdmask[f1] & MBR) >> ((9 - f2) * 4); if (AC[3] == 0) { AC[3] |= ((t_uint64)sign) << 40; @@ -1536,7 +1536,7 @@ sim_instr(void) hst[hst_p].before = MBR; } temp = dec_bin_idx(MBR); - sign = ((MBR & SMASK)>> 40); + sign = (uint8)(((MBR & SMASK)>> 40) & 0xf); MBR &= DMASK; switch(sign) { case 0x6: /* + - tc b add */ @@ -1567,7 +1567,7 @@ sim_instr(void) } temp = 0; upd_idx(&temp, MA); - sign = ((MBR & SMASK)>> 40); + sign = (uint8)(((MBR & SMASK)>> 40) & 0xf); MBR &= DMASK; switch(sign) { default: diff --git a/I7000/i7080_cpu.c b/I7000/i7080_cpu.c index c8702c23..3feb9060 100644 --- a/I7000/i7080_cpu.c +++ b/I7000/i7080_cpu.c @@ -218,7 +218,7 @@ uint16 stop_flags = 0; /* Stop on error */ uint16 selreg; /* Last select address */ uint16 selreg2; /* RWW select address */ int chwait; /* Channel wait register */ -uint8 ioflags[5000/8] = {0}; /* IO Error flags */ +uint8 ioflags[6200/8] = {0}; /* IO Error flags */ uint16 irqflags; /* IRQ Flags */ uint8 lpr_chan9[NUM_CHAN]; /* Line printer Channel 9 flag */ uint8 bkcmp = 0; /* Backwords compare */ diff --git a/I7000/i7080_sys.c b/I7000/i7080_sys.c index 4e0c8cea..e33ff3a9 100644 --- a/I7000/i7080_sys.c +++ b/I7000/i7080_sys.c @@ -273,7 +273,6 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) } return SCPE_OK; } else if (match_ext(fnam, "dck")) { - extern char ascii_to_six[128]; while (fgets(buffer, 160, fileref) != 0) { uint8 image[80]; /* Convert bits into image */ @@ -599,7 +598,6 @@ parse_sym(CONST char *cptr, t_addr addr, UNIT * uptr, t_value * val, int32 sw) int i; t_value d; char buffer[100]; - extern char ascii_to_six[]; while (isspace(*cptr)) cptr++; diff --git a/I7000/i7090_chan.c b/I7000/i7090_chan.c index c1daac6a..c2ef53cd 100644 --- a/I7000/i7090_chan.c +++ b/I7000/i7090_chan.c @@ -79,7 +79,7 @@ uint8 cmd[NUM_CHAN]; /* Current command */ uint16 wcount[NUM_CHAN]; /* Word count */ t_uint64 assembly[NUM_CHAN]; /* Assembly register */ uint16 location[NUM_CHAN]; /* Pointer to next opcode */ -uint32 chan_flags[NUM_CHAN]; /* Unit status */ +uint32 chan_flags[NUM_CHAN]; /* Unit status */ uint16 chan_info[NUM_CHAN]; /* Private channel info */ uint8 counter[NUM_CHAN]; /* Channel counter */ uint8 sms[NUM_CHAN]; /* Channel mode infomation */ @@ -329,7 +329,9 @@ void chan_proc() { int chan; +#ifdef I7090 int cmask; +#endif /* Scan channels looking for work */ for (chan = 0; chan < NUM_CHAN; chan++) { @@ -341,7 +343,9 @@ chan_proc() if (chan_flags[chan] & DEV_DISCO) continue; +#ifdef I7090 cmask = 0x0100 << chan; +#endif switch (CHAN_G_TYPE(chan_unit[chan].flags)) { case CHAN_PIO: if ((chan_flags[chan] & (DEV_REOR|DEV_SEL|DEV_FULL)) == @@ -810,8 +814,7 @@ chan_proc() uptr = (*dptr)->units; for (j = 0; j < num; j++, uptr++) { if ((uptr->flags & UNIT_DIS) == 0 && - UNIT_G_CHAN(uptr->flags) == - (unsigned int)chan && + UNIT_G_CHAN(uptr->flags) == chan && (sms[chan] & 1) == ((UNIT_SELECT & uptr->flags) != 0)) { goto found; @@ -1243,7 +1246,7 @@ int chan_cmd(uint16 dev, uint16 dcmd) { UNIT *uptr; - uint32 chan; + int32 chan; DEVICE **dptr; DIB *dibp; int j; diff --git a/I7000/i7090_cpu.c b/I7000/i7090_cpu.c index 60f27d2b..0a29c67b 100644 --- a/I7000/i7090_cpu.c +++ b/I7000/i7090_cpu.c @@ -723,7 +723,7 @@ sim_instr(void) uint16 decr; uint16 xr; uint16 opinfo; - int fptemp, fptemp2; + int fptemp = 0, fptemp2; uint8 f; uint16 tbase; int xeccnt = 15; @@ -4198,8 +4198,7 @@ t_stat rtc_srv(UNIT * uptr) { if (cpu_unit.flags & OPTION_TIMER) { - int32 t; - t = sim_rtcn_calb (rtc_tps, TMR_RTC); + (void)sim_rtcn_calb (rtc_tps, TMR_RTC); sim_activate_after(uptr, 1000000/rtc_tps); M[5] += 1; if (M[5] & MSIGN) diff --git a/I7000/i7090_drum.c b/I7000/i7090_drum.c index 3af9d85b..9385b103 100644 --- a/I7000/i7090_drum.c +++ b/I7000/i7090_drum.c @@ -262,10 +262,6 @@ drm_detach(UNIT * uptr) t_stat drm_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr) { - const char *cpu = cpu_description(&cpu_dev); - DIB *dibp = (DIB *) dptr->ctxt; - int ctype = dibp->ctype; - fprintf (st, "%s\n\n", drm_description(dptr)); fprintf (st, "Up to %d units of drum could be used\n", NUM_UNITS_DR); fprintf (st, " sim> set %s UNITS=n to set number of units\n", dptr->name); diff --git a/I7000/i7090_lpr.c b/I7000/i7090_lpr.c index aebc75b4..f614aa5b 100644 --- a/I7000/i7090_lpr.c +++ b/I7000/i7090_lpr.c @@ -168,7 +168,6 @@ print_line(UNIT * uptr, int chan, int unit) uint16 buff[80]; /* Temp conversion buffer */ int i, j; int outsel = uptr->u3; - int prt_flg = 1; if ((uptr->flags & (UNIT_ATT | ECHO)) == 0) return SCPE_UNATT; /* attached? */ @@ -670,8 +669,6 @@ lpr_attach(UNIT * uptr, CONST char *file) t_stat lpr_detach(UNIT * uptr) { - int u = (uptr - lpr_unit); - return detach_unit(uptr); }