Updated several file to remove "egregious" errors

This commit is contained in:
Bill Beech 2012-07-11 11:59:15 -07:00
parent e0d8de9de7
commit 5fcd6a7960
6 changed files with 57 additions and 63 deletions

View file

@ -144,7 +144,7 @@ t_stat BOOTROM_config (UNIT *uptr, int32 val, char *cptr, void *desc)
if (val == UNIT_NONE) if (val == UNIT_NONE)
BOOTROM_unit.capac = 0; /* set EPROM size */ BOOTROM_unit.capac = 0; /* set EPROM size */
else else
BOOTROM_unit.capac = 0x200 << (val >> UNIT_V_MSIZE) - 1; /* set EPROM size */ BOOTROM_unit.capac = 0x200 << ((val >> UNIT_V_MSIZE) - 1); /* set EPROM size */
if (BOOTROM_unit.filebuf) { /* free buffer */ if (BOOTROM_unit.filebuf) { /* free buffer */
free (BOOTROM_unit.filebuf); free (BOOTROM_unit.filebuf);
BOOTROM_unit.filebuf = NULL; BOOTROM_unit.filebuf = NULL;
@ -161,9 +161,9 @@ t_stat BOOTROM_config (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat BOOTROM_reset (DEVICE *dptr) t_stat BOOTROM_reset (DEVICE *dptr)
{ {
int j, c; t_addr j;
int c;
FILE *fp; FILE *fp;
t_stat r;
if (BOOTROM_dev.dctrl & DEBUG_flow) if (BOOTROM_dev.dctrl & DEBUG_flow)
printf("BOOTROM_reset: \n"); printf("BOOTROM_reset: \n");
@ -195,7 +195,7 @@ t_stat BOOTROM_reset (DEVICE *dptr)
j = 0; /* load EPROM file */ j = 0; /* load EPROM file */
c = fgetc(fp); c = fgetc(fp);
while (c != EOF) { while (c != EOF) {
*(uint8 *)(BOOTROM_unit.filebuf + j++) = c & 0xFF; *((uint8 *)(BOOTROM_unit.filebuf) + j++) = c & 0xFF;
c = fgetc(fp); c = fgetc(fp);
if (j > BOOTROM_unit.capac) { if (j > BOOTROM_unit.capac) {
printf("\tImage is too large - Load truncated!!!\n"); printf("\tImage is too large - Load truncated!!!\n");
@ -222,7 +222,7 @@ int32 BOOTROM_get_mbyte(int32 offset)
} }
if (BOOTROM_dev.dctrl & DEBUG_read) if (BOOTROM_dev.dctrl & DEBUG_read)
printf("BOOTROM_get_mbyte: offset=%04X\n", offset); printf("BOOTROM_get_mbyte: offset=%04X\n", offset);
val = *(uint8 *)(BOOTROM_unit.filebuf + offset) & 0xFF; val = *((uint8 *)(BOOTROM_unit.filebuf) + offset) & 0xFF;
if (BOOTROM_dev.dctrl & DEBUG_read) if (BOOTROM_dev.dctrl & DEBUG_read)
printf("BOOTROM_get_mbyte: Normal val=%02X\n", val); printf("BOOTROM_get_mbyte: Normal val=%02X\n", val);
return val; return val;

View file

@ -368,7 +368,6 @@ t_stat dsk_reset (DEVICE *dptr)
int32 fdcdrv(int32 io, int32 data) int32 fdcdrv(int32 io, int32 data)
{ {
static long pos; static long pos;
char buf[128];
if (io) { /* write to DC-4 drive register */ if (io) { /* write to DC-4 drive register */
if (dsk_dev.dctrl & DEBUG_write) if (dsk_dev.dctrl & DEBUG_write)
@ -394,9 +393,9 @@ int32 fdcdrv(int32 io, int32 data)
sim_fread(dsk_unit[cur_dsk].filebuf, SECSIZ, 1, dsk_unit[cur_dsk].fileref); /* read in buffer */ sim_fread(dsk_unit[cur_dsk].filebuf, SECSIZ, 1, dsk_unit[cur_dsk].fileref); /* read in buffer */
dsk_unit[cur_dsk].u3 |= BUSY | DRQ; /* set DRQ & BUSY */ dsk_unit[cur_dsk].u3 |= BUSY | DRQ; /* set DRQ & BUSY */
dsk_unit[cur_dsk].pos = 0; /* clear counter */ dsk_unit[cur_dsk].pos = 0; /* clear counter */
spt = *(uint8 *)(dsk_unit[cur_dsk].filebuf + MAXSEC) & 0xFF; spt = *((uint8 *)(dsk_unit[cur_dsk].filebuf) + MAXSEC) & 0xFF;
heds = 0; heds = 0;
cpd = *(uint8 *)(dsk_unit[cur_dsk].filebuf + MAXCYL) & 0xFF; cpd = *((uint8 *)(dsk_unit[cur_dsk].filebuf) + MAXCYL) & 0xFF;
trksiz = spt * SECSIZ; trksiz = spt * SECSIZ;
dsksiz = trksiz * cpd; dsksiz = trksiz * cpd;
if (dsk_dev.dctrl & DEBUG_read) if (dsk_dev.dctrl & DEBUG_read)
@ -538,7 +537,7 @@ int32 fdcdata(int32 io, int32 data)
if (dsk_unit[cur_dsk].pos < SECSIZ) { /* copy bytes to buffer */ if (dsk_unit[cur_dsk].pos < SECSIZ) { /* copy bytes to buffer */
if (dsk_dev.dctrl & DEBUG_write) if (dsk_dev.dctrl & DEBUG_write)
printf("\nfdcdata: Writing byte %d of %02X", dsk_unit[cur_dsk].pos, data); printf("\nfdcdata: Writing byte %d of %02X", dsk_unit[cur_dsk].pos, data);
*(uint8 *)(dsk_unit[cur_dsk].filebuf + dsk_unit[cur_dsk].pos) = data; /* byte into buffer */ *((uint8 *)(dsk_unit[cur_dsk].filebuf) + dsk_unit[cur_dsk].pos) = data; /* byte into buffer */
dsk_unit[cur_dsk].pos++; /* step counter */ dsk_unit[cur_dsk].pos++; /* step counter */
if (dsk_unit[cur_dsk].pos == SECSIZ) { if (dsk_unit[cur_dsk].pos == SECSIZ) {
dsk_unit[cur_dsk].u3 &= ~(BUSY | DRQ); dsk_unit[cur_dsk].u3 &= ~(BUSY | DRQ);
@ -555,7 +554,7 @@ int32 fdcdata(int32 io, int32 data)
if (dsk_unit[cur_dsk].pos < SECSIZ) { /* copy bytes from buffer */ if (dsk_unit[cur_dsk].pos < SECSIZ) { /* copy bytes from buffer */
if (dsk_dev.dctrl & DEBUG_read) if (dsk_dev.dctrl & DEBUG_read)
printf("\nfdcdata: Reading byte %d u3=%02X", dsk_unit[cur_dsk].pos, dsk_unit[cur_dsk].u3); printf("\nfdcdata: Reading byte %d u3=%02X", dsk_unit[cur_dsk].pos, dsk_unit[cur_dsk].u3);
val = *(uint8 *)(dsk_unit[cur_dsk].filebuf + dsk_unit[cur_dsk].pos) & 0xFF; val = *((uint8 *)(dsk_unit[cur_dsk].filebuf) + dsk_unit[cur_dsk].pos) & 0xFF;
dsk_unit[cur_dsk].pos++; /* step counter */ dsk_unit[cur_dsk].pos++; /* step counter */
if (dsk_unit[cur_dsk].pos == SECSIZ) { /* done? */ if (dsk_unit[cur_dsk].pos == SECSIZ) { /* done? */
dsk_unit[cur_dsk].u3 &= ~(BUSY | DRQ); /* clear flags */ dsk_unit[cur_dsk].u3 &= ~(BUSY | DRQ); /* clear flags */

View file

@ -130,7 +130,7 @@ t_stat i2716_attach (UNIT *uptr, char *cptr)
j = 0; /* load EPROM file */ j = 0; /* load EPROM file */
c = fgetc(fp); c = fgetc(fp);
while (c != EOF) { while (c != EOF) {
*(uint8 *)(uptr->filebuf + j++) = c & 0xFF; *((uint8 *)(uptr->filebuf) + j++) = c & 0xFF;
c = fgetc(fp); c = fgetc(fp);
if (j > 2048) { if (j > 2048) {
printf("\tImage is too large - Load truncated!!!\n"); printf("\tImage is too large - Load truncated!!!\n");
@ -150,8 +150,7 @@ t_stat i2716_attach (UNIT *uptr, char *cptr)
t_stat i2716_reset (DEVICE *dptr) t_stat i2716_reset (DEVICE *dptr)
{ {
int32 i, j, c, base; int32 i, base;
t_stat r;
UNIT *uptr; UNIT *uptr;
if (i2716_dev.dctrl & DEBUG_flow) if (i2716_dev.dctrl & DEBUG_flow)
@ -207,7 +206,7 @@ int32 i2716_get_mbyte(int32 offset)
printf("i2716_get_mbyte: EPROM not configured\n"); printf("i2716_get_mbyte: EPROM not configured\n");
return 0xFF; return 0xFF;
} else { } else {
val = *(uint8 *)(uptr->filebuf + (offset - org)); val = *((uint8 *)(uptr->filebuf) + (offset - org));
if (i2716_dev.dctrl & DEBUG_read) if (i2716_dev.dctrl & DEBUG_read)
printf(" val=%04X\n", val); printf(" val=%04X\n", val);
return (val & 0xFF); return (val & 0xFF);

View file

@ -303,8 +303,6 @@ int32 oplen[256] = {
3,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3 3,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3
}; };
/* simulator instruction decode routine */
int32 sim_instr (void) int32 sim_instr (void)
{ {
extern int32 sim_interval; extern int32 sim_interval;
@ -318,10 +316,8 @@ int32 sim_instr (void)
while (reason == 0) { /* loop until halted */ while (reason == 0) { /* loop until halted */
// dump_regs1(); // dump_regs1();
if (sim_interval <= 0) /* check clock queue */ if (sim_interval <= 0) /* check clock queue */
if (reason = sim_process_event ()) { if (reason = sim_process_event ())
// printf("sim_process_event()=%08X\n", reason);
break; break;
}
if (mem_fault) { /* memory fault? */ if (mem_fault) { /* memory fault? */
mem_fault = 0; /* reset fault flag */ mem_fault = 0; /* reset fault flag */
reason = STOP_MEMORY; reason = STOP_MEMORY;
@ -1804,7 +1800,7 @@ uint16 pop_word(void)
return res; return res;
} }
/* This routine does the jump to relative offset if the condition is /* this routine does the jump to relative offset if the condition is
met. Otherwise, execution continues at the current PC. */ met. Otherwise, execution continues at the current PC. */
void go_rel(int32 cond) void go_rel(int32 cond)
@ -1896,7 +1892,7 @@ void condevalVa(int32 op1, int32 op2)
{ {
if (get_flag(CF)) if (get_flag(CF))
COND_SET_FLAG_V(((op1 & 0x80) && (op2 & 0x80)) || ( COND_SET_FLAG_V(((op1 & 0x80) && (op2 & 0x80)) || (
(op1 & 0x80 == 0) && (op2 & 0x80 == 0))); ((op1 & 0x80) == 0) && ((op2 & 0x80) == 0)));
} }
/* test and set V for subtraction */ /* test and set V for subtraction */
@ -1904,8 +1900,8 @@ void condevalVa(int32 op1, int32 op2)
void condevalVs(int32 op1, int32 op2) void condevalVs(int32 op1, int32 op2)
{ {
if (get_flag(CF)) if (get_flag(CF))
COND_SET_FLAG_V(((op1 & 0x80) && (op2 & 0x80 == 0)) || COND_SET_FLAG_V(((op1 & 0x80) && ((op2 & 0x80) == 0)) ||
((op1 & 0x80 == 0) && (op2 & 0x80))); (((op1 & 0x80) == 0) && (op2 & 0x80)));
} }
/* calls from the simulator */ /* calls from the simulator */

View file

@ -111,12 +111,12 @@ t_stat m6810_reset (DEVICE *dptr)
int32 m6810_get_mbyte(int32 offset) int32 m6810_get_mbyte(int32 offset)
{ {
int32 val, org, len; int32 val;
if (m6810_dev.dctrl & DEBUG_read) if (m6810_dev.dctrl & DEBUG_read)
printf("m6810_get_mbyte: offset=%04X\n", offset); printf("m6810_get_mbyte: offset=%04X\n", offset);
if (offset < m6810_unit.capac) { if (((t_addr)offset) < m6810_unit.capac) {
val = *(uint8 *)(m6810_unit.filebuf + offset) & 0xFF; val = *((uint8 *)(m6810_unit.filebuf) + offset) & 0xFF;
if (m6810_dev.dctrl & DEBUG_read) if (m6810_dev.dctrl & DEBUG_read)
printf("val=%04X\n", val); printf("val=%04X\n", val);
return val; return val;
@ -133,8 +133,8 @@ void m6810_put_mbyte(int32 offset, int32 val)
{ {
if (m6810_dev.dctrl & DEBUG_write) if (m6810_dev.dctrl & DEBUG_write)
printf("m6810_put_mbyte: offset=%04X, val=%02X\n", offset, val); printf("m6810_put_mbyte: offset=%04X, val=%02X\n", offset, val);
if (offset < m6810_unit.capac) { if ((t_addr)offset < m6810_unit.capac) {
*(uint8 *)(m6810_unit.filebuf + offset) = val & 0xFF; *((uint8 *)(m6810_unit.filebuf) + offset) = val & 0xFF;
return; return;
} else { } else {
if (m6810_dev.dctrl & DEBUG_write) if (m6810_dev.dctrl & DEBUG_write)

View file

@ -120,7 +120,7 @@ t_stat mp_8m_reset (DEVICE *dptr)
} }
for (j=0; j<8192; j++) { /* fill pattern for testing */ for (j=0; j<8192; j++) { /* fill pattern for testing */
val = (0xA0 | i); val = (0xA0 | i);
*(uint8 *)(uptr->filebuf + j) = val & 0xFF; *((uint8 *)(uptr->filebuf) + j) = val & 0xFF;
} }
} }
if (mp_8m_dev.dctrl & DEBUG_flow) if (mp_8m_dev.dctrl & DEBUG_flow)
@ -151,7 +151,7 @@ int32 mp_8m_get_mbyte(int32 addr)
org = uptr->u3; org = uptr->u3;
len = uptr->capac - 1; len = uptr->capac - 1;
if ((addr >= org) && (addr <= org + len)) { if ((addr >= org) && (addr <= org + len)) {
val = *(uint8 *)(uptr->filebuf + (addr - org)); val = *((uint8 *)(uptr->filebuf) + (addr - org));
if (mp_8m_dev.dctrl & DEBUG_read) if (mp_8m_dev.dctrl & DEBUG_read)
printf(" val=%04X\n", val); printf(" val=%04X\n", val);
return (val & 0xFF); return (val & 0xFF);
@ -177,7 +177,7 @@ int32 mp_8m_get_mword(int32 addr)
void mp_8m_put_mbyte(int32 addr, int32 val) void mp_8m_put_mbyte(int32 addr, int32 val)
{ {
int32 org, len, type; int32 org, len;
int32 i; int32 i;
UNIT *uptr; UNIT *uptr;
@ -188,7 +188,7 @@ void mp_8m_put_mbyte(int32 addr, int32 val)
org = uptr->u3; org = uptr->u3;
len = uptr->capac - 1; len = uptr->capac - 1;
if ((addr >= org) && (addr < org + len)) { if ((addr >= org) && (addr < org + len)) {
*(uint8 *)(uptr->filebuf + (addr - org)) = val & 0xFF; *((uint8 *)(uptr->filebuf) + (addr - org)) = val & 0xFF;
if (mp_8m_dev.dctrl & DEBUG_write) if (mp_8m_dev.dctrl & DEBUG_write)
printf("\n"); printf("\n");
return; return;