mirror of
https://github.com/rcornwell/sims.git
synced 2026-03-05 18:59:00 +00:00
Ridge32: Clean up coverity errors.
This commit is contained in:
@@ -386,7 +386,6 @@ int TransAddr(t_addr va, t_addr *pa, uint8 code, uint wr) {
|
||||
* Return 1 if failure, 0 if success.
|
||||
*/
|
||||
int ReadFull(t_addr addr, uint32 *data, uint8 code) {
|
||||
uint32 temp;
|
||||
t_addr pa;
|
||||
|
||||
/* Validate address */
|
||||
@@ -411,7 +410,6 @@ int ReadFull(t_addr addr, uint32 *data, uint8 code) {
|
||||
* Return 1 if failure, 0 if success.
|
||||
*/
|
||||
int WriteFull(t_addr addr, uint32 data) {
|
||||
int offset;
|
||||
t_addr pa;
|
||||
|
||||
/* Validate address */
|
||||
@@ -435,7 +433,6 @@ int WriteFull(t_addr addr, uint32 data) {
|
||||
int WriteHalf(t_addr addr, uint32 data) {
|
||||
uint32 mask;
|
||||
t_addr pa;
|
||||
int offset;
|
||||
|
||||
/* Validate address */
|
||||
if (TransAddr(addr, &pa, 0, 1))
|
||||
@@ -504,9 +501,7 @@ sim_instr(void)
|
||||
uint8 op; /* Current opcode */
|
||||
uint8 reg1; /* First register */
|
||||
uint8 reg2; /* Second register */
|
||||
uint16 irq;
|
||||
int temp, temp2;
|
||||
uint16 ops[3];
|
||||
int temp;
|
||||
int code_seg;
|
||||
|
||||
reason = SCPE_OK;
|
||||
@@ -1047,7 +1042,7 @@ trap:
|
||||
break;
|
||||
|
||||
case OP_CHKI:
|
||||
if (!((src1 & MSIGN) == 0 && src1 <= (int32)src2)) {
|
||||
if (!((src1 & MSIGN) == 0 && (int32)src1 <= (int32)src2)) {
|
||||
sregs[1] = op;
|
||||
sregs[2] = reg1;
|
||||
sregs[3] = reg2;
|
||||
@@ -1824,7 +1819,6 @@ priv_trap: sregs[1] = op;
|
||||
break;
|
||||
|
||||
default:
|
||||
ill_inst:
|
||||
trapcode = ILLINS;
|
||||
sregs[1] = op;
|
||||
sregs[2] = reg1;
|
||||
@@ -1843,6 +1837,7 @@ ill_inst:
|
||||
|
||||
}
|
||||
PC = nPC & WMASK; /* Low order bit can't be set */
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1981,13 +1976,13 @@ if ((mc != 0) && !get_yn ("Really truncate memory [N]?", FALSE))
|
||||
nM = (uint32 *) calloc (val >> 2, sizeof (uint32));
|
||||
if (nM == NULL)
|
||||
return SCPE_MEM;
|
||||
clim = (val < MEMSIZE)? val >> 2: max;
|
||||
clim = ((uint32)val < MEMSIZE)? val >> 2: max;
|
||||
for (i = 0; i < clim; i++)
|
||||
nM[i] = M[i];
|
||||
free (M);
|
||||
M = nM;
|
||||
fprintf(stderr, "Mem size=%x\n\r", val);
|
||||
MEMSIZE = val;
|
||||
MEMSIZE = (uint32)val;
|
||||
cpu_unit.flags &= ~UNIT_MSIZE;
|
||||
cpu_unit.flags |= (val / (1024 * 1024)) << UNIT_V_MSIZE;
|
||||
reset_all (0);
|
||||
@@ -2036,7 +2031,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
int32 k, di, lnt;
|
||||
const char *cptr = (const char *) desc;
|
||||
t_stat r;
|
||||
t_value sim_eval;
|
||||
struct InstHistory *h;
|
||||
|
||||
if (hst_lnt == 0)
|
||||
@@ -2054,7 +2048,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
for (k = 0; k < lnt; k++) { /* print specified */
|
||||
h = &hst[(++di) % hst_lnt]; /* entry pointer */
|
||||
if (h->pc & HIST_PC) { /* instruction? */
|
||||
int i;
|
||||
fprintf(st, "%06x%c %06x %08x %08x %08x %02x%02x ",
|
||||
h->pc & HIST_MASK, (h->pc & HIST_USER) ? 'v':' ', h->addr,
|
||||
h->src1, h->src2, h->dest, h->inst[0], h->inst[1]);
|
||||
@@ -2071,7 +2064,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
fputc('\n', st); /* end line */
|
||||
} /* end else instruction */
|
||||
else if (h->pc & HIST_TRAP) { /* Trap */
|
||||
int i;
|
||||
fprintf(st, "%06x %06x\n",
|
||||
h->pc & HIST_MASK, h->addr);
|
||||
} /* end else trap */
|
||||
|
||||
@@ -221,7 +221,6 @@ ct_mkstatus(UNIT *uptr)
|
||||
t_stat
|
||||
ct_svc (UNIT *uptr)
|
||||
{
|
||||
int len;
|
||||
t_mtrlnt reclen;
|
||||
t_stat r;
|
||||
|
||||
@@ -229,7 +228,7 @@ ct_svc (UNIT *uptr)
|
||||
case 0:
|
||||
if (uptr->MODE & FEN) {
|
||||
if (uptr->MODE & DMA) {
|
||||
len = (ct_dcb.count ^ CMASK) + 1;
|
||||
int len = (ct_dcb.count ^ CMASK) + 1;
|
||||
/* Write a block to the tape. */
|
||||
if (uptr->MODE & WRITE) {
|
||||
io_read_blk(ct_dcb.addr, &ct_buf[0], len);
|
||||
@@ -245,8 +244,8 @@ ct_svc (UNIT *uptr)
|
||||
switch(r) {
|
||||
case MTSE_OK:
|
||||
/* Copy record */
|
||||
if (reclen < len) {
|
||||
len = reclen;
|
||||
if (reclen < (t_mtrlnt)len) {
|
||||
len = (int)reclen;
|
||||
}
|
||||
io_write_blk(ct_dcb.addr, &ct_buf[0], len);
|
||||
ct_dcb.addr += len;
|
||||
@@ -274,7 +273,7 @@ ct_svc (UNIT *uptr)
|
||||
ct_dcb.count = ct_dcb.count + reclen;
|
||||
if (ct_dcb.count & ~CMASK)
|
||||
uptr->STATUS |= BCO;
|
||||
sim_debug(DEBUG_CMD, &ct_dev, "CT spaceb %d %d\n", reclen, len);
|
||||
sim_debug(DEBUG_CMD, &ct_dev, "CT spaceb %d\n", reclen);
|
||||
if (uptr->MODE & MARK) {
|
||||
sim_activate(uptr, 1000);
|
||||
return SCPE_OK;
|
||||
@@ -334,8 +333,6 @@ ct_svc (UNIT *uptr)
|
||||
t_stat
|
||||
ct_reset(DEVICE *dptr)
|
||||
{
|
||||
int i,t;
|
||||
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
@@ -365,7 +362,6 @@ ct_boot (int32 unit, DEVICE *dptr)
|
||||
t_stat
|
||||
ct_attach(UNIT *uptr, CONST char *cptr)
|
||||
{
|
||||
char header[4];
|
||||
t_stat r;
|
||||
|
||||
r = sim_tape_attach_ex(uptr, cptr, 0, 0); /* attach unit */
|
||||
@@ -379,10 +375,8 @@ ct_attach(UNIT *uptr, CONST char *cptr)
|
||||
/* Detach routine */
|
||||
t_stat ct_detach(UNIT *uptr)
|
||||
{
|
||||
t_stat r;
|
||||
|
||||
r = sim_tape_detach(uptr); /* detach unit */
|
||||
return r;
|
||||
uptr->STATUS &= ~(IRQ|ONL|RDY);
|
||||
return sim_tape_detach(uptr); /* detach unit */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -204,7 +204,6 @@ dsk_write(uint32 dev, uint32 data)
|
||||
int cmd = (data >> 24) & 0xff;
|
||||
int drive = cmd & 3;
|
||||
int offset = drive << 6;;
|
||||
int i;
|
||||
uint8 buff[64];
|
||||
|
||||
/* Check if command can be accepted */
|
||||
@@ -323,15 +322,14 @@ dsk_incsect(UNIT *uptr, int drive)
|
||||
t_stat
|
||||
dsk_svc (UNIT *uptr)
|
||||
{
|
||||
UNIT *dcb = &dsk_unit[0];
|
||||
int drive = uptr - dsk_unit;
|
||||
int offset = drive << 6;;
|
||||
int type = GET_DTYPE(uptr->flags);
|
||||
int da;
|
||||
int flags;
|
||||
int len;
|
||||
int i;
|
||||
int sc;
|
||||
UNIT *dcb = &dsk_unit[0];
|
||||
int drive = uptr - dsk_unit;
|
||||
int offset = drive << 6;;
|
||||
int type = GET_DTYPE(uptr->flags);
|
||||
int da;
|
||||
size_t len;
|
||||
size_t i;
|
||||
int sc;
|
||||
|
||||
/* Check if disk attached */
|
||||
if ((uptr->flags & UNIT_ATT) == 0) {
|
||||
@@ -370,7 +368,7 @@ dsk_svc (UNIT *uptr)
|
||||
}
|
||||
if (len > dsk_dcb[drive].count)
|
||||
len = dsk_dcb[drive].count;
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk Read: %d bytes\n", len);
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk Read: %lu bytes\n", len);
|
||||
for (i = 0; i < len; i++) {
|
||||
sim_debug(DEBUG_DATA, &dsk_dev, "%02x ", dsk_buf[i]);
|
||||
if ((i & 0x1f) == 0x1f)
|
||||
@@ -393,11 +391,11 @@ dsk_svc (UNIT *uptr)
|
||||
uptr->CMD += DSK_INC;
|
||||
if ((uptr->CMD & DSK_SMSK) == 0) {
|
||||
uint32 t;
|
||||
i = ((uptr->CMD & DSK_CNT) >> 14) - 1;
|
||||
t = io_dcbread_half(dcb, offset + 0x20 + (i * 2));
|
||||
t = ((uptr->CMD & DSK_CNT) >> 14) - 1;
|
||||
t = io_dcbread_half(dcb, offset + 0x20 + (t * 2));
|
||||
if (t != 0)
|
||||
dsk_dcb[drive].addr = t << 8;
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk new address: %08x %x\n", t, i);
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk new address: %08x\n", t);
|
||||
}
|
||||
sim_activate(uptr, 100);
|
||||
return SCPE_OK;
|
||||
@@ -430,7 +428,7 @@ dsk_svc (UNIT *uptr)
|
||||
while (len < sizeof(dsk_buf)) {
|
||||
dsk_buf[len++] = 0;
|
||||
}
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk Write: %d bytes\n", len);
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk Write: %lu bytes\n", len);
|
||||
for (i = 0; i < len; i++) {
|
||||
sim_debug(DEBUG_DATA, &dsk_dev, "%02x ", dsk_buf[i]);
|
||||
if ((i & 0x1f) == 0x1f)
|
||||
@@ -456,11 +454,11 @@ dsk_svc (UNIT *uptr)
|
||||
uptr->CMD += DSK_INC;
|
||||
if ((uptr->CMD & DSK_SMSK) == 0) {
|
||||
uint32 t;
|
||||
i = ((uptr->CMD & DSK_CNT) >> 14) - 1;
|
||||
t = io_dcbread_half(dcb, offset + 0x20 + (i * 2));
|
||||
t = ((uptr->CMD & DSK_CNT) >> 14) - 1;
|
||||
t = io_dcbread_half(dcb, offset + 0x20 + (t * 2));
|
||||
if (t != 0)
|
||||
dsk_dcb[drive].addr = t << 8;
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk new address: %08x %x\n", t, i);
|
||||
sim_debug(DEBUG_DETAIL, &dsk_dev, "Disk new address: %08x\n", t);
|
||||
}
|
||||
sim_activate(uptr, 100);
|
||||
return SCPE_OK;
|
||||
@@ -593,7 +591,6 @@ t_stat
|
||||
dsk_boot(int32 unit_num, DEVICE *dptr)
|
||||
{
|
||||
UNIT *dkuptr = &dptr->units[unit_num];
|
||||
int i = 0;
|
||||
|
||||
if (unit_num != 0)
|
||||
return SCPE_ARG;
|
||||
@@ -621,7 +618,7 @@ dsk_boot(int32 unit_num, DEVICE *dptr)
|
||||
t_stat
|
||||
dsk_reset(DEVICE *dptr)
|
||||
{
|
||||
int i,t;
|
||||
uint32 i,t;
|
||||
|
||||
dsk_unit[0].DCB = 0x3c100;
|
||||
for (i = 0; i < dptr->numunits; i++) {
|
||||
@@ -637,7 +634,8 @@ dsk_set_type(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (uptr == NULL) return SCPE_IERR;
|
||||
if (uptr == NULL)
|
||||
return SCPE_IERR;
|
||||
i = GET_DTYPE(val);
|
||||
uptr->capac = dsk_type[i].cyl * dsk_type[i].hds *
|
||||
dsk_type[i].sect * 1024;
|
||||
@@ -649,26 +647,14 @@ dsk_set_type(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
t_stat
|
||||
dsk_attach(UNIT *uptr, CONST char *cptr)
|
||||
{
|
||||
char header[4];
|
||||
t_stat r;
|
||||
|
||||
r = attach_unit(uptr, cptr); /* attach unit */
|
||||
if ( r != SCPE_OK) /* error? */
|
||||
return r;
|
||||
|
||||
/* Determine length of this disk */
|
||||
uptr->capac = sim_fsize(uptr->fileref);
|
||||
return SCPE_OK;
|
||||
return attach_unit(uptr, cptr); /* attach unit */
|
||||
}
|
||||
|
||||
|
||||
/* Detach routine */
|
||||
t_stat dsk_detach(UNIT *uptr)
|
||||
{
|
||||
t_stat r;
|
||||
|
||||
r = detach_unit(uptr); /* detach unit */
|
||||
return r;
|
||||
return detach_unit(uptr); /* detach unit */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -564,9 +564,9 @@ flp_start(UNIT *uptr, int drive)
|
||||
t_stat
|
||||
flp_svc (UNIT *uptr)
|
||||
{
|
||||
int flags;
|
||||
int len;
|
||||
int i;
|
||||
uint32 flags;
|
||||
uint32 len;
|
||||
uint32 i;
|
||||
/* Read status to decide action */
|
||||
switch (uptr->PHASE) {
|
||||
case PHASE_IDLE: /* Done with commands, just idle out */
|
||||
@@ -996,7 +996,6 @@ flp_attach(UNIT *uptr, CONST char *cptr)
|
||||
t_stat flp_detach(UNIT *uptr)
|
||||
{
|
||||
t_stat r;
|
||||
int8 i;
|
||||
|
||||
r = diskClose((DISK_INFO **)&uptr->up7);
|
||||
if (r != SCPE_OK)
|
||||
|
||||
@@ -117,7 +117,7 @@ rfix(uint32 *res, uint32 src, int round)
|
||||
e1 ++;
|
||||
}
|
||||
|
||||
if (round)
|
||||
if (round)
|
||||
src++;
|
||||
src >>= 1; /* Remove guard bit */
|
||||
if (s)
|
||||
@@ -145,13 +145,12 @@ makerd(uint32 *resl, uint32 *resh, uint32 src)
|
||||
*resl = (src & MSIGN) | ((e << 20) & DEMSK) | ((src & MMASK) >> 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Compare to floating point numbers */
|
||||
int
|
||||
rcomp(uint32 src1, uint32 src2)
|
||||
{
|
||||
int e1, e2; /* Hold the two exponents */
|
||||
int s; /* Hold resulting sign */
|
||||
int temp; /* Hold exponent difference */
|
||||
uint32 m1, m2;
|
||||
|
||||
@@ -159,11 +158,11 @@ rcomp(uint32 src1, uint32 src2)
|
||||
e1 = (src1 & EMASK) >> 23;
|
||||
m1 = src1 & MMASK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
m1 |= ONE;
|
||||
m1 |= ONE;
|
||||
e2 = (src2 & EMASK) >> 23;
|
||||
m2 = src2 & MMASK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
m2 |= ONE;
|
||||
m2 |= ONE;
|
||||
temp = e1 - e2;
|
||||
/* Align operands */
|
||||
if (temp > 0) {
|
||||
@@ -185,7 +184,7 @@ rcomp(uint32 src1, uint32 src2)
|
||||
/* Exponents should be equal now. */
|
||||
if (src1 & MSIGN)
|
||||
m1 = (m1 ^ FMASK) + 1;
|
||||
|
||||
|
||||
if ((src2 & MSIGN) == 0)
|
||||
m2 = (m2 ^ FMASK) + 1;
|
||||
|
||||
@@ -201,7 +200,7 @@ rcomp(uint32 src1, uint32 src2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Add two single precision numbers */
|
||||
int
|
||||
radd(uint32 *res, uint32 src1, uint32 src2)
|
||||
@@ -220,10 +219,10 @@ radd(uint32 *res, uint32 src1, uint32 src2)
|
||||
s |= 1;
|
||||
src2 &= MMASK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
src2 |= ONE;
|
||||
src2 |= ONE;
|
||||
src1 &= MMASK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
src1 |= ONE;
|
||||
src1 |= ONE;
|
||||
temp = e1 - e2;
|
||||
/* Create guard digit */
|
||||
src2 <<= 1;
|
||||
@@ -249,7 +248,7 @@ radd(uint32 *res, uint32 src1, uint32 src2)
|
||||
/* Exponents should be equal now. */
|
||||
if (s & 2)
|
||||
src1 = (src1 ^ FMASK) + 1;
|
||||
|
||||
|
||||
if (s & 1)
|
||||
src2 = (src2 ^ FMASK) + 1;
|
||||
|
||||
@@ -311,10 +310,10 @@ rmult(uint32 *res, uint32 src1, uint32 src2)
|
||||
s = 1;
|
||||
src2 &= MMASK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
src2 |= ONE;
|
||||
src2 |= ONE;
|
||||
src1 &= MMASK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
src1 |= ONE;
|
||||
src1 |= ONE;
|
||||
|
||||
/* Compute exponent */
|
||||
e1 = e1 + e2 - 127;
|
||||
@@ -388,16 +387,16 @@ rdiv(uint32 *res, uint32 src1, uint32 src2)
|
||||
e1 = (src1 & EMASK) >> 23;
|
||||
e2 = (src2 & EMASK) >> 23;
|
||||
s = 0;
|
||||
if (e2 == 0)
|
||||
if (e2 == 0)
|
||||
return 20;
|
||||
if ((src1 & MSIGN) != (src2 & MSIGN))
|
||||
s = 1;
|
||||
src2 &= MMASK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
src2 |= ONE;
|
||||
src2 |= ONE;
|
||||
src1 &= MMASK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
src1 |= ONE;
|
||||
src1 |= ONE;
|
||||
|
||||
/* Compute exponent */
|
||||
e1 = e1 - e2 + 127;
|
||||
@@ -419,10 +418,10 @@ rdiv(uint32 *res, uint32 src1, uint32 src2)
|
||||
|
||||
/* Subtract remainder to dividend */
|
||||
desth = src1 - src2;
|
||||
|
||||
|
||||
/* Shift quotent left one bit */
|
||||
dest <<= 1;
|
||||
|
||||
|
||||
/* If remainder larger then divisor replace */
|
||||
if ((desth & MSIGN) == 0) {
|
||||
src1 = desth;
|
||||
@@ -533,7 +532,7 @@ dfix(uint32 *res, uint32 src, uint32 srch, int round)
|
||||
e1 ++;
|
||||
}
|
||||
|
||||
if (round && (srch & MSIGN) != 0)
|
||||
if (round && (srch & MSIGN) != 0)
|
||||
src++;
|
||||
if (s)
|
||||
src = (src ^ FMASK) + 1;
|
||||
@@ -562,13 +561,12 @@ makedr(uint32 *res, uint32 src, uint32 srch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Compare to floating point numbers */
|
||||
int
|
||||
drcomp(uint32 src1, uint32 src1h, uint32 src2, uint32 src2h)
|
||||
{
|
||||
int e1, e2; /* Hold the two exponents */
|
||||
int s; /* Hold resulting sign */
|
||||
int temp; /* Hold exponent difference */
|
||||
uint32 m1, m2, mh;
|
||||
|
||||
@@ -576,11 +574,11 @@ drcomp(uint32 src1, uint32 src1h, uint32 src2, uint32 src2h)
|
||||
e1 = (src1 & DEMSK) >> 20;
|
||||
m1 = src1 & DMMSK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
m1 |= DONE;
|
||||
m1 |= DONE;
|
||||
e2 = (src2 & DEMSK) >> 20;
|
||||
m2 = src2 & DMMSK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
m2 |= DONE;
|
||||
m2 |= DONE;
|
||||
temp = e1 - e2;
|
||||
/* Align operands */
|
||||
if (temp > 0) {
|
||||
@@ -618,7 +616,7 @@ drcomp(uint32 src1, uint32 src1h, uint32 src2, uint32 src2h)
|
||||
if (src1h == 0)
|
||||
m1++;
|
||||
}
|
||||
|
||||
|
||||
if ((src2 & MSIGN) == 0) {
|
||||
src2h = (src2h ^ FMASK) + 1;
|
||||
m2 = m2 ^ FMASK;
|
||||
@@ -641,7 +639,7 @@ drcomp(uint32 src1, uint32 src1h, uint32 src2, uint32 src2h)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Add two double precision numbers */
|
||||
int
|
||||
dradd(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint32 src2h)
|
||||
@@ -655,11 +653,11 @@ dradd(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint32
|
||||
e1 = (src1 & DEMSK) >> 20;
|
||||
m1 = src1 & DMMSK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
m1 |= DONE;
|
||||
m1 |= DONE;
|
||||
e2 = (src2 & DEMSK) >> 20;
|
||||
m2 = src2 & DMMSK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
m2 |= DONE;
|
||||
m2 |= DONE;
|
||||
temp = e1 - e2;
|
||||
//printf(" %08x %08x %08x %08x %d %d %d\n", m1, src1h, m2, src2h, e1, e2, temp);
|
||||
/* Align operands */
|
||||
@@ -696,7 +694,7 @@ dradd(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint32
|
||||
if (src1h == 0)
|
||||
m1++;
|
||||
}
|
||||
|
||||
|
||||
if ((src2 & MSIGN) != 0) {
|
||||
src2h = (src2h ^ FMASK) + 1;
|
||||
m2 = m2 ^ FMASK;
|
||||
@@ -767,7 +765,7 @@ drmult(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint3
|
||||
int e1, e2; /* Hold the two exponents */
|
||||
int s = 0; /* Hold resulting sign */
|
||||
int temp; /* Hold exponent difference */
|
||||
uint32 m1, m2, mh;
|
||||
uint32 m1, m2;
|
||||
uint32 dest, desth;
|
||||
|
||||
/* Extract numbers and adjust */
|
||||
@@ -776,11 +774,11 @@ drmult(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint3
|
||||
s = 1;
|
||||
m1 = src1 & DMMSK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
m1 |= DONE;
|
||||
m1 |= DONE;
|
||||
e2 = (src2 & DEMSK) >> 20;
|
||||
m2 = src2 & DMMSK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
m2 |= DONE;
|
||||
m2 |= DONE;
|
||||
temp = e1 - e2;
|
||||
|
||||
/* Compute exponent */
|
||||
@@ -855,7 +853,7 @@ drdiv(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint32
|
||||
int e1, e2; /* Hold the two exponents */
|
||||
int s = 0; /* Hold resulting sign */
|
||||
int temp; /* Hold exponent difference */
|
||||
uint32 m1, m2, mh;
|
||||
uint32 m1, m2;
|
||||
uint32 dest, desth;
|
||||
|
||||
/* Extract numbers and adjust */
|
||||
@@ -864,11 +862,11 @@ drdiv(uint32 *resl, uint32 *resh, uint32 src1, uint32 src1h, uint32 src2, uint32
|
||||
s = 1;
|
||||
m1 = src1 & DMMSK; /* extract mantissa */
|
||||
if (e1 != 0) /* Add in hidden bit if needed */
|
||||
m1 |= DONE;
|
||||
m1 |= DONE;
|
||||
e2 = (src2 & DEMSK) >> 20;
|
||||
m2 = src2 & DMMSK; /* extract mantissa */
|
||||
if (e2 != 0) /* Add in hidden bit if needed */
|
||||
m2 |= DONE;
|
||||
m2 |= DONE;
|
||||
temp = e1 - e2;
|
||||
|
||||
/* Compute exponent */
|
||||
|
||||
@@ -271,7 +271,7 @@ empty_iord(uint32 *data)
|
||||
t_stat
|
||||
chan_set_devs()
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
dev_table[i] = &null_dev; /* Empty device */
|
||||
@@ -450,7 +450,6 @@ show_slot_num(FILE * st, UNIT * uptr, int32 v, CONST void *desc)
|
||||
{
|
||||
DEVICE *dptr;
|
||||
DIB *dibp;
|
||||
int addr;
|
||||
int slot;
|
||||
|
||||
if (uptr == NULL)
|
||||
|
||||
@@ -80,11 +80,9 @@ const char *sim_stop_messages[] = {
|
||||
|
||||
t_stat sim_load (FILE *fileref, CONST char *cptr, CONST char *fnam, int flag)
|
||||
{
|
||||
DISK_INFO *disk;
|
||||
uint8 buf[1024];
|
||||
int i, sect;
|
||||
uint32 flags;
|
||||
uint32 len;
|
||||
size_t len;
|
||||
size_t i;
|
||||
uint32 addr = 0x3a000;
|
||||
uint32 data;
|
||||
uint32 mask;
|
||||
@@ -92,7 +90,7 @@ t_stat sim_load (FILE *fileref, CONST char *cptr, CONST char *fnam, int flag)
|
||||
int offset;
|
||||
|
||||
while((len = fread(&buf[0], 1, sizeof(buf), fileref)) > 0) {
|
||||
for (i = 0; i <len; i++) {
|
||||
for (i = 0; i < len; i++) {
|
||||
offset = 8 * (3 - (addr & 0x3));
|
||||
pa = addr >> 2;
|
||||
mask = 0xff;
|
||||
@@ -108,6 +106,8 @@ t_stat sim_load (FILE *fileref, CONST char *cptr, CONST char *fnam, int flag)
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
DISK_INFO *disk;
|
||||
uint32 flags;
|
||||
disk = diskOpen(fileref, TRUE);
|
||||
|
||||
fprintf(stderr, " %06x ", addr);
|
||||
@@ -354,8 +354,6 @@ CONST char *rone[] = {
|
||||
|
||||
void fprint_inst(FILE *of, t_addr addr, t_value *val) {
|
||||
uint8 inst = val[0];
|
||||
int i;
|
||||
int l = 1;
|
||||
t_opcode *tab;
|
||||
uint32 disp = 0;
|
||||
|
||||
@@ -449,7 +447,6 @@ uint8 inst = *val;
|
||||
int i;
|
||||
int l = 1;
|
||||
int rdx = 16;
|
||||
t_opcode *tab;
|
||||
uint32 num;
|
||||
|
||||
if (sw & SWMASK ('D'))
|
||||
@@ -477,7 +474,7 @@ if (sw & SWMASK ('M')) {
|
||||
if (sw & SWMASK ('C')) {
|
||||
fputc('\'', of);
|
||||
for(i = 0; i < l; i++) {
|
||||
char ch = val[i] & 0xff;
|
||||
uint8 ch = val[i] & 0xff;
|
||||
if (ch >= 0x20 && ch <= 0x7f)
|
||||
fprintf(of, "%c", ch);
|
||||
else
|
||||
@@ -615,7 +612,6 @@ t_stat parse_sym (CONST char *cptr, t_addr addr, UNIT *uptr, t_value *val, int32
|
||||
int i;
|
||||
int l = 1;
|
||||
int rdx = 16;
|
||||
char mod = 0;
|
||||
t_opcode *tab;
|
||||
t_stat r;
|
||||
uint32 num;
|
||||
@@ -741,9 +737,9 @@ if (sw & SWMASK ('M')) {
|
||||
cptr++;
|
||||
}
|
||||
while (sim_isspace (*cptr)) cptr++;
|
||||
if ((r = get_imm(cptr, &tptr, rdx, &i)) != SCPE_OK)
|
||||
if ((r = get_imm(cptr, &tptr, rdx, &num)) != SCPE_OK)
|
||||
return r;
|
||||
val[1] |= i;
|
||||
val[1] |= num;
|
||||
cptr = tptr;
|
||||
if (tab->type & PCREL) {
|
||||
if (*cptr != ',')
|
||||
@@ -827,9 +823,9 @@ if (sw & SWMASK ('M')) {
|
||||
val[i+2] = (num >> (((l - 1) - i) * 8)) & 0xff;
|
||||
return -(l-1);
|
||||
case RN:
|
||||
if ((r = get_n(cptr, &tptr, rdx, &i)) != SCPE_OK)
|
||||
if ((r = get_n(cptr, &tptr, rdx, &num)) != SCPE_OK)
|
||||
return r;
|
||||
val[1] = i;
|
||||
val[1] = num;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ mono_disp (UNIT *uptr)
|
||||
}
|
||||
|
||||
struct _keytab {
|
||||
int8 syms; /* Key symbol */
|
||||
uint8 syms; /* Key symbol */
|
||||
char norm; /* Normal unshifted key */
|
||||
char shift; /* Shifted key */
|
||||
char cap; /* Capslock on */
|
||||
@@ -391,7 +391,7 @@ struct _keytab {
|
||||
{SIM_KEY_TAB, '\t', '\t', '\t', '\t', '\t', },
|
||||
{SIM_KEY_ENTER, '\r', '\r', '\r', '\r', '\r', },
|
||||
{SIM_KEY_SPACE, ' ', ' ', ' ', ' ', '0', },
|
||||
{-1, ' ', ' ', ' ', ' ', '0', },
|
||||
{SIM_KEY_UNKNOWN, ' ', ' ', ' ', ' ', '0', },
|
||||
};
|
||||
|
||||
void
|
||||
@@ -425,7 +425,7 @@ mono_key_event(UNIT *uptr, SIM_KEY_EVENT *kev)
|
||||
uptr->KEYFLG |= SH_R;
|
||||
break;
|
||||
default:
|
||||
for(i = 0; mono_keytab[i].syms != -1; i++) {
|
||||
for(i = 0; mono_keytab[i].syms != SIM_KEY_UNKNOWN; i++) {
|
||||
if (mono_keytab[i].syms == kev->key) {
|
||||
if ((uptr->KEYFLG & (CTL_L|CTL_R)) != 0) {
|
||||
ch = mono_keytab[i].cntrl;
|
||||
|
||||
Reference in New Issue
Block a user