Skip to content

Commit b52438a

Browse files
committed
KA10: Added support for Address Stop (lars)
1 parent 2a4e4dc commit b52438a

File tree

5 files changed

+135
-4
lines changed

5 files changed

+135
-4
lines changed

PDP10/kx10_cpu.c

+75-4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ uint64 MI; /* Monitor lights */
126126
uint32 FLAGS; /* Flags */
127127
uint32 AC; /* Operand accumulator */
128128
uint64 SW; /* Switch register */
129+
#if PDP6 | KA | KI
130+
t_addr AS; /* Address switches */
131+
#endif
129132
int BYF5; /* Flag for second half of LDB/DPB instruction */
130133
int uuo_cycle; /* Uuo cycle in progress */
131134
int SC; /* Shift count */
@@ -138,6 +141,15 @@ int push_ovf; /* Push stack overflow */
138141
int mem_prot; /* Memory protection flag */
139142
#endif
140143
int nxm_flag; /* Non-existant memory flag */
144+
#if KA | KI
145+
int adr_flag; /* Address break flag */
146+
int adr_cond; /* Address condition swiches */
147+
#define ADR_IFETCH 020
148+
#define ADR_DFETCH 010
149+
#define ADR_WRITE 004
150+
#define ADR_STOP 002
151+
#define ADR_BREAK 001
152+
#endif
141153
int clk_flg; /* Clock flag */
142154
int ov_irq; /* Trap overflow */
143155
int fov_irq; /* Trap floating overflow */
@@ -450,7 +462,10 @@ REG cpu_reg[] = {
450462
{ ORDATAD (PIE, PIE, 8, "Priority Interrupt Enable") },
451463
{ ORDATAD (PIENB, pi_enable, 7, "Enable Priority System") },
452464
{ ORDATAD (SW, SW, 36, "Console SW Register"), REG_FIT},
453-
{ ORDATAD (MI, MI, 36, "Monitor Display"), REG_FIT},
465+
{ ORDATAD (MI, MI, 36, "Memory Indicators"), REG_FIT},
466+
#if PDP6 | KA | KI
467+
{ ORDATAD (AS, AS, 18, "Console AS Register"), REG_FIT},
468+
#endif
454469
{ FLDATAD (BYF5, BYF5, 0, "Byte Flag") },
455470
{ FLDATAD (UUO, uuo_cycle, 0, "UUO Cycle") },
456471
#if KA | PDP6
@@ -463,6 +478,10 @@ REG cpu_reg[] = {
463478
{ FLDATAD (MEMPROT, mem_prot, 0, "Memory protection flag") },
464479
#endif
465480
{ FLDATAD (NXM, nxm_flag, 0, "Non-existing memory access") },
481+
#if KA | KI
482+
{ FLDATAD (ABRK, adr_flag, 0, "Address break") },
483+
{ ORDATAD (ACOND, adr_cond, 5, "Address condition switches") },
484+
#endif
466485
{ FLDATAD (CLK, clk_flg, 0, "Clock interrupt") },
467486
{ FLDATAD (OV, ov_irq, 0, "Overflow enable") },
468487
#if PDP6
@@ -1040,6 +1059,9 @@ t_stat dev_pi(uint32 dev, uint64 *data) {
10401059
#if KI | KL
10411060
res |= ((uint64)(PIR) << 18);
10421061
#endif
1062+
#if KI
1063+
res |= ((uint64)adr_flag << 31);
1064+
#endif
10431065
#if !KL
10441066
res |= ((uint64)parity_irq << 15);
10451067
#endif
@@ -1501,7 +1523,7 @@ void check_apr_irq() {
15011523
if (pi_enable && apr_irq) {
15021524
int flg = 0;
15031525
clr_interrupt(0);
1504-
flg |= inout_fail | nxm_flag;
1526+
flg |= inout_fail | nxm_flag | adr_flag;
15051527
if (flg)
15061528
set_interrupt(0, apr_irq);
15071529
}
@@ -1652,7 +1674,7 @@ void check_apr_irq() {
16521674
clr_interrupt(0);
16531675
flg |= ((FLAGS & OVR) != 0) & ov_irq;
16541676
flg |= ((FLAGS & FLTOVR) != 0) & fov_irq;
1655-
flg |= nxm_flag | mem_prot | push_ovf;
1677+
flg |= nxm_flag | mem_prot | push_ovf | adr_flag;
16561678
if (flg)
16571679
set_interrupt(0, apr_irq);
16581680
}
@@ -1686,7 +1708,7 @@ t_stat dev_apr(uint32 dev, uint64 *data) {
16861708
res |= (((FLAGS & FLTOVR) != 0) << 6) | (fov_irq << 7) ;
16871709
res |= (clk_flg << 9) | (((uint64)clk_en) << 10) | (nxm_flag << 12);
16881710
res |= (mem_prot << 13) | (((FLAGS & USERIO) != 0) << 15);
1689-
res |= (push_ovf << 16) | (maoff >> 1);
1711+
res |= (adr_flag << 14) | (push_ovf << 16) | (maoff >> 1);
16901712
*data = res;
16911713
sim_debug(DEBUG_CONI, &cpu_dev, "CONI APR %012llo\n", *data);
16921714
break;
@@ -1725,6 +1747,8 @@ t_stat dev_apr(uint32 dev, uint64 *data) {
17251747
nxm_flag = 0;
17261748
if (res & 020000)
17271749
mem_prot = 0;
1750+
if (res & 040000)
1751+
adr_flag = 0;
17281752
if (res & 0200000) {
17291753
#if MPX_DEV
17301754
mpx_enable = 0;
@@ -2998,6 +3022,27 @@ int Mem_write_byte(int n, uint16 *data) {
29983022

29993023
#endif
30003024

3025+
#if KA | KI
3026+
static void
3027+
address_conditions (int fetch, int write)
3028+
{
3029+
int cond;
3030+
if (fetch)
3031+
cond = ADR_IFETCH;
3032+
else if (write)
3033+
cond = ADR_WRITE;
3034+
else
3035+
cond = ADR_DFETCH;
3036+
if (adr_cond & cond) {
3037+
if (adr_cond & ADR_STOP)
3038+
watch_stop = 1;
3039+
if (adr_cond & ADR_BREAK)
3040+
adr_flag = 1;
3041+
}
3042+
check_apr_irq();
3043+
}
3044+
#endif
3045+
30013046
#if KI
30023047
/*
30033048
* Load the TLB entry, used for both page_lookup and MAP.
@@ -3067,6 +3112,9 @@ int page_lookup(t_addr addr, int flag, t_addr *loc, int wr, int cur_context, int
30673112
if (page_fault)
30683113
return 0;
30693114

3115+
if (adr_cond && addr == AS)
3116+
address_conditions (fetch, wr);
3117+
30703118
/* If paging is not enabled, address is direct */
30713119
if (!page_enable) {
30723120
*loc = addr;
@@ -3300,6 +3348,9 @@ int page_lookup_its(t_addr addr, int flag, t_addr *loc, int wr, int cur_context,
33003348
int uf = (FLAGS & USER) != 0;
33013349
int ofd = (int)fault_data;
33023350

3351+
if (adr_cond && addr == AS)
3352+
address_conditions (fetch, wr);
3353+
33033354
/* If paging is not enabled, address is direct */
33043355
if (!page_enable) {
33053356
*loc = addr;
@@ -3577,6 +3628,9 @@ int page_lookup_bbn(t_addr addr, int flag, t_addr *loc, int wr, int cur_context,
35773628
if (page_fault)
35783629
return 0;
35793630

3631+
if (adr_cond && addr == AS)
3632+
address_conditions (fetch, wr);
3633+
35803634
/* If paging is not enabled, address is direct */
35813635
if (!page_enable) {
35823636
*loc = addr;
@@ -3872,6 +3926,9 @@ int page_lookup_waits(t_addr addr, int flag, t_addr *loc, int wr, int cur_contex
38723926
/* If this is modify instruction use write access */
38733927
wr |= modify;
38743928

3929+
if (adr_cond && addr == AS)
3930+
address_conditions (fetch, wr);
3931+
38753932
/* Figure out if this is a user space access */
38763933
if (flag)
38773934
uf = 0;
@@ -3970,6 +4027,9 @@ int Mem_write_waits(int flag, int cur_context) {
39704027
#endif
39714028

39724029
int page_lookup_ka(t_addr addr, int flag, t_addr *loc, int wr, int cur_context, int fetch) {
4030+
if (adr_cond && addr == AS)
4031+
address_conditions (fetch, wr);
4032+
39734033
if (!flag && (FLAGS & USER) != 0) {
39744034
if (addr <= Pl) {
39754035
*loc = (addr + Rl) & RMASK;
@@ -4216,6 +4276,10 @@ int Mem_write(int flag, int cur_context) {
42164276
* Return of 0 if successful, 1 if there was an error.
42174277
*/
42184278
int Mem_read_nopage() {
4279+
#if KA | KI
4280+
if (adr_cond && AB == AS)
4281+
address_conditions (0, 0);
4282+
#endif
42194283
if (AB < 020) {
42204284
MB = get_reg(AB);
42214285
} else {
@@ -4240,6 +4304,10 @@ int Mem_read_nopage() {
42404304
* Return of 0 if successful, 1 if there was an error.
42414305
*/
42424306
int Mem_write_nopage() {
4307+
#if KA | KI
4308+
if (adr_cond && AB == AS)
4309+
address_conditions (0, 1);
4310+
#endif
42434311
if (AB < 020) {
42444312
set_reg(AB, MB);
42454313
} else {
@@ -13447,6 +13515,9 @@ t_stat cpu_reset (DEVICE *dptr)
1344713515
#if ITS | BBN
1344813516
page_enable = 0;
1344913517
#endif
13518+
#endif
13519+
#if KA | KI
13520+
adr_flag = 0;
1345013521
#endif
1345113522
nxm_flag = clk_flg = 0;
1345213523
PIR = PIH = PIE = pi_enable = parity_irq = 0;

PDP10/tests/adrbrk.do

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
;JSR ADRBRK
2+
dep 000042 264000000105
3+
;CONO CONO APR,200000+PIA
4+
dep 000100 700200200001
5+
;CONO PI,2200+<200_-PIA>
6+
dep 000101 700600002300
7+
;MOVE A,100
8+
dep 000102 200040000100
9+
;MOVEM A,200
10+
dep 000103 202040000200
11+
;JRST 400
12+
dep 000104 254000000400
13+
;0
14+
dep 000105 000000000000
15+
;CONO APR,40000+PIA
16+
dep 000106 700200040001
17+
;JRST 12,@ADRBRK
18+
dep 000107 254520000105
19+
;JRST LOOP
20+
dep 000400 254000000102
21+
22+
;Check address stop: data fetch from 100.
23+
dep acond 12
24+
dep as 100
25+
go 100
26+
if (PC != 000103) echof "FAIL: stop dfetch 100"; ex pc; exit 1
27+
28+
;Check address stop: write to 200.
29+
dep acond 06
30+
dep as 200
31+
continue
32+
if (PC != 000104) echof "FAIL: stop write 200"; ex pc; exit 1
33+
34+
;Check address stop: instruction fetch from 400.
35+
dep acond 22
36+
dep as 400
37+
continue
38+
if (PC != 000102) echof "FAIL: stop ifetch 400"; ex pc; exit 1
39+
40+
;Check address break: data fetch from 100.
41+
break 106
42+
dep acond 11
43+
dep as 100
44+
continue
45+
if (PC != 000106) echof "FAIL: break dfetch 100"; ex pc; exit 1
46+
47+
;Check address break: write to 200.
48+
dep acond 05
49+
dep as 200
50+
continue
51+
if (PC != 000106) echof "FAIL: break write 200"; ex pc; exit 1
52+
53+
;Check address break: instruction fetch from 400.
54+
dep acond 21
55+
dep as 400
56+
continue
57+
if (PC != 000106) echof "FAIL: break ifetch 400"; ex pc; exit 1
58+
59+
echof "PASS"
60+
exit 0

doc/ka10_doc.doc

1.5 KB
Binary file not shown.

doc/ki10_doc.doc

1.5 KB
Binary file not shown.

doc/pdp6_doc.doc

2.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)