B5500: Fixed Coverity errors, and fixed for current SCP.
This commit is contained in:
parent
14b9265af3
commit
5efbd203a3
6 changed files with 128 additions and 134 deletions
|
@ -101,7 +101,7 @@
|
|||
#define UNIT_MSIZE (7 << UNIT_V_MSIZE)
|
||||
#define MEMAMOUNT(x) (x << UNIT_V_MSIZE)
|
||||
|
||||
#define TMR_RTC 1
|
||||
#define TMR_RTC 0
|
||||
|
||||
#define HIST_MAX 5000
|
||||
#define HIST_MIN 64
|
||||
|
@ -700,10 +700,6 @@ int mkint() {
|
|||
B <<= 3;
|
||||
exp_b--;
|
||||
}
|
||||
if (exp_b != 0) {
|
||||
B = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (f && B != 0)
|
||||
B |= MSIGN;
|
||||
|
@ -3855,8 +3851,7 @@ cpu_reset(DEVICE * dptr)
|
|||
sim_brk_types = sim_brk_dflt = SWMASK('E') | SWMASK('A') | SWMASK('B');
|
||||
hst_p = 0;
|
||||
|
||||
sim_register_clock_unit (&cpu_unit[0]);
|
||||
sim_rtcn_init (cpu_unit[0].wait, TMR_RTC);
|
||||
sim_rtcn_init_unit (&cpu_unit[0], cpu_unit[0].wait, TMR_RTC);
|
||||
sim_activate(&cpu_unit[0], cpu_unit[0].wait) ;
|
||||
|
||||
return SCPE_OK;
|
||||
|
|
|
@ -52,18 +52,13 @@ extern uint8 loading; /* System booting flag *
|
|||
|
||||
/* Debuging controls */
|
||||
#define DEBUG_CHAN 0x0000001 /* Show channel fetchs */
|
||||
#define DEBUG_TRAP 0x0000002 /* Show CPU Traps */
|
||||
#define DEBUG_CMD 0x0000004 /* Show device commands */
|
||||
#define DEBUG_DATA 0x0000008 /* Show data transfers */
|
||||
#define DEBUG_DETAIL 0x0000010 /* Show details */
|
||||
#define DEBUG_EXP 0x0000020 /* Show error conditions */
|
||||
#define DEBUG_SNS 0x0000040 /* Shows sense data for 7909 devs */
|
||||
#define DEBUG_CTSS 0x0000080 /* Shows CTSS specail instructions */
|
||||
#define DEBUG_PROT 0x0000100 /* Protection traps */
|
||||
|
||||
extern DEBTAB dev_debug[];
|
||||
|
||||
|
||||
/* Returns from device commands */
|
||||
#define SCPE_BUSY (1) /* Device is active */
|
||||
#define SCPE_NODEV (2) /* No device exists */
|
||||
|
@ -77,23 +72,6 @@ typedef struct _opcode
|
|||
}
|
||||
t_opcode;
|
||||
|
||||
/* I/O Command codes */
|
||||
#define IO_RDS 1 /* Read record */
|
||||
#define IO_BSR 2 /* Backspace one record */
|
||||
#define IO_BSF 3 /* Backspace one file */
|
||||
#define IO_WRS 4 /* Write one record */
|
||||
#define IO_WEF 5 /* Write eof */
|
||||
#define IO_REW 6 /* Rewind */
|
||||
#define IO_DRS 7 /* Set unit offline */
|
||||
#define IO_SDL 8 /* Set density low */
|
||||
#define IO_SDH 9 /* Set density high */
|
||||
#define IO_RUN 10 /* Rewind and unload unit */
|
||||
#define IO_TRS 11 /* Check it unit ready */
|
||||
#define IO_CTL 12 /* Io control device specific */
|
||||
#define IO_RDB 13 /* Read backwards */
|
||||
#define IO_SKR 14 /* Skip record forward */
|
||||
#define IO_ERG 15 /* Erase next records from tape */
|
||||
|
||||
|
||||
t_stat chan_reset(DEVICE *);
|
||||
t_stat chan_boot(t_uint64);
|
||||
|
|
|
@ -268,7 +268,6 @@ t_stat dtc_srv(UNIT * uptr)
|
|||
int line = uptr->u4;
|
||||
|
||||
|
||||
|
||||
/* Process interrage command */
|
||||
if (uptr->u5 & DTC_INQ) {
|
||||
if (line == -1) {
|
||||
|
@ -306,7 +305,6 @@ t_stat dtc_srv(UNIT * uptr)
|
|||
}
|
||||
dtc_lstatus[line] &= ~BufIRQ;
|
||||
}
|
||||
sim_debug(DEBUG_DETAIL, &dtc_dev, " %03o ", dtc_lstatus[i]);
|
||||
} else {
|
||||
if (line > dtc_desc.lines) {
|
||||
chan_set_notrdy(chan);
|
||||
|
@ -445,11 +443,16 @@ t_stat dtc_srv(UNIT * uptr)
|
|||
switch(i) {
|
||||
case BufNotReady:
|
||||
chan_set_notrdy(chan);
|
||||
/* Fall through */
|
||||
case BufInputBusy:
|
||||
chan_set_error(chan);
|
||||
/* Fall through */
|
||||
case BufWriteRdy:
|
||||
/* Fall through */
|
||||
case BufOutBusy:
|
||||
/* Fall through */
|
||||
case BufIdle:
|
||||
/* Fall through */
|
||||
case BufWrite:
|
||||
chan_set_eof(chan);
|
||||
chan_set_end(chan);
|
||||
|
@ -536,8 +539,10 @@ dtco_srv(UNIT * uptr)
|
|||
if (dtc_ldsc[ln].conn == 0) { /* connected? */
|
||||
switch(dtc_lstatus[ln] & BufSMASK) {
|
||||
case BufIdle: /* Idle, throw in EOT */
|
||||
/* Fall through */
|
||||
case BufWriteRdy: /* Awaiting output, terminate */
|
||||
dtc_bufptr[ln] = 0;
|
||||
/* Fall through */
|
||||
case BufInputBusy: /* reading, terminate with EOT */
|
||||
dtc_buf[ln][dtc_bufptr[ln]++] = 017;
|
||||
dtc_bsize[ln] = dtc_bufptr[ln];
|
||||
|
@ -597,7 +602,9 @@ dtco_srv(UNIT * uptr)
|
|||
/* Fall through to next */
|
||||
|
||||
case '\r':
|
||||
/* Fall through */
|
||||
case '\n':
|
||||
/* Fall through */
|
||||
case '~':
|
||||
dtc_lstatus[ln] &= ~BufSMASK;
|
||||
dtc_lstatus[ln] |= BufIRQ|BufReadRdy;
|
||||
|
@ -777,6 +784,7 @@ t_stat dtc_setnl (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
|||
return r;
|
||||
if ((newln == 0) || (newln > DTC_MLINES))
|
||||
return SCPE_ARG;
|
||||
newln--;
|
||||
if (newln < dtc_desc.lines) {
|
||||
for (i = newln, t = 0; i < dtc_desc.lines; i++)
|
||||
t = t | dtc_ldsc[i].conn;
|
||||
|
|
|
@ -159,7 +159,7 @@ mt_cmd(uint16 cmd, uint16 dev, uint8 chan, uint16 *wc)
|
|||
int unit = dev >> 1;
|
||||
|
||||
/* Make sure valid drive number */
|
||||
if (unit > NUM_DEVS_MT || unit < 0)
|
||||
if (unit > (NUM_DEVS_MT - 1) || unit < 0)
|
||||
return SCPE_NODEV;
|
||||
|
||||
uptr = &mt_unit[unit];
|
||||
|
|
|
@ -532,10 +532,4 @@ parse_sym(CONST char *cptr, t_addr addr, UNIT * uptr, t_value * val, int32 sw)
|
|||
}
|
||||
*val = d;
|
||||
return SCPE_OK;
|
||||
|
||||
/* Symbolic input, continued */
|
||||
|
||||
if (*cptr != 0)
|
||||
return SCPE_ARG; /* junk at end? */
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ cdr_srv(UNIT *uptr) {
|
|||
|
||||
/* Copy next column over */
|
||||
if (uptr->u5 & URCSTA_CARD &&
|
||||
uptr->u4 <= ((uptr->u5 & URCSTA_BIN) ? 160 : 80)) {
|
||||
uptr->u4 < ((uptr->u5 & URCSTA_BIN) ? 160 : 80)) {
|
||||
struct _card_data *data;
|
||||
uint8 ch = 0;
|
||||
int u = (uptr - cdr_unit);
|
||||
|
@ -384,6 +384,8 @@ cdr_srv(UNIT *uptr) {
|
|||
break; /* Translate ? to error*/
|
||||
}
|
||||
}
|
||||
sim_debug(DEBUG_DATA, &cdr_dev, "cdr %d: Char > %03o '%c' %d\n", u, ch,
|
||||
sim_six_to_ascii[ch & 077], uptr->u4);
|
||||
if(chan_write_char(chan, &ch, 0)) {
|
||||
uptr->u5 &= ~(URCSTA_ACTIVE|URCSTA_CARD);
|
||||
chan_set_end(chan);
|
||||
|
@ -396,8 +398,18 @@ cdr_srv(UNIT *uptr) {
|
|||
uptr->u4++;
|
||||
sim_activate(uptr, 100);
|
||||
}
|
||||
sim_debug(DEBUG_DATA, &cdr_dev, "cdr %d: Char > %03o '%c' %d\n", u, ch,
|
||||
sim_six_to_ascii[ch & 077], uptr->u4);
|
||||
}
|
||||
|
||||
/* Check if last column */
|
||||
if (uptr->u5 & URCSTA_CARD &&
|
||||
uptr->u4 == ((uptr->u5 & URCSTA_BIN) ? 160 : 80)) {
|
||||
|
||||
uptr->u5 &= ~(URCSTA_ACTIVE|URCSTA_CARD);
|
||||
chan_set_end(chan);
|
||||
/* Drop ready a bit after the last card is read */
|
||||
if (sim_card_eof(uptr)) {
|
||||
uptr->u5 |= URCSTA_EOF;
|
||||
}
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
@ -502,7 +514,7 @@ cdp_srv(UNIT *uptr) {
|
|||
}
|
||||
|
||||
/* Copy next column over */
|
||||
if (uptr->u5 & URCSTA_ACTIVE && uptr->u4 <= 80) {
|
||||
if (uptr->u5 & URCSTA_ACTIVE && uptr->u4 < 80) {
|
||||
struct _card_data *data;
|
||||
uint8 ch = 0;
|
||||
|
||||
|
@ -518,6 +530,12 @@ cdp_srv(UNIT *uptr) {
|
|||
}
|
||||
sim_activate(uptr, 10);
|
||||
}
|
||||
|
||||
/* Check if last column */
|
||||
if (uptr->u5 & URCSTA_ACTIVE && uptr->u4 == 80) {
|
||||
uptr->u5 |= URCSTA_BUSY|URCSTA_FULL;
|
||||
uptr->u5 &= ~URCSTA_ACTIVE;
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
|
@ -945,6 +963,7 @@ con_srv(UNIT *uptr) {
|
|||
switch (ch) {
|
||||
case 033:
|
||||
con_data[0].inptr = 0;
|
||||
/* Fall through */
|
||||
case '\r':
|
||||
case '\n':
|
||||
uptr->u5 &= ~URCSTA_INPUT;
|
||||
|
|
Loading…
Add table
Reference in a new issue