IBM1130: GUI support for alternate disk booting (James Fehlinger)

as discussed in #452 and #453
This commit is contained in:
Mark Pizzolato 2017-05-24 13:00:57 -07:00
parent 85deff82ec
commit 99e833f9c0
4 changed files with 68 additions and 12 deletions

View file

@ -541,10 +541,8 @@ t_stat sim_instr (void)
reason = 0; reason = 0;
wait_lamp = 0; /* release lock on wait lamp */ wait_lamp = 0; /* release lock on wait lamp */
#ifdef GUI_SUPPORT
update_gui(TRUE); update_gui(TRUE);
gui_run(TRUE); gui_run(TRUE);
#endif
while (reason == 0) { while (reason == 0) {
IAR &= mem_mask; IAR &= mem_mask;
@ -1186,9 +1184,7 @@ t_stat sim_instr (void)
} }
} /* end main loop */ } /* end main loop */
#ifdef GUI_SUPPORT
gui_run(FALSE); gui_run(FALSE);
#endif
running = FALSE; running = FALSE;
int_lamps = 0; /* display only currently active interrupts while halted */ int_lamps = 0; /* display only currently active interrupts while halted */
@ -1205,6 +1201,16 @@ t_stat sim_instr (void)
if (cgi) /* give CGI hook function a chance to do something */ if (cgi) /* give CGI hook function a chance to do something */
cgi_stop(reason); cgi_stop(reason);
if (reason == STOP_WAIT) {
if (((sim_switches & SWMASK('Q')) == 0) && ! cgi) {
if (IAR==0x2a) {
IR = ReadW(IAR);
if (IR==0x4c80)
remark_cmd("\nEntered DMS V2M12\n");
}
}
}
return reason; return reason;
} }

View file

@ -754,6 +754,9 @@ static void pcr_xio_feedcycle(void);
static void pcr_xio_startread(void); static void pcr_xio_startread(void);
static void pcr_reset(void); static void pcr_reset(void);
int boot_drive = -1;
t_bool program_is_loaded = FALSE;
/* lookup_codetable - use code flag setting to get code table pointer and length */ /* lookup_codetable - use code flag setting to get code table pointer and length */
static t_bool lookup_codetable (int32 match, CPCODE **pcode, int *pncode) static t_bool lookup_codetable (int32 match, CPCODE **pcode, int *pncode)
@ -963,13 +966,12 @@ t_stat load_cr_boot (int32 drvno, int switches)
if (((switches & SWMASK('Q')) == 0) && ! cgi) { /* 3.0-3, parenthesized & operation, per lint check */ if (((switches & SWMASK('Q')) == 0) && ! cgi) { /* 3.0-3, parenthesized & operation, per lint check */
sprintf(msg, "Loaded %s cold start card", name); sprintf(msg, "Loaded %s cold start card", name);
#ifdef GUI_SUPPORT
remark_cmd(msg); remark_cmd(msg);
#else
printf("%s\n", msg);
#endif
} }
boot_drive = drvno;
program_is_loaded = TRUE;
return SCPE_OK; return SCPE_OK;
} }
@ -1008,6 +1010,9 @@ t_stat cr_boot (int32 unitno, DEVICE *dptr)
WriteW(i, (readstation[i] & 0xF800) | ((readstation[i] & 0x0400) ? 0x00C0 : 0x0000) | ((readstation[i] & 0x03F0) >> 4)); WriteW(i, (readstation[i] & 0xF800) | ((readstation[i] & 0x0400) ? 0x00C0 : 0x0000) | ((readstation[i] & 0x03F0) >> 4));
readstate = STATION_READ; /* the current card has been consumed */ readstate = STATION_READ; /* the current card has been consumed */
program_is_loaded = TRUE;
return SCPE_OK; return SCPE_OK;
} }

View file

@ -182,6 +182,8 @@ static struct tag_dsk_action { /* stores data needed for pending IO
extern void void_backtrace (int afrom, int ato); extern void void_backtrace (int afrom, int ato);
extern int boot_drive;
void xio_disk (int32 iocc_addr, int32 func, int32 modify, int drv) void xio_disk (int32 iocc_addr, int32 func, int32 modify, int drv)
{ {
int i, rev, nsteps, newcyl, sec, nwords; int i, rev, nsteps, newcyl, sec, nwords;
@ -531,7 +533,7 @@ static t_stat dsk_attach (UNIT *uptr, CONST char *cptr)
return rval; return rval;
} }
if (drv == 0) { if ((boot_drive>=0) && (dsk_unit[boot_drive].flags&UNIT_ATT)) {
disk_ready(TRUE); disk_ready(TRUE);
disk_unlocked(FALSE); disk_unlocked(FALSE);
} }
@ -560,7 +562,7 @@ static t_stat dsk_detach (UNIT *uptr)
uptr->FUNC = DSK_FUNC_IDLE; uptr->FUNC = DSK_FUNC_IDLE;
dsk_dsw[drv] = DSK_DSW_NOT_READY; dsk_dsw[drv] = DSK_DSW_NOT_READY;
if (drv == 0) { if ((boot_drive>=0) && (!dsk_unit[boot_drive].flags&UNIT_ATT)) {
disk_unlocked(TRUE); disk_unlocked(TRUE);
disk_ready(FALSE); disk_ready(FALSE);
} }

View file

@ -96,6 +96,10 @@ DEVICE console_dev = {
extern UNIT cr_unit; /* pointers to 1442 and 1132 (1403) printers */ extern UNIT cr_unit; /* pointers to 1442 and 1132 (1403) printers */
extern UNIT prt_unit; extern UNIT prt_unit;
extern UNIT dsk_unit[];
extern int boot_drive;
extern t_bool program_is_loaded;
#ifndef GUI_SUPPORT #ifndef GUI_SUPPORT
void update_gui (int force) {} /* stubs for non-GUI builds */ void update_gui (int force) {} /* stubs for non-GUI builds */
void forms_check (int set) {} void forms_check (int set) {}
@ -433,6 +437,20 @@ void update_gui (BOOL force)
if (V) if (V)
CND |= 1; CND |= 1;
if ((boot_drive<0) || (!program_is_loaded)) {
boot_drive = CES & 7;
if (boot_drive > 4)
boot_drive = -1;
}
if ((boot_drive>=0) && (dsk_unit[boot_drive].flags&UNIT_ATT)) {
disk_ready(TRUE);
disk_unlocked(FALSE);
}
else {
disk_ready(FALSE);
disk_unlocked(TRUE);
}
int_lamps |= int_req; int_lamps |= int_req;
if (ipl >= 0) if (ipl >= 0)
int_lamps |= (0x20 >> ipl); int_lamps |= (0x20 >> ipl);
@ -1173,7 +1191,12 @@ void HandleCommand (HWND hWnd, WORD wNotify, WORD idCtl, HWND hwCtl)
for (i = 0; i < NBUTTONS; i++) /* repaint all of the lamps */ for (i = 0; i < NBUTTONS; i++) /* repaint all of the lamps */
if (! btn[i].pushable) if (! btn[i].pushable)
InvalidateRect(btn[i].hBtn, NULL, TRUE); InvalidateRect(btn[i].hBtn, NULL, TRUE);
if ((cr_unit.flags & UNIT_ATT) &&
(btn[IDC_1442].state!=STATE_1442_FULL)) {
stuff_and_wait("detach cr", 0, 500);
update_gui(TRUE);
}
program_is_loaded = FALSE;
break; break;
case IDC_PROGRAM_START: /* begin execution */ case IDC_PROGRAM_START: /* begin execution */
@ -1238,13 +1261,33 @@ void HandleCommand (HWND hWnd, WORD wNotify, WORD idCtl, HWND hwCtl)
forms_check(0); /* clear forms-check status */ forms_check(0); /* clear forms-check status */
print_check(0); print_check(0);
} }
if ((cr_unit.flags & UNIT_ATT) &&
(btn[IDC_1442].state!=STATE_1442_FULL)) {
stuff_and_wait("detach cr", 0, 500);
update_gui(TRUE);
}
program_is_loaded = FALSE;
break; break;
case IDC_PROGRAM_LOAD: case IDC_PROGRAM_LOAD:
if (! running) { /* if card reader is attached to a file, do cold start read of one card */ if (! running) { /* if card reader is attached to a file, do cold start read of one card */
IAR = 0; /* reset IAR */ IAR = 0; /* reset IAR */
#ifdef PROGRAM_LOAD_STARTS_CPU #ifdef PROGRAM_LOAD_STARTS_CPU
stuff_cmd("boot cr"); if (cr_unit.flags & UNIT_ATT)
stuff_cmd("boot cr");
else {
if (((CES & 7) <= 4) &&
(dsk_unit[(CES & 7)].flags&UNIT_ATT))
boot_drive = CES & 7;
else
boot_drive = -1;
if (boot_drive >= 0) {
char cmd[50];
sprintf(cmd, "boot dsk%d", boot_drive);
stuff_cmd(cmd);
}
}
#else #else
if (cr_boot(0, NULL) != SCPE_OK) /* load boot card */ if (cr_boot(0, NULL) != SCPE_OK) /* load boot card */
remark_cmd("IPL failed"); remark_cmd("IPL failed");