sigma: Added IO numeric channel numbers to SET/SHOW

This commit is contained in:
Bob Supnik 2022-07-23 16:45:43 -07:00 committed by Mark Pizzolato
parent 59ddf72b52
commit 4846006b41

View file

@ -23,6 +23,7 @@
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik.
21-Jul-2022 RMS Added numeric channel numbers to SET/SHOW
07-Jul-2022 RMS Fixed dangling else in read/write direct (Ken Rector)
05-Mar-2020 RMS Fixed s5x0_ireg size declaration (Mark Pizzolato)
09-Mar-2017 RMS Fixed unspecified return value in HIO (COVERITY)
@ -1395,15 +1396,19 @@ t_stat io_set_dvc (UNIT* uptr, int32 val, CONST char *cptr, void *desc)
int32 num;
DEVICE *dptr;
dib_t *dibp;
t_stat r;
if (((dptr = find_dev_from_unit (uptr)) == NULL) ||
((dibp = (dib_t *) dptr->ctxt) == NULL))
return SCPE_IERR;
if ((cptr == NULL) || (*cptr == 0) || (*(cptr + 1) != 0))
if ((cptr == NULL) || (*cptr == 0))
return SCPE_ARG;
num = *cptr - 'A';
if ((num < 0) || (num >= (int32) chan_num))
num = (int32) get_uint (cptr, 10, cpu_tab[cpu_model].chan_max, &r);
if (r != SCPE_OK) {
num = *cptr - 'A';
if ((num < 0) || (num >= (int32) cpu_tab[cpu_model].chan_max))
return SCPE_ARG;
}
dibp->dva = (dibp->dva & ~DVA_CHAN) | (num << DVA_V_CHAN);
return SCPE_OK;
}
@ -1412,11 +1417,13 @@ t_stat io_show_dvc (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
{
DEVICE *dptr;
dib_t *dibp;
uint32 dvc;
if (((dptr = find_dev_from_unit (uptr)) == NULL) ||
((dibp = (dib_t *) dptr->ctxt) == NULL))
return SCPE_IERR;
fprintf (st, "channel=%c", DVA_GETCHAN (dibp->dva) + 'A');
dvc = DVA_GETCHAN (dibp->dva);
fprintf (st, "channel=%d (%c)", dvc, (dvc + 'A'));
return SCPE_OK;
}