mirror of
https://github.com/rcornwell/sims.git
synced 2026-01-29 13:11:00 +00:00
IBM360: Support for new interface to sim_card.
This commit is contained in:
@@ -163,6 +163,7 @@ uint8 cdp_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
|
||||
t_stat
|
||||
cdp_srv(UNIT *uptr) {
|
||||
int u = uptr-cdp_unit;
|
||||
uint16 *image = (uint16 *)(uptr->up7);
|
||||
uint16 addr = GET_UADDR(uptr->u3);
|
||||
|
||||
/* Handle sense */
|
||||
@@ -177,7 +178,7 @@ cdp_srv(UNIT *uptr) {
|
||||
/* Done waiting, punch card */
|
||||
uptr->u3 &= ~CDP_CARD;
|
||||
sim_debug(DEBUG_DETAIL, &cdp_dev, "unit=%d:punch\n", u);
|
||||
switch(sim_punch_card(uptr, NULL)) {
|
||||
switch(sim_punch_card(uptr, NULL, image)) {
|
||||
/* If we get here, something is wrong */
|
||||
case SCPE_IOERR:
|
||||
set_devattn(addr, SNS_DEVEND|SNS_UNITCHK);
|
||||
@@ -191,16 +192,13 @@ cdp_srv(UNIT *uptr) {
|
||||
|
||||
/* Copy next column over */
|
||||
if (uptr->u4 < 80) {
|
||||
struct _card_data *data;
|
||||
uint8 ch = 0;
|
||||
|
||||
data = (struct _card_data *)uptr->up7;
|
||||
|
||||
if (chan_read_byte(addr, &ch)) {
|
||||
uptr->u3 |= CDP_CARD;
|
||||
} else {
|
||||
sim_debug(DEBUG_DATA, &cdp_dev, "%d: Char < %02o\n", u, ch);
|
||||
data->image[uptr->u4++] = sim_ebcdic_to_hol(ch);
|
||||
image[uptr->u4++] = sim_ebcdic_to_hol(ch);
|
||||
if (uptr->u4 == 80) {
|
||||
uptr->u3 |= CDP_CARD;
|
||||
}
|
||||
@@ -223,15 +221,23 @@ cdp_attach(UNIT * uptr, CONST char *file)
|
||||
|
||||
if ((r = sim_card_attach(uptr, file)) != SCPE_OK)
|
||||
return r;
|
||||
uptr->u5 = 0;
|
||||
if (uptr->up7 == 0) {
|
||||
uptr->up7 = calloc(80, sizeof(uint16));
|
||||
uptr->u5 = 0;
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat
|
||||
cdp_detach(UNIT * uptr)
|
||||
{
|
||||
uint16 *image = (uint16 *)(uptr->up7);
|
||||
|
||||
if (uptr->u5 & CDP_CARD)
|
||||
sim_punch_card(uptr, NULL);
|
||||
sim_punch_card(uptr, NULL, image);
|
||||
if (uptr->up7 != 0)
|
||||
free(uptr->up7);
|
||||
uptr->up7 = 0;
|
||||
return sim_card_detach(uptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "sim_card.h"
|
||||
|
||||
#ifdef NUM_DEVS_CDR
|
||||
#define UNIT_CDR UNIT_ATTABLE | UNIT_RO | UNIT_DISABLE | UNIT_ROABLE | MODE_029
|
||||
#define UNIT_CDR UNIT_ATTABLE | UNIT_RO | UNIT_DISABLE | MODE_029
|
||||
|
||||
|
||||
#define CHN_SNS 0x04 /* Sense command */
|
||||
@@ -102,7 +102,7 @@ struct dib cdr_dib = { 0xFF, 1, NULL, cdr_startcmd, NULL, cdr_unit};
|
||||
DEVICE cdr_dev = {
|
||||
"CDR", cdr_unit, NULL, cdr_mod,
|
||||
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_UADDR | DEV_DISABLE | DEV_DEBUG, 0, crd_debug
|
||||
};
|
||||
|
||||
@@ -166,7 +166,8 @@ uint8 cdr_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
|
||||
/* Handle transfer of data for card reader */
|
||||
t_stat
|
||||
cdr_srv(UNIT *uptr) {
|
||||
int addr = GET_UADDR(uptr->u3);
|
||||
int addr = GET_UADDR(uptr->u3);
|
||||
uint16 *image = (uint16 *)(uptr->up7);
|
||||
|
||||
if ((uptr->u3 & CDR_CMDMSK) == CHN_SNS) {
|
||||
uint8 ch = uptr->u5;
|
||||
@@ -178,7 +179,7 @@ cdr_srv(UNIT *uptr) {
|
||||
|
||||
/* Check if new card requested. */
|
||||
if ((uptr->u3 & CDR_CARD) == 0) {
|
||||
switch(sim_read_card(uptr)) {
|
||||
switch(sim_read_card(uptr, image)) {
|
||||
case SCPE_EOF:
|
||||
case SCPE_UNATT:
|
||||
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP);
|
||||
@@ -203,13 +204,11 @@ cdr_srv(UNIT *uptr) {
|
||||
|
||||
/* Copy next column over */
|
||||
if ((uptr->u3 & CDR_CMDMSK) == CDR_RD) {
|
||||
struct _card_data *data;
|
||||
int u = uptr-cdr_unit;
|
||||
uint16 xlat;
|
||||
uint8 ch = 0;
|
||||
|
||||
data = (struct _card_data *)uptr->up7;
|
||||
xlat = sim_hol_to_ebcdic(data->image[uptr->u4]);
|
||||
xlat = sim_hol_to_ebcdic(image[uptr->u4]);
|
||||
|
||||
if (xlat == 0x100) {
|
||||
uptr->u5 |= SNS_DATCHK;
|
||||
@@ -260,4 +259,14 @@ cdr_attach(UNIT * uptr, CONST char *file)
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat
|
||||
cdr_detach(UNIT * uptr)
|
||||
{
|
||||
if (uptr->up7 != 0)
|
||||
free(uptr->up7);
|
||||
uptr->up7 = 0;
|
||||
return sim_card_detach(uptr);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -716,6 +716,7 @@ t_stat chan_boot(uint16 addr, DEVICE *dptyr) {
|
||||
*/
|
||||
uint16 scan_chan(uint8 mask) {
|
||||
int i;
|
||||
int ch;
|
||||
int pend = 0; /* No device */
|
||||
int imask = 0x80;
|
||||
|
||||
@@ -745,23 +746,23 @@ uint16 scan_chan(uint8 mask) {
|
||||
}
|
||||
if (pend) {
|
||||
irq_pend = 1;
|
||||
i = find_subchan(pend);
|
||||
if (i >= 0) {
|
||||
sim_debug(DEBUG_EXP, &cpu_dev, "Scan end (%x %x)\n", chan_dev[i], pend);
|
||||
store_csw(i);
|
||||
ch = find_subchan(pend);
|
||||
if (ch >= 0) {
|
||||
sim_debug(DEBUG_EXP, &cpu_dev, "Scan end (%x %x)\n", chan_dev[ch], pend);
|
||||
store_csw(ch);
|
||||
}
|
||||
dev_status[pend] = 0;
|
||||
} else {
|
||||
for (pend = 0; pend < MAX_DEV; pend++) {
|
||||
if (dev_status[pend] != 0) {
|
||||
i = find_subchan(pend);
|
||||
if (i >= 0 && ccw_cmd[i] == 0 && mask & (0x80 >> (pend >> 8))) {
|
||||
ch = find_subchan(pend);
|
||||
if (ch >= 0 && ccw_cmd[ch] == 0 && mask & (0x80 >> (pend >> 8))) {
|
||||
irq_pend = 1;
|
||||
M[0x44 >> 2] = (((uint32)dev_status[pend]) << 24);
|
||||
M[0x40>>2] = 0;
|
||||
sim_debug(DEBUG_EXP, &cpu_dev,
|
||||
"Set atten %03x %02x [%08x] %08x\n",
|
||||
i, dev_status[pend], M[0x40 >> 2], M[0x44 >> 2]);
|
||||
ch, dev_status[pend], M[0x40 >> 2], M[0x44 >> 2]);
|
||||
dev_status[pend] = 0;
|
||||
return pend;
|
||||
}
|
||||
|
||||
@@ -1384,7 +1384,7 @@ dasd_format(UNIT * uptr) {
|
||||
hdr.heads = disk_type[type].heads;
|
||||
hdr.tracksize = (disk_type[type].bpt | 0x1ff) + 1;
|
||||
hdr.devtype = disk_type[type].dev_type;
|
||||
sim_fseek(uptr->fileref, 0, SEEK_SET);
|
||||
(void)sim_fseek(uptr->fileref, 0, SEEK_SET);
|
||||
sim_fwrite(&hdr, 1, sizeof(struct dasd_header), uptr->fileref);
|
||||
if ((data = (struct dasd_t *)calloc(1, sizeof(struct dasd_t))) == 0)
|
||||
return 1;
|
||||
|
||||
@@ -891,7 +891,7 @@ mt_attach(UNIT * uptr, CONST char *file)
|
||||
uint16 addr = GET_UADDR(uptr->u3);
|
||||
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;
|
||||
set_devattn(addr, SNS_DEVEND);
|
||||
return SCPE_OK;
|
||||
|
||||
Reference in New Issue
Block a user