diff --git a/simhv36-1/BIN/pdp8 b/simhv36-1/BIN/pdp8 index 36bf630..a322f57 100755 Binary files a/simhv36-1/BIN/pdp8 and b/simhv36-1/BIN/pdp8 differ diff --git a/simhv36-1/PDP8/pdp8_clk.c b/simhv36-1/PDP8/pdp8_clk.c index 61c1d3d..46cfe53 100644 --- a/simhv36-1/PDP8/pdp8_clk.c +++ b/simhv36-1/PDP8/pdp8_clk.c @@ -97,20 +97,21 @@ int32 clk (int32 IR, int32 AC) { switch (IR & 07) { /* decode IR<9:11> */ +case 7: case 1: /* CLEI */ int_enable = int_enable | INT_CLK; /* enable clk ints */ - int_req = INT_UPDATE; /* update interrupts */ +//xxx int_req = INT_UPDATE; /* update interrupts */ return AC; case 2: /* CLDI */ int_enable = int_enable & ~INT_CLK; /* disable clk ints */ - int_req = int_req & ~INT_CLK; /* update interrupts */ +//xxx int_req = int_req & ~INT_CLK; /* update interrupts */ return AC; case 3: /* CLSC */ if (dev_done & INT_CLK) { /* flag set? */ dev_done = dev_done & ~INT_CLK; /* clear flag */ - int_req = int_req & ~INT_CLK; /* clear int req */ +//xxx int_req = int_req & ~INT_CLK; /* clear int req */ return IOT_SKP + AC; } return AC; @@ -118,16 +119,16 @@ switch (IR & 07) { /* decode IR<9:11> */ case 5: /* CLLE */ if (AC & 1) int_enable = int_enable | INT_CLK; /* test AC<11> */ else int_enable = int_enable & ~INT_CLK; - int_req = INT_UPDATE; /* update interrupts */ +//xxx int_req = INT_UPDATE; /* update interrupts */ return AC; case 6: /* CLCL */ dev_done = dev_done & ~INT_CLK; /* clear flag */ - int_req = int_req & ~INT_CLK; /* clear int req */ +//xxx int_req = int_req & ~INT_CLK; /* clear int req */ return AC; - case 7: /* CLSK */ - return (dev_done & INT_CLK)? IOT_SKP + AC: AC; +// case 7: /* CLSK */ +// return (dev_done & INT_CLK)? IOT_SKP + AC: AC; default: return (stop_inst << IOT_V_REASON) + AC; @@ -140,8 +141,13 @@ t_stat clk_svc (UNIT *uptr) { int32 t; +{ +extern unsigned long cycles; +printf("clock fire; cycles %d\n", cycles); +} + dev_done = dev_done | INT_CLK; /* set done */ -int_req = INT_UPDATE; /* update interrupts */ +//xxx int_req = INT_UPDATE; /* update interrupts */ t = sim_rtcn_calb (clk_tps, TMR_CLK); /* calibrate clock */ sim_activate (&clk_unit, t); /* reactivate unit */ tmxr_poll = t; /* set mux poll */ @@ -153,7 +159,7 @@ return SCPE_OK; t_stat clk_reset (DEVICE *dptr) { dev_done = dev_done & ~INT_CLK; /* clear done, int */ -int_req = int_req & ~INT_CLK; +//xxx int_req = int_req & ~INT_CLK; int_enable = int_enable & ~INT_CLK; /* clear enable */ sim_activate (&clk_unit, clk_unit.wait); /* activate unit */ return SCPE_OK; diff --git a/simhv36-1/PDP8/pdp8_cpu.c b/simhv36-1/PDP8/pdp8_cpu.c index 9da3ed2..3b73276 100644 --- a/simhv36-1/PDP8/pdp8_cpu.c +++ b/simhv36-1/PDP8/pdp8_cpu.c @@ -315,11 +315,12 @@ DEVICE cpu_dev = { NULL, 0 }; -static int dtrace = 1; +/*static*/ int dtrace = 1; static int mtrace = 0; extern void tt_service(void); -static unsigned long cycles; +/*static*/ unsigned long cycles; +static unsigned long cycles_last; static unsigned long max_cycles; int need_stop; @@ -351,6 +352,11 @@ while (reason == 0) { /* loop until halted */ cycles++; if (max_cycles && cycles >= max_cycles) need_stop = 1; + cycles_last++; + if (cycles_last >= 100000) { + cycles_last = 0; + printf("xxx cycles %d\r\n", (int)cycles); + } if (need_stop) { printf("\r\nxxx %lu stop\n", cycles); @@ -366,9 +372,7 @@ while (reason == 0) { /* loop until halted */ } if (int_req > INT_PENDING) { /* interrupt? */ -#if 1 - if (UF && 0) { dtrace = 1; mtrace = 1; } - //if (dtrace) printf("interrupt @ %o\n", PC); +#if 0 if (dtrace) printf("xxx %lu interrupt @ %o (UF%d IF%o DF%o)\n", cycles, PC, UF, IF>>12, DF>>12); #endif @@ -409,11 +413,6 @@ while (reason == 0) { /* loop until halted */ */ #if 1 - if (!dtrace) { - if (IR == 06603 && 0) - dtrace = 1; - } - if (dtrace) { printf("pc %04o ir %04o l%o ac %04o ion %d " "(IF%o DF%o UF%o SF%03o IB%o UB%o)\n", diff --git a/simhv36-1/PDP8/pdp8_rf.c b/simhv36-1/PDP8/pdp8_rf.c index d4df799..dc139d2 100644 --- a/simhv36-1/PDP8/pdp8_rf.c +++ b/simhv36-1/PDP8/pdp8_rf.c @@ -106,6 +106,7 @@ extern uint16 M[]; extern int32 int_req, stop_inst; extern UNIT cpu_unit; +extern int dtrace; int32 rf_sta = 0; /* status register */ int32 rf_da = 0; /* disk address */ @@ -199,7 +200,7 @@ if (pulse & 6) { /* DMAR, DMAW */ t = (rf_da & RF_WMASK) - GET_POS (rf_time); /* delta to new loc */ if (t < 0) t = t + RF_NUMWD; /* wrap around? */ #if 1 - printf("xxx rf_go!\n"); + printf("xxx rf_go! (rf_da %o, wc %o, ma %o)\n", rf_da, M[RF_WC], M[RF_MA]); sim_activate (&rf_unit, 0); /* schedule op */ #else sim_activate (&rf_unit, t * rf_time); /* schedule op */ @@ -317,6 +318,7 @@ if ((uptr->flags & UNIT_BUF) == 0) { /* not buf? abort */ return IORETURN (rf_stopioe, SCPE_UNATT); } +//rf_burst = 0; mex = GET_MEX (rf_sta); do { if ((uint32) rf_da >= rf_unit.capac) { /* disk overflow? */ @@ -329,8 +331,8 @@ do { if (uptr->FUNC == RF_READ) { /* read? */ if (MEM_ADDR_OK (pa)) /* if !nxm */ M[pa] = fbuf[rf_da]; /* read word */ -#if 0 - printf("dma [%o] <- %o\n", pa, M[pa]); +#if 1 + if (dtrace) printf("dma [%o] <- %o\n", pa, M[pa]); #endif } else { /* write */ @@ -347,7 +349,7 @@ do { if ((M[RF_WC] != 0) && ((rf_sta & RFS_ERR) == 0)) /* more to do? */ #if 1 - sim_activate (&rf_unit, 0); /* sched next */ + sim_activate (&rf_unit, 1/*0*/); /* sched next */ #else sim_activate (&rf_unit, rf_time); /* sched next */ #endif diff --git a/simhv36-1/PDP8/pdp8_tt.c b/simhv36-1/PDP8/pdp8_tt.c index defd4e5..42748d4 100644 --- a/simhv36-1/PDP8/pdp8_tt.c +++ b/simhv36-1/PDP8/pdp8_tt.c @@ -41,6 +41,7 @@ #include extern int32 int_req, int_enable, dev_done, stop_inst; +extern int cycles; int32 tti (int32 IR, int32 AC); int32 tto (int32 IR, int32 AC); @@ -136,8 +137,9 @@ DEVICE tto_dev = { #define FAKE_INPUT #ifdef FAKE_INPUT int tt_input_index; -char tt_input[] = "START\r01:01:85\r10:10\r\r\r"; +char tt_input[] = "START\r01:01:85\r10:10\r"; int tt_input_count = sizeof(tt_input)-1; +int tt_refire; #endif /* Terminal input: IOT routine */ @@ -174,7 +176,7 @@ switch (IR & 07) { /* decode IR<9:11> */ case 4: /* KRS */ #ifdef FAKE_INPUT - printf("xxx rx input %o (%d/%d)\n", + printf("xxx rx input %o (%d/%d)\r\n", tti_unit.buf, tt_input_index, tt_input_count); #endif return (AC | tti_unit.buf); /* return buffer */ @@ -193,7 +195,7 @@ switch (IR & 07) { /* decode IR<9:11> */ void tt_set_event(void); tt_set_event(); } - printf("xxx rx input %o (%d/%d)\n", + printf("xxx rx input %o (%d/%d)\r\n", tti_unit.buf, tt_input_index, tt_input_count); #endif return (tti_unit.buf); /* return buffer */ @@ -249,16 +251,83 @@ void tt_set_event(void) tt_event = 1; } +#if 0 +#define R1 30000 +#define R2 40000 +#define R3 50000 +#define R4 300000 +#define R5 400000 +#else +#define R1 110000 +#define R2 120000 +#define R3 130000 +#define R4 300000 +#define R5 400000 +#endif + void tt_service(void) { + if (tt_refire == 0 && (tt_input_index == tt_input_count)) { + if (cycles >= R1) { + strcpy(tt_input, "LOGIN 2 LXHE\r\r"); + tt_input_count = strlen(tt_input); + tt_input_index = 0; + tt_refire++; + printf("xxx boom 1; cycles %d\r\n", cycles); + } + } + + if (tt_refire == 1 && (tt_input_index == tt_input_count)) { + if (cycles >= R2) { + strcpy(tt_input, "\r"); + tt_input_count = strlen(tt_input); + tt_input_index = 0; + tt_refire++; + printf("xxx boom 2; cycles %d\r\n", cycles); + } + } + + if (tt_refire == 2 && (tt_input_index == tt_input_count)) { + if (cycles >= R3) { + strcpy(tt_input, "\r"); + tt_input_count = strlen(tt_input); + tt_input_index = 0; + tt_refire++; + printf("xxx boom 3; cycles %d\r\n", cycles); + } + } + + if (tt_refire == 3 && (tt_input_index == tt_input_count)) { + if (cycles >= R4) { + strcpy(tt_input, "R FOCAL\r"); + tt_input_count = strlen(tt_input); + tt_input_index = 0; + tt_refire++; + printf("xxx boom 4; cycles %d\r\n", cycles); + } + } + + if (tt_refire == 4 && (tt_input_index == tt_input_count)) { + if (cycles >= R5) { + strcpy(tt_input, "\r"); + tt_input_count = strlen(tt_input); + tt_input_index = 0; + tt_refire++; + printf("xxx boom 5; cycles %d\r\n", cycles); + } + } + if (tt_input_index < tt_input_count && (dev_done & INT_TTI) == 0 && tt_event) { - tti_unit.buf = tt_input[tt_input_index++]; + tti_unit.buf = tt_input[tt_input_index++] & 0xff; tti_unit.pos++; dev_done |= INT_TTI; int_req = INT_UPDATE; tt_event = 0; + if (tt_input_index == tt_input_count) { + printf("xxx input exhausted %d cycles\r\n", cycles); + } } if (tt_countdown > 0) { @@ -266,7 +335,7 @@ void tt_service(void) if (tt_countdown == 0) { int i; - printf("xxx tx_data %o\n", tt_data); + printf("xxx tx_data %o\r\n", tt_data); tt_flag = 1; @@ -277,13 +346,25 @@ void tt_service(void) printf("xxx output: "); for (i = 0; i < tt_buf_count; i++) { char ch = tt_buf[i] & 0177; +if (ch == 0) ch = '@'; +tt_buf[i] = ch; switch (ch) { case '\n': printf("\\n"); break; case '\r': printf("\\r"); break; - default: printf("%c", ch & 0177); break; + default: printf("%c", ch); break; + } + } + printf("\r\n"); + +tt_buf[tt_buf_count] = 0; + + if (tt_refire == 5) { + extern int need_stop; + if (strstr(tt_buf, "RETAIN")) { + need_stop = 1; + printf("xxx need stop %d cycles\r\n", cycles); } } - printf("\n"); } } else { #if 0 @@ -366,8 +447,18 @@ void check_output(int c) break; case 2: if (c == '.') { - need_stop = 1; + /*need_stop = 1*/; +#if 0 + if (tt_refire == 1) { + printf("xxx boom 3\n"); + strcpy(tt_input, "R FOCAL\r"); + tt_input_count = strlen(tt_input); + tt_input_index = 0; + tt_refire++; + } +#endif } + state = 0; break; }