1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-04-14 07:49:56 +00:00

IBM360: Fixed disk issues to get MTS D2.0 to restore.

This commit is contained in:
Richard Cornwell
2020-11-05 23:05:56 -05:00
parent 18ac7d64e2
commit e9eb79aee9
3 changed files with 28 additions and 6 deletions

View File

@@ -125,6 +125,7 @@ con_ini(UNIT *uptr, t_bool f) {
uint8 con_startcmd(UNIT *uptr, uint8 cmd) {
int u = (uptr - con_unit);
sim_debug(DEBUG_CMD, &con_dev, "%d: Cmd %x %x\n", u, cmd, uptr->CMD);
if ((uptr->CMD & CON_MSK) != 0)
return SNS_BSY;
@@ -137,6 +138,7 @@ uint8 con_startcmd(UNIT *uptr, uint8 cmd) {
case 2: /* Read command */
sim_debug(DEBUG_CMD, &con_dev, "%d: Cmd RD\n", u);
if (uptr->CMD & CON_REQ) {
uptr->CMD &= ~CON_REQ;
return SNS_ATTN|SNS_BSY;
}
@@ -159,6 +161,7 @@ uint8 con_startcmd(UNIT *uptr, uint8 cmd) {
case 1: /* Write command */
sim_debug(DEBUG_CMD, &con_dev, "%d: Cmd WR\n", u);
if (uptr->CMD & CON_REQ) {
uptr->CMD &= ~CON_REQ;
return SNS_ATTN|SNS_BSY;
}
uptr->CMD |= cmd & CON_MSK;
@@ -174,6 +177,7 @@ uint8 con_startcmd(UNIT *uptr, uint8 cmd) {
case 3: /* Control */
sim_debug(DEBUG_CMD, &con_dev, "%d: Cmd NOP\n", u);
if (uptr->CMD & CON_REQ) {
uptr->CMD &= ~CON_REQ;
return SNS_ATTN|SNS_BSY;
}
uptr->SNS = 0;

View File

@@ -370,16 +370,25 @@ uint8 dasd_startio(UNIT *uptr) {
int unit = (uptr - dptr->units);
unsigned int i;
/* Check if unit is busy */
if ((uptr->CMD & 0xff) != 0) {
return SNS_BSY;
}
/* Check if controller is free */
for (i = 0; i < dptr->numunits; i++) {
int cmd = (dptr->units[i].CMD) & 0xff;
if (cmd != 0 && cmd != DK_SEEK)
return SNS_BSY;
}
/* Set up for command to start */
uptr->CMD &= ~(DK_INDEX|DK_NOEQ|DK_HIGH|DK_PARAM|DK_MSET|DK_DONE|DK_INDEX2);
if ((uptr->flags & UNIT_ATT) != 0) {
struct dasd_t *data = (struct dasd_t *)(uptr->up7);
data->filemsk = 0;
sim_debug(DEBUG_CMD, dptr, "start io unit=%d %d %d %d\n", unit, data->tstart,
data->tpos, data->rpos);
}
sim_debug(DEBUG_CMD, dptr, "start io unit=%d\n", unit);
return 0;
@@ -589,18 +598,21 @@ t_stat dasd_srv(UNIT * uptr)
uint8 buf[8];
/* Check if read or write command, if so grab correct cylinder */
if (rd && data->cyl != data->ccyl) {
if (state != DK_POS_SEEK && rd && data->cyl != data->ccyl) {
uint32 tsize = data->tsize * disk_type[type].heads;
if (uptr->CMD & DK_CYL_DIRTY) {
sim_debug(DEBUG_DETAIL, dptr, "Save unit=%d cyl=%d %x\n", unit, data->ccyl, data->cpos);
(void)sim_fseek(uptr->fileref, data->cpos, SEEK_SET);
(void)sim_fwrite(data->cbuf, 1, tsize, uptr->fileref);
uptr->CMD &= ~DK_CYL_DIRTY;
}
data->ccyl = data->cyl;
sim_debug(DEBUG_DETAIL, dptr, "Load unit=%d cyl=%d\n", unit, data->cyl);
data->cpos = sizeof(struct dasd_header) + (data->ccyl * tsize);
sim_debug(DEBUG_DETAIL, dptr, "Load unit=%d cyl=%d %x\n", unit, data->cyl, data->cpos);
(void)sim_fseek(uptr->fileref, data->cpos, SEEK_SET);
(void)sim_fread(data->cbuf, 1, tsize, uptr->fileref);
state = DK_POS_INDEX;
goto ntrack;
}
sim_debug(DEBUG_POS, dptr, "state unit=%d %02x %d\n", unit, state, data->tpos);
@@ -636,11 +648,12 @@ endcyl:
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITCHK);
goto index;
}
if ((uptr->CMD & 0x7) == 1 && (uptr->CMD & 0x60) != 0)
uptr->CMD &= ~(DK_INDEX|DK_INDEX2);
/* Clear index flag */
uptr->CMD &= ~(DK_INDEX2);
}
/* If INDEX set signal no record if read */
if ((cmd & 0x03) == 0x01 && uptr->CMD & DK_INDEX2) {
if (((cmd & 0x3) == 0x1 || (cmd & 0x3) == 0x2) &&
uptr->CMD & DK_INDEX2) {
sim_debug(DEBUG_DETAIL, dptr, "index unit=%d %02x %d %04x\n",
unit, state, data->tpos, uptr->SNS);
/* Unless command is Read Header, return No record found */
@@ -662,6 +675,7 @@ endcyl:
}
index:
uptr->CMD |= (uptr->CMD & DK_INDEX) ? DK_INDEX2 : DK_INDEX;
ntrack:
uptr->CMD &= ~DK_SRCOK;
data->tstart = data->tsize * (uptr->CCH & 0xff);
data->tpos = data->rpos = 0;
@@ -1404,6 +1418,10 @@ rd:
break;
}
if (state == DK_POS_DATA && count == data->dlen) {
sim_debug(DEBUG_DETAIL, dptr,
"RD end unit=%d %d k=%d d=%d %02x %04x %04x %d\n",
unit, data->rec, data->klen, data->dlen, data->state, data->dlen,
8 + data->klen + data->dlen, count);
sim_debug(DEBUG_DETAIL, dptr,
"RD next unit=%d %02x %02x %02x %02x %02x %02x %02x %02x\n",
unit, da[0], da[1], da[2], da[3], da[4], da[5], da[6], da[7]);

View File

@@ -135,7 +135,7 @@ const char ascii_to_ebcdic[128] = {
/* 0 1 2 3 4 5 6 7 */
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
/* 8 9 : ; < = > ? */
0xf8, 0xf9, 0x7a, 0x6e, 0x4c, 0x7e, 0x6e, 0x6f,
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
/* @ A B C D E F G */
0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 100 - 137 */
/* H I J K L M N O */