1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-02-11 18:45:41 +00:00

KA10: Fixed so history works at simH prompt.

This commit is contained in:
Richard Cornwell
2024-03-29 10:30:02 -04:00
parent d8d4701b9e
commit bf72ad0b51
2 changed files with 31 additions and 17 deletions

View File

@@ -278,7 +278,8 @@ read_sw()
adr_cond |= ((sw & ADR_BRK_SW) == 0) ? ADR_BREAK : 0;
nxm_stop = (sw & NXM_STOP) == 0;
#endif
sing_inst_sw = (sw & SING_INST) == 0;
sing_inst_sw = ((sw & SING_INST) == 0) ||
((sw & SING_CYCL) == 0);
/* PAR_STOP handle special features */
par_stop = (sw & PAR_STOP) == 0;
/* SING_CYCL no function yet */
@@ -483,12 +484,14 @@ void *blink(void *ptr)
} else {
AS = new_as;
}
/* Check repeat count */
if (rep_count > 0 && --rep_count == 0) {
for (col = 0; col < 12; col++) {
for (col = 0; col < 10; col++) {
switch_state[col].changed = switch_state[col].state;
}
}
/* Process switch changes if running */
if (RUN) {
for (col = 0; col < 10; col++) {
@@ -536,6 +539,7 @@ void *blink(void *ptr)
}
}
}
/* done with reading the switches,
* so start the next cycle of lighting up LEDs
*/
@@ -554,7 +558,7 @@ void *blink(void *ptr)
}
volatile int input_wait;
static char *input_buffer;
static char *input_buffer = NULL;
/*
* Handler for EditLine package when line is complete.
@@ -565,6 +569,7 @@ read_line_handler(char *line)
if (line != NULL) {
input_buffer = line;
input_wait = 0;
add_history(line);
}
}
@@ -579,6 +584,9 @@ vm_read(char *cptr, int32 sz, FILE *file)
int fd = fileno(file); /* What to wait on */
int col;
if (input_buffer != NULL)
free(input_buffer);
rl_callback_handler_install(sim_prompt, (rl_vcpfunc_t*) &read_line_handler);
input_wait = 1;
input_buffer = NULL;
while (input_wait) {
@@ -592,7 +600,7 @@ vm_read(char *cptr, int32 sz, FILE *file)
} else {
if (pwr_off) {
if ((input_buffer = (char *)malloc(20)) != 0) {
strcpy(input_buffer, "quit");
strcpy(input_buffer, "quit\r");
stop_sw = 1;
pwr_off = 0;
input_wait = 0;
@@ -618,20 +626,19 @@ vm_read(char *cptr, int32 sz, FILE *file)
AB = AS;
MB = (AS < 020) ? FM[AS] : M[AS];
MI_flag = 0;
printf("Examime %06o %012llo\r\n", AS, SW);
break;
case 2: /* Execute function */
if ((input_buffer = (char *)malloc(20)) != 0) {
strcpy(input_buffer, "step");
strcpy(input_buffer, "step\r");
xct_sw = 1;
input_wait = 0;
}
break;
case 3: /* Reset function */
if ((input_buffer = (char *)malloc(10)) != 0) {
strcpy(input_buffer, "reset all");
if ((input_buffer = (char *)malloc(20)) != 0) {
strcpy(input_buffer, "reset all\r");
input_wait = 0;
}
break;
@@ -642,14 +649,14 @@ vm_read(char *cptr, int32 sz, FILE *file)
case 5: /* Continue */
if ((input_buffer = (char *)malloc(10)) != 0) {
strcpy(input_buffer,
(sing_inst_sw) ? "step" : "cont");
(sing_inst_sw) ? "step\r" : "cont\r");
input_wait = 0;
}
break;
case 6: /* Start */
if ((input_buffer = (char *)malloc(20)) != 0) {
sprintf(input_buffer, "run %06o", AS);
sprintf(input_buffer, "run %06o\r", AS);
input_wait = 0;
}
break;
@@ -666,10 +673,10 @@ vm_read(char *cptr, int32 sz, FILE *file)
if (dibp && !(dptr->flags & DEV_DIS) &&
(dibp->dev_num == (rdrin_dev & 0774))) {
if (dptr->numunits > 1)
sprintf(input_buffer, "boot %s0",
sprintf(input_buffer, "boot %s0\r",
dptr->name);
else
sprintf(input_buffer, "boot %s",
sprintf(input_buffer, "boot %s\r",
dptr->name);
input_wait = 0;
break;
@@ -700,7 +707,6 @@ vm_read(char *cptr, int32 sz, FILE *file)
case 9: /* Deposit this */
AB = AS;
printf("Deposit %06o %012llo\r\n", AS, SW);
if (AS < 020) {
FM[AS] = SW;
MB = FM[AS];
@@ -716,6 +722,7 @@ vm_read(char *cptr, int32 sz, FILE *file)
}
}
}
rl_callback_handler_remove();
return input_buffer;
}
@@ -737,7 +744,6 @@ t_stat pi_panel_start(void)
r = gpio_mux_thread_start();
sim_vm_read = &vm_read;
sim_vm_post = &vm_post;
rl_callback_handler_install("", (rl_vcpfunc_t*) &read_line_handler);
return r;
}
@@ -748,7 +754,6 @@ void pi_panel_stop(void)
{
if (blink_thread_terminate == 0) {
blink_thread_terminate=1;
rl_callback_handler_remove();
sim_vm_read = NULL;
sleep (2); /* allow threads to close down */

View File

@@ -4498,8 +4498,8 @@ if ((reason = build_dev_tab ()) != SCPE_OK) /* build, chk dib_tab */
xct_flag = 0;
uuo_cycle = 1;
f_pc_inh = 1;
f_load_pc = 0;
MB = SW;
xct_sw = 0;
goto no_fetch;
}
if (stop_sw) { /* Stop switch set */
@@ -4905,6 +4905,11 @@ st_pi:
nrf = 0;
fxu_hold_set = 0;
modify = 0;
#if PIDP10
if (xct_sw) { /* Handle Front panel xct switch */
xct_sw = 0;
} else
#endif
f_pc_inh = 0;
#if KL | KS
if (extend) {
@@ -12262,7 +12267,7 @@ last:
if (QITS)
load_quantum();
#endif
RUN = 0;
RUN = 0;
return SCPE_STEP;
}
}
@@ -13499,7 +13504,11 @@ rtc_srv(UNIT * uptr)
tmxr_poll = t/2;
#if PDP6 | KA | KI
clk_flg = 1;
#if PIDP10
if (clk_en && !sing_inst_sw) {
#else
if (clk_en) {
#endif
sim_debug(DEBUG_CONO, &cpu_dev, "CONO timmer\n");
set_interrupt(4, clk_irq);
}