SCP: Added generic output routine sim_printf to output to stdout and sim_log (and sim_deb when enabled)

The goals here being to simplify calling code while getting consistent output delivered everywhere it may be useful.

Modified most places which explicitly used sim_log or merely called printf to now avoid doing that and merely call sim_printf().
This commit is contained in:
Mark Pizzolato 2014-03-28 08:20:05 -07:00
parent e81de979f6
commit 6ce8d99cd8
46 changed files with 332 additions and 498 deletions

View file

@ -1548,11 +1548,8 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) { /* loop thru dev */
(curr->ba < (dibp->ba + dibp->lnt))) || (curr->ba < (dibp->ba + dibp->lnt))) ||
((end >= dibp->ba) && /* overlap end? */ ((end >= dibp->ba) && /* overlap end? */
(end < (dibp->ba + dibp->lnt)))) { (end < (dibp->ba + dibp->lnt)))) {
printf ("Device %s address conflict at %08o\n", sim_printf ("Device %s address conflict at %08o\n",
sim_dname (dptr), dibp->ba); sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Device %s address conflict at %08o\n",
sim_dname (dptr), dibp->ba);
return TRUE; return TRUE;
} }
} }

View file

@ -383,7 +383,7 @@ switch (fmt) { /* case fmt */
return load_exe (fileref); return load_exe (fileref);
} }
printf ("Can't determine load file format\n"); sim_printf ("Can't determine load file format\n");
return SCPE_FMT; return SCPE_FMT;
} }

View file

@ -1185,9 +1185,7 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) {
if ((dptr->flags & DEV_DISABLE) && /* disable-able? */ if ((dptr->flags & DEV_DISABLE) && /* disable-able? */
!(dptr->flags & DEV_DIS) && /* enabled? */ !(dptr->flags & DEV_DIS) && /* enabled? */
((dptr->flags & mask) == 0)) { /* not allowed? */ ((dptr->flags & mask) == 0)) { /* not allowed? */
printf ("Disabling %s\n", sim_dname (dptr)); sim_printf ("Disabling %s\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "Disabling %s\n", sim_dname (dptr));
dptr->flags = dptr->flags | DEV_DIS; dptr->flags = dptr->flags | DEV_DIS;
} }
} }

View file

@ -1514,7 +1514,7 @@ controller->control_out_operations_completed = 0;
controller->ddcmp_control_packets_received = 0; controller->ddcmp_control_packets_received = 0;
controller->ddcmp_control_packets_sent = 0; controller->ddcmp_control_packets_sent = 0;
printf("Statistics reset\n" ); sim_printf("Statistics reset\n");
return SCPE_OK; return SCPE_OK;
} }
@ -2569,6 +2569,15 @@ if (!buffer) {
dmc_showddcmp (sim_log, controller->unit, 0, NULL); dmc_showddcmp (sim_log, controller->unit, 0, NULL);
fflush (sim_log); fflush (sim_log);
} }
if (sim_deb) {
fprintf (sim_deb, "DDCMP Buffer allocation failure.\n");
fprintf (sim_deb, "This is a fatal error which should never happen.\n");
fprintf (sim_deb, "Please submit this output when you report this bug.\n");
dmc_showqueues (sim_deb, controller->unit, 0, NULL);
dmc_showstats (sim_deb, controller->unit, 0, NULL);
dmc_showddcmp (sim_deb, controller->unit, 0, NULL);
fflush (sim_deb);
}
return buffer; return buffer;
} }
buffer->address = 0; buffer->address = 0;
@ -3741,9 +3750,7 @@ if (!cptr || !*cptr)
if (!(uptr->flags & UNIT_ATTABLE)) if (!(uptr->flags & UNIT_ATTABLE))
return SCPE_NOATT; return SCPE_NOATT;
if (!peer[0]) { if (!peer[0]) {
printf ("Peer must be specified before attach\n"); sim_printf ("Peer must be specified before attach\n");
if (sim_log)
fprintf (sim_log, "Peer must be specified before attach\n");
return SCPE_ARG; return SCPE_ARG;
} }
sprintf (attach_string, "Line=%d,Connect=%s,%s", dmc, peer, cptr); sprintf (attach_string, "Line=%d,Connect=%s,%s", dmc, peer, cptr);

View file

@ -1199,7 +1199,7 @@ sim_debug(DBG_TRC, dptr, "dup_reset()\n");
dup_desc.packet = TRUE; dup_desc.packet = TRUE;
if ((UNIBUS) && (dptr == &dpv_dev)) { if ((UNIBUS) && (dptr == &dpv_dev)) {
if (!(dptr->flags & DEV_DIS)) { if (!(dptr->flags & DEV_DIS)) {
printf ("Can't enable Qbus device on Unibus system\n"); sim_printf ("Can't enable Qbus device on Unibus system\n");
dptr->flags |= DEV_DIS; dptr->flags |= DEV_DIS;
return SCPE_ARG; return SCPE_ARG;
} }
@ -1208,7 +1208,7 @@ if ((UNIBUS) && (dptr == &dpv_dev)) {
if ((!UNIBUS) && (dptr == &dup_dev)) { if ((!UNIBUS) && (dptr == &dup_dev)) {
if (!(dptr->flags & DEV_DIS)) { if (!(dptr->flags & DEV_DIS)) {
printf ("Can't enable Unibus device on Qbus system\n"); sim_printf ("Can't enable Unibus device on Qbus system\n");
dptr->flags |= DEV_DIS; dptr->flags |= DEV_DIS;
return SCPE_ARG; return SCPE_ARG;
} }

View file

@ -769,14 +769,10 @@ if (r != SCPE_OK) { /* error? */
} }
if (sim_switches & SWMASK ('M')) { /* modem control? */ if (sim_switches & SWMASK ('M')) { /* modem control? */
dz_mctl = 1; dz_mctl = 1;
printf ("Modem control activated\n"); sim_printf ("Modem control activated\n");
if (sim_log)
fprintf (sim_log, "Modem control activated\n");
if (sim_switches & SWMASK ('A')) { /* autodisconnect? */ if (sim_switches & SWMASK ('A')) { /* autodisconnect? */
dz_auto = 1; dz_auto = 1;
printf ("Auto disconnect activated\n"); sim_printf ("Auto disconnect activated\n");
if (sim_log)
fprintf (sim_log, "Auto disconnect activated\n");
} }
} }

View file

@ -313,16 +313,10 @@ if (vec && !(sim_switches & SWMASK ('P'))) {
if (!cdname) { if (!cdname) {
cdname = "CPU"; cdname = "CPU";
} }
printf ("Device %s interrupt vector conflict with %s at ", sim_printf ("Device %s interrupt vector conflict with %s at ",
sim_dname (dptr), cdname); sim_dname (dptr), cdname);
fprint_val (stdout, (t_value) dibp->vec, DEV_RDX, 32, PV_LEFT); sim_print_val ((t_value) dibp->vec, DEV_RDX, 32, PV_LEFT);
printf ("\n"); sim_printf ("\n");
if (sim_log) {
fprintf (sim_log, "Device %s interrupt vector conflict with %s at ",
sim_dname (dptr), cdname);
fprint_val (sim_log, (t_value) dibp->vec, DEV_RDX, 32, PV_LEFT);
fprintf (sim_log, "\n");
}
return SCPE_STOP; return SCPE_STOP;
} }
} }
@ -336,11 +330,8 @@ for (i = 0; i < dibp->vnum; i++) { /* loop thru vec */
(int_ack[ilvl][ibit] != dibp->ack[i])) || (int_ack[ilvl][ibit] != dibp->ack[i])) ||
(int_vec[ilvl][ibit] && vec && (int_vec[ilvl][ibit] && vec &&
(int_vec[ilvl][ibit] != vec))) { (int_vec[ilvl][ibit] != vec))) {
printf ("Device %s interrupt slot conflict at %d\n", sim_printf ("Device %s interrupt slot conflict at %d\n",
sim_dname (dptr), idx); sim_dname (dptr), idx);
if (sim_log)
fprintf (sim_log, "Device %s interrupt slot conflict at %d\n",
sim_dname (dptr), idx);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->ack[i]) if (dibp->ack[i])
@ -373,15 +364,9 @@ for (i = 0; i < (int32) dibp->lnt; i = i + 2) { /* create entries */
if (!cdname) { if (!cdname) {
cdname = "CPU"; cdname = "CPU";
} }
printf ("Device %s address conflict with %s at ", sim_dname (dptr), cdname); sim_printf ("Device %s address conflict with %s at ", sim_dname (dptr), cdname);
fprint_val (stdout, (t_value) dibp->ba, DEV_RDX, 32, PV_LEFT); sim_print_val ((t_value) dibp->ba, DEV_RDX, 32, PV_LEFT);
printf ("\n"); sim_printf ("\n");
if (sim_log) {
fprintf (sim_log, "Device %s address conflict with %s at ", sim_dname (dptr),
cdname);
fprint_val (sim_log, (t_value) dibp->ba, DEV_RDX, 32, PV_LEFT);
fprintf (sim_log, "\n");
}
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */
@ -812,9 +797,7 @@ for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */
dptr->flags |= DEV_DIS; dptr->flags |= DEV_DIS;
if (sim_switches & SWMASK ('P')) if (sim_switches & SWMASK ('P'))
continue; continue;
printf ("%s device not compatible with system bus\n", sim_dname(dptr)); sim_printf ("%s device not compatible with system bus\n", sim_dname(dptr));
if (sim_log)
fprintf (sim_log, "%s device not compatible with system bus\n", sim_dname(dptr));
return SCPE_NOFNC; return SCPE_NOFNC;
} }
dibp = (DIB *) dptr->ctxt; /* get DIB */ dibp = (DIB *) dptr->ctxt; /* get DIB */

View file

@ -242,7 +242,7 @@ if ((ptr_unit.flags & UNIT_ATT) == 0)
if ((temp = getc (ptr_unit.fileref)) == EOF) { if ((temp = getc (ptr_unit.fileref)) == EOF) {
if (feof (ptr_unit.fileref)) { if (feof (ptr_unit.fileref)) {
if (ptr_stopioe) if (ptr_stopioe)
printf ("PTR end of file\n"); sim_printf ("PTR end of file\n");
else return SCPE_OK; else return SCPE_OK;
} }
else perror ("PTR I/O error"); else perror ("PTR I/O error");

View file

@ -908,11 +908,8 @@ if ((mbregR[idx] && dibp->rd && /* conflict? */
(mbregW[idx] != dibp->wr)) || (mbregW[idx] != dibp->wr)) ||
(mbabort[idx] && dibp->ack[0] && (mbabort[idx] && dibp->ack[0] &&
(mbabort[idx] != dibp->ack[0]))) { (mbabort[idx] != dibp->ack[0]))) {
printf ("Massbus %s assignment conflict at %d\n", sim_printf ("Massbus %s assignment conflict at %d\n",
sim_dname (dptr), dibp->ba); sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Massbus %s assignment conflict at %d\n",
sim_dname (dptr), dibp->ba);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */

View file

@ -1242,13 +1242,13 @@ if (uptr->filebuf == NULL) { /* can't alloc? */
return SCPE_MEM; return SCPE_MEM;
} }
fbuf = (uint32 *) uptr->filebuf; /* file buffer */ fbuf = (uint32 *) uptr->filebuf; /* file buffer */
printf ("%s%d: ", sim_dname (&dt_dev), u); sim_printf ("%s%d: ", sim_dname (&dt_dev), u);
if (uptr->flags & UNIT_8FMT) if (uptr->flags & UNIT_8FMT)
printf ("12b format"); sim_printf ("12b format");
else if (uptr->flags & UNIT_11FMT) else if (uptr->flags & UNIT_11FMT)
printf ("16b format"); sim_printf ("16b format");
else printf ("18b/36b format"); else sim_printf ("18b/36b format");
printf (", buffering file in memory\n"); sim_printf (", buffering file in memory\n");
uptr->io_flush = dt_flush; uptr->io_flush = dt_flush;
if (uptr->flags & UNIT_8FMT) { /* 12b? */ if (uptr->flags & UNIT_8FMT) { /* 12b? */
for (ba = 0; ba < uptr->capac; ) { /* loop thru file */ for (ba = 0; ba < uptr->capac; ) { /* loop thru file */
@ -1356,7 +1356,7 @@ if (sim_is_active (uptr)) { /* active? cancel op */
uptr->STATE = uptr->pos = 0; uptr->STATE = uptr->pos = 0;
} }
if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { /* any data? */ if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { /* any data? */
printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u); sim_printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u);
dt_flush (uptr); dt_flush (uptr);
} /* end if hwmark */ } /* end if hwmark */
free (uptr->filebuf); /* release buf */ free (uptr->filebuf); /* release buf */

View file

@ -2705,8 +2705,7 @@ t_stat xq_attach(UNIT* uptr, char* cptr)
char buf[32]; char buf[32];
eth_mac_fmt(&xq->var->mac, buf); /* format ethernet mac address */ eth_mac_fmt(&xq->var->mac, buf); /* format ethernet mac address */
printf("%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf); sim_printf("%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf);
if (sim_log) fprintf (sim_log, "%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf);
eth_close(xq->var->etherface); eth_close(xq->var->etherface);
free(tptr); free(tptr);
free(xq->var->etherface); free(xq->var->etherface);

View file

@ -1078,7 +1078,7 @@ int32 xu_command(CTLR* xu)
break; break;
default: /* Unknown (unimplemented) command. */ default: /* Unknown (unimplemented) command. */
printf("%s: unknown ancilliary command 0%o requested !\n", xu->dev->name, fnc); sim_printf("%s: unknown ancilliary command 0%o requested !\n", xu->dev->name, fnc);
return PCSR0_PCEI; return PCSR0_PCEI;
break; break;
@ -1497,8 +1497,7 @@ void xu_port_command (CTLR* xu)
case CMD_BOOT: /* BOOT */ case CMD_BOOT: /* BOOT */
/* not implemented */ /* not implemented */
msg = "%s: BOOT command not implemented!\n"; msg = "%s: BOOT command not implemented!\n";
printf (msg, xu->dev->name); sim_printf (msg, xu->dev->name);
if (sim_log) fprintf(sim_log, msg, xu->dev->name);
xu->var->pcsr0 |= PCSR0_PCEI; xu->var->pcsr0 |= PCSR0_PCEI;
break; break;
@ -1660,8 +1659,7 @@ t_stat xu_attach(UNIT* uptr, char* cptr)
char buf[32]; char buf[32];
eth_mac_fmt(&xu->var->mac, buf); /* format ethernet mac address */ eth_mac_fmt(&xu->var->mac, buf); /* format ethernet mac address */
printf("%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf); sim_printf("%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf);
if (sim_log) fprintf (sim_log, "%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf);
eth_close(xu->var->etherface); eth_close(xu->var->etherface);
free(tptr); free(tptr);
free(xu->var->etherface); free(xu->var->etherface);
@ -1760,7 +1758,7 @@ void xu_dump_rxring (CTLR* xu)
{ {
int i; int i;
int rrlen = xu->var->rrlen; int rrlen = xu->var->rrlen;
printf ("receive ring[%s]: base address: %08x headers: %d, header size: %d, current: %d\n", xu->dev->name, xu->var->rdrb, xu->var->rrlen, xu->var->relen, xu->var->rxnext); sim_printf ("receive ring[%s]: base address: %08x headers: %d, header size: %d, current: %d\n", xu->dev->name, xu->var->rdrb, xu->var->rrlen, xu->var->relen, xu->var->rxnext);
for (i=0; i<rrlen; i++) { for (i=0; i<rrlen; i++) {
uint16 rxhdr[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; uint16 rxhdr[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
uint32 ba = xu->var->rdrb + (xu->var->relen * 2) * i; uint32 ba = xu->var->rdrb + (xu->var->relen * 2) * i;
@ -1769,7 +1767,7 @@ void xu_dump_rxring (CTLR* xu)
int len = rxhdr[0]; int len = rxhdr[0];
uint32 addr = rxhdr[1] + ((rxhdr[2] & 3) << 16); uint32 addr = rxhdr[1] + ((rxhdr[2] & 3) << 16);
if (rstatus == 0) if (rstatus == 0)
printf (" header[%d]: own:%d, len:%d, address:%08x data:{%04x,%04x,%04x,%04x}\n", i, own, len, addr, rxhdr[0], rxhdr[1], rxhdr[2], rxhdr[3]); sim_printf (" header[%d]: own:%d, len:%d, address:%08x data:{%04x,%04x,%04x,%04x}\n", i, own, len, addr, rxhdr[0], rxhdr[1], rxhdr[2], rxhdr[3]);
} }
} }
@ -1777,7 +1775,7 @@ void xu_dump_txring (CTLR* xu)
{ {
int i; int i;
int trlen = xu->var->trlen; int trlen = xu->var->trlen;
printf ("transmit ring[%s]: base address: %08x headers: %d, header size: %d, current: %d\n", xu->dev->name, xu->var->tdrb, xu->var->trlen, xu->var->telen, xu->var->txnext); sim_printf ("transmit ring[%s]: base address: %08x headers: %d, header size: %d, current: %d\n", xu->dev->name, xu->var->tdrb, xu->var->trlen, xu->var->telen, xu->var->txnext);
for (i=0; i<trlen; i++) { for (i=0; i<trlen; i++) {
uint16 txhdr[4]; uint16 txhdr[4];
uint32 ba = xu->var->tdrb + (xu->var->telen * 2) * i; uint32 ba = xu->var->tdrb + (xu->var->telen * 2) * i;
@ -1786,7 +1784,7 @@ void xu_dump_txring (CTLR* xu)
int len = txhdr[0]; int len = txhdr[0];
uint32 addr = txhdr[1] + ((txhdr[2] & 3) << 16); uint32 addr = txhdr[1] + ((txhdr[2] & 3) << 16);
if (tstatus == 0) if (tstatus == 0)
printf (" header[%d]: own:%d, len:%d, address:%08x data:{%04x,%04x,%04x,%04x}\n", i, own, len, addr, txhdr[0], txhdr[1], txhdr[2], txhdr[3]); sim_printf (" header[%d]: own:%d, len:%d, address:%08x data:{%04x,%04x,%04x,%04x}\n", i, own, len, addr, txhdr[0], txhdr[1], txhdr[2], txhdr[3]);
} }
} }

View file

@ -2259,11 +2259,8 @@ for (i = p = 0; (dptr = sim_devices[i]) != NULL; i++) { /* add devices *
for (j = 0; j < dibp->num; j++) { /* loop thru disp */ for (j = 0; j < dibp->num; j++) { /* loop thru disp */
if (dibp->dsp[j]) { /* any dispatch? */ if (dibp->dsp[j]) { /* any dispatch? */
if (dev_tab[dibp->dev + j]) { /* already filled? */ if (dev_tab[dibp->dev + j]) { /* already filled? */
printf ("%s device number conflict at %02o\n", sim_printf ("%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j); sim_dname (dptr), dibp->dev + j);
if (sim_log)
fprintf (sim_log, "%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j);
return TRUE; return TRUE;
} }
dev_tab[dibp->dev + j] = dibp->dsp[j]; /* fill */ dev_tab[dibp->dev + j] = dibp->dsp[j]; /* fill */

View file

@ -1436,13 +1436,13 @@ if (uptr->filebuf == NULL) { /* can't alloc? */
return SCPE_MEM; return SCPE_MEM;
} }
fbuf = (uint32 *) uptr->filebuf; /* file buffer */ fbuf = (uint32 *) uptr->filebuf; /* file buffer */
printf ("%s%d: ", sim_dname (&dt_dev), u); sim_printf ("%s%d: ", sim_dname (&dt_dev), u);
if (uptr->flags & UNIT_8FMT) if (uptr->flags & UNIT_8FMT)
printf ("12b format"); sim_printf ("12b format");
else if (uptr->flags & UNIT_11FMT) else if (uptr->flags & UNIT_11FMT)
printf ("16b format"); sim_printf ("16b format");
else printf ("18b/36b format"); else sim_printf ("18b/36b format");
printf (", buffering file in memory\n"); sim_printf (", buffering file in memory\n");
uptr->io_flush = dt_flush; uptr->io_flush = dt_flush;
if (uptr->flags & UNIT_8FMT) { /* 12b? */ if (uptr->flags & UNIT_8FMT) { /* 12b? */
for (ba = 0; ba < uptr->capac; ) { /* loop thru file */ for (ba = 0; ba < uptr->capac; ) { /* loop thru file */
@ -1548,7 +1548,7 @@ if (sim_is_active (uptr)) {
uptr->STATE = uptr->pos = 0; uptr->STATE = uptr->pos = 0;
} }
if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { /* any data? */ if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { /* any data? */
printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u); sim_printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u);
dt_flush (uptr); dt_flush (uptr);
} /* end if hwmark */ } /* end if hwmark */
free (uptr->filebuf); /* release buf */ free (uptr->filebuf); /* release buf */

View file

@ -573,7 +573,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { /* end of file? */
#endif #endif
if (feof (ptr_unit.fileref)) { if (feof (ptr_unit.fileref)) {
if (ptr_stopioe) if (ptr_stopioe)
printf ("PTR end of file\n"); sim_printf ("PTR end of file\n");
else return SCPE_OK; else return SCPE_OK;
} }
else perror ("PTR I/O error"); else perror ("PTR I/O error");

View file

@ -1499,12 +1499,9 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) { /* add devices */
for (j = 0; j < dibp->num; j++) { /* loop thru disp */ for (j = 0; j < dibp->num; j++) { /* loop thru disp */
if (dibp->dsp[j]) { /* any dispatch? */ if (dibp->dsp[j]) { /* any dispatch? */
if (dev_tab[dibp->dev + j]) { /* already filled? */ if (dev_tab[dibp->dev + j]) { /* already filled? */
printf ("%s device number conflict at %02o\n", sim_printf ("%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j); sim_dname (dptr), dibp->dev + j);
if (sim_log) return TRUE;
fprintf (sim_log, "%s device number conflict at %02o\n",
sim_dname (dptr), dibp->dev + j);
return TRUE;
} }
dev_tab[dibp->dev + j] = dibp->dsp[j]; /* fill */ dev_tab[dibp->dev + j] = dibp->dsp[j]; /* fill */
} /* end if dsp */ } /* end if dsp */

View file

@ -1234,13 +1234,13 @@ if (uptr->filebuf == NULL) { /* can't alloc? */
return SCPE_MEM; return SCPE_MEM;
} }
fbuf = (uint16 *) uptr->filebuf; /* file buffer */ fbuf = (uint16 *) uptr->filebuf; /* file buffer */
printf ("%s%d: ", sim_dname (&dt_dev), u); sim_printf ("%s%d: ", sim_dname (&dt_dev), u);
if (uptr->flags & UNIT_8FMT) if (uptr->flags & UNIT_8FMT)
printf ("12b format"); sim_printf ("12b format");
else if (uptr->flags & UNIT_11FMT) else if (uptr->flags & UNIT_11FMT)
printf ("16b format"); sim_printf ("16b format");
else printf ("18b/36b format"); else sim_printf ("18b/36b format");
printf (", buffering file in memory\n"); sim_printf (", buffering file in memory\n");
uptr->io_flush = dt_flush; uptr->io_flush = dt_flush;
if (uptr->flags & UNIT_8FMT) /* 12b? */ if (uptr->flags & UNIT_8FMT) /* 12b? */
uptr->hwmark = fxread (uptr->filebuf, sizeof (uint16), uptr->hwmark = fxread (uptr->filebuf, sizeof (uint16),
@ -1332,7 +1332,7 @@ if (sim_is_active (uptr)) {
uptr->STATE = uptr->pos = 0; uptr->STATE = uptr->pos = 0;
} }
if (uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any data? */ if (uptr->hwmark && ((uptr->flags & UNIT_RO)== 0)) { /* any data? */
printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u); sim_printf ("%s%d: writing buffer to file\n", sim_dname (&dt_dev), u);
dt_flush (uptr); dt_flush (uptr);
} /* end if hwmark */ } /* end if hwmark */
free (uptr->filebuf); /* release buf */ free (uptr->filebuf); /* release buf */

View file

@ -196,12 +196,14 @@ int32 sections_read = 0;
for (;;) { for (;;) {
csum = origin = field = newf = 0; /* init */ csum = origin = field = newf = 0; /* init */
do { /* skip leader */ do { /* skip leader */
if ((hi = sim_bin_getc (fi, &newf)) == EOF) if ((hi = sim_bin_getc (fi, &newf)) == EOF) {
if (sections_read != 0) { if (sections_read != 0) {
printf ("%d sections sucessfully read\n\r", sections_read); sim_printf ("%d sections sucessfully read\n\r", sections_read);
return SCPE_OK; return SCPE_OK;
} else }
else
return SCPE_FMT; return SCPE_FMT;
}
} while ((hi == 0) || (hi >= 0200)); } while ((hi == 0) || (hi >= 0200));
for (;;) { /* data blocks */ for (;;) { /* data blocks */
if ((lo = sim_bin_getc (fi, &newf)) == EOF) /* low char */ if ((lo = sim_bin_getc (fi, &newf)) == EOF) /* low char */
@ -213,7 +215,7 @@ for (;;) {
if (hi == 0200) { /* end of tape? */ if (hi == 0200) { /* end of tape? */
if ((csum - wd) & 07777) { /* valid csum? */ if ((csum - wd) & 07777) { /* valid csum? */
if (sections_read != 0) if (sections_read != 0)
printf ("%d sections sucessfully read\n\r", sections_read); sim_printf ("%d sections sucessfully read\n\r", sections_read);
return SCPE_CSUM; return SCPE_CSUM;
} }
if (!(sim_switches & SWMASK ('A'))) /* Load all sections? */ if (!(sim_switches & SWMASK ('A'))) /* Load all sections? */

View file

@ -982,11 +982,8 @@ for (i = 0; (dptr = sim_devices[i]); i++) { /* loop thru devices */
for (j = 0; j < tplp->num; j++) { /* repeat as needed */ for (j = 0; j < tplp->num; j++) { /* repeat as needed */
doff = dev + tplp->off + j; /* get offset dnum */ doff = dev + tplp->off + j; /* get offset dnum */
if (dev_map[doff][ch]) { /* slot in use? */ if (dev_map[doff][ch]) { /* slot in use? */
printf ("Device number conflict, chan = %s, devno = %02o\n", sim_printf ("Device number conflict, chan = %s, devno = %02o\n",
chname[ch], doff); chname[ch], doff);
if (sim_log)
fprintf (sim_log, "Device number conflict, chan = %s, dev = %02o\n",
chname[ch], doff);
return TRUE; return TRUE;
} }
dev_map[doff][ch] = dibp->xfr; /* set xfr flag */ dev_map[doff][ch] = dibp->xfr; /* set xfr flag */

View file

@ -278,7 +278,7 @@ if ((temp = getc (ptr_unit.fileref)) == EOF) { /* end of file? */
ptr_set_err (); /* yes, err, disc */ ptr_set_err (); /* yes, err, disc */
if (feof (ptr_unit.fileref)) { /* end of file? */ if (feof (ptr_unit.fileref)) { /* end of file? */
if (ptr_stopioe) if (ptr_stopioe)
printf ("PTR end of file\n"); sim_printf ("PTR end of file\n");
else return SCPE_OK; else return SCPE_OK;
} }
else perror ("PTR I/O error"); /* I/O error */ else perror ("PTR I/O error"); /* I/O error */

View file

@ -379,9 +379,7 @@ t_stat r;
r = vax610_boot_parse (flag, ptr); /* parse the boot cmd */ r = vax610_boot_parse (flag, ptr); /* parse the boot cmd */
if (r != SCPE_OK) { /* error? */ if (r != SCPE_OK) { /* error? */
if (r >= SCPE_BASE) { /* message available? */ if (r >= SCPE_BASE) { /* message available? */
printf ("%s\n", sim_error_text (r)); sim_printf ("%s\n", sim_error_text (r));
if (sim_log)
fprintf (sim_log, "%s\n", sim_error_text (r));
r |= SCPE_NOMESSAGE; r |= SCPE_NOMESSAGE;
} }
return r; return r;
@ -504,9 +502,7 @@ if ((cpu_boot_cmd[0] == 0) || /* saved boot cmd? */
(reset_all (0) != SCPE_OK) || /* reset the world */ (reset_all (0) != SCPE_OK) || /* reset the world */
(cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */ (cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */
ABORT (STOP_BOOT); /* any error? */ ABORT (STOP_BOOT); /* any error? */
printf ("Rebooting...\n"); sim_printf ("Rebooting...\n");
if (sim_log)
fprintf (sim_log, "Rebooting...\n");
return cc; return cc;
} }

View file

@ -489,7 +489,7 @@ switch (opcode) {
case TD_OPDAT: case TD_OPDAT:
if (td_state != TD_WRITE1) { /* expecting data? */ if (td_state != TD_WRITE1) { /* expecting data? */
printf("TU58 protocol error 1\n"); sim_printf("TU58 protocol error 1\n");
return; return;
} }
if (td_ibptr < 2) { /* whole packet read? */ if (td_ibptr < 2) { /* whole packet read? */
@ -502,7 +502,7 @@ switch (opcode) {
case TD_OPCMD: case TD_OPCMD:
if (td_state != TD_IDLE) { /* expecting command? */ if (td_state != TD_IDLE) { /* expecting command? */
printf("TU58 protocol error 2\n"); sim_printf("TU58 protocol error 2\n");
return; return;
} }
if (td_ibptr < 2) { /* whole packet read? */ if (td_ibptr < 2) { /* whole packet read? */
@ -521,7 +521,7 @@ switch (opcode) {
break; break;
case TD_CMDINI: case TD_CMDINI:
printf("Warning: TU58 command 'INIT' not implemented\n"); sim_printf("Warning: TU58 command 'INIT' not implemented\n");
break; break;
case TD_CMDRD: case TD_CMDRD:
@ -543,11 +543,11 @@ switch (opcode) {
break; break;
case TD_CMDPOS: case TD_CMDPOS:
printf("Warning: TU58 command 'Position' not implemented\n"); sim_printf("Warning: TU58 command 'Position' not implemented\n");
break; break;
case TD_CMDDIA: case TD_CMDDIA:
printf("Warning: TU58 command 'Diagnose' not implemented\n"); sim_printf("Warning: TU58 command 'Diagnose' not implemented\n");
break; break;
case TD_CMDMRSP: /* MRSP supported? */ case TD_CMDMRSP: /* MRSP supported? */
@ -574,7 +574,7 @@ switch (opcode) {
case TD_OPBOO: case TD_OPBOO:
if (td_state != TD_IDLE) { if (td_state != TD_IDLE) {
printf("TU58 protocol error 3\n"); sim_printf("TU58 protocol error 3\n");
return; return;
} }
if (td_ibptr < 2) { /* whole packet read? */ if (td_ibptr < 2) { /* whole packet read? */

View file

@ -465,9 +465,7 @@ if ((cpu_boot_cmd[0] == 0) || /* saved boot cmd? */
(reset_all (0) != SCPE_OK) || /* reset the world */ (reset_all (0) != SCPE_OK) || /* reset the world */
(cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */ (cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */
ABORT (STOP_BOOT); /* any error? */ ABORT (STOP_BOOT); /* any error? */
printf ("Rebooting...\n"); sim_printf ("Rebooting...\n");
if (sim_log)
fprintf (sim_log, "Rebooting...\n");
return cc; return cc;
} }
@ -485,9 +483,7 @@ t_stat r;
r = vax730_boot_parse (flag, ptr); /* parse the boot cmd */ r = vax730_boot_parse (flag, ptr); /* parse the boot cmd */
if (r != SCPE_OK) { /* error? */ if (r != SCPE_OK) { /* error? */
if (r >= SCPE_BASE) { /* message available? */ if (r >= SCPE_BASE) { /* message available? */
printf ("%s\n", sim_error_text (r)); sim_printf ("%s\n", sim_error_text (r));
if (sim_log)
fprintf (sim_log, "%s\n", sim_error_text (r));
r |= SCPE_NOMESSAGE; r |= SCPE_NOMESSAGE;
} }
return r; return r;
@ -633,9 +629,7 @@ if ((nexusR[idx] && dibp->rd && /* conflict? */
(nexusR[idx] != dibp->rd)) || (nexusR[idx] != dibp->rd)) ||
(nexusW[idx] && dibp->wr && (nexusW[idx] && dibp->wr &&
(nexusW[idx] != dibp->wr))) { (nexusW[idx] != dibp->wr))) {
printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba); sim_printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */

View file

@ -192,7 +192,7 @@ t_stat uba_rdreg (int32 *val, int32 pa, int32 lnt)
int32 idx, ofs; int32 idx, ofs;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>UBA: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>UBA: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt);
// **FIXME** - Set error bit? // **FIXME** - Set error bit?
return SCPE_OK; return SCPE_OK;
} }
@ -243,7 +243,7 @@ t_stat uba_wrreg (int32 val, int32 pa, int32 lnt)
int32 idx, ofs; int32 idx, ofs;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>UBA: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>UBA: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt);
// **FIXME** - Set error bit? // **FIXME** - Set error bit?
return SCPE_OK; return SCPE_OK;
} }
@ -335,7 +335,7 @@ if ((lnt == L_BYTE) || /* byte? */
iod = iod << 16; iod = iod << 16;
} }
else { else {
printf (">>UBA: invalid read mask, pa = %x, lnt = %d\n", pa, lnt); sim_printf (">>UBA: invalid read mask, pa = %x, lnt = %d\n", pa, lnt);
// **FIXME** - Set error bit? // **FIXME** - Set error bit?
iod = 0; iod = 0;
} }
@ -360,7 +360,7 @@ if (lnt == L_BYTE) /* byte? DATOB */
else if ((lnt == L_WORD) && ((pa & 1) == 0)) /* aligned word? */ else if ((lnt == L_WORD) && ((pa & 1) == 0)) /* aligned word? */
WriteUb (pa, val, WRITE); /* DATO */ WriteUb (pa, val, WRITE); /* DATO */
else { else {
printf (">>UBA: invalid write mask, pa = %x, lnt = %d\n", pa, lnt); sim_printf (">>UBA: invalid write mask, pa = %x, lnt = %d\n", pa, lnt);
// **FIXME** - Set error bit? // **FIXME** - Set error bit?
} }
SET_IRQL; /* update ints */ SET_IRQL; /* update ints */

View file

@ -549,9 +549,7 @@ if ((cpu_boot_cmd[0] == 0) || /* saved boot cmd? */
(reset_all (0) != SCPE_OK) || /* reset the world */ (reset_all (0) != SCPE_OK) || /* reset the world */
(cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */ (cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */
ABORT (STOP_BOOT); /* any error? */ ABORT (STOP_BOOT); /* any error? */
printf ("Rebooting...\n"); sim_printf ("Rebooting...\n");
if (sim_log)
fprintf (sim_log, "Rebooting...\n");
return cc; return cc;
} }
@ -569,9 +567,7 @@ t_stat r;
r = vax750_boot_parse (flag, ptr); /* parse the boot cmd */ r = vax750_boot_parse (flag, ptr); /* parse the boot cmd */
if (r != SCPE_OK) { /* error? */ if (r != SCPE_OK) { /* error? */
if (r >= SCPE_BASE) { /* message available? */ if (r >= SCPE_BASE) { /* message available? */
printf ("%s\n", sim_error_text (r)); sim_printf ("%s\n", sim_error_text (r));
if (sim_log)
fprintf (sim_log, "%s\n", sim_error_text (r));
r |= SCPE_NOMESSAGE; r |= SCPE_NOMESSAGE;
} }
return r; return r;
@ -720,9 +716,7 @@ if ((nexusR[idx] && dibp->rd && /* conflict? */
(nexusR[idx] != dibp->rd)) || (nexusR[idx] != dibp->rd)) ||
(nexusW[idx] && dibp->wr && (nexusW[idx] && dibp->wr &&
(nexusW[idx] != dibp->wr))) { (nexusW[idx] != dibp->wr))) {
printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba); sim_printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */

View file

@ -487,7 +487,7 @@ switch (opcode) {
case TD_OPDAT: case TD_OPDAT:
if (td_state != TD_WRITE1) { /* expecting data? */ if (td_state != TD_WRITE1) { /* expecting data? */
printf("TU58 protocol error 1\n"); sim_printf("TU58 protocol error 1\n");
return; return;
} }
if (td_ibptr < 2) { /* whole packet read? */ if (td_ibptr < 2) { /* whole packet read? */
@ -500,7 +500,7 @@ switch (opcode) {
case TD_OPCMD: case TD_OPCMD:
if (td_state != TD_IDLE) { /* expecting command? */ if (td_state != TD_IDLE) { /* expecting command? */
printf("TU58 protocol error 2\n"); sim_printf("TU58 protocol error 2\n");
return; return;
} }
if (td_ibptr < 2) { /* whole packet read? */ if (td_ibptr < 2) { /* whole packet read? */
@ -518,7 +518,7 @@ switch (opcode) {
break; break;
case TD_CMDINI: case TD_CMDINI:
printf("Warning: TU58 command 'INIT' not implemented\n"); sim_printf("Warning: TU58 command 'INIT' not implemented\n");
break; break;
case TD_CMDRD: case TD_CMDRD:
@ -538,11 +538,11 @@ switch (opcode) {
break; break;
case TD_CMDPOS: case TD_CMDPOS:
printf("Warning: TU58 command 'Position' not implemented\n"); sim_printf("Warning: TU58 command 'Position' not implemented\n");
break; break;
case TD_CMDDIA: case TD_CMDDIA:
printf("Warning: TU58 command 'Diagnose' not implemented\n"); sim_printf("Warning: TU58 command 'Diagnose' not implemented\n");
break; break;
case TD_CMDMRSP: case TD_CMDMRSP:
@ -568,7 +568,7 @@ switch (opcode) {
case TD_OPBOO: case TD_OPBOO:
if (td_state != TD_IDLE) { if (td_state != TD_IDLE) {
printf("TU58 protocol error 3\n"); sim_printf("TU58 protocol error 3\n");
return; return;
} }
if (td_ibptr < 2) { /* whole packet read? */ if (td_ibptr < 2) { /* whole packet read? */

View file

@ -193,7 +193,7 @@ t_stat uba_rdreg (int32 *val, int32 pa, int32 lnt)
int32 idx, ofs; int32 idx, ofs;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>UBA: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>UBA: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt);
/* FIXME: set appropriate error bits */ /* FIXME: set appropriate error bits */
return SCPE_OK; return SCPE_OK;
} }
@ -242,7 +242,7 @@ t_stat uba_wrreg (int32 val, int32 pa, int32 lnt)
int32 idx, ofs; int32 idx, ofs;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>UBA: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>UBA: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt);
/* FIXME: set appropriate error bits */ /* FIXME: set appropriate error bits */
return SCPE_OK; return SCPE_OK;
} }
@ -339,7 +339,7 @@ if ((lnt == L_BYTE) || /* byte? */
iod = iod << 16; iod = iod << 16;
} }
else { else {
printf (">>UBA: invalid read mask, pa = %x, lnt = %d\n", pa, lnt); sim_printf (">>UBA: invalid read mask, pa = %x, lnt = %d\n", pa, lnt);
/* FIXME: set appropriate error bits */ /* FIXME: set appropriate error bits */
iod = 0; iod = 0;
} }
@ -364,7 +364,7 @@ if (lnt == L_BYTE) /* byte? DATOB */
else if ((lnt == L_WORD) && ((pa & 1) == 0)) /* aligned word? */ else if ((lnt == L_WORD) && ((pa & 1) == 0)) /* aligned word? */
WriteUb (pa, val, WRITE); /* DATO */ WriteUb (pa, val, WRITE); /* DATO */
else { else {
printf (">>UBA: invalid write mask, pa = %x, lnt = %d\n", pa, lnt); sim_printf (">>UBA: invalid write mask, pa = %x, lnt = %d\n", pa, lnt);
/* FIXME: set appropriate error bits */ /* FIXME: set appropriate error bits */
} }
SET_IRQL; /* update ints */ SET_IRQL; /* update ints */

View file

@ -168,7 +168,7 @@ int32 mctl, ofs;
t_bool extmem = MEMSIZE > MAXMEMSIZE; t_bool extmem = MEMSIZE > MAXMEMSIZE;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>MCTL: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>MCTL: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt);
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
return SCPE_OK; return SCPE_OK;
} }
@ -213,7 +213,7 @@ int32 mctl, ofs, mask;
t_bool extmem = MEMSIZE > MAXMEMSIZE; t_bool extmem = MEMSIZE > MAXMEMSIZE;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>MCTL: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>MCTL: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt);
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
return SCPE_OK; return SCPE_OK;
} }

View file

@ -615,9 +615,7 @@ if ((cpu_boot_cmd[0] == 0) || /* saved boot cmd? */
(reset_all (0) != SCPE_OK) || /* reset the world */ (reset_all (0) != SCPE_OK) || /* reset the world */
(cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */ (cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */
ABORT (STOP_BOOT); /* any error? */ ABORT (STOP_BOOT); /* any error? */
printf ("Rebooting...\n"); sim_printf ("Rebooting...\n");
if (sim_log)
fprintf (sim_log, "Rebooting...\n");
return cc; return cc;
} }
@ -635,9 +633,7 @@ t_stat r;
r = vax780_boot_parse (flag, ptr); /* parse the boot cmd */ r = vax780_boot_parse (flag, ptr); /* parse the boot cmd */
if (r != SCPE_OK) { /* error? */ if (r != SCPE_OK) { /* error? */
if (r >= SCPE_BASE) { /* message available? */ if (r >= SCPE_BASE) { /* message available? */
printf ("%s\n", sim_error_text (r)); sim_printf ("%s\n", sim_error_text (r));
if (sim_log)
fprintf (sim_log, "%s\n", sim_error_text (r));
r |= SCPE_NOMESSAGE; r |= SCPE_NOMESSAGE;
} }
return r; return r;
@ -792,9 +788,7 @@ if ((nexusR[idx] && dibp->rd && /* conflict? */
(nexusR[idx] != dibp->rd)) || (nexusR[idx] != dibp->rd)) ||
(nexusW[idx] && dibp->wr && (nexusW[idx] && dibp->wr &&
(nexusW[idx] != dibp->wr))) { (nexusW[idx] != dibp->wr))) {
printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba); sim_printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */

View file

@ -304,7 +304,7 @@ t_stat uba_rdreg (int32 *val, int32 pa, int32 lnt)
int32 idx, ofs; int32 idx, ofs;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>UBA: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>UBA: invalid adapter read mask, pa = %X, lnt = %d\r\n", pa, lnt);
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
return SCPE_OK; return SCPE_OK;
} }
@ -393,7 +393,7 @@ t_stat uba_wrreg (int32 val, int32 pa, int32 lnt)
int32 idx, ofs, old_cr; int32 idx, ofs, old_cr;
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>UBA: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt); sim_printf (">>UBA: invalid adapter write mask, pa = %X, lnt = %d\r\n", pa, lnt);
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
return SCPE_OK; return SCPE_OK;
} }
@ -526,7 +526,7 @@ if ((lnt == L_BYTE) || /* byte? */
iod = iod << 16; iod = iod << 16;
} }
else { else {
printf (">>UBA: invalid read mask, pa = %x, lnt = %d\n", pa, lnt); sim_printf (">>UBA: invalid read mask, pa = %x, lnt = %d\n", pa, lnt);
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
iod = 0; iod = 0;
} }
@ -551,7 +551,7 @@ if (lnt == L_BYTE) /* byte? DATOB */
else if ((lnt == L_WORD) && ((pa & 1) == 0)) /* aligned word? */ else if ((lnt == L_WORD) && ((pa & 1) == 0)) /* aligned word? */
WriteUb (pa, val, WRITE); /* DATO */ WriteUb (pa, val, WRITE); /* DATO */
else { else {
printf (">>UBA: invalid write mask, pa = %x, lnt = %d\n", pa, lnt); sim_printf (">>UBA: invalid write mask, pa = %x, lnt = %d\n", pa, lnt);
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
} }
SET_IRQL; /* update ints */ SET_IRQL; /* update ints */

View file

@ -366,7 +366,7 @@ t_stat r;
mb = NEXUS_GETNEX (pa) - TR_MBA0; /* get MBA */ mb = NEXUS_GETNEX (pa) - TR_MBA0; /* get MBA */
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>MBA%d: invalid adapter read mask, pa = 0x%X, lnt = %d\r\n", mb, pa, lnt); sim_printf (">>MBA%d: invalid adapter read mask, pa = 0x%X, lnt = %d\r\n", mb, pa, lnt);
#if defined(VAX_780) #if defined(VAX_780)
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
#endif #endif
@ -460,7 +460,7 @@ t_bool cs1dt;
mb = NEXUS_GETNEX (pa) - TR_MBA0; /* get MBA */ mb = NEXUS_GETNEX (pa) - TR_MBA0; /* get MBA */
if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */ if ((pa & 3) || (lnt != L_LONG)) { /* unaligned or not lw? */
printf (">>MBA%d: invalid adapter write mask, pa = 0x%X, lnt = %d\r\n", mb, pa, lnt); sim_printf (">>MBA%d: invalid adapter write mask, pa = 0x%X, lnt = %d\r\n", mb, pa, lnt);
#if defined(VAX_780) #if defined(VAX_780)
sbi_set_errcnf (); /* err confirmation */ sbi_set_errcnf (); /* err confirmation */
#endif #endif
@ -935,11 +935,8 @@ if ((mbregR[idx] && dibp->rd && /* conflict? */
(mbregW[idx] != dibp->wr)) || (mbregW[idx] != dibp->wr)) ||
(mbabort[idx] && dibp->ack[0] && (mbabort[idx] && dibp->ack[0] &&
(mbabort[idx] != dibp->ack[0]))) { (mbabort[idx] != dibp->ack[0]))) {
printf ("Massbus %s assignment conflict at %d\n", sim_printf ("Massbus %s assignment conflict at %d\n",
sim_dname (dptr), dibp->ba); sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Massbus %s assignment conflict at %d\n",
sim_dname (dptr), dibp->ba);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */

View file

@ -682,9 +682,7 @@ if ((cpu_boot_cmd[0] == 0) || /* saved boot cmd? */
(reset_all (0) != SCPE_OK) || /* reset the world */ (reset_all (0) != SCPE_OK) || /* reset the world */
(cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */ (cpu_boot (0, NULL) != SCPE_OK)) /* set up boot code */
ABORT (STOP_BOOT); /* any error? */ ABORT (STOP_BOOT); /* any error? */
printf ("Rebooting...\n"); sim_printf ("Rebooting...\n");
if (sim_log)
fprintf (sim_log, "Rebooting...\n");
return cc; return cc;
} }
@ -702,9 +700,7 @@ t_stat r;
r = vax860_boot_parse (flag, ptr); /* parse the boot cmd */ r = vax860_boot_parse (flag, ptr); /* parse the boot cmd */
if (r != SCPE_OK) { /* error? */ if (r != SCPE_OK) { /* error? */
if (r >= SCPE_BASE) { /* message available? */ if (r >= SCPE_BASE) { /* message available? */
printf ("%s\n", sim_error_text (r)); sim_printf ("%s\n", sim_error_text (r));
if (sim_log)
fprintf (sim_log, "%s\n", sim_error_text (r));
r |= SCPE_NOMESSAGE; r |= SCPE_NOMESSAGE;
} }
return r; return r;

View file

@ -186,7 +186,7 @@ void sbia_wr (int32 pa, int32 val, int32 lnt)
break; break;
case 1: /* SBICSR */ case 1: /* SBICSR */
printf ("sbi_csr wr: %08X\n", val); sim_printf ("sbi_csr wr: %08X\n", val);
sbi_csr = sbi_csr & SBICSR_WR; sbi_csr = sbi_csr & SBICSR_WR;
break; break;
@ -350,9 +350,7 @@ if ((nexusR[idx] && dibp->rd && /* conflict? */
(nexusR[idx] != dibp->rd)) || (nexusR[idx] != dibp->rd)) ||
(nexusW[idx] && dibp->wr && (nexusW[idx] && dibp->wr &&
(nexusW[idx] != dibp->wr))) { (nexusW[idx] != dibp->wr))) {
printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba); sim_printf ("Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
if (sim_log)
fprintf (sim_log, "Nexus %s conflict at %d\n", sim_dname (dptr), dibp->ba);
return SCPE_STOP; return SCPE_STOP;
} }
if (dibp->rd) /* set rd dispatch */ if (dibp->rd) /* set rd dispatch */

View file

@ -558,7 +558,7 @@ switch (fnc) {
break; break;
default: default:
printf ("CS: Unknown Command: %d\n", fnc); sim_printf ("CS: Unknown Command: %d\n", fnc);
} }
} }
@ -1073,7 +1073,7 @@ else switch (lc_fnc) { /* idle, case */
break; break;
default: /* all others */ default: /* all others */
printf ("TTO3: Unknown console command: %X\n", lc_fnc); sim_printf ("TTO3: Unknown console command: %X\n", lc_fnc);
break; break;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -3514,9 +3514,7 @@ t_stat cpu_load_bootcode (const char *filename, const unsigned char *builtin_cod
char args[CBUFSIZE]; char args[CBUFSIZE];
t_stat r; t_stat r;
printf ("Loading boot code from %s\n", filename); sim_printf ("Loading boot code from %s\n", filename);
if (sim_log)
fprintf (sim_log, "Loading boot code from %s\n", filename);
if (rom) if (rom)
sprintf (args, "-R %s", filename); sprintf (args, "-R %s", filename);
else else
@ -3527,14 +3525,10 @@ if (r != SCPE_OK) {
FILE *f; FILE *f;
if ((f = sim_fopen (filename, "wb"))) { if ((f = sim_fopen (filename, "wb"))) {
printf ("Saving boot code to %s\n", filename); sim_printf ("Saving boot code to %s\n", filename);
if (sim_log)
fprintf (sim_log, "Saving boot code to %s\n", filename);
sim_fwrite ((void *)builtin_code, 1, size, f); sim_fwrite ((void *)builtin_code, 1, size, f);
fclose (f); fclose (f);
printf ("Loading boot code from %s\n", filename); sim_printf ("Loading boot code from %s\n", filename);
if (sim_log)
fprintf (sim_log, "Loading boot code from %s\n", filename);
r = load_cmd (0, args); r = load_cmd (0, args);
} }
} }

View file

@ -354,7 +354,7 @@ if (lk_rbuf[0] & 1) { /* peripheral command */
break; break;
default: default:
printf ("lk: unknown cmd %02X\n", lk_rbuf[0]); sim_printf ("lk: unknown cmd %02X\n", lk_rbuf[0]);
break; break;
} }
} }

268
scp.c
View file

@ -1717,11 +1717,8 @@ while (stat != SCPE_EXIT) { /* in case exit */
if (cmdp && (cmdp->message)) /* special message handler? */ if (cmdp && (cmdp->message)) /* special message handler? */
cmdp->message (NULL, stat); /* let it deal with display */ cmdp->message (NULL, stat); /* let it deal with display */
else else
if (stat >= SCPE_BASE) { /* error? */ if (stat >= SCPE_BASE) /* error? */
printf ("%s\n", sim_error_text (stat)); sim_printf ("%s\n", sim_error_text (stat));
if (sim_log)
fprintf (sim_log, "%s\n", sim_error_text (stat));
}
} }
if (sim_vm_post != NULL) if (sim_vm_post != NULL)
(*sim_vm_post) (TRUE); (*sim_vm_post) (TRUE);
@ -2297,6 +2294,8 @@ if ((cptr == NULL) || (strlen (cptr) == 0))
fflush(stdout); /* flush stdout */ fflush(stdout); /* flush stdout */
if (sim_log) /* flush log if enabled */ if (sim_log) /* flush log if enabled */
fflush (sim_log); fflush (sim_log);
if (sim_deb) /* flush debug if enabled */
fflush (sim_deb);
status = system (cptr); status = system (cptr);
#if defined (VMS) #if defined (VMS)
printf ("\n"); printf ("\n");
@ -4041,7 +4040,7 @@ if ((!cptr) || (*cptr == 0))
return SCPE_2FARG; return SCPE_2FARG;
sim_trim_endspc(cptr); sim_trim_endspc(cptr);
if (chdir(cptr) != 0) { if (chdir(cptr) != 0) {
printf("Unable to change to: %s\n", cptr); sim_printf("Unable to directory change to: %s\n", cptr);
return SCPE_IOERR & SCPE_NOMESSAGE; return SCPE_IOERR & SCPE_NOMESSAGE;
} }
return SCPE_OK; return SCPE_OK;
@ -4087,57 +4086,37 @@ if ((hFind = FindFirstFileA (cptr, &File)) != INVALID_HANDLE_VALUE) {
else { else {
getcwd(DirName, PATH_MAX); getcwd(DirName, PATH_MAX);
} }
printf (" Directory of %s\n\n", DirName); sim_printf (" Directory of %s\n\n", DirName);
if (sim_log)
fprintf (sim_log, " Directory of %s\n\n", DirName);
do { do {
FileSize = (((t_int64)(File.nFileSizeHigh)) << 32) | File.nFileSizeLow; FileSize = (((t_int64)(File.nFileSizeHigh)) << 32) | File.nFileSizeLow;
sprintf (FileName, "%s%c%s", DirName, pathsep, File.cFileName); sprintf (FileName, "%s%c%s", DirName, pathsep, File.cFileName);
stat (FileName, &filestat); stat (FileName, &filestat);
local = localtime (&filestat.st_mtime); local = localtime (&filestat.st_mtime);
printf ("%02d/%02d/%04d %02d:%02d %s ", local->tm_mon+1, local->tm_mday, 1900+local->tm_year, local->tm_hour%12, local->tm_min, (local->tm_hour >= 12) ? "PM" : "AM"); sim_printf ("%02d/%02d/%04d %02d:%02d %s ", local->tm_mon+1, local->tm_mday, 1900+local->tm_year, local->tm_hour%12, local->tm_min, (local->tm_hour >= 12) ? "PM" : "AM");
if (sim_log)
fprintf (sim_log, "%02d/%02d/%04d %02d:%02d %s ", local->tm_mon+1, local->tm_mday, 1900+local->tm_year, local->tm_hour%12, local->tm_min, (local->tm_hour >= 12) ? "PM" : "AM");
if (filestat.st_mode & S_IFDIR) { if (filestat.st_mode & S_IFDIR) {
++DirCount; ++DirCount;
printf (" <DIR> "); sim_printf (" <DIR> ");
if (sim_log)
fprintf (sim_log, " <DIR> ");
} }
else { else {
if (filestat.st_mode & S_IFREG) { if (filestat.st_mode & S_IFREG) {
++FileCount; ++FileCount;
fprint_val (stdout, (t_value) FileSize, 10, 17, PV_RCOMMA); sim_print_val ((t_value) FileSize, 10, 17, PV_RCOMMA);
if (sim_log)
fprint_val (sim_log, (t_value) FileSize, 10, 17, PV_RCOMMA);
TotalSize += FileSize; TotalSize += FileSize;
} }
else { else {
printf ("%17s", ""); sim_printf ("%17s", "");
if (sim_log)
fprintf (sim_log, "%17s", "");
} }
} }
printf (" %s\n", File.cFileName); sim_printf (" %s\n", File.cFileName);
if (sim_log)
fprintf (sim_log, " %s\n", File.cFileName);
} while (FindNextFile (hFind, &File)); } while (FindNextFile (hFind, &File));
printf ("%16d File(s)", FileCount); sim_printf ("%16d File(s)", FileCount);
fprint_val (stdout, (t_value) TotalSize, 10, 15, PV_RCOMMA); sim_print_val ((t_value) TotalSize, 10, 15, PV_RCOMMA);
printf (" bytes\n"); sim_printf (" bytes\n");
printf ("%16d Dir(s)\n", DirCount); sim_printf ("%16d Dir(s)\n", DirCount);
if (sim_log) {
fprintf (sim_log, "%16d File(s)", FileCount);
fprint_val (sim_log, (t_value) TotalSize, 10, 15, PV_RCOMMA);
fprintf (sim_log, " bytes\n");
fprintf (sim_log, "%16d Dir(s)\n", DirCount);
}
FindClose (hFind); FindClose (hFind);
} }
else { else {
printf ("Can't list files for %s\n", cptr); sim_printf ("Can't list files for %s\n", cptr);
if (sim_log)
fprintf (sim_log, "Can't list files for %s\n", cptr);
return SCPE_ARG; return SCPE_ARG;
} }
return SCPE_OK; return SCPE_OK;
@ -4227,9 +4206,7 @@ if (dir) {
#endif #endif
MatchName = 1 + strrchr (cptr, '/'); MatchName = 1 + strrchr (cptr, '/');
printf (" Directory of %s\n\n", DirName[0] ? DirName : "/"); sim_printf (" Directory of %s\n\n", DirName[0] ? DirName : "/");
if (sim_log)
fprintf (sim_log, " Directory of %s\n\n", DirName[0] ? DirName : "/");
#if defined (HAVE_GLOB) #if defined (HAVE_GLOB)
for (i=0; i<paths.gl_pathc; i++) { for (i=0; i<paths.gl_pathc; i++) {
sprintf (FileName, "%s", paths.gl_pathv[i]); sprintf (FileName, "%s", paths.gl_pathv[i]);
@ -4243,51 +4220,33 @@ if (dir) {
#endif #endif
stat (FileName, &filestat); stat (FileName, &filestat);
local = localtime (&filestat.st_mtime); local = localtime (&filestat.st_mtime);
printf ("%02d/%02d/%04d %02d:%02d %s ", local->tm_mon+1, local->tm_mday, 1900+local->tm_year, local->tm_hour%12, local->tm_min, (local->tm_hour >= 12) ? "PM" : "AM"); sim_printf ("%02d/%02d/%04d %02d:%02d %s ", local->tm_mon+1, local->tm_mday, 1900+local->tm_year, local->tm_hour%12, local->tm_min, (local->tm_hour >= 12) ? "PM" : "AM");
if (sim_log)
fprintf (sim_log, "%02d/%02d/%04d %02d:%02d %s ", local->tm_mon+1, local->tm_mday, 1900+local->tm_year, local->tm_hour%12, local->tm_min, (local->tm_hour >= 12) ? "PM" : "AM");
if (filestat.st_mode & S_IFDIR) { if (filestat.st_mode & S_IFDIR) {
++DirCount; ++DirCount;
printf (" <DIR> "); sim_printf (" <DIR> ");
if (sim_log)
fprintf (sim_log, " <DIR> ");
} }
else { else {
if (filestat.st_mode & S_IFREG) { if (filestat.st_mode & S_IFREG) {
++FileCount; ++FileCount;
FileSize = sim_fsize_name_ex (FileName); FileSize = sim_fsize_name_ex (FileName);
fprint_val (stdout, (t_value) FileSize, 10, 17, PV_RCOMMA); sim_print_val ((t_value) FileSize, 10, 17, PV_RCOMMA);
if (sim_log)
fprint_val (sim_log, (t_value) FileSize, 10, 17, PV_RCOMMA);
TotalSize += FileSize; TotalSize += FileSize;
} }
else { else {
printf ("%17s", ""); sim_printf ("%17s", "");
if (sim_log)
fprintf (sim_log, "%17s", "");
} }
} }
c = strrchr (FileName, '/'); c = strrchr (FileName, '/');
printf (" %s\n", c ? c + 1 : FileName); sim_printf (" %s\n", c ? c + 1 : FileName);
if (sim_log)
fprintf (sim_log, " %s\n", c ? c + 1 : FileName);
} }
if (FileCount) { if (FileCount) {
printf ("%16d File(s)", FileCount); sim_printf ("%16d File(s)", FileCount);
fprint_val (stdout, (t_value) TotalSize, 10, 15, PV_RCOMMA); sim_print_val ((t_value) TotalSize, 10, 15, PV_RCOMMA);
printf (" bytes\n"); sim_printf (" bytes\n");
printf ("%16d Dir(s)\n", DirCount); sim_printf ("%16d Dir(s)\n", DirCount);
if (sim_log) {
fprintf (sim_log, "%16d File(s)", FileCount);
fprint_val (sim_log, (t_value) TotalSize, 10, 15, PV_RCOMMA);
fprintf (sim_log, " bytes\n");
fprintf (sim_log, "%16d Dir(s)\n", DirCount);
}
} }
else { else {
printf ("File Not Found\n"); sim_printf ("File Not Found\n");
if (sim_log)
fprintf (sim_log, "File Not Found\n");
} }
#if defined (HAVE_GLOB) #if defined (HAVE_GLOB)
globfree (&paths); globfree (&paths);
@ -4296,9 +4255,7 @@ if (dir) {
#endif #endif
} }
else { else {
printf ("Can't list files for %s\n", cptr); sim_printf ("Can't list files for %s\n", cptr);
if (sim_log)
fprintf (sim_log, "Can't list files for %s\n", cptr);
return SCPE_ARG; return SCPE_ARG;
} }
return SCPE_OK; return SCPE_OK;
@ -4569,9 +4526,7 @@ if (sim_switches & SWMASK ('R')) { /* read only? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */ return attach_err (uptr, SCPE_OPENERR); /* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */ uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s: unit is read only\n", sim_dname (dptr)); sim_printf ("%s: unit is read only\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "%s: unit is read only\n", sim_dname (dptr));
} }
} }
else { else {
@ -4580,9 +4535,7 @@ else {
if (uptr->fileref == NULL) /* open fail? */ if (uptr->fileref == NULL) /* open fail? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */ return attach_err (uptr, SCPE_OPENERR); /* yes, error */
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s: creating new file\n", sim_dname (dptr)); sim_printf ("%s: creating new file\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "%s: creating new file\n", sim_dname (dptr));
} }
} }
else { /* normal */ else { /* normal */
@ -4600,9 +4553,7 @@ else {
return attach_err (uptr, SCPE_OPENERR); /* yes, error */ return attach_err (uptr, SCPE_OPENERR); /* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */ uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s: unit is read only\n", sim_dname (dptr)); sim_printf ("%s: unit is read only\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "%s: unit is read only\n", sim_dname (dptr));
} }
} }
else { /* doesn't exist */ else { /* doesn't exist */
@ -4612,9 +4563,7 @@ else {
if (uptr->fileref == NULL) /* open fail? */ if (uptr->fileref == NULL) /* open fail? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */ return attach_err (uptr, SCPE_OPENERR); /* yes, error */
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s: creating new file\n", sim_dname (dptr)); sim_printf ("%s: creating new file\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "%s: creating new file\n", sim_dname (dptr));
} }
} }
} /* end if null */ } /* end if null */
@ -4627,9 +4576,7 @@ if (uptr->flags & UNIT_BUFABLE) { /* buffer? */
if (uptr->filebuf == NULL) /* no buffer? */ if (uptr->filebuf == NULL) /* no buffer? */
return attach_err (uptr, SCPE_MEM); /* error */ return attach_err (uptr, SCPE_MEM); /* error */
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s: buffering file in memory\n", sim_dname (dptr)); sim_printf ("%s: buffering file in memory\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "%s: buffering file in memory\n", sim_dname (dptr));
} }
uptr->hwmark = (uint32)sim_fread (uptr->filebuf, /* read file */ uptr->hwmark = (uint32)sim_fread (uptr->filebuf, /* read file */
SZ_D (dptr), cap, uptr->fileref); SZ_D (dptr), cap, uptr->fileref);
@ -4745,9 +4692,7 @@ if (uptr->flags & UNIT_BUF) {
uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr; uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr;
if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) {
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s: writing buffer to file\n", sim_dname (dptr)); sim_printf ("%s: writing buffer to file\n", sim_dname (dptr));
if (sim_log)
fprintf (sim_log, "%s: writing buffer to file\n", sim_dname (dptr));
} }
rewind (uptr->fileref); rewind (uptr->fileref);
sim_fwrite (uptr->filebuf, SZ_D (dptr), cap, uptr->fileref); sim_fwrite (uptr->filebuf, SZ_D (dptr), cap, uptr->fileref);
@ -5043,31 +4988,23 @@ if (strcmp (buf, save_vercur) == 0) /* version 3.5? */
else if (strcmp (buf, save_ver32) == 0) /* version 3.2? */ else if (strcmp (buf, save_ver32) == 0) /* version 3.2? */
v32 = TRUE; v32 = TRUE;
else if (strcmp (buf, save_ver30) != 0) { /* version 3.0? */ else if (strcmp (buf, save_ver30) != 0) { /* version 3.0? */
printf ("Invalid file version: %s\n", buf); sim_printf ("Invalid file version: %s\n", buf);
if (sim_log)
fprintf (sim_log, "Invalid file version: %s\n", buf);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
READ_S (buf); /* read sim name */ READ_S (buf); /* read sim name */
if (strcmp (buf, sim_name)) { /* name match? */ if (strcmp (buf, sim_name)) { /* name match? */
printf ("Wrong system type: %s\n", buf); sim_printf ("Wrong system type: %s\n", buf);
if (sim_log)
fprintf (sim_log, "Wrong system type: %s\n", buf);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
if (v35) { /* [V3.5+] options */ if (v35) { /* [V3.5+] options */
READ_S (buf); /* integer size */ READ_S (buf); /* integer size */
if (strcmp (buf, sim_si64) != 0) { if (strcmp (buf, sim_si64) != 0) {
printf ("Incompatible integer size, save file = %s\n", buf); sim_printf ("Incompatible integer size, save file = %s\n", buf);
if (sim_log)
fprintf (sim_log, "Incompatible integer size, save file = %s\n", buf);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
READ_S (buf); /* address size */ READ_S (buf); /* address size */
if (strcmp (buf, sim_sa64) != 0) { if (strcmp (buf, sim_sa64) != 0) {
printf ("Incompatible address size, save file = %s\n", buf); sim_printf ("Incompatible address size, save file = %s\n", buf);
if (sim_log)
fprintf (sim_log, "Incompatible address size, save file = %s\n", buf);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
READ_S (buf); /* Ethernet */ READ_S (buf); /* Ethernet */
@ -5084,9 +5021,7 @@ for ( ;; ) { /* device loop */
if (buf[0] == 0) /* last? */ if (buf[0] == 0) /* last? */
break; break;
if ((dptr = find_dev (buf)) == NULL) { /* locate device */ if ((dptr = find_dev (buf)) == NULL) { /* locate device */
printf ("Invalid device name: %s\n", buf); sim_printf ("Invalid device name: %s\n", buf);
if (sim_log)
fprintf (sim_log, "Invalid device name: %s\n", buf);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
READ_S (buf); /* [V3.0+] logical name */ READ_S (buf); /* [V3.0+] logical name */
@ -5106,9 +5041,7 @@ for ( ;; ) { /* device loop */
if (unitno < 0) /* end units? */ if (unitno < 0) /* end units? */
break; break;
if ((uint32) unitno >= dptr->numunits) { /* too big? */ if ((uint32) unitno >= dptr->numunits) { /* too big? */
printf ("Invalid unit number: %s%d\n", sim_dname (dptr), unitno); sim_printf ("Invalid unit number: %s%d\n", sim_dname (dptr), unitno);
if (sim_log)
fprintf (sim_log, "Invalid unit number: %s%d\n", sim_dname (dptr), unitno);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
READ_I (time); /* event time */ READ_I (time); /* event time */
@ -5157,9 +5090,7 @@ for ( ;; ) { /* device loop */
if (high > 0) { /* [V2.5+] any memory? */ if (high > 0) { /* [V2.5+] any memory? */
if (((uptr->flags & (UNIT_FIX + UNIT_ATTABLE)) != UNIT_FIX) || if (((uptr->flags & (UNIT_FIX + UNIT_ATTABLE)) != UNIT_FIX) ||
(dptr->deposit == NULL)) { (dptr->deposit == NULL)) {
printf ("Can't restore memory: %s%d\n", sim_dname (dptr), unitno); sim_printf ("Can't restore memory: %s%d\n", sim_dname (dptr), unitno);
if (sim_log)
fprintf (sim_log, "Can't restore memory: %s%d\n", sim_dname (dptr), unitno);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
if (high != old_capac) { /* size change? */ if (high != old_capac) { /* size change? */
@ -5167,11 +5098,8 @@ for ( ;; ) { /* device loop */
if ((dptr->flags & DEV_DYNM) && if ((dptr->flags & DEV_DYNM) &&
((dptr->msize == NULL) || ((dptr->msize == NULL) ||
(dptr->msize (uptr, (int32) high, NULL, NULL) != SCPE_OK))) { (dptr->msize (uptr, (int32) high, NULL, NULL) != SCPE_OK))) {
printf ("Can't change memory size: %s%d\n", sim_printf ("Can't change memory size: %s%d\n",
sim_dname (dptr), unitno); sim_dname (dptr), unitno);
if (sim_log)
fprintf (sim_log, "Can't change memory size: %s%d\n",
sim_dname (dptr), unitno);
return SCPE_INCOMP; return SCPE_INCOMP;
} }
uptr->capac = high; /* new memory size */ uptr->capac = high; /* new memory size */
@ -5219,28 +5147,21 @@ for ( ;; ) { /* device loop */
break; break;
READ_I (depth); /* [V2.10+] depth */ READ_I (depth); /* [V2.10+] depth */
if ((rptr = find_reg (buf, NULL, dptr)) == NULL) { if ((rptr = find_reg (buf, NULL, dptr)) == NULL) {
printf ("Invalid register name: %s %s\n", sim_dname (dptr), buf); sim_printf ("Invalid register name: %s %s\n", sim_dname (dptr), buf);
if (sim_log)
fprintf (sim_log, "Invalid register name: %s %s\n", sim_dname (dptr), buf);
for (us = 0; us < depth; us++) { /* skip values */ for (us = 0; us < depth; us++) { /* skip values */
READ_I (val); READ_I (val);
} }
continue; continue;
} }
if (depth != rptr->depth) { /* [V2.10+] mismatch? */ if (depth != rptr->depth) { /* [V2.10+] mismatch? */
printf ("Register depth mismatch: %s %s, file = %d, sim = %d\n", sim_printf ("Register depth mismatch: %s %s, file = %d, sim = %d\n",
sim_dname (dptr), buf, depth, rptr->depth); sim_dname (dptr), buf, depth, rptr->depth);
if (sim_log)
fprintf (sim_log, "Register depth mismatch: %s %s, file = %d, sim = %d\n",
sim_dname (dptr), buf, depth, rptr->depth);
} }
mask = width_mask[rptr->width]; /* get mask */ mask = width_mask[rptr->width]; /* get mask */
for (us = 0; us < depth; us++) { /* loop thru values */ for (us = 0; us < depth; us++) { /* loop thru values */
READ_I (val); /* read value */ READ_I (val); /* read value */
if (val > mask) { /* value ok? */ if (val > mask) { /* value ok? */
printf ("Invalid register value: %s %s\n", sim_dname (dptr), buf); sim_printf ("Invalid register value: %s %s\n", sim_dname (dptr), buf);
if (sim_log)
fprintf (sim_log, "Invalid register value: %s %s\n", sim_dname (dptr), buf);
} }
else if (us < rptr->depth) /* in range? */ else if (us < rptr->depth) /* in range? */
put_rval (rptr, us, val); put_rval (rptr, us, val);
@ -5260,23 +5181,16 @@ for (j=0, r = SCPE_OK; j<attcnt; j++) {
(!stat(attnames[j], &fstat))) (!stat(attnames[j], &fstat)))
if (fstat.st_mtime > rstat.st_mtime + 30) { if (fstat.st_mtime > rstat.st_mtime + 30) {
r = SCPE_INCOMP; r = SCPE_INCOMP;
printf ("Error Attaching %s to %s - the restore state is %d seconds older than the attach file\n", sim_dname (dptr), attnames[j], (int)(fstat.st_mtime - rstat.st_mtime)); sim_printf ("Error Attaching %s to %s - the restore state is %d seconds older than the attach file\n", sim_dname (dptr), attnames[j], (int)(fstat.st_mtime - rstat.st_mtime));
printf ("restore with the -F switch to override this sanity check\n"); sim_printf ("restore with the -F switch to override this sanity check\n");
if (sim_log) {
fprintf (sim_log, "Error Attaching %s to %s - the restore state is %d seconds older than the attach file\n", sim_dname (dptr), attnames[j], (int)(fstat.st_mtime - rstat.st_mtime));
fprintf (sim_log, "restore with the -F switch to override this sanity check\n");
}
continue; continue;
} }
saved_pos = attunits[j]->pos; saved_pos = attunits[j]->pos;
sim_switches = attswitches[j]; sim_switches = attswitches[j];
r = scp_attach_unit (dptr, attunits[j], attnames[j]);/* reattach unit */ r = scp_attach_unit (dptr, attunits[j], attnames[j]);/* reattach unit */
attunits[j]->pos = saved_pos; attunits[j]->pos = saved_pos;
if (r != SCPE_OK) { if (r != SCPE_OK)
printf ("Error Attaching %s to %s\n", sim_dname (dptr), attnames[j]); sim_printf ("Error Attaching %s to %s\n", sim_dname (dptr), attnames[j]);
if (sim_log)
fprintf (sim_log, "Error Attaching %s to %s\n", sim_dname (dptr), attnames[j]);
}
} }
free (attnames[j]); free (attnames[j]);
} }
@ -5463,6 +5377,8 @@ if (unechoed_cmdline) {
fprint_stopped (stdout, r); /* print msg */ fprint_stopped (stdout, r); /* print msg */
if (sim_log) /* log if enabled */ if (sim_log) /* log if enabled */
fprint_stopped (sim_log, r); fprint_stopped (sim_log, r);
if (sim_deb) /* log if enabled */
fprint_stopped (sim_deb, r);
} }
/* Common setup for RUN or BOOT */ /* Common setup for RUN or BOOT */
@ -7074,6 +6990,25 @@ if (fputs (dbuf, stream) == EOF)
return SCPE_OK; return SCPE_OK;
} }
t_stat sim_print_val (t_value val, uint32 radix,
uint32 width, uint32 format)
{
char dbuf[MAX_WIDTH + 1];
if (width > MAX_WIDTH)
width = MAX_WIDTH;
sprint_val (dbuf, val, radix, width, format);
if (fputs (dbuf, stdout) == EOF)
return SCPE_IOERR;
if (sim_log && (sim_log != stdout))
if (fputs (dbuf, sim_log) == EOF)
return SCPE_IOERR;
if (sim_deb && (sim_deb != stdout))
if (fputs (dbuf, sim_deb) == EOF)
return SCPE_IOERR;
return SCPE_OK;
}
/* Event queue package /* Event queue package
sim_activate add entry to event queue sim_activate add entry to event queue
@ -7892,6 +7827,65 @@ if (sim_deb && (dptr->dctrl & dbits)) {
} }
} }
/* Print message to stdout, sim_log (if enabled) and sim_deb (if enabled) */
void sim_printf (const char* fmt, ...)
{
char stackbuf[STACKBUFSIZE];
int32 bufsize = sizeof(stackbuf);
char *buf = stackbuf;
int32 len;
va_list arglist;
while (1) { /* format passed string, args */
va_start (arglist, fmt);
#if defined(NO_vsnprintf)
#if defined(HAS_vsprintf_void)
/* Note, this could blow beyond the buffer, and we couldn't tell */
/* That is a limitation of the C runtime library available on this platform */
vsprintf (buf, fmt, arglist);
for (len = 0; len < bufsize-1; len++)
if (buf[len] == 0) break;
#else
len = vsprintf (buf, fmt, arglist);
#endif /* HAS_vsprintf_void */
#else /* NO_vsnprintf */
#if defined(HAS_vsnprintf_void)
vsnprintf (buf, bufsize-1, fmt, arglist);
for (len = 0; len < bufsize-1; len++)
if (buf[len] == 0) break;
#else
len = vsnprintf (buf, bufsize-1, fmt, arglist);
#endif /* HAS_vsnprintf_void */
#endif /* NO_vsnprintf */
va_end (arglist);
/* If the formatted result didn't fit into the buffer, then grow the buffer and try again */
if ((len < 0) || (len >= bufsize-1)) {
if (buf != stackbuf)
free (buf);
bufsize = bufsize * 2;
buf = (char *) malloc (bufsize);
if (buf == NULL) /* out of memory */
return;
buf[bufsize-1] = '\0';
continue;
}
break;
}
printf("%s", buf);
if (sim_log && (sim_log != stdout))
fprintf (sim_log, "%s", buf);
if (sim_deb && (sim_deb != stdout))
fprintf (sim_deb, "%s", buf);
if (buf != stackbuf)
free (buf);
}
/* Inline debugging - will print debug message if debug file is /* Inline debugging - will print debug message if debug file is
set and the bitmask matches the current device debug options. set and the bitmask matches the current device debug options.
Extra returns are added for un*x systems, since the output Extra returns are added for un*x systems, since the output

2
scp.h
View file

@ -118,6 +118,7 @@ char *get_range (DEVICE *dptr, char *cptr, t_addr *lo, t_addr *hi,
uint32 rdx, t_addr max, char term); uint32 rdx, t_addr max, char term);
t_value strtotv (const char *cptr, char **endptr, uint32 radix); t_value strtotv (const char *cptr, char **endptr, uint32 radix);
t_stat fprint_val (FILE *stream, t_value val, uint32 rdx, uint32 wid, uint32 fmt); t_stat fprint_val (FILE *stream, t_value val, uint32 rdx, uint32 wid, uint32 fmt);
t_stat sim_print_val (t_value val, uint32 radix, uint32 width, uint32 format);
char *read_line (char *cptr, int32 size, FILE *stream); char *read_line (char *cptr, int32 size, FILE *stream);
void fprint_reg_help (FILE *st, DEVICE *dptr); void fprint_reg_help (FILE *st, DEVICE *dptr);
void fprint_set_help (FILE *st, DEVICE *dptr); void fprint_set_help (FILE *st, DEVICE *dptr);
@ -142,6 +143,7 @@ t_stat show_dev_debug (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cpt
const char *sim_error_text (t_stat stat); const char *sim_error_text (t_stat stat);
t_stat sim_string_to_stat (char *cptr, t_stat *cond); t_stat sim_string_to_stat (char *cptr, t_stat *cond);
t_stat sim_cancel_step (void); t_stat sim_cancel_step (void);
void sim_printf (const char* fmt, ...);
void sim_debug_bits (uint32 dbits, DEVICE* dptr, BITFIELD* bitdefs, void sim_debug_bits (uint32 dbits, DEVICE* dptr, BITFIELD* bitdefs,
uint32 before, uint32 after, int terminate); uint32 before, uint32 after, int terminate);
#if defined (__DECC) && defined (__VMS) && (defined (__VAX) || (__DECC_VER < 60590001)) #if defined (__DECC) && defined (__VMS) && (defined (__VAX) || (__DECC_VER < 60590001))

View file

@ -444,8 +444,7 @@ t_stat sim_disk_set_async (UNIT *uptr, int latency)
{ {
#if !defined(SIM_ASYNCH_IO) #if !defined(SIM_ASYNCH_IO)
char *msg = "Disk: can't operate asynchronously\r\n"; char *msg = "Disk: can't operate asynchronously\r\n";
printf ("%s", msg); sim_printf ("%s", msg);
if (sim_log) fprintf (sim_log, "%s", msg);
return SCPE_NOFNC; return SCPE_NOFNC;
#else #else
struct disk_context *ctx = (struct disk_context *)uptr->disk_ctx; struct disk_context *ctx = (struct disk_context *)uptr->disk_ctx;
@ -877,17 +876,13 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
return r; return r;
} }
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s%d: creating new virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf); sim_printf ("%s%d: creating new virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf);
if (sim_log)
fprintf (sim_log, "%s%d: creating new virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf);
} }
capac_factor = ((dptr->dwidth / dptr->aincr) == 16) ? 2 : 1; /* capacity units (word: 2, byte: 1) */ capac_factor = ((dptr->dwidth / dptr->aincr) == 16) ? 2 : 1; /* capacity units (word: 2, byte: 1) */
vhd = sim_vhd_disk_create (gbuf, ((t_offset)uptr->capac)*capac_factor*((dptr->flags & DEV_SECTORS) ? 512 : 1)); vhd = sim_vhd_disk_create (gbuf, ((t_offset)uptr->capac)*capac_factor*((dptr->flags & DEV_SECTORS) ? 512 : 1));
if (!vhd) { if (!vhd) {
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s%d: can't create virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf); sim_printf ("%s%d: can't create virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf);
if (sim_log)
fprintf (sim_log, "%s%d: can't create virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf);
} }
return SCPE_OPENERR; return SCPE_OPENERR;
} }
@ -904,11 +899,8 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
return SCPE_MEM; return SCPE_MEM;
} }
for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) { for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) {
if (!sim_quiet) { if (!sim_quiet)
printf ("%s%d: Copied %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors)); sim_printf ("%s%d: Copied %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
if (sim_log)
fprintf (sim_log, "%s%d: Copied %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
}
sects = sectors_per_buffer; sects = sectors_per_buffer;
if (lba + sects > total_sectors) if (lba + sects > total_sectors)
sects = total_sectors - lba; sects = total_sectors - lba;
@ -925,16 +917,10 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
} }
} }
if (!sim_quiet) { if (!sim_quiet) {
if (r == SCPE_OK) { if (r == SCPE_OK)
printf ("\n%s%d: Copied %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000)); sim_printf ("\n%s%d: Copied %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
if (sim_log) else
fprintf (sim_log, "\n%s%d: Copied %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000)); sim_printf ("\n%s%d: Error copying: %s.\n", sim_dname (dptr), (int)(uptr-dptr->units), sim_error_text (r));
}
else {
printf ("\n%s%d: Error copying: %s.\n", sim_dname (dptr), (int)(uptr-dptr->units), sim_error_text (r));
if (sim_log)
fprintf (sim_log, "\n%s%d: Error copying: %s.\n", sim_dname (dptr), (int)(uptr-dptr->units), sim_error_text (r));
}
} }
if ((r == SCPE_OK) && (sim_switches & SWMASK ('V'))) { if ((r == SCPE_OK) && (sim_switches & SWMASK ('V'))) {
uint8 *verify_buf = (uint8*) malloc (1024*1024); uint8 *verify_buf = (uint8*) malloc (1024*1024);
@ -946,11 +932,8 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
return SCPE_MEM; return SCPE_MEM;
} }
for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) { for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) {
if (!sim_quiet) { if (!sim_quiet)
printf ("%s%d: Verified %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors)); sim_printf ("%s%d: Verified %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
if (sim_log)
fprintf (sim_log, "%s%d: Verified %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
}
sects = sectors_per_buffer; sects = sectors_per_buffer;
if (lba + sects > total_sectors) if (lba + sects > total_sectors)
sects = total_sectors - lba; sects = total_sectors - lba;
@ -971,11 +954,8 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
} }
} }
if (!sim_quiet) { if (!sim_quiet) {
if (r == SCPE_OK) { if (r == SCPE_OK)
printf ("\n%s%d: Verified %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000)); sim_printf ("\n%s%d: Verified %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
if (sim_log)
fprintf (sim_log, "\n%s%d: Verified %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
}
else { else {
t_lba i; t_lba i;
uint32 save_dctrl = dptr->dctrl; uint32 save_dctrl = dptr->dctrl;
@ -984,9 +964,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
for (i = 0; i < (1024*1024/sector_size); ++i) for (i = 0; i < (1024*1024/sector_size); ++i)
if (0 != memcmp (copy_buf+i*sector_size, verify_buf+i*sector_size, sector_size)) if (0 != memcmp (copy_buf+i*sector_size, verify_buf+i*sector_size, sector_size))
break; break;
printf ("\n%s%d: Verification Error on lbn %d.\n", sim_dname (dptr), (int)(uptr-dptr->units), lba+i); sim_printf ("\n%s%d: Verification Error on lbn %d.\n", sim_dname (dptr), (int)(uptr-dptr->units), lba+i);
if (sim_log)
fprintf (sim_log, "\n%s%d: Verification Error on lbn %d.\n", sim_dname (dptr), (int)(uptr-dptr->units), lba+i);
dptr->dctrl = 0xFFFFFFFF; dptr->dctrl = 0xFFFFFFFF;
sim_deb = stdout; sim_deb = stdout;
sim_disk_data_trace (uptr, copy_buf+i*sector_size, lba+i, sector_size, "Expected", TRUE, 1); sim_disk_data_trace (uptr, copy_buf+i*sector_size, lba+i, sector_size, "Expected", TRUE, 1);
@ -1076,9 +1054,7 @@ if (sim_switches & SWMASK ('R')) { /* read only? */
return _err_return (uptr, SCPE_OPENERR); /* yes, error */ return _err_return (uptr, SCPE_OPENERR); /* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */ uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units)); sim_printf ("%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
if (sim_log)
fprintf (sim_log, "%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
} }
} }
else { /* normal */ else { /* normal */
@ -1092,7 +1068,7 @@ else { /* normal */
return _err_return (uptr, SCPE_OPENERR);/* yes, error */ return _err_return (uptr, SCPE_OPENERR);/* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */ uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet) if (!sim_quiet)
printf ("%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units)); sim_printf ("%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
} }
else { /* doesn't exist */ else { /* doesn't exist */
if (sim_switches & SWMASK ('E')) /* must exist? */ if (sim_switches & SWMASK ('E')) /* must exist? */
@ -1104,7 +1080,7 @@ else { /* normal */
if (uptr->fileref == NULL) /* open fail? */ if (uptr->fileref == NULL) /* open fail? */
return _err_return (uptr, SCPE_OPENERR);/* yes, error */ return _err_return (uptr, SCPE_OPENERR);/* yes, error */
if (!sim_quiet) if (!sim_quiet)
printf ("%s%d: creating new file\n", sim_dname (dptr), (int)(uptr-dptr->units)); sim_printf ("%s%d: creating new file\n", sim_dname (dptr), (int)(uptr-dptr->units));
created = TRUE; created = TRUE;
} }
} /* end if null */ } /* end if null */
@ -1162,18 +1138,11 @@ if (capac && (capac != (t_offset)-1)) {
if (dontautosize) { if (dontautosize) {
if ((capac < (((t_offset)uptr->capac)*ctx->capac_factor*((dptr->flags & DEV_SECTORS) ? 512 : 1))) && (DKUF_F_STD != DK_GET_FMT (uptr))) { if ((capac < (((t_offset)uptr->capac)*ctx->capac_factor*((dptr->flags & DEV_SECTORS) ? 512 : 1))) && (DKUF_F_STD != DK_GET_FMT (uptr))) {
if (!sim_quiet) { if (!sim_quiet) {
printf ("%s%d: non expandable disk %s is smaller than simulated device (", sim_dname (dptr), (int)(uptr-dptr->units), cptr); sim_printf ("%s%d: non expandable disk %s is smaller than simulated device (", sim_dname (dptr), (int)(uptr-dptr->units), cptr);
fprint_val (stdout, (t_addr)(capac/ctx->capac_factor), 10, T_ADDR_W, PV_LEFT); sim_print_val ((t_addr)(capac/ctx->capac_factor), 10, T_ADDR_W, PV_LEFT);
printf ("%s < ", (ctx->capac_factor == 2) ? "W" : ""); sim_printf ("%s < ", (ctx->capac_factor == 2) ? "W" : "");
fprint_val (stdout, uptr->capac*((dptr->flags & DEV_SECTORS) ? 512 : 1), 10, T_ADDR_W, PV_LEFT); sim_print_val (uptr->capac*((dptr->flags & DEV_SECTORS) ? 512 : 1), 10, T_ADDR_W, PV_LEFT);
printf ("%s)\n", (ctx->capac_factor == 2) ? "W" : ""); sim_printf ("%s)\n", (ctx->capac_factor == 2) ? "W" : "");
if (sim_log) {
fprintf (sim_log, "%s%d: non expandable disk %s is smaller than simulated device (", sim_dname (dptr), (int)(uptr-dptr->units), cptr);
fprint_val (sim_log, (t_addr)(capac/ctx->capac_factor), 10, T_ADDR_W, PV_LEFT);
fprintf (sim_log, "%s < ", (ctx->capac_factor == 2) ? "W" : "");
fprint_val (sim_log, uptr->capac*((dptr->flags & DEV_SECTORS) ? 512 : 1), 10, T_ADDR_W, PV_LEFT);
fprintf (sim_log, "%s)\n", (ctx->capac_factor == 2) ? "W" : "");
}
} }
} }
} }
@ -2815,7 +2784,7 @@ if ((sDynamic) &&
} }
if (!*szParentVHDPath) { if (!*szParentVHDPath) {
Return = EINVAL; /* File Corrupt */ Return = EINVAL; /* File Corrupt */
fprintf (stderr, "Error Invalid Parent VHD for Differencing VHD\n"); sim_printf ("Error Invalid Parent VHD for Differencing VHD\n");
} }
} }
} }
@ -3024,7 +2993,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD)
++BlocksToMerge; ++BlocksToMerge;
} }
if (!sim_quiet) if (!sim_quiet)
printf ("Merging %s\ninto %s\n", szVHDPath, hVHD->ParentVHDPath); sim_printf ("Merging %s\ninto %s\n", szVHDPath, hVHD->ParentVHDPath);
for (BlockNumber=NeededBlock=0; BlockNumber < NtoHl (hVHD->Dynamic.MaxTableEntries); ++BlockNumber) { for (BlockNumber=NeededBlock=0; BlockNumber < NtoHl (hVHD->Dynamic.MaxTableEntries); ++BlockNumber) {
uint32 BlockSectors = SectorsPerBlock; uint32 BlockSectors = SectorsPerBlock;
@ -3048,7 +3017,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD)
SectorsPerBlock*BlockNumber)) SectorsPerBlock*BlockNumber))
break; break;
if (!sim_quiet) if (!sim_quiet)
printf ("Merged %dMB. %d%% complete.\r", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000), (int)((((float)NeededBlock)*100)/BlocksToMerge)); sim_printf ("Merged %dMB. %d%% complete.\r", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000), (int)((((float)NeededBlock)*100)/BlocksToMerge));
hVHD->BAT[BlockNumber] = VHD_BAT_FREE_ENTRY; hVHD->BAT[BlockNumber] = VHD_BAT_FREE_ENTRY;
} }
if (BlockNumber < NtoHl (hVHD->Dynamic.MaxTableEntries)) { if (BlockNumber < NtoHl (hVHD->Dynamic.MaxTableEntries)) {
@ -3057,7 +3026,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD)
else { else {
Status = 0; Status = 0;
if (!sim_quiet) if (!sim_quiet)
printf ("Merged %dMB. 100%% complete.\n", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000)); sim_printf ("Merged %dMB. 100%% complete.\n", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000));
fclose (hVHD->File); fclose (hVHD->File);
hVHD->File = NULL; hVHD->File = NULL;
remove (szVHDPath); remove (szVHDPath);

View file

@ -735,8 +735,7 @@ t_stat ethq_init(ETH_QUE* que, int max)
if (!que->item) { if (!que->item) {
/* failed to allocate memory */ /* failed to allocate memory */
char* msg = "EthQ: failed to allocate dynamic queue[%d]\r\n"; char* msg = "EthQ: failed to allocate dynamic queue[%d]\r\n";
printf(msg, max); sim_printf(msg, max);
if (sim_log) fprintf(sim_log, msg, max);
return SCPE_MEM; return SCPE_MEM;
}; };
que->max = max; que->max = max;
@ -1005,8 +1004,7 @@ static void load_function(char* function, _func* func_ptr) {
if (*func_ptr == 0) { if (*func_ptr == 0) {
char* msg = "Eth: Failed to find function '%s' in %s\r\n"; char* msg = "Eth: Failed to find function '%s' in %s\r\n";
printf (msg, function, lib_name); sim_printf (msg, function, lib_name);
if (sim_log) fprintf (sim_log, msg, function, lib_name);
lib_loaded = 3; lib_loaded = 3;
} }
} }
@ -1031,12 +1029,8 @@ int load_pcap(void) {
"Eth: You must install libpcap to use networking\r\n"; "Eth: You must install libpcap to use networking\r\n";
#endif #endif
printf (msg, lib_name); sim_printf (msg, lib_name);
printf ("%s", msg2); sim_printf ("%s", msg2);
if (sim_log) {
fprintf (sim_log, msg, lib_name);
fprintf (sim_log, "%s", msg2);
}
lib_loaded = 2; lib_loaded = 2;
break; break;
} else { } else {
@ -1071,10 +1065,7 @@ int load_pcap(void) {
if (lib_loaded == 1) { if (lib_loaded == 1) {
/* log successful load */ /* log successful load */
char* version = p_pcap_lib_version(); sim_printf("%s\n", p_pcap_lib_version());
printf("%s\n", version);
if (sim_log)
fprintf(sim_log, "%s\n", version);
} }
break; break;
default: /* loaded or failed */ default: /* loaded or failed */
@ -1693,8 +1684,7 @@ t_stat eth_set_async (ETH_DEV *dev, int latency)
{ {
#if !defined(USE_READER_THREAD) || !defined(SIM_ASYNCH_IO) #if !defined(USE_READER_THREAD) || !defined(SIM_ASYNCH_IO)
char *msg = "Eth: can't operate asynchronously, must poll\r\n"; char *msg = "Eth: can't operate asynchronously, must poll\r\n";
printf ("%s", msg); sim_printf ("%s", msg);
if (sim_log) fprintf (sim_log, "%s", msg);
return SCPE_NOFNC; return SCPE_NOFNC;
#else #else
int wakeup_needed; int wakeup_needed;
@ -1772,8 +1762,7 @@ if (0 == strncmp("tap:", savname, 4)) {
#if defined(HAVE_TAP_NETWORK) #if defined(HAVE_TAP_NETWORK)
if (!strcmp(savname, "tap:tapN")) { if (!strcmp(savname, "tap:tapN")) {
msg = "Eth: Must specify actual tap device name (i.e. tap:tap0)\r\n"; msg = "Eth: Must specify actual tap device name (i.e. tap:tap0)\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
return SCPE_OPENERR; return SCPE_OPENERR;
} }
#endif #endif
@ -1858,8 +1847,7 @@ else
memset(&voa, 0, sizeof(voa)); memset(&voa, 0, sizeof(voa));
if (!strcmp(savname, "vde:vdedevice")) { if (!strcmp(savname, "vde:vdedevice")) {
msg = "Eth: Must specify actual vde device name (i.e. vde:/tmp/switch)\r\n"; msg = "Eth: Must specify actual vde device name (i.e. vde:/tmp/switch)\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
return SCPE_OPENERR; return SCPE_OPENERR;
} }
if (!(dev->handle = (void*) vde_open(savname+4, "simh", &voa))) if (!(dev->handle = (void*) vde_open(savname+4, "simh", &voa)))
@ -1879,8 +1867,7 @@ else
if (!strcmp(savname, "udp:sourceport:remotehost:remoteport")) { if (!strcmp(savname, "udp:sourceport:remotehost:remoteport")) {
msg = "Eth: Must specify actual udp host and ports(i.e. udp:1224:somehost.com:2234)\r\n"; msg = "Eth: Must specify actual udp host and ports(i.e. udp:1224:somehost.com:2234)\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
return SCPE_OPENERR; return SCPE_OPENERR;
} }
@ -1893,8 +1880,7 @@ else
if ((SCPE_OK == sim_parse_addr (hostport, NULL, 0, NULL, NULL, 0, NULL, "localhost")) && if ((SCPE_OK == sim_parse_addr (hostport, NULL, 0, NULL, NULL, 0, NULL, "localhost")) &&
(0 == strcmp (localport, port))) { (0 == strcmp (localport, port))) {
msg = "Eth: Must specify different udp localhost ports\r\n"; msg = "Eth: Must specify different udp localhost ports\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
return SCPE_OPENERR; return SCPE_OPENERR;
} }
dev->fd_handle = sim_connect_sock_ex (localport, hostport, NULL, NULL, TRUE, FALSE); dev->fd_handle = sim_connect_sock_ex (localport, hostport, NULL, NULL, TRUE, FALSE);
@ -1908,8 +1894,7 @@ else
dev->handle = (void*) pcap_open_live(savname, bufsz, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf); dev->handle = (void*) pcap_open_live(savname, bufsz, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf);
if (!dev->handle) { /* can't open device */ if (!dev->handle) { /* can't open device */
msg = "Eth: pcap_open_live error - %s\r\n"; msg = "Eth: pcap_open_live error - %s\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
return SCPE_OPENERR; return SCPE_OPENERR;
} }
dev->eth_api = ETH_API_PCAP; dev->eth_api = ETH_API_PCAP;
@ -1920,13 +1905,11 @@ else
} }
if (errbuf[0]) { if (errbuf[0]) {
msg = "Eth: open error - %s\r\n"; msg = "Eth: open error - %s\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
return SCPE_OPENERR; return SCPE_OPENERR;
} }
msg = "Eth: opened OS device %s\r\n"; msg = "Eth: opened OS device %s\r\n";
printf (msg, savname); sim_printf (msg, savname);
if (sim_log) fprintf (sim_log, msg, savname);
/* get the NIC's hardware MAC address */ /* get the NIC's hardware MAC address */
eth_get_nic_hw_addr(dev, savname); eth_get_nic_hw_addr(dev, savname);
@ -1982,8 +1965,7 @@ if (1) {
/* set ethernet device non-blocking so pcap_dispatch() doesn't hang */ /* set ethernet device non-blocking so pcap_dispatch() doesn't hang */
if ((dev->eth_api == ETH_API_PCAP) && (pcap_setnonblock (dev->handle, 1, errbuf) == -1)) { if ((dev->eth_api == ETH_API_PCAP) && (pcap_setnonblock (dev->handle, 1, errbuf) == -1)) {
msg = "Eth: Failed to set non-blocking: %s\r\n"; msg = "Eth: Failed to set non-blocking: %s\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
} }
#endif #endif
#endif /* !defined (USE_READER_THREAD */ #endif /* !defined (USE_READER_THREAD */
@ -2065,8 +2047,7 @@ switch (dev->eth_api) {
break; break;
#endif #endif
} }
printf (msg, dev->name); sim_printf (msg, dev->name);
if (sim_log) fprintf (sim_log, msg, dev->name);
/* clean up the mess */ /* clean up the mess */
free(dev->name); free(dev->name);
@ -2183,8 +2164,7 @@ if (status != SCPE_OK) {
"which is at least 0.9 from your OS vendor or www.tcpdump.org\r\n" : "which is at least 0.9 from your OS vendor or www.tcpdump.org\r\n" :
"Eth: Error Transmitting packet: %s\r\n" "Eth: Error Transmitting packet: %s\r\n"
"You may need to run as root.\r\n"; "You may need to run as root.\r\n";
printf(msg, strerror(errno)); sim_printf(msg, strerror(errno));
if (sim_log) fprintf (sim_log, msg, strerror(errno));
return status; return status;
} }
@ -3216,22 +3196,17 @@ if (dev->eth_api == ETH_API_PCAP) {
if ((status = pcap_compile(dev->handle, &bpf, buf, 1, bpf_netmask)) < 0) { if ((status = pcap_compile(dev->handle, &bpf, buf, 1, bpf_netmask)) < 0) {
sprintf(errbuf, "%s", pcap_geterr(dev->handle)); sprintf(errbuf, "%s", pcap_geterr(dev->handle));
msg = "Eth: pcap_compile error: %s\r\n"; msg = "Eth: pcap_compile error: %s\r\n";
printf(msg, errbuf); sim_printf(msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
sim_debug(dev->dbit, dev->dptr, "Eth: pcap_compile error: %s\n", errbuf);
/* show erroneous BPF string */ /* show erroneous BPF string */
msg = "Eth: BPF string is: |%s|\r\n"; msg = "Eth: BPF string is: |%s|\r\n";
printf (msg, buf); sim_printf (msg, buf);
if (sim_log) fprintf (sim_log, msg, buf);
} }
else { else {
/* apply compiled filter string */ /* apply compiled filter string */
if ((status = pcap_setfilter(dev->handle, &bpf)) < 0) { if ((status = pcap_setfilter(dev->handle, &bpf)) < 0) {
sprintf(errbuf, "%s", pcap_geterr(dev->handle)); sprintf(errbuf, "%s", pcap_geterr(dev->handle));
msg = "Eth: pcap_setfilter error: %s\r\n"; msg = "Eth: pcap_setfilter error: %s\r\n";
printf(msg, errbuf); sim_printf(msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
sim_debug(dev->dbit, dev->dptr, "Eth: pcap_setfilter error: %s\n", errbuf);
} }
else { else {
#ifdef USE_SETNONBLOCK #ifdef USE_SETNONBLOCK
@ -3382,8 +3357,7 @@ errbuf[0] = '\0';
/* retrieve the device list */ /* retrieve the device list */
if (pcap_findalldevs(&alldevs, errbuf) == -1) { if (pcap_findalldevs(&alldevs, errbuf) == -1) {
char* msg = "Eth: error in pcap_findalldevs: %s\r\n"; char* msg = "Eth: error in pcap_findalldevs: %s\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
} }
else { else {
/* copy device list into the passed structure */ /* copy device list into the passed structure */
@ -3407,8 +3381,7 @@ i = eth_host_devices(i, max, list);
/* If no devices were found and an error message was left in the buffer, display it */ /* If no devices were found and an error message was left in the buffer, display it */
if ((i == 0) && (errbuf[0])) { if ((i == 0) && (errbuf[0])) {
char* msg = "Eth: pcap_findalldevs warning: %s\r\n"; char* msg = "Eth: pcap_findalldevs warning: %s\r\n";
printf (msg, errbuf); sim_printf (msg, errbuf);
if (sim_log) fprintf (sim_log, msg, errbuf);
} }
/* return device count */ /* return device count */

View file

@ -215,9 +215,7 @@ for (i=0; i<serial_open_device_count; ++i)
static void sim_error_serial (char *routine, int error) static void sim_error_serial (char *routine, int error)
{ {
fprintf (stderr, "Serial: %s fails with error %d\n", routine, error); sim_printf ("Serial: %s fails with error %d\n", routine, error);
if (sim_deb)
fprintf (sim_deb, "Serial: %s fails with error %d\n", routine, error);
return; return;
} }

View file

@ -162,22 +162,14 @@ int32 i;
for (i=0; (sock_errors[i].text) && (sock_errors[i].value != err); i++) for (i=0; (sock_errors[i].text) && (sock_errors[i].value != err); i++)
; ;
if (sock_errors[i].value == err) { if (sock_errors[i].value == err)
printf ("Sockets: %s error %d - %s\n", emsg, err, sock_errors[i].text); sim_printf ("Sockets: %s error %d - %s\n", emsg, err, sock_errors[i].text);
if (sim_log) else
fprintf (sim_log, "Sockets: %s error %d - %s\n", emsg, err, sock_errors[i].text);
}
else {
#if defined(_WIN32) #if defined(_WIN32)
printf ("Sockets: %s error %d\n", emsg, err); sim_printf ("Sockets: %s error %d\n", emsg, err);
if (sim_log)
fprintf (sim_log, "Sockets: %s error %d\n", emsg, err);
#else #else
printf ("Sockets: %s error %d - %s\n", emsg, err, strerror(err)); sim_printf ("Sockets: %s error %d - %s\n", emsg, err, strerror(err));
if (sim_log)
fprintf (sim_log, "Sockets: %s error %d - %s\n", emsg, err, strerror(err));
#endif #endif
}
if (s != INVALID_SOCKET) if (s != INVALID_SOCKET)
sim_close_sock (s, flg); sim_close_sock (s, flg);
return INVALID_SOCKET; return INVALID_SOCKET;
@ -461,9 +453,7 @@ static void load_function(char* function, _func* func_ptr) {
if (*func_ptr == 0) { if (*func_ptr == 0) {
char* msg = "Sockets: Failed to find function '%s' in %s\r\n"; char* msg = "Sockets: Failed to find function '%s' in %s\r\n";
printf (msg, function, lib_name); sim_printf (msg, function, lib_name);
if (sim_log)
fprintf (sim_log, msg, function, lib_name);
lib_loaded = 3; lib_loaded = 3;
} }
} }
@ -482,9 +472,7 @@ int load_ws2(void) {
/* failed to load DLL */ /* failed to load DLL */
char* msg = "Sockets: Failed to load %s\r\n"; char* msg = "Sockets: Failed to load %s\r\n";
printf (msg, lib_name); sim_printf (msg, lib_name);
if (sim_log)
fprintf (sim_log, msg, lib_name);
lib_loaded = 2; lib_loaded = 2;
break; break;
} else { } else {
@ -732,7 +720,7 @@ wVersionRequested = MAKEWORD (2, 2);
err = WSAStartup (wVersionRequested, &wsaData); /* start Winsock */ err = WSAStartup (wVersionRequested, &wsaData); /* start Winsock */
if (err != 0) if (err != 0)
printf ("Winsock: startup error %d\n", err); sim_printf ("Winsock: startup error %d\n", err);
#if defined(AF_INET6) #if defined(AF_INET6)
load_ws2 (); load_ws2 ();
#endif /* endif AF_INET6 */ #endif /* endif AF_INET6 */

View file

@ -347,8 +347,7 @@ t_stat sim_tape_set_async (UNIT *uptr, int latency)
{ {
#if !defined(SIM_ASYNCH_IO) #if !defined(SIM_ASYNCH_IO)
char *msg = "Tape: can't operate asynchronously\r\n"; char *msg = "Tape: can't operate asynchronously\r\n";
printf ("%s", msg); sim_printf ("%s", msg);
if (sim_log) fprintf (sim_log, "%s", msg);
return SCPE_NOFNC; return SCPE_NOFNC;
#else #else
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx; struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;

View file

@ -118,12 +118,14 @@ UNIT sim_throt_unit = { UDATA (&sim_throt_svc, 0, 0) };
#define DBG_TRC 0x004 /* tracing */ #define DBG_TRC 0x004 /* tracing */
#define DBG_CAL 0x008 /* calibration activities */ #define DBG_CAL 0x008 /* calibration activities */
#define DBG_TIM 0x010 /* timer thread activities */ #define DBG_TIM 0x010 /* timer thread activities */
#define DBG_THR 0x020 /* throttle activities */
DEBTAB sim_timer_debug[] = { DEBTAB sim_timer_debug[] = {
{"TRACE", DBG_TRC}, {"TRACE", DBG_TRC},
{"IDLE", DBG_IDL}, {"IDLE", DBG_IDL},
{"QUEUE", DBG_QUE}, {"QUEUE", DBG_QUE},
{"CALIB", DBG_CAL}, {"CALIB", DBG_CAL},
{"TIME", DBG_TIM}, {"TIME", DBG_TIM},
{"THROT", DBG_THR},
{0} {0}
}; };
@ -907,15 +909,11 @@ t_stat r;
uint32 v; uint32 v;
if (sim_idle_rate_ms == 0) { if (sim_idle_rate_ms == 0) {
printf ("Idling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms); sim_printf ("Idling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms);
if (sim_log)
fprintf (sim_log, "Idling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms);
return SCPE_NOFNC; return SCPE_NOFNC;
} }
if ((val != 0) && (sim_idle_rate_ms > (uint32) val)) { if ((val != 0) && (sim_idle_rate_ms > (uint32) val)) {
printf ("Idling is not available, Minimum OS sleep time is %dms, Requied minimum OS sleep is %dms\n", sim_os_sleep_min_ms, val); sim_printf ("Idling is not available, Minimum OS sleep time is %dms, Requied minimum OS sleep is %dms\n", sim_os_sleep_min_ms, val);
if (sim_log)
fprintf (sim_log, "Idling is not available, Minimum OS sleep time is %dms, Requied minimum OS sleep is %dms\n", sim_os_sleep_min_ms, val);
return SCPE_NOFNC; return SCPE_NOFNC;
} }
if (cptr) { if (cptr) {
@ -927,9 +925,7 @@ if (cptr) {
sim_idle_enab = TRUE; sim_idle_enab = TRUE;
if (sim_throt_type != SIM_THROT_NONE) { if (sim_throt_type != SIM_THROT_NONE) {
sim_set_throt (0, NULL); sim_set_throt (0, NULL);
printf ("Throttling disabled\n"); sim_printf ("Throttling disabled\n");
if (sim_log)
fprintf (sim_log, "Throttling disabled\n");
} }
return SCPE_OK; return SCPE_OK;
} }
@ -969,9 +965,7 @@ if (arg == 0) {
sim_throt_cancel (); sim_throt_cancel ();
} }
else if (sim_idle_rate_ms == 0) { else if (sim_idle_rate_ms == 0) {
printf ("Throttling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms); sim_printf ("Throttling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms);
if (sim_log)
fprintf (sim_log, "Throttling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms);
return SCPE_NOFNC; return SCPE_NOFNC;
} }
else { else {
@ -995,9 +989,7 @@ else {
} }
else return SCPE_ARG; else return SCPE_ARG;
if (sim_idle_enab) { if (sim_idle_enab) {
printf ("Idling disabled\n"); sim_printf ("Idling disabled\n");
if (sim_log)
fprintf (sim_log, "Idling disabled\n");
sim_clr_idle (NULL, 0, NULL, NULL); sim_clr_idle (NULL, 0, NULL, NULL);
} }
sim_throt_val = (uint32) val; sim_throt_val = (uint32) val;
@ -1121,8 +1113,8 @@ switch (sim_throt_state) {
} }
sim_throt_ms_start = sim_throt_ms_stop; sim_throt_ms_start = sim_throt_ms_stop;
sim_throt_state = 2; sim_throt_state = 2;
// fprintf (stderr, "Throttle values a_cps = %f, d_cps = %f, wait = %d\n", sim_debug (DBG_THR, &sim_timer_dev, "sim_throt_svc() Throttle values a_cps = %f, d_cps = %f, wait = %d\n",
// a_cps, d_cps, sim_throt_wait); a_cps, d_cps, sim_throt_wait);
} }
break; break;

View file

@ -2310,9 +2310,7 @@ while (*tptr) {
free (mp->port); free (mp->port);
mp->port = NULL; mp->port = NULL;
} }
printf ("Listening on port %s\n", listen); sim_printf ("Listening on port %s\n", listen);
if (sim_log)
fprintf (sim_log, "Listening on port %s\n", listen);
mp->port = (char *)realloc (mp->port, 1 + strlen (listen)); mp->port = (char *)realloc (mp->port, 1 + strlen (listen));
strcpy (mp->port, listen); /* save port */ strcpy (mp->port, listen); /* save port */
mp->master = sock; /* save master socket */ mp->master = sock; /* save master socket */
@ -2337,9 +2335,7 @@ while (*tptr) {
if (loopback) { if (loopback) {
if (mp->lines > 1) if (mp->lines > 1)
return SCPE_ARG; /* ambiguous */ return SCPE_ARG; /* ambiguous */
printf ("Operating in loopback mode\n"); sim_printf ("Operating in loopback mode\n");
if (sim_log)
fprintf (sim_log, "Operating in loopback mode\n");
for (i = 0; i < mp->lines; i++) { for (i = 0; i < mp->lines; i++) {
lp = mp->ldsc + i; lp = mp->ldsc + i;
tmxr_set_line_loopback (lp, loopback); tmxr_set_line_loopback (lp, loopback);
@ -2452,9 +2448,7 @@ while (*tptr) {
if (sock == INVALID_SOCKET) /* open error */ if (sock == INVALID_SOCKET) /* open error */
return SCPE_OPENERR; return SCPE_OPENERR;
_mux_detach_line (lp, TRUE, FALSE); _mux_detach_line (lp, TRUE, FALSE);
printf ("Line %d Listening on port %s\n", line, listen); sim_printf ("Line %d Listening on port %s\n", line, listen);
if (sim_log)
fprintf (sim_log, "Line %d Listening on port %s\n", line, listen);
lp->port = (char *)realloc (lp->port, 1 + strlen (listen)); lp->port = (char *)realloc (lp->port, 1 + strlen (listen));
strcpy (lp->port, listen); /* save port */ strcpy (lp->port, listen); /* save port */
lp->master = sock; /* save master socket */ lp->master = sock; /* save master socket */
@ -2513,9 +2507,7 @@ while (*tptr) {
} }
if (loopback) { if (loopback) {
tmxr_set_line_loopback (lp, loopback); tmxr_set_line_loopback (lp, loopback);
printf ("Line %d operating in loopback mode\n", line); sim_printf ("Line %d operating in loopback mode\n", line);
if (sim_log)
fprintf (sim_log, "Line %d operating in loopback mode\n", line);
} }
lp->modem_control = modem_control; lp->modem_control = modem_control;
r = SCPE_OK; r = SCPE_OK;
@ -2794,7 +2786,7 @@ while (sim_asynch_enabled) {
wait_count = 0; wait_count = 0;
if (select_errno == EINTR) if (select_errno == EINTR)
break; break;
fprintf (stderr, "select() returned -1, errno=%d - %s\r\n", select_errno, strerror(select_errno)); sim_printf ("select() returned -1, errno=%d - %s\r\n", select_errno, strerror(select_errno));
abort(); abort();
break; break;
default: default:
@ -2915,7 +2907,7 @@ while (sim_asynch_enabled) {
pthread_mutex_lock (&sim_tmxr_poll_lock); pthread_mutex_lock (&sim_tmxr_poll_lock);
switch (status) { switch (status) {
case WAIT_FAILED: case WAIT_FAILED:
fprintf (stderr, "WaitForMultipleObjects() Failed, LastError=%d\r\n", GetLastError()); sim_printf ("WaitForMultipleObjects() Failed, LastError=%d\r\n", GetLastError());
abort(); abort();
break; break;
case WAIT_TIMEOUT: case WAIT_TIMEOUT:
@ -3030,7 +3022,7 @@ while (sim_asynch_enabled) {
IO$_READLBLK | IO$M_NOECHO | IO$M_NOFILTR | IO$M_TIMED | IO$M_TRMNOECHO, IO$_READLBLK | IO$M_NOECHO | IO$M_NOFILTR | IO$M_TIMED | IO$M_TRMNOECHO,
&iosb, 0, 0, buf, 1, 1, term, 0, 0); &iosb, 0, 0, buf, 1, 1, term, 0, 0);
if (status != SS$_NORMAL) { if (status != SS$_NORMAL) {
fprintf (stderr, "_tmxr_serial_line_poll() - QIO Failed, Status=%d\r\n", status); sim_printf ("_tmxr_serial_line_poll() - QIO Failed, Status=%d\r\n", status);
abort(); abort();
} }
wait_count = 0; wait_count = 0;

View file

@ -1521,9 +1521,7 @@ SDL_Init (SDL_INIT_VIDEO);
SDL_CreateWindowAndRenderer (vid_width, vid_height, SDL_WINDOW_SHOWN, &vid_window, &vid_renderer); SDL_CreateWindowAndRenderer (vid_width, vid_height, SDL_WINDOW_SHOWN, &vid_window, &vid_renderer);
if ((vid_window == NULL) || (vid_renderer == NULL)) { if ((vid_window == NULL) || (vid_renderer == NULL)) {
printf ("%s: Error Creating Video Window: %s\b", sim_dname(vid_dev), SDL_GetError()); sim_printf ("%s: Error Creating Video Window: %s\b", sim_dname(vid_dev), SDL_GetError());
if (sim_log)
fprintf (sim_log, "%s: Error Creating Video Window: %s\b", sim_dname(vid_dev), SDL_GetError());
SDL_Quit (); SDL_Quit ();
return 0; return 0;
} }
@ -1537,9 +1535,7 @@ vid_texture = SDL_CreateTexture (vid_renderer,
SDL_TEXTUREACCESS_STREAMING, SDL_TEXTUREACCESS_STREAMING,
vid_width, vid_height); vid_width, vid_height);
if (!vid_texture) { if (!vid_texture) {
printf ("%s: Error configuring Video environment: %s\b", sim_dname(vid_dev), SDL_GetError()); sim_printf ("%s: Error configuring Video environment: %s\b", sim_dname(vid_dev), SDL_GetError());
if (sim_log)
fprintf (sim_log, "%s: Error configuring Video environment: %s\b", sim_dname(vid_dev), SDL_GetError());
SDL_DestroyRenderer(vid_renderer); SDL_DestroyRenderer(vid_renderer);
vid_renderer = NULL; vid_renderer = NULL;
SDL_DestroyWindow(vid_window); SDL_DestroyWindow(vid_window);