From b0107ee74adecb5d67b7ba39274caef503b9bbc6 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 18 Apr 2016 01:33:40 +0200 Subject: [PATCH] implemented BLT --- apr.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- main.c | 20 +++++++++---- mem | 9 +++--- pdp6.h | 1 + test.s | 11 ++++++-- 5 files changed, 117 insertions(+), 13 deletions(-) diff --git a/apr.c b/apr.c index 47c14f8..26df73c 100644 --- a/apr.c +++ b/apr.c @@ -424,6 +424,7 @@ pulse(key_rd_wr_ret); pulse(it0); pulse(it1); pulse(ft0); +pulse(ft1a); pulse(at0); pulse(at1); pulse(at3a); @@ -437,6 +438,9 @@ pulse(mc_split_rd_rq); pulse(mc_wr_rq_pulse); pulse(mc_rdwr_rq_pulse); pulse(mc_rd_wr_rs_pulse); +pulse(ar_pm1_t1); +pulse(ar_ast0); +pulse(pir_stb); // TODO: find A LONG, it probably doesn't exist @@ -514,6 +518,9 @@ pulse(mr_clr){ apr->sf5a = 0; // 5-6 apr->sf7 = 0; // 5-6 apr->iot_f0a = 0; // 8-1 + apr->blt_f0a = 0; // 6-18 + apr->blt_f3a = 0; // 6-18 + apr->blt_f5a = 0; // 6-18 apr->sct2_ret = NULL; } @@ -718,6 +725,77 @@ pulse(iot_t0){ nextpulse(apr, mc_rd_wr_rs_pulse); // 7-8 } +/* + * BLT subroutine + */ + +pulse(blt_t6){ + trace("BLT T6\n"); + swap(&apr->mb, &apr->ar); // 6-3 + nextpulse(apr, ft1a); // 5-4 +} + +pulse(blt_t5a){ + trace("BLT T5A\n"); + apr->blt_f5a = 0; // 6-18 + if(!(apr->mq & F0)) + apr->pc = apr->pc+1 & RT; // 5-12 + nextpulse(apr, BLT_DONE ? et10 : blt_t6); // 5-5, 6-18 +} + +pulse(blt_t5){ + trace("BLT T5\n"); + swap(&apr->mb, &apr->mq); // 6-17 + apr->blt_f5a = 1; // 6-18 + nextpulse(apr, ar_pm1_t1); // 6-9 +} + +pulse(blt_t4){ + trace("BLT T4\n"); + swap(&apr->mb, &apr->ar); // 6-3 + nextpulse(apr, pir_stb); // 8-4 + nextpulse(apr, blt_t5); // 6-18 +} + +pulse(blt_t3a){ + trace("BLT T3A\n"); + apr->blt_f3a = 0; // 6-18 + swap(&apr->mb, &apr->mq); // 6-17 + nextpulse(apr, blt_t4); // 6-18 +} + +pulse(blt_t3){ + trace("BLT T3\n"); + apr->blt_f3a = 1; // 6-18 + nextpulse(apr, ar_ast0); // 6-9 +} + +pulse(blt_t2){ + trace("BLT T2\n"); + apr->ar &= RT; // 6-8 + nextpulse(apr, blt_t3); // 6-18 +} + +pulse(blt_t1){ + trace("BLT T1\n"); + swap(&apr->mb, &apr->ar); // 6-3 + nextpulse(apr, blt_t2); // 6-18 +} + +pulse(blt_t0a){ + trace("BLT T0A\n"); + apr->blt_f0a = 0; // 6-18 + apr->mb = apr->mq; // 6-3 + nextpulse(apr, blt_t1); // 6-18 +} + +pulse(blt_t0){ + trace("BLT T0\n"); + swap(&apr->mb, &apr->mq); // 6-17 + apr->blt_f0a = 1; // 6-18 + nextpulse(apr, mc_wr_rq_pulse); // 7-8 +} + /* * Shift subroutines */ @@ -799,6 +877,8 @@ pulse(art3){ if(apr->af3a) nextpulse(apr, at3a); // 5-3 if(apr->et4_ar_pse) nextpulse(apr, et4); // 5-5 + if(apr->blt_f3a) nextpulse(apr, blt_t3a); // 6-18 + if(apr->blt_f5a) nextpulse(apr, blt_t5a); // 6-18 } pulse(ar_cry_comp){ @@ -871,13 +951,14 @@ pulse(pir_stb){ pulse(pi_sync){ trace("PI SYNC\n"); + /* Call directly, we need the result in this pulse */ if(!apr->pi_cyc) pir_stb(apr); // 8-4 if(apr->pi_req && !apr->pi_cyc) nextpulse(apr, iat0); // 5-3 if(IA_NOT_INT) nextpulse(apr, apr->if1a ? it1 : at1); // 5-3 - // no longer needed + /* no longer needed */ apr->ia_inh = 0; } @@ -1174,6 +1255,8 @@ pulse(et3){ if(AR_P1) nextpulse(apr, ar_pm1_t1); + if(apr->inst == BLT) + nextpulse(apr, blt_t0); // 6-18 if(apr->shift_op) nextpulse(apr, sht1); // 6-20 if(AR_SBR) @@ -1553,6 +1636,9 @@ pulse(mc_rs_t1){ if(apr->af3) nextpulse(apr, at3); // 5-3 if(apr->if1a) nextpulse(apr, it1a); // 5-3 if(apr->iot_f0a) nextpulse(apr, iot_t0a); // 8-1 + if(apr->blt_f0a) nextpulse(apr, blt_t0a); // 6-18 + if(apr->blt_f3a) nextpulse(apr, blt_t3a); // 6-18 + if(apr->blt_f5a) nextpulse(apr, blt_t5a); // 6-18 } pulse(mc_rs_t0){ @@ -1565,6 +1651,7 @@ pulse(mc_wr_rs){ trace("MC WR RS\n"); if(apr->ma == apr->mas) apr->mi = apr->mb; // 7-7 +print("write %llo to %o\n", apr->mb, apr->ma); membus1 = apr->mb; // 7-8 membus0 |= MEMBUS_WR_RS; // 7-8 if(!apr->mc_stop) diff --git a/main.c b/main.c index c2cfa58..cd3a197 100644 --- a/main.c +++ b/main.c @@ -137,7 +137,7 @@ Light op_lights[] = { { lampsurf, { 857, 75, 12, 12 }, 0 }, { lampsurf, { 872, 75, 12, 12 }, 0 }, { lampsurf, { 886, 75, 12, 12 }, 0 }, - /* PIO */ + /* PIH */ { lampsurf, { 974, 43, 12, 12 }, 0 }, { lampsurf, { 988, 43, 12, 12 }, 0 }, { lampsurf, { 1002, 43, 12, 12 }, 0 }, @@ -153,7 +153,7 @@ Light op_lights[] = { { lampsurf, { 1030, 75, 12, 12 }, 0 }, { lampsurf, { 1044, 75, 12, 12 }, 0 }, { lampsurf, { 1058, 75, 12, 12 }, 0 }, - /* PIH */ + /* PIO */ { lampsurf, { 974, 107, 12, 12 }, 0 }, { lampsurf, { 988, 107, 12, 12 }, 0 }, { lampsurf, { 1002, 107, 12, 12 }, 0 }, @@ -366,8 +366,12 @@ Light ind_lights[] = { { lampsurf, { 143, 59, 14, 22 }, 0 }, { lampsurf, { 143, 76, 14, 22 }, 0 }, { lampsurf, { 143, 93, 14, 22 }, 0 }, - { lampsurf, { 319, 144, 14, 22 }, 0 }, - { lampsurf, { 319, 161, 14, 22 }, 0 }, + { lampsurf, { 143, 110, 14, 22 }, 0 }, // BLT + { lampsurf, { 143, 127, 14, 22 }, 0 }, + { lampsurf, { 143, 144, 14, 22 }, 0 }, + { lampsurf, { 143, 162, 14, 22 }, 0 }, // IOT + { lampsurf, { 319, 144, 14, 22 }, 0 }, // shf1 + { lampsurf, { 319, 161, 14, 22 }, 0 }, // sc=777 }; Light extra_lights[] = { @@ -870,8 +874,12 @@ error: ff_lght[49].state = apr.sf5a; ff_lght[50].state = apr.sf7; ff_lght[51].state = apr.ar_com_cont; - ff_lght[52].state = apr.shf1; - ff_lght[53].state = apr.sc == 0777; + ff_lght[52].state = apr.blt_f0a; + ff_lght[53].state = apr.blt_f3a; + ff_lght[54].state = apr.blt_f5a; + ff_lght[55].state = apr.iot_f0a; + ff_lght[56].state = apr.shf1; + ff_lght[57].state = apr.sc == 0777; setlights(membus0, membus_lght, 36); setlights(apr.pr, pr_lght, 8); diff --git a/mem b/mem index 1660a42..36724b2 100644 --- a/mem +++ b/mem @@ -1,5 +1,6 @@ -1000: 700000001003 -1001: 254200000000 -1002: 254000001000 +1000: 200000001035 +1001: 251000001033 +1002: 254200000000 1003: 777773001004 -1014: 321321123123 +1034: 321321123123 +1035: 1001014 diff --git a/pdp6.h b/pdp6.h index 6573dfd..8df18f3 100644 --- a/pdp6.h +++ b/pdp6.h @@ -156,6 +156,7 @@ struct Apr { bool sf3, sf5a, sf7; bool shf1; bool iot_f0a; + bool blt_f0a, blt_f3a, blt_f5a; /* temporaries */ bool ex_inh_rel; diff --git a/test.s b/test.s index 9f30003..8fd1bdf 100644 --- a/test.s +++ b/test.s @@ -14,13 +14,20 @@ PI_SET_ACT = 200 # DATAO APR,APR_PR_RLR # DATAI APR,2 # CONI APR,1 - BLKI APR,TEST +# BLKI APR,TEST +# JRST 4, +# JRST .-2 + MOVE 0,BLTTEST + BLT 0,BLTSPC+17 JRST 4, - JRST .-2 TEST: -5,,TEST+1 . = . + 10 +BLTSPC: + . = . + 20 APR_PR_RLR: 321321123123 +BLTTEST: + 1,,BLTSPC