diff --git a/CDC1700/cdc1700_cd.c b/CDC1700/cdc1700_cd.c index c30ae960..d50869d1 100644 --- a/CDC1700/cdc1700_cd.c +++ b/CDC1700/cdc1700_cd.c @@ -325,30 +325,14 @@ IO_DEVICE CDdev = IODEV(NULL, "1733-2", 1733, 3, 0xFF, 0, */ UNIT cd_unit[] = { - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[0], &cd_unit[1] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[0], &cd_unit[0] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[1], &cd_unit[3] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[1], &cd_unit[2] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[2], &cd_unit[5] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[2], &cd_unit[4] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[3], &cd_unit[7] - }, - { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE), - 0, 0, 0, 0, 0, &CDunits[3], &cd_unit[6] - } + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)}, + { UDATA(&cd_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_856_4, CD856_4_SIZE)} }; REG cd_reg[] = { @@ -1058,7 +1042,27 @@ static t_stat CDreset(DEVICE *dptr) t_stat cd_reset(DEVICE *dptr) { t_stat r = SCPE_OK; + static t_bool Initialized = FALSE; + if (!Initialized) { /* Initialize additional UNIT state not done by UDATA macro */ + Initialized = TRUE; + cd_unit[0].up7 = &CDunits[0]; + cd_unit[0].up8 = &cd_unit[1]; + cd_unit[1].up7 = &CDunits[0]; + cd_unit[1].up8 = &cd_unit[0]; + cd_unit[2].up7 = &CDunits[1]; + cd_unit[2].up8 = &cd_unit[3]; + cd_unit[3].up7 = &CDunits[1]; + cd_unit[3].up8 = &cd_unit[2]; + cd_unit[4].up7 = &CDunits[2]; + cd_unit[4].up8 = &cd_unit[5]; + cd_unit[5].up7 = &CDunits[2]; + cd_unit[5].up8 = &cd_unit[4]; + cd_unit[6].up7 = &CDunits[3]; + cd_unit[6].up8 = &cd_unit[7]; + cd_unit[7].up7 = &CDunits[3]; + cd_unit[7].up8 = &cd_unit[6]; + } if (IOFWinitialized) if ((dptr->flags & DEV_DIS) == 0) if ((r = checkReset(dptr, CDdev.iod_equip) == SCPE_OK)) { diff --git a/CDC1700/cdc1700_dp.c b/CDC1700/cdc1700_dp.c index 1e0aa491..face232c 100644 --- a/CDC1700/cdc1700_dp.c +++ b/CDC1700/cdc1700_dp.c @@ -249,12 +249,8 @@ IO_DEVICE DPdev = IODEV(NULL, "1738-B", 1738, 3, 0xFF, 0, */ UNIT dp_unit[] = { - { UDATA(&dp_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_854, DP854_SIZE), - 0, 0, 0, 0, 0, &DPunits[0] - }, - { UDATA(&dp_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_854, DP854_SIZE), - 0, 0, 0, 0, 0, &DPunits[1] - }, + { UDATA(&dp_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_854, DP854_SIZE)}, + { UDATA(&dp_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+UNIT_854, DP854_SIZE)}, }; REG dp_reg[] = { @@ -812,6 +808,8 @@ t_stat dp_reset(DEVICE *dptr) { t_stat r; + dp_unit[0].up7 = &DPunits[0]; + dp_unit[1].up7 = &DPunits[1]; if (IOFWinitialized) if ((dptr->flags & DEV_DIS) == 0) if ((r = checkReset(dptr, DPdev.iod_equip)) != SCPE_OK) diff --git a/sim_defs.h b/sim_defs.h index cec4d543..0b48e3f8 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -594,11 +594,6 @@ struct UNIT { void (*io_flush)(UNIT *up); /* io flush routine */ uint32 iostarttime; /* I/O start time */ int32 buf; /* buffer */ - int32 wait; /* wait */ - int32 u3; /* device specific */ - int32 u4; /* device specific */ - int32 u5; /* device specific */ - int32 u6; /* device specific */ void *up7; /* device specific */ void *up8; /* device specific */ uint16 us9; /* device specific */ @@ -631,6 +626,14 @@ struct UNIT { double a_due_gtime; /* due time (in instructions) for timer event */ double a_usec_delay; /* time delay for timer event */ #endif + /* Everything above here in the UNIT structure is within the scope of the UDATA + macro initializer, if a simulator developer wants to initialize any of these + values, they must be done by explicit code usually in a device reset routine */ + int32 wait; /* wait */ + int32 u3; /* device specific */ + int32 u4; /* device specific */ + int32 u5; /* device specific */ + int32 u6; /* device specific */ }; /* Unit flags */ @@ -911,7 +914,12 @@ struct MEMFILE { */ -#define UDATA(act,fl,cap) NULL,act,NULL,NULL,NULL,NULL,0,0,(fl),0,(cap),0,NULL,0,0 +#ifdef SIM_ASYNCH_IO +#define UDATA(act,fl,cap) NULL,act,NULL,NULL,NULL,NULL,0,0,(fl),0,(cap),0,NULL,0,0,NULL,NULL,0,0,NULL,NULL,NULL,0,0,0,NULL,0,NULL,NULL,0,NULL,\ + NULL,NULL,NULL,0,NULL,0,0,0,0,0 +#else +#define UDATA(act,fl,cap) NULL,act,NULL,NULL,NULL,NULL,0,0,(fl),0,(cap),0,NULL,0,0,NULL,NULL,0,0,NULL,NULL,NULL,0,0,0,NULL,0,NULL,NULL,0,NULL +#endif /* Register initialization macros.