From 988e542a8f94dbeb32358de586fee0ced67cf9c5 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 31 Oct 2015 22:14:57 +0100 Subject: [PATCH] implemented address cycle --- apr.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- main.c | 7 ++++ mem | 7 ++-- pdp6.h | 6 ++++ 4 files changed, 110 insertions(+), 11 deletions(-) diff --git a/apr.c b/apr.c index e13985a..76f5727 100644 --- a/apr.c +++ b/apr.c @@ -12,7 +12,7 @@ typedef void *Pulse(void); Apr apr; int extpulse; Pulse *nextpulse; -Pulse *mc_rst1_ret; +Pulse *mc_rst1_ret, *art3_ret; void set_ex_mode_sync(bool value) @@ -123,6 +123,7 @@ calcaddr(void) pulse(kt4); pulse(it1); pulse(at1); +pulse(at0); pulse(iat0); pulse(mc_wr_rs); pulse(mc_rd_rq_pulse); @@ -172,6 +173,9 @@ pulse(mr_clr){ /* sbr flip-flops */ apr.key_rd_wr = 0; // 5-2 apr.if1a = 0; // 5-3 + apr.af0 = 0; // 5-3 + apr.af3 = 0; // 5-3 + apr.af3a = 0; // 5-3 mc_rst1_ret = NULL; return NULL; } @@ -220,6 +224,24 @@ pulse(st7){ return NULL; } +/* + * AR + */ + +// very temporary + +pulse(art3){ +// apr.ar_com_cont = 0; + return art3_ret; +} + +pulse(ar_ast1){ + printf("AR AST1,2\n"); + // TODO + apr.ar += apr.mb; + return art3; +} + /* * Priority Interrupt */ @@ -243,18 +265,81 @@ pulse(pi_sync){ return at1; } +/* + * Fetch + */ + +pulse(ft0){ + printf("FT0\n"); + return NULL; +} + /* * Address */ +pulse(at5){ + printf("AT5\n"); + apr.a_long = 1; // nowhere to be found :( + apr.af0 = 1; // 5-3 + apr.ma = apr.mb & RT; // 7-3 + apr.ir &= ~037; // 5-7 + mc_rst1_ret = at0; + return mc_rd_rq_pulse; +} + +pulse(at4){ + printf("AT4\n"); + apr.ar &= ~LT; // 6-8 + // TODO: what is MC DR SPLIT? + if(apr.sw_addr_stop || apr.key_mem_stop) + apr.mc_split_cyc_sync = 1; // 7-9 + if(apr.ir & 020) + return at5; // 5-3 + return ft0; // 5-4 +} + +pulse(at3a){ + printf("AT3A\n"); + apr.af3a = 0; // 5-3 + apr.mb = apr.ar; // 6-3 + return at4; // 5-3 +} + +pulse(at3){ + printf("AT3\n"); + apr.af3 = 0; // 5-3 + apr.ma = 0; // 7-3 + apr.af3a = 1; // 5-3 + art3_ret = at3a; + return ar_ast1; +} + +pulse(at2){ + printf("AT2\n"); + apr.a_long = 1; // nowhere to be found :( + apr.ma = apr.ir & 017; // 7-3 + apr.af3 = 1; // 5-3 + mc_rst1_ret = at3; + return mc_rd_rq_pulse; +} + pulse(at1){ printf("AT1\n"); - return NULL; + apr.ex_uuo_sync = 1; // 5-13 + if((apr.ir & 017) == 0) + return at4; // 5-3 + return at2; // 5-3 } pulse(at0){ printf("AT0\n"); - return NULL; + apr.ar &= ~RT; // 6-8 + apr.ar |= apr.mb & RT; // 6-8 + apr.ir |= apr.mb>>18 & 037; // 5-7 + apr.ma = 0; // 7-3 + apr.af0 = 0; // 5-3 + return pi_sync; // 8-4 } /* @@ -271,7 +356,7 @@ pulse(iat0){ pulse(it1a){ printf("IT1A\n"); apr.if1a = 0; - apr.ir |= (apr.mb & 0777740000000) >> 18; // 5-7 + apr.ir |= apr.mb>>18 & 0777740; // 5-7 if(apr.ma & 0777760) set_key_rim_sbr(0); // 5-2 return at0; @@ -289,7 +374,7 @@ pulse(it1){ }else apr.ma = apr.pc; // 7-3 if(apr.pi_ov) - apr.ma = (apr.ma+1)&0777777; // 7-3 + apr.ma = (apr.ma+1)&RT; // 7-3 apr.if1a = 1; mc_rst1_ret = it1a; return mc_rd_rq_pulse; @@ -300,7 +385,7 @@ pulse(it0){ apr.ma = 0; mr_clr(); apr.if1a = 1; // 5-3 - return pi_sync; + return pi_sync; // 8-4 } /* @@ -519,13 +604,13 @@ pulse(kt12){ if(apr.key_ex) apr.ma = apr.mas; if(apr.key_ex_next) - apr.ma = (apr.ma+1)&0777777; + apr.ma = (apr.ma+1)&RT; if(apr.key_dep){ apr.ma = apr.mas; apr.ar = apr.data; } if(apr.key_dep_next){ - apr.ma = (apr.ma+1)&0777777; + apr.ma = (apr.ma+1)&RT; apr.ar = apr.data; } diff --git a/main.c b/main.c index f3b4d28..a29285b 100644 --- a/main.c +++ b/main.c @@ -355,7 +355,11 @@ Light ind_lights[] = { { lampsurf, { 407, 161, 14, 22 }, 0 }, /* sbr flip-flops */ { lampsurf, { 99, 42, 14, 22 }, 0 }, + { lampsurf, { 99, 59, 14, 22 }, 0 }, + { lampsurf, { 99, 76, 14, 22 }, 0 }, + { lampsurf, { 99, 93, 14, 22 }, 0 }, }; + Light extra_lights[] = { /* MEMBUS */ { lampsurf, { 693, 26, 12, 12 }, 0 }, @@ -837,6 +841,9 @@ error: ff_lght[38].state = apr.uuo_f1; ff_lght[39].state = apr.cpa_pdl_ov; ff_lght[40].state = apr.if1a; + ff_lght[41].state = apr.af0; + ff_lght[42].state = apr.af3; + ff_lght[43].state = apr.af3a; setlights(membus0, membus_lght, 36); setlights(apr.pr, pr_lght, 8); diff --git a/mem b/mem index 5cae503..e190fc5 100644 --- a/mem +++ b/mem @@ -1,11 +1,12 @@ -201040001234 -0 -0 +201040001134 +201050001134 +201070000001 0 0 0 0 0 +20 0 0 0 diff --git a/pdp6.h b/pdp6.h index 5b37946..b9aefba 100644 --- a/pdp6.h +++ b/pdp6.h @@ -11,6 +11,11 @@ typedef uint16_t u16; typedef uint8_t u8; typedef char bool; +enum { + RT = 0000000777777, + LT = 0777777000000, +}; + typedef struct Apr Apr; struct Apr { hword ir; @@ -63,6 +68,7 @@ struct Apr { /* sbr flip-flops */ bool if1a; + bool af0, af3, af3a; bool chf7; /* temporaries */