mirror of
https://github.com/rcornwell/sims.git
synced 2026-05-04 15:07:17 +00:00
I7000: Support for new interface to sim_card.
This commit is contained in:
@@ -189,6 +189,8 @@ t_stat
|
|||||||
cdp_srv(UNIT *uptr) {
|
cdp_srv(UNIT *uptr) {
|
||||||
int chan = UNIT_G_CHAN(uptr->flags);
|
int chan = UNIT_G_CHAN(uptr->flags);
|
||||||
int u = (uptr - cdp_unit);
|
int u = (uptr - cdp_unit);
|
||||||
|
uint16 *image = (uint16 *)(uptr->up7);
|
||||||
|
|
||||||
/* Waiting for disconnect */
|
/* Waiting for disconnect */
|
||||||
if (uptr->u5 & URCSTA_WDISCO) {
|
if (uptr->u5 & URCSTA_WDISCO) {
|
||||||
if (chan_stat(chan, DEV_DISCO)) {
|
if (chan_stat(chan, DEV_DISCO)) {
|
||||||
@@ -209,9 +211,9 @@ cdp_srv(UNIT *uptr) {
|
|||||||
if (uptr->u5 & URCSTA_FULL) {
|
if (uptr->u5 & URCSTA_FULL) {
|
||||||
#ifdef STACK_DEV
|
#ifdef STACK_DEV
|
||||||
switch(sim_punch_card(uptr,
|
switch(sim_punch_card(uptr,
|
||||||
&stack_unit[(u * 10) + ((uptr->u5 >> 16) & 0xf)])) {
|
&stack_unit[(u * 10) + ((uptr->u5 >> 16) & 0xf)], image)) {
|
||||||
#else
|
#else
|
||||||
switch(sim_punch_card(uptr, NULL)) {
|
switch(sim_punch_card(uptr, NULL, image)) {
|
||||||
#endif
|
#endif
|
||||||
case SCPE_EOF:
|
case SCPE_EOF:
|
||||||
case SCPE_UNATT:
|
case SCPE_UNATT:
|
||||||
@@ -240,11 +242,8 @@ cdp_srv(UNIT *uptr) {
|
|||||||
|
|
||||||
/* Copy next column over */
|
/* Copy next column over */
|
||||||
if (uptr->u5 & URCSTA_WRITE && uptr->u4 < 80) {
|
if (uptr->u5 & URCSTA_WRITE && uptr->u4 < 80) {
|
||||||
struct _card_data *data;
|
|
||||||
uint8 ch = 0;
|
uint8 ch = 0;
|
||||||
|
|
||||||
data = (struct _card_data *)uptr->up7;
|
|
||||||
|
|
||||||
switch(chan_read_char(chan, &ch, 0)) {
|
switch(chan_read_char(chan, &ch, 0)) {
|
||||||
case TIME_ERROR:
|
case TIME_ERROR:
|
||||||
case END_RECORD:
|
case END_RECORD:
|
||||||
@@ -257,7 +256,7 @@ cdp_srv(UNIT *uptr) {
|
|||||||
else if (ch == 020)
|
else if (ch == 020)
|
||||||
ch = 0;
|
ch = 0;
|
||||||
sim_debug(DEBUG_DATA, &cdp_dev, "%d: Char < %02o\n", u, ch);
|
sim_debug(DEBUG_DATA, &cdp_dev, "%d: Char < %02o\n", u, ch);
|
||||||
data->image[uptr->u4++] = sim_bcd_to_hol(ch);
|
image[uptr->u4++] = sim_bcd_to_hol(ch);
|
||||||
if (uptr->u4 == 80) {
|
if (uptr->u4 == 80) {
|
||||||
chan_set(chan, DEV_REOR);
|
chan_set(chan, DEV_REOR);
|
||||||
uptr->u5 |= URCSTA_WDISCO|URCSTA_BUSY|URCSTA_FULL;
|
uptr->u5 |= URCSTA_WDISCO|URCSTA_BUSY|URCSTA_FULL;
|
||||||
@@ -278,24 +277,32 @@ cdp_ini(UNIT *uptr, t_bool f) {
|
|||||||
t_stat
|
t_stat
|
||||||
cdp_attach(UNIT * uptr, CONST char *file)
|
cdp_attach(UNIT * uptr, CONST char *file)
|
||||||
{
|
{
|
||||||
t_stat r;
|
t_stat r;
|
||||||
|
|
||||||
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
uptr->u5 = 0;
|
if (uptr->up7 == 0) {
|
||||||
|
uptr->up7 = calloc(80, sizeof(uint16));
|
||||||
|
uptr->u5 = 0;
|
||||||
|
}
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_stat
|
t_stat
|
||||||
cdp_detach(UNIT * uptr)
|
cdp_detach(UNIT * uptr)
|
||||||
{
|
{
|
||||||
|
uint16 *image = (uint16 *)(uptr->up7);
|
||||||
|
|
||||||
if (uptr->u5 & URCSTA_FULL)
|
if (uptr->u5 & URCSTA_FULL)
|
||||||
#ifdef STACK_DEV
|
#ifdef STACK_DEV
|
||||||
sim_punch_card(uptr, &stack_unit[
|
sim_punch_card(uptr, &stack_unit[
|
||||||
((uptr - cdp_unit) * 10) + ((uptr->u5 >> 16) & 0xf)]);
|
((uptr - cdp_unit) * 10) + ((uptr->u5 >> 16) & 0xf)], image);
|
||||||
#else
|
#else
|
||||||
sim_punch_card(uptr, NULL);
|
sim_punch_card(uptr, NULL, image);
|
||||||
#endif
|
#endif
|
||||||
|
if (uptr->up7 == 0)
|
||||||
|
free(uptr->up7);
|
||||||
|
uptr->up7 = 0;
|
||||||
return sim_card_detach(uptr);
|
return sim_card_detach(uptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@
|
|||||||
#include "sim_defs.h"
|
#include "sim_defs.h"
|
||||||
#ifdef NUM_DEVS_CDR
|
#ifdef NUM_DEVS_CDR
|
||||||
|
|
||||||
#define UNIT_CDR UNIT_ATTABLE | UNIT_RO | UNIT_DISABLE | \
|
#define UNIT_CDR UNIT_ATTABLE | UNIT_RO | UNIT_DISABLE | MODE_026
|
||||||
UNIT_ROABLE | MODE_026
|
|
||||||
|
|
||||||
/* Flags for punch and reader. */
|
/* Flags for punch and reader. */
|
||||||
#define ATTENA (1 << (UNIT_V_UF+7))
|
#define ATTENA (1 << (UNIT_V_UF+7))
|
||||||
@@ -91,7 +90,7 @@ MTAB cdr_mod[] = {
|
|||||||
DEVICE cdr_dev = {
|
DEVICE cdr_dev = {
|
||||||
"CDR", cdr_unit, NULL, cdr_mod,
|
"CDR", cdr_unit, NULL, cdr_mod,
|
||||||
NUM_DEVS_CDR, 8, 15, 1, 8, 8,
|
NUM_DEVS_CDR, 8, 15, 1, 8, 8,
|
||||||
NULL, NULL, NULL, &cdr_boot, &cdr_attach, &sim_card_detach,
|
NULL, NULL, NULL, &cdr_boot, &cdr_attach, &cdr_detach,
|
||||||
&cdr_dib, DEV_DISABLE | DEV_DEBUG, 0, crd_debug,
|
&cdr_dib, DEV_DISABLE | DEV_DEBUG, 0, crd_debug,
|
||||||
NULL, NULL, &cdr_help, NULL, NULL, &cdr_description
|
NULL, NULL, &cdr_help, NULL, NULL, &cdr_description
|
||||||
};
|
};
|
||||||
@@ -169,9 +168,7 @@ t_stat
|
|||||||
cdr_srv(UNIT *uptr) {
|
cdr_srv(UNIT *uptr) {
|
||||||
int chan = UNIT_G_CHAN(uptr->flags);
|
int chan = UNIT_G_CHAN(uptr->flags);
|
||||||
int u = (uptr - cdr_unit);
|
int u = (uptr - cdr_unit);
|
||||||
struct _card_data *data;
|
uint16 *image = (uint16 *)(uptr->up7);
|
||||||
|
|
||||||
data = (struct _card_data *)uptr->up7;
|
|
||||||
|
|
||||||
/* Waiting for disconnect */
|
/* Waiting for disconnect */
|
||||||
if (uptr->u5 & URCSTA_WDISCO) {
|
if (uptr->u5 & URCSTA_WDISCO) {
|
||||||
@@ -201,7 +198,7 @@ cdr_srv(UNIT *uptr) {
|
|||||||
/* Check if new card requested. */
|
/* Check if new card requested. */
|
||||||
if (uptr->u4 == 0 && uptr->u5 & URCSTA_READ &&
|
if (uptr->u4 == 0 && uptr->u5 & URCSTA_READ &&
|
||||||
(uptr->u5 & URCSTA_CARD) == 0) {
|
(uptr->u5 & URCSTA_CARD) == 0) {
|
||||||
switch(sim_read_card(uptr)) {
|
switch(sim_read_card(uptr, image)) {
|
||||||
case SCPE_EOF:
|
case SCPE_EOF:
|
||||||
sim_debug(DEBUG_DETAIL, &cdr_dev, "%d: EOF\n", u);
|
sim_debug(DEBUG_DETAIL, &cdr_dev, "%d: EOF\n", u);
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
@@ -229,7 +226,7 @@ cdr_srv(UNIT *uptr) {
|
|||||||
}
|
}
|
||||||
#ifdef I7070
|
#ifdef I7070
|
||||||
/* Check if load card. */
|
/* Check if load card. */
|
||||||
if (uptr->capac && (data->image[uptr->capac-1] & 0x800)) {
|
if (uptr->capac && (image[uptr->capac-1] & 0x800)) {
|
||||||
uptr->u5 |= URCSTA_LOAD;
|
uptr->u5 |= URCSTA_LOAD;
|
||||||
chan_set_load_mode(chan);
|
chan_set_load_mode(chan);
|
||||||
} else {
|
} else {
|
||||||
@@ -249,7 +246,7 @@ cdr_srv(UNIT *uptr) {
|
|||||||
|
|
||||||
#ifdef I7080
|
#ifdef I7080
|
||||||
/* Detect RSU */
|
/* Detect RSU */
|
||||||
if (data->image[uptr->u4] == 0x924) {
|
if (image[uptr->u4] == 0x924) {
|
||||||
uptr->u5 &= ~URCSTA_READ;
|
uptr->u5 &= ~URCSTA_READ;
|
||||||
uptr->u5 |= URCSTA_WDISCO;
|
uptr->u5 |= URCSTA_WDISCO;
|
||||||
chan_set(chan, DEV_REOR);
|
chan_set(chan, DEV_REOR);
|
||||||
@@ -258,7 +255,7 @@ cdr_srv(UNIT *uptr) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ch = sim_hol_to_bcd(data->image[uptr->u4]);
|
ch = sim_hol_to_bcd(image[uptr->u4]);
|
||||||
|
|
||||||
/* Handle invalid punch */
|
/* Handle invalid punch */
|
||||||
if (ch == 0x7f) {
|
if (ch == 0x7f) {
|
||||||
@@ -321,14 +318,31 @@ cdr_attach(UNIT * uptr, CONST char *file)
|
|||||||
|
|
||||||
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
uptr->u5 &= URCSTA_BUSY|URCSTA_WDISCO;
|
if (uptr->up7 == 0) {
|
||||||
uptr->u4 = 0;
|
uptr->up7 = malloc(sizeof(uint16)*80);
|
||||||
uptr->u6 = 0;
|
uptr->u5 &= URCSTA_BUSY|URCSTA_WDISCO;
|
||||||
|
uptr->u4 = 0;
|
||||||
|
uptr->u6 = 0;
|
||||||
|
}
|
||||||
#ifdef I7010
|
#ifdef I7010
|
||||||
chan_set_attn_urec(UNIT_G_CHAN(uptr->flags), cdr_dib.addr);
|
chan_set_attn_urec(UNIT_G_CHAN(uptr->flags), cdr_dib.addr);
|
||||||
#endif
|
#endif
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t_stat
|
||||||
|
cdr_detach(UNIT * uptr)
|
||||||
|
{
|
||||||
|
t_stat r;
|
||||||
|
|
||||||
|
if ((r = sim_card_detach(uptr)) != SCPE_OK)
|
||||||
|
return r;
|
||||||
|
if (uptr->up7 != 0)
|
||||||
|
free(uptr->up7);
|
||||||
|
uptr->up7 = 0;
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef I7070
|
#ifdef I7070
|
||||||
t_stat
|
t_stat
|
||||||
cdr_setload(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
cdr_setload(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||||
|
|||||||
@@ -959,7 +959,7 @@ ht_attach(UNIT * uptr, CONST char *file)
|
|||||||
{
|
{
|
||||||
t_stat r;
|
t_stat r;
|
||||||
|
|
||||||
if ((r = sim_tape_attach(uptr, file)) != SCPE_OK)
|
if ((r = sim_tape_attach_ex(uptr, file, 0, 0)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
uptr->u5 = HT_BOT /*|HT_ATTN */ ;
|
uptr->u5 = HT_BOT /*|HT_ATTN */ ;
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
|
|||||||
@@ -1354,7 +1354,7 @@ mt_attach(UNIT * uptr, CONST char *file)
|
|||||||
{
|
{
|
||||||
t_stat r;
|
t_stat r;
|
||||||
|
|
||||||
if ((r = sim_tape_attach(uptr, file)) != SCPE_OK)
|
if ((r = sim_tape_attach_ex(uptr, file, 0, 0)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
uptr->u3 = 0;
|
uptr->u3 = 0;
|
||||||
uptr->u5 |= MT_RDY;
|
uptr->u5 |= MT_RDY;
|
||||||
|
|||||||
@@ -121,19 +121,19 @@ t_stat cdp_srv(UNIT * uptr)
|
|||||||
{
|
{
|
||||||
int chan = UNIT_G_CHAN(uptr->flags);
|
int chan = UNIT_G_CHAN(uptr->flags);
|
||||||
int u = (uptr - cdp_unit);
|
int u = (uptr - cdp_unit);
|
||||||
|
uint16 *image = (uint16 *)(uptr->up7);
|
||||||
int pos;
|
int pos;
|
||||||
t_uint64 wd;
|
t_uint64 wd;
|
||||||
int bit;
|
int bit;
|
||||||
t_uint64 mask;
|
t_uint64 mask;
|
||||||
int b;
|
int b;
|
||||||
int col;
|
int col;
|
||||||
struct _card_data *data;
|
|
||||||
|
|
||||||
/* Channel has disconnected, abort current card. */
|
/* Channel has disconnected, abort current card. */
|
||||||
if (uptr->u5 & URCSTA_CMD && chan_stat(chan, DEV_DISCO)) {
|
if (uptr->u5 & URCSTA_CMD && chan_stat(chan, DEV_DISCO)) {
|
||||||
if ((uptr->u5 & CDPSTA_POSMASK) != 0) {
|
if ((uptr->u5 & CDPSTA_POSMASK) != 0) {
|
||||||
sim_debug(DEBUG_DETAIL, &cdp_dev, "punch card\n");
|
sim_debug(DEBUG_DETAIL, &cdp_dev, "punch card\n");
|
||||||
sim_punch_card(uptr, NULL);
|
sim_punch_card(uptr, NULL, image);
|
||||||
uptr->u5 &= ~CDPSTA_PUNCH;
|
uptr->u5 &= ~CDPSTA_PUNCH;
|
||||||
}
|
}
|
||||||
uptr->u5 &= ~(URCSTA_WRITE | URCSTA_CMD | CDPSTA_POSMASK);
|
uptr->u5 &= ~(URCSTA_WRITE | URCSTA_CMD | CDPSTA_POSMASK);
|
||||||
@@ -189,7 +189,7 @@ t_stat cdp_srv(UNIT * uptr)
|
|||||||
sim_debug(DEBUG_CHAN, &cdp_dev, "unit=%d disconnect\n", u);
|
sim_debug(DEBUG_CHAN, &cdp_dev, "unit=%d disconnect\n", u);
|
||||||
}
|
}
|
||||||
sim_debug(DEBUG_DETAIL, &cdp_dev, "punch card full\n");
|
sim_debug(DEBUG_DETAIL, &cdp_dev, "punch card full\n");
|
||||||
sim_punch_card(uptr, NULL);
|
sim_punch_card(uptr, NULL, image);
|
||||||
uptr->u5 |= URCSTA_IDLE;
|
uptr->u5 |= URCSTA_IDLE;
|
||||||
uptr->u5 &= ~(URCSTA_WRITE | CDPSTA_POSMASK | CDPSTA_PUNCH);
|
uptr->u5 &= ~(URCSTA_WRITE | CDPSTA_POSMASK | CDPSTA_PUNCH);
|
||||||
uptr->wait = 85;
|
uptr->wait = 85;
|
||||||
@@ -201,7 +201,6 @@ t_stat cdp_srv(UNIT * uptr)
|
|||||||
|
|
||||||
sim_debug(DEBUG_DATA, &cdp_dev, "unit=%d write column %d ", u, pos);
|
sim_debug(DEBUG_DATA, &cdp_dev, "unit=%d write column %d ", u, pos);
|
||||||
wd = 0;
|
wd = 0;
|
||||||
data = (struct _card_data *)uptr->up7;
|
|
||||||
switch (chan_read(chan, &wd, 0)) {
|
switch (chan_read(chan, &wd, 0)) {
|
||||||
case DATA_OK:
|
case DATA_OK:
|
||||||
sim_debug(DEBUG_DATA, &cdp_dev, " %012llo\n", wd);
|
sim_debug(DEBUG_DATA, &cdp_dev, " %012llo\n", wd);
|
||||||
@@ -212,7 +211,7 @@ t_stat cdp_srv(UNIT * uptr)
|
|||||||
|
|
||||||
for (col = 35; col >= 0; mask <<= 1, col--) {
|
for (col = 35; col >= 0; mask <<= 1, col--) {
|
||||||
if (wd & mask)
|
if (wd & mask)
|
||||||
data->image[col + b] |= bit;
|
image[col + b] |= bit;
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
uptr->wait = 0;
|
uptr->wait = 0;
|
||||||
@@ -258,13 +257,19 @@ cdp_attach(UNIT * uptr, CONST char *file)
|
|||||||
|
|
||||||
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
uptr->u5 = CDPSTA_POSMASK;
|
if (uptr->up7 == 0) {
|
||||||
|
uptr->up7 = calloc(80, sizeof(uint16));
|
||||||
|
uptr->u5 = CDPSTA_POSMASK;
|
||||||
|
}
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_stat
|
t_stat
|
||||||
cdp_detach(UNIT * uptr)
|
cdp_detach(UNIT * uptr)
|
||||||
{
|
{
|
||||||
|
if (uptr->up7 != 0)
|
||||||
|
free(uptr->up7);
|
||||||
|
uptr->up7 = 0;
|
||||||
return sim_card_detach(uptr);
|
return sim_card_detach(uptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
|
|
||||||
#ifdef NUM_DEVS_CDR
|
#ifdef NUM_DEVS_CDR
|
||||||
|
|
||||||
#define UNIT_CDR UNIT_ATTABLE | UNIT_RO | UNIT_DISABLE | UNIT_ROABLE |\
|
#define UNIT_CDR UNIT_ATTABLE | UNIT_RO | UNIT_DISABLE | MODE_026
|
||||||
MODE_026
|
|
||||||
|
|
||||||
|
|
||||||
/* std devices. data structures
|
/* std devices. data structures
|
||||||
@@ -119,9 +118,9 @@ t_stat cdr_srv(UNIT * uptr)
|
|||||||
int chan = UNIT_G_CHAN(uptr->flags);
|
int chan = UNIT_G_CHAN(uptr->flags);
|
||||||
int u = (uptr - cdr_unit);
|
int u = (uptr - cdr_unit);
|
||||||
int pos, col, b;
|
int pos, col, b;
|
||||||
|
uint16 *image = (uint16 *)(uptr->up7);
|
||||||
uint16 bit;
|
uint16 bit;
|
||||||
t_uint64 mask, wd;
|
t_uint64 mask, wd;
|
||||||
struct _card_data *data;
|
|
||||||
|
|
||||||
/* Channel has disconnected, abort current read. */
|
/* Channel has disconnected, abort current read. */
|
||||||
if (uptr->u5 & URCSTA_CMD && chan_stat(chan, DEV_DISCO)) {
|
if (uptr->u5 & URCSTA_CMD && chan_stat(chan, DEV_DISCO)) {
|
||||||
@@ -164,7 +163,7 @@ t_stat cdr_srv(UNIT * uptr)
|
|||||||
|
|
||||||
pos = (uptr->u5 & CDRPOSMASK) >> CDRPOSSHIFT;
|
pos = (uptr->u5 & CDRPOSMASK) >> CDRPOSSHIFT;
|
||||||
if (pos == (CDRPOSMASK >> CDRPOSSHIFT)) {
|
if (pos == (CDRPOSMASK >> CDRPOSSHIFT)) {
|
||||||
switch (sim_read_card(uptr)) {
|
switch (sim_read_card(uptr, image)) {
|
||||||
case SCPE_UNATT:
|
case SCPE_UNATT:
|
||||||
case SCPE_IOERR:
|
case SCPE_IOERR:
|
||||||
sim_debug(DEBUG_EXP, &cdr_dev, "unit=%d Setting ATTN\n", u);
|
sim_debug(DEBUG_EXP, &cdr_dev, "unit=%d Setting ATTN\n", u);
|
||||||
@@ -197,7 +196,6 @@ t_stat cdr_srv(UNIT * uptr)
|
|||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = (struct _card_data *)uptr->up7;
|
|
||||||
/* Bit flip into read buffer */
|
/* Bit flip into read buffer */
|
||||||
bit = 1 << (pos / 2);
|
bit = 1 << (pos / 2);
|
||||||
mask = 1;
|
mask = 1;
|
||||||
@@ -205,7 +203,7 @@ t_stat cdr_srv(UNIT * uptr)
|
|||||||
b = (pos & 1)?36:0;
|
b = (pos & 1)?36:0;
|
||||||
|
|
||||||
for (col = 35; col >= 0; mask <<= 1) {
|
for (col = 35; col >= 0; mask <<= 1) {
|
||||||
if (data->image[col-- + b] & bit)
|
if (image[col-- + b] & bit)
|
||||||
wd |= mask;
|
wd |= mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +245,7 @@ cdr_boot(int32 unit_num, DEVICE * dptr)
|
|||||||
int chan = UNIT_G_CHAN(uptr->flags);
|
int chan = UNIT_G_CHAN(uptr->flags);
|
||||||
t_stat r;
|
t_stat r;
|
||||||
int pos;
|
int pos;
|
||||||
struct _card_data *data;
|
uint16 *image = (uint16 *)(uptr->up7);
|
||||||
|
|
||||||
if ((uptr->flags & UNIT_ATT) == 0)
|
if ((uptr->flags & UNIT_ATT) == 0)
|
||||||
return SCPE_UNATT; /* attached? */
|
return SCPE_UNATT; /* attached? */
|
||||||
@@ -255,12 +253,11 @@ cdr_boot(int32 unit_num, DEVICE * dptr)
|
|||||||
/* Init for a read */
|
/* Init for a read */
|
||||||
if (cdr_cmd(uptr, IO_RDS, cdr_dib.addr) != SCPE_OK)
|
if (cdr_cmd(uptr, IO_RDS, cdr_dib.addr) != SCPE_OK)
|
||||||
return STOP_IONRDY;
|
return STOP_IONRDY;
|
||||||
r = sim_read_card(uptr);
|
r = sim_read_card(uptr, image);
|
||||||
if (r != SCPE_OK)
|
if (r != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* Copy first three records. */
|
/* Copy first three records. */
|
||||||
data = (struct _card_data *)uptr->up7;
|
|
||||||
uptr->u5 &= ~CDRPOSMASK;
|
uptr->u5 &= ~CDRPOSMASK;
|
||||||
for(pos = 0; pos <3; pos++) {
|
for(pos = 0; pos <3; pos++) {
|
||||||
uint16 bit = 1 << (pos / 2);
|
uint16 bit = 1 << (pos / 2);
|
||||||
@@ -272,7 +269,7 @@ cdr_boot(int32 unit_num, DEVICE * dptr)
|
|||||||
break;
|
break;
|
||||||
M[pos] = 0;
|
M[pos] = 0;
|
||||||
for (col = 35; col >= 0; mask <<= 1) {
|
for (col = 35; col >= 0; mask <<= 1) {
|
||||||
if (data->image[col-- + b] & bit)
|
if (image[col-- + b] & bit)
|
||||||
M[pos] |= mask;
|
M[pos] |= mask;
|
||||||
}
|
}
|
||||||
sim_debug(DEBUG_DATA, &cdr_dev, "boot read row %d %012llo\n",
|
sim_debug(DEBUG_DATA, &cdr_dev, "boot read row %d %012llo\n",
|
||||||
@@ -296,14 +293,20 @@ cdr_attach(UNIT * uptr, CONST char *file)
|
|||||||
|
|
||||||
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
uptr->u5 = 0;
|
if (uptr->up7 == 0) {
|
||||||
uptr->u4 = 0;
|
uptr->up7 = malloc(sizeof(uint16)*80);
|
||||||
|
uptr->u5 = 0;
|
||||||
|
uptr->u4 = 0;
|
||||||
|
}
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_stat
|
t_stat
|
||||||
cdr_detach(UNIT * uptr)
|
cdr_detach(UNIT * uptr)
|
||||||
{
|
{
|
||||||
|
if (uptr->up7 != 0)
|
||||||
|
free(uptr->up7);
|
||||||
|
uptr->up7 = 0;
|
||||||
return sim_card_detach(uptr);
|
return sim_card_detach(uptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user