diff --git a/Ibm1130/ibm1130_cpu.c b/Ibm1130/ibm1130_cpu.c index 186e8422..b0378874 100644 --- a/Ibm1130/ibm1130_cpu.c +++ b/Ibm1130/ibm1130_cpu.c @@ -541,10 +541,8 @@ t_stat sim_instr (void) reason = 0; wait_lamp = 0; /* release lock on wait lamp */ -#ifdef GUI_SUPPORT update_gui(TRUE); gui_run(TRUE); -#endif while (reason == 0) { IAR &= mem_mask; @@ -1186,9 +1184,7 @@ t_stat sim_instr (void) } } /* end main loop */ -#ifdef GUI_SUPPORT gui_run(FALSE); -#endif running = FALSE; 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 */ 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; } diff --git a/Ibm1130/ibm1130_cr.c b/Ibm1130/ibm1130_cr.c index c0ce72dc..d6957ca6 100644 --- a/Ibm1130/ibm1130_cr.c +++ b/Ibm1130/ibm1130_cr.c @@ -754,6 +754,9 @@ static void pcr_xio_feedcycle(void); static void pcr_xio_startread(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 */ 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 */ sprintf(msg, "Loaded %s cold start card", name); -#ifdef GUI_SUPPORT remark_cmd(msg); -#else - printf("%s\n", msg); -#endif } + boot_drive = drvno; + program_is_loaded = TRUE; + 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)); readstate = STATION_READ; /* the current card has been consumed */ + + program_is_loaded = TRUE; + return SCPE_OK; } diff --git a/Ibm1130/ibm1130_disk.c b/Ibm1130/ibm1130_disk.c index 82f0bfb1..56cddbb0 100644 --- a/Ibm1130/ibm1130_disk.c +++ b/Ibm1130/ibm1130_disk.c @@ -182,6 +182,8 @@ static struct tag_dsk_action { /* stores data needed for pending IO extern void void_backtrace (int afrom, int ato); +extern int boot_drive; + void xio_disk (int32 iocc_addr, int32 func, int32 modify, int drv) { int i, rev, nsteps, newcyl, sec, nwords; @@ -531,7 +533,7 @@ static t_stat dsk_attach (UNIT *uptr, CONST char *cptr) return rval; } - if (drv == 0) { + if ((boot_drive>=0) && (dsk_unit[boot_drive].flags&UNIT_ATT)) { disk_ready(TRUE); disk_unlocked(FALSE); } @@ -560,7 +562,7 @@ static t_stat dsk_detach (UNIT *uptr) uptr->FUNC = DSK_FUNC_IDLE; 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_ready(FALSE); } diff --git a/Ibm1130/ibm1130_gui.c b/Ibm1130/ibm1130_gui.c index 4cbe0446..3a4616a7 100644 --- a/Ibm1130/ibm1130_gui.c +++ b/Ibm1130/ibm1130_gui.c @@ -96,6 +96,10 @@ DEVICE console_dev = { extern UNIT cr_unit; /* pointers to 1442 and 1132 (1403) printers */ extern UNIT prt_unit; +extern UNIT dsk_unit[]; +extern int boot_drive; +extern t_bool program_is_loaded; + #ifndef GUI_SUPPORT void update_gui (int force) {} /* stubs for non-GUI builds */ void forms_check (int set) {} @@ -433,6 +437,20 @@ void update_gui (BOOL force) if (V) 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; if (ipl >= 0) 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 */ if (! btn[i].pushable) 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; 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 */ 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; case IDC_PROGRAM_LOAD: if (! running) { /* if card reader is attached to a file, do cold start read of one card */ IAR = 0; /* reset IAR */ #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 if (cr_boot(0, NULL) != SCPE_OK) /* load boot card */ remark_cmd("IPL failed");