1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-22 10:31:12 +00:00

I7000: Fixed various coverity errors.

This commit is contained in:
Richard Cornwell 2017-04-30 11:42:14 -04:00
parent 4f42dd9c80
commit 374e88fbbc
10 changed files with 41 additions and 38 deletions

View File

@ -127,7 +127,7 @@ chan_set_devs(DEVICE * dptr)
}
/* Print help for "SET dev CHAN" based on allowed types */
void help_set_chan_type(FILE *st, DEVICE *dptr, char *name)
void help_set_chan_type(FILE *st, DEVICE *dptr, char *name)
{
#if NUM_CHAN > 1
DIB *dibp = (DIB *) dptr->ctxt;
@ -143,8 +143,8 @@ void help_set_chan_type(FILE *st, DEVICE *dptr, char *name)
fprintf (st, " %s", chname[0]);
if ((ctype & ~3) != 0)
fprintf(st, " or");
}
if ((ctype & ~3) != 0)
}
if ((ctype & ~3) != 0)
fprintf(st, " %s to %s", chname[1], chname[NUM_CHAN-1]);
fprintf (st, "\n%s can be attached to ", name);
m = 1;

View File

@ -445,7 +445,7 @@ t_stat com_svc(UNIT * uptr)
if (chan_test(chan, CTL_SNS)) {
int eor = (com_sta == 4)?DEV_REOR:0;
ch = (com_sense >> ((4 - com_sta) * 4)) & 0xf;
ch = (com_sense >> ((4 - (uint32)com_sta) * 4)) & 0xf;
if (ch & 010) /* Move A bit over one */
ch ^= 030;
sim_debug(DEBUG_SNS, &com_dev, "sense unit=%02x\n", ch);

View File

@ -63,7 +63,7 @@ extern uint8 M[];
/* Not yet */
#endif
#ifdef I7070 /* Includes 7070, 7074 */
#define NUM_CHAN 8
#define NUM_CHAN 9
#define NUM_DEVS_CDR 1
#define NUM_DEVS_CDP 1
#define NUM_DEVS_LPR 1
@ -80,7 +80,7 @@ extern uint8 M[];
extern t_uint64 M[];
#endif
#ifdef I7080 /* Includes 702, 705-i/ii, 705-iii, 7080 */
#define NUM_CHAN 9
#define NUM_CHAN 11
#define NUM_DEVS_CDR 1
#define NUM_DEVS_CDP 1
#define NUM_DEVS_LPR 1
@ -607,7 +607,7 @@ extern DEVICE mtf_dev;
extern DEVICE cpu_dev;
extern UNIT cpu_unit;
extern DEVICE chan_dev;
extern UNIT chan_unit[];
extern UNIT chan_unit[NUM_CHAN];
extern REG cpu_reg[];
extern int cycle_time;

View File

@ -734,13 +734,13 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
case HFPN: /* File Protect On (Nop for now ) */
case HEOS: /* End of sequence */
case HNOP: /* Nop */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "NOP\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "NOP\n");
up->u5 &= ~(HT_NOTRDY | HT_CMDMSK);
chan_set(chan, DEV_REOR|CTL_END);
return;
case HRWD: /* Rewind */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "REW\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "REW\n");
if (up->u5 & HT_BOT) {
r = MTSE_OK;
up->wait = 1;
@ -754,7 +754,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
break;
case HERG: /* Erase long gap */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "ERG\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "ERG\n");
if (sim_tape_wrp(up)) {
r = MTSE_WRP;
} else {
@ -766,7 +766,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
break;
case HWTM: /* Write tape mark */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "WTM\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "WTM\n");
if (sim_tape_wrp(up)) {
r = MTSE_WRP;
} else {
@ -779,7 +779,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
break;
case HBSR: /* Backspace */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "BSR\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "BSR\n");
if (sim_tape_bot(up)) {
r = MTSE_BOT;
break;
@ -801,7 +801,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
break;
case HBSF: /* Backspace file */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "BSF\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "BSF\n");
if (sim_tape_bot(up)) {
r = MTSE_BOT;
break;
@ -825,7 +825,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
break;
case HSKR: /* Space */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "SKR\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "SKR\n");
r = sim_tape_sprecf(up, &reclen);
up->u5 |= HT_PEND|HT_NOTRDY;
uptr->u5 |= HT_NOTRDY;
@ -839,7 +839,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
break;
case HSKF: /* Space file */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "SKF\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "SKF\n");
while ((r = sim_tape_sprecf(up, &reclen)) == MTSE_OK) {
up->wait += reclen;
}
@ -858,7 +858,7 @@ ht_tape_cmd(DEVICE * dptr, UNIT * uptr)
case HRUN: /* Rewind and unload */
case HCHC: /* Change Cartridge */
case HUNL: /* Unload Cartridge */
sim_debug(DEBUG_DETAIL | DEBUG_CMD, dptr, "RUN\n");
sim_debug((DEBUG_DETAIL | DEBUG_CMD), dptr, "RUN\n");
r = sim_tape_detach(up);
chan_set(chan, DEV_REOR|CTL_END);
up->u5 |= HT_NOTRDY;

View File

@ -577,7 +577,7 @@ uint32 mt_cmd(UNIT * uptr, uint16 cmd, uint16 dev)
#if I7090 | I704 | I701
/* Read a word from tape, used during boot read */
int
mt_read_buff(UNIT * uptr, int cmd, DEVICE * dptr, t_value *word)
mt_read_buff(UNIT * uptr, int cmd, DEVICE * dptr, t_uint64 *word)
{
int chan = UNIT_G_CHAN(uptr->flags);
int bufnum = GET_DEV_BUF(dptr->flags);

View File

@ -680,7 +680,7 @@ sim_instr(void)
reason = STOP_INVADDR;
break;
}
if (op_info & (O_C|O_A)) { /* units */
if (op_info & (O_C|O_A)) /* units */
STAR += bcd_bin[br & 0xf];
if ((op_info & O_A) && (ix != 0)) {
int j, a, s;
@ -733,7 +733,7 @@ sim_instr(void)
case 8: /* Has to be B address */
state = 9;
/* hundreds */
if (op_info & (O_B|O_D))
if (op_info & (O_B|O_D)) {
STAR += dscale[1][bcd_bin[br & 0xf]];
ix = (br & 0x30) >> 2;
}
@ -3839,7 +3839,7 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
int32 k, i, di, lnt, pc;
char *cptr = (char *) desc;
t_stat r;
t_value sim_eval[15];
t_value sim_eval[50];
struct InstHistory *h;
if (hst_lnt == 0)

View File

@ -468,7 +468,7 @@ chan_trap:
chan_info[chan] &= ~(CHAN_SEOS|CHAN_FIRST);
continue;
}
if (bcnt[chan] >= 6 && chan_flags[chan] & DEV_REOR) {
if (chan_info[chan] & CHAN_SEOS) {
if (chan_dev.dctrl & cmask)
@ -510,7 +510,7 @@ chan_trap:
chan, assembly[chan]);
if (caddr[chan] < MEMSIZE)
M[caddr[chan]] = assembly[chan];
if (bcnt[chan] != 0)
chan_info[chan] |= CHAN_SCLR;
else
@ -531,7 +531,7 @@ chan_trap:
/* Check for record mark */
if ((cmd[chan] & CHN_RECORD) &&
(assembly[chan] & DMASK) == ASIGN &&
(assembly[chan] & SMASK) == ASIGN &&
(assembly[chan] & 0xFF) == RM_CHAR) {
if (cmd[chan] & CHN_LAST) {
chan_flags[chan] &= ~(STA_ACTIVE);
@ -661,7 +661,7 @@ chan_trap:
chan_flags[chan] |= STA_TWAIT|STA_WAIT;
} else
caddr[chan]++;
/* Update channel status word */
if (chan != 0 && (chan_info[chan] & CHAN_NORDW) == 0) {
int adr = 100 + (chan * 10) + (chan_info[chan]&0xf);
@ -745,7 +745,7 @@ chan_trap:
if ((chan_flags[chan] & (STA_ACTIVE|DEV_SEL|STA_TWAIT)) == 0 &&
(chan_flags[chan] & (SNS_ATTN1|SNS_ATTN2))) {
t_uint64 temp;
if (chan_dev.dctrl & cmask)
sim_debug(DEBUG_TRAP, &chan_dev, "chan %d Attn Trap\n",
chan);
@ -841,7 +841,7 @@ chan_trap:
if (caddr[chan] > limit[chan])
break;
}
/* Check if we still have a select signal */
if ((chan_flags[chan] & DEV_SEL) == 0) {
chan_info[chan] |= CHAN_TWE;
@ -858,7 +858,7 @@ chan_trap:
}
continue;
}
/* Abort if we get control end */
if (chan_flags[chan] & CTL_END) {
/* Disconnect channel if select still active */
@ -935,7 +935,7 @@ chan_trap:
break;
}
/* Check if ready to transfer something */
if (caddr[chan] <= limit[chan]) {
assembly[chan] = M[caddr[chan]];
@ -1034,7 +1034,7 @@ chan_trap:
}
continue;
}
/* Check if in other mode */
if (chan_flags[chan] & (CTL_CNTL|CTL_READ|CTL_WRITE)) {
if (chan_dev.dctrl & cmask)
@ -1114,7 +1114,7 @@ chan_trap:
/* Wait for device to grab the command */
if (chan_flags[chan] & DEV_FULL)
continue;
/* Check if device ready for next command word */
if ((chan_flags[chan] & (DEV_WRITE | DEV_FULL)) ==
DEV_WRITE) {
@ -1146,7 +1146,7 @@ chan_trap:
break;
}
/* If last all done */
if (cmd[chan] & CHN_LAST || chan_flags[chan] & (SNS_UEND)
|| chan_info[chan] & CHAN_TWE) {
@ -1247,7 +1247,7 @@ chan_cmd(uint16 dev, uint16 dcmd, uint16 addr)
chan_info[chan] |= CHAN_PRIO;
assembly[chan] = 0;
bcnt[chan] = 10;
if (CHAN_G_TYPE(chan_unit[chan].flags) == CHAN_7907) {
chan_flags[chan] |= STA_ACTIVE;
if (dev & 1)
@ -1414,7 +1414,7 @@ chan_write_char(int chan, uint8 * data, int flags)
chan_flags[chan] |= DEV_FULL|DEV_REOR;
chan_flags[chan] &= ~DEV_WRITE;
if (bcnt[chan] != 0 && ((cmd[chan] & (CHN_NUM_MODE)) == 0 ||
(cmd[chan] & (CHN_ALPHA)) != 0))
(cmd[chan] & (CHN_ALPHA)) != 0))
chan_info[chan] |= CHAN_SCLR;
chan_info[chan] |= CHAN_SEOR;
chan_proc();
@ -1543,7 +1543,7 @@ chan_read_char(int chan, uint8 * data, int flags)
ch = (assembly[chan] >> (4 * bcnt[chan])) & 0xff;
*data = mem_bcd[ch];
}
done:
if (bcnt[chan] == 0) {
chan_flags[chan] &= ~DEV_FULL;

View File

@ -771,7 +771,7 @@ chan_cmd(uint16 dev, uint16 dcmd, uint32 addr)
/* Find device on given channel and give it the command */
chan = chan_mapdev(dev);
if (chan < 0 || chan > NUM_CHAN)
if (chan < 0 || chan >= NUM_CHAN)
return SCPE_IOERR;
/* If no channel device, quick exit */
if (chan_unit[chan].flags & UNIT_DIS)
@ -1227,7 +1227,7 @@ chan_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
fprintf (st, "Channels are fixed on the 7080.\n\n");
fprintf (st, "Channel * is a puesdo channel for unit record devices.\n");
fprintf(st, "\n");
fprintf(st, "\n");
fprint_set_help(st, dptr);
fprint_show_help(st, dptr);
return SCPE_OK;

View File

@ -2989,6 +2989,7 @@ step6:
remtrig = 1;
tsac = next_addr[tsac];
}
/* Not reached */
goto step6;
step8:
smt = 0;

View File

@ -422,9 +422,11 @@ t_stat lpr_srv(UNIT * uptr)
action = 2;
break;
case 19: /* Echo 8-4 L */
/* I'm not sure how these are computed */
#if 0 /* Should be correct, but force to zero works */
wd = lpr_data[u].wbuff[3];
wd -= lpr_data[u].wbuff[11];
/* I'm not sure how these are computed */
#endif
/* But forcing to zero works */
wd = 0;
action = 3;
@ -438,12 +440,12 @@ t_stat lpr_srv(UNIT * uptr)
action = 1;
break;
case 22: /* Echo 8-3 */
/* I'm not sure how these are computed */
/* Fill for echo back */
#if 0
wd = lpr_data[u].wbuff[2];
wd -= lpr_data[u].wbuff[12];
#endif
/* I'm not sure how these are computed */
/* But forcing to zero works */
wd = 0;
action = 2;