bfa555213dbf03ad2cec4f56032084849ddf67a0
1 /* pdp11_defs.h: PDP-11 simulator definitions
3 Copyright (c) 1993-2008, Robert M Supnik
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of Robert M Supnik shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from Robert M Supnik.
26 The author gratefully acknowledges the help of Max Burnet, Megan Gentry,
27 and John Wilson in resolving questions about the PDP-11
29 16-May-08 RMS Added KE11A, DC11 support
30 02-Feb-08 RMS Fixed DMA memory address limit test (found by John Dundas)
31 25-Jan-08 RMS Added RC11, KG11A support (from John Dundas)
32 16-Dec-06 RMS Added TA11 support
33 29-Oct-06 RMS Added clock coscheduling
34 06-Jul-06 RMS Added multiple KL11/DL11 support
35 26-Jun-06 RMS Added RF11 support
36 24-May-06 RMS Added 11/44 DR support (from CIS diagnostic)
37 17-May-06 RMS Added CR11/CD11 support (from John Dundas)
38 30-Sep-04 RMS Added Massbus support
39 Removed Map_Addr prototype
40 Removed map argument from Unibus routines
41 Added framework for model selection
42 28-May-04 RMS Added DHQ support
43 25-Jan-04 RMS Removed local debug logging support
44 22-Dec-03 RMS Added second DEUNA/DELUA support
45 18-Oct-03 RMS Added DECtape off reel message
46 19-May-03 RMS Revised for new conditional compilation
47 05-Apr-03 RMS Fixed bug in MMR1 update (found by Tim Stark)
48 28-Feb-03 RMS Added TM logging support
49 19-Jan-03 RMS Changed mode definitions for Apple Dev Kit conflict
50 11-Nov-02 RMS Changed log definitions to be VAX compatible
51 10-Oct-02 RMS Added vector information to DIB
52 Changed DZ11 vector to Unibus standard
53 Added DEQNA/DELQA, DEUNA/DELUA support
54 Added multiple RQDX3, autoconfigure support
55 12-Sep-02 RMS Added TMSCP, KW11P,and RX211 support
56 28-Apr-02 RMS Clarified PDF ACF mnemonics
57 22-Apr-02 RMS Added HTRAP, BPOK maint register flags, MT_MAXFR
58 06-Mar-02 RMS Changed system type to KDJ11A
59 20-Jan-02 RMS Added multiboard DZ11 support
60 09-Nov-01 RMS Added bus map support
61 07-Nov-01 RMS Added RQDX3 support
62 26-Oct-01 RMS Added symbolic definitions for IO page
63 19-Oct-01 RMS Added DZ definitions
64 15-Oct-01 RMS Added logging capabilities
65 07-Sep-01 RMS Revised for multilevel interrupts
66 01-Jun-01 RMS Added DZ11 support
67 23-Apr-01 RMS Added RK611 support
68 05-Apr-01 RMS Added TS11/TSV05 support
69 10-Feb-01 RMS Added DECtape support
73 #define _PDP11_DEFS_H 0
79 #include "sim_defs.h" /* simulator defns */
82 /* Architectural constants */
84 #define STKL_R 0340 /* stack limit */
86 #define VASIZE 0200000 /* 2**16 */
87 #define VAMASK (VASIZE - 1) /* 2**16 - 1 */
88 #define MEMSIZE64K 0200000 /* 2**16 */
89 #define INIMEMSIZE 001000000 /* 2**18 */
90 #define UNIMEMSIZE 001000000 /* 2**18 */
91 #define UNIMASK (UNIMEMSIZE - 1) /* 2**18 - 1 */
92 #define IOPAGEBASE 017760000 /* 2**22 - 2**13 */
93 #define IOPAGESIZE 000020000 /* 2**13 */
94 #define IOPAGEMASK (IOPAGESIZE - 1) /* 2**13 - 1 */
95 #define MAXMEMSIZE 020000000 /* 2**22 */
96 #define PAMASK (MAXMEMSIZE - 1) /* 2**22 - 1 */
97 #define MEMSIZE (cpu_unit.capac)
98 #define ADDR_IS_MEM(x) (((t_addr) (x)) < cpu_memsize) /* use only in sim! */
125 #define CPUT_03 (1u << MOD_1103) /* LSI-11 */
126 #define CPUT_04 (1u << MOD_1104) /* 11/04 */
127 #define CPUT_05 (1u << MOD_1105) /* 11/05 */
128 #define CPUT_20 (1u << MOD_1120) /* 11/20 */
129 #define CPUT_23 (1u << MOD_1123) /* 11/23 */
130 #define CPUT_23P (1u << MOD_1123P) /* 11/23+ */
131 #define CPUT_24 (1u << MOD_1124) /* 11/24 */
132 #define CPUT_34 (1u << MOD_1134) /* 11/34 */
133 #define CPUT_40 (1u << MOD_1140) /* 11/40 */
134 #define CPUT_44 (1u << MOD_1144) /* 11/44 */
135 #define CPUT_45 (1u << MOD_1145) /* 11/45 */
136 #define CPUT_60 (1u << MOD_1160) /* 11/60 */
137 #define CPUT_70 (1u << MOD_1170) /* 11/70 */
138 #define CPUT_73 (1u << MOD_1173) /* 11/73 */
139 #define CPUT_53 (1u << MOD_1153) /* 11/53 */
140 #define CPUT_73B (1u << MOD_1173B) /* 11/73B */
141 #define CPUT_83 (1u << MOD_1183) /* 11/83 */
142 #define CPUT_84 (1u << MOD_1184) /* 11/84 */
143 #define CPUT_93 (1u << MOD_1193) /* 11/93 */
144 #define CPUT_94 (1u << MOD_1194) /* 11/94 */
145 #define CPUT_T (1u << MOD_T) /* T-11 */
147 #define CPUT_F (CPUT_23|CPUT_23P|CPUT_24) /* all F11's */
148 #define CPUT_J (CPUT_53|CPUT_73|CPUT_73B| \
149 CPUT_83|CPUT_84|CPUT_93|CPUT_94)
150 #define CPUT_JB (CPUT_73B|CPUT_83|CPUT_84) /* KDJ11B */
151 #define CPUT_JE (CPUT_93|CPUT_94) /* KDJ11E */
152 #define CPUT_JU (CPUT_84|CPUT_94) /* KTJ11B UBA */
153 #define CPUT_ALL 0xFFFFFFFF
157 #define BUS_U (1u << 0) /* Unibus */
158 #define BUS_Q (0) /* Qbus */
159 #define OPT_EIS (1u << 1) /* EIS */
160 #define OPT_FIS (1u << 2) /* FIS */
161 #define OPT_FPP (1u << 3) /* FPP */
162 #define OPT_CIS (1u << 4) /* CIS */
163 #define OPT_MMU (1u << 5) /* MMU */
164 #define OPT_RH11 (1u << 6) /* RH11 */
165 #define OPT_PAR (1u << 7) /* parity */
166 #define OPT_UBM (1u << 8) /* UBM */
168 #define CPUT(x) ((cpu_type & (x)) != 0)
169 #define CPUO(x) ((cpu_opt & (x)) != 0)
170 #define UNIBUS (cpu_opt & BUS_U)
174 SDSD source addr, dest addr, source fetch, dest fetch
178 SXS SXT, XOR, SOB instructions
179 MARK MARK instruction
181 MXPY MTPI, MTPD, MFPI, MFPD instructions
182 MXPS MTPS, MFPS instructions
183 MFPT MFPT instruction
185 TSWLK TSTSET, WRLCK instructions
187 EXPT explicit PSW writes can alter T-bit
188 IOSR general registers readable from programs in IO space
189 2REG dual register set
192 STKLR STKLIM register
193 STKLF fixed stack limit
194 SID supervisor mode, I/D spaces
196 HALT4 halt in kernel mode traps to 4
197 JREG4 JMP/JSR R traps to 4
198 STKA stop on stack abort
203 #define IS_SDSD (CPUT_20|CPUT_F|CPUT_40|CPUT_60|CPUT_J|CPUT_T)
204 #define HAS_SR (CPUT_04|CPUT_05|CPUT_20|CPUT_34|CPUT_40| \
205 CPUT_44|CPUT_45|CPUT_60|CPUT_70)
206 #define HAS_DR (CPUT_04|CPUT_05|CPUT_20|CPUT_24|CPUT_34| \
207 CPUT_40|CPUT_44|CPUT_45|CPUT_60|CPUT_70)
208 #define HAS_RTT (CPUT_03|CPUT_04|CPUT_F|CPUT_34|CPUT_40| \
209 CPUT_44|CPUT_45|CPUT_60|CPUT_70|CPUT_J|CPUT_T)
210 #define HAS_SXS (CPUT_03|CPUT_F|CPUT_34|CPUT_40|CPUT_44| \
211 CPUT_45|CPUT_60|CPUT_70|CPUT_J|CPUT_T)
212 #define HAS_MARK (CPUT_03|CPUT_F|CPUT_34|CPUT_40|CPUT_44| \
213 CPUT_45|CPUT_60|CPUT_70|CPUT_J)
214 #define HAS_SPL (CPUT_44|CPUT_45|CPUT_70|CPUT_J)
215 #define HAS_MXPY (CPUT_F|CPUT_34|CPUT_40|CPUT_44|CPUT_45| \
216 CPUT_60|CPUT_70|CPUT_J)
217 #define HAS_MXPS (CPUT_03|CPUT_F|CPUT_34|CPUT_J|CPUT_T)
218 #define HAS_MFPT (CPUT_F|CPUT_44|CPUT_J|CPUT_T)
219 #define HAS_CSM (CPUT_44|CPUT_J)
220 #define HAS_TSWLK (CPUT_J)
221 #define HAS_PSW (CPUT_04|CPUT_05|CPUT_20|CPUT_F|CPUT_34|CPUT_40| \
222 CPUT_44|CPUT_45|CPUT_60|CPUT_70|CPUT_J)
223 #define HAS_EXPT (CPUT_04|CPUT_05|CPUT_20)
224 #define HAS_IOSR (CPUT_04|CPUT_05)
225 #define HAS_2REG (CPUT_45|CPUT_70|CPUT_J)
226 #define HAS_MMR3 (CPUT_F|CPUT_44|CPUT_45|CPUT_70|CPUT_J)
227 #define HAS_MMTR (CPUT_45|CPUT_70)
228 #define HAS_STKLR (CPUT_45|CPUT_60|CPUT_70)
229 #define HAS_STKLF (CPUT_04|CPUT_05|CPUT_20|CPUT_F|CPUT_34| \
230 CPUT_40|CPUT_44|CPUT_J)
231 #define HAS_SID (CPUT_44|CPUT_45|CPUT_70|CPUT_J)
232 #define HAS_ODD (CPUT_04|CPUT_05|CPUT_20|CPUT_34|CPUT_40| \
233 CPUT_44|CPUT_45|CPUT_60|CPUT_70|CPUT_J)
234 #define HAS_HALT4 (CPUT_44|CPUT_45|CPUT_70|CPUT_J)
235 #define HAS_JREG4 (CPUT_03|CPUT_04|CPUT_05|CPUT_20|CPUT_F| \
236 CPUT_34|CPUT_40|CPUT_60|CPUT_T)
237 #define STOP_STKA (CPUT_03|CPUT_04|CPUT_05|CPUT_20|CPUT_34|CPUT_44)
238 #define HAS_LTCR (CPUT_04|CPUT_05|CPUT_20|CPUT_23P|CPUT_24| \
239 CPUT_34|CPUT_40|CPUT_44|CPUT_45|CPUT_60| \
241 #define HAS_LTCM (CPUT_04|CPUT_05|CPUT_20|CPUT_24|CPUT_34| \
242 CPUT_40|CPUT_44|CPUT_45|CPUT_60|CPUT_70|CPUT_J)
244 /* Protection modes */
251 /* I/O access modes */
254 #define READC 1 /* read console */
256 #define WRITEC 3 /* write console */
261 #define PSW_V_C 0 /* condition codes */
265 #define PSW_V_TBIT 4 /* trace trap */
266 #define PSW_V_IPL 5 /* int priority */
267 #define PSW_V_FPD 8 /* first part done */
268 #define PSW_V_RS 11 /* register set */
269 #define PSW_V_PM 12 /* previous mode */
270 #define PSW_V_CM 14 /* current mode */
272 #define PSW_TBIT (1 << PSW_V_TBIT)
273 #define PSW_PM (3 << PSW_V_PM)
277 #define FPS_V_C 0 /* condition codes */
281 #define FPS_V_T 5 /* truncate */
282 #define FPS_V_L 6 /* long */
283 #define FPS_V_D 7 /* double */
284 #define FPS_V_IC 8 /* ic err int */
285 #define FPS_V_IV 9 /* overflo err int */
286 #define FPS_V_IU 10 /* underflo err int */
287 #define FPS_V_IUV 11 /* undef var err int */
288 #define FPS_V_ID 14 /* int disable */
289 #define FPS_V_ER 15 /* error */
293 #define PIRQ_PIR1 0001000
294 #define PIRQ_PIR2 0002000
295 #define PIRQ_PIR3 0004000
296 #define PIRQ_PIR4 0010000
297 #define PIRQ_PIR5 0020000
298 #define PIRQ_PIR6 0040000
299 #define PIRQ_PIR7 0100000
300 #define PIRQ_IMP 0177356 /* implemented bits */
301 #define PIRQ_RW 0177000 /* read/write bits */
305 #define STKLIM_RW 0177400
309 #define MMR0_MME 0000001 /* mem mgt enable */
310 #define MMR0_V_PAGE 1 /* offset to pageno */
311 #define MMR0_M_PAGE 077 /* mask for pageno */
312 #define MMR0_PAGE (MMR0_M_PAGE << MMR0_V_PAGE)
313 #define MMR0_IC 0000200 /* instr complete */
314 #define MMR0_MAINT 0000400 /* maintenance */
315 #define MMR0_TENB 0001000 /* trap enable */
316 #define MMR0_TRAP 0010000 /* mem mgt trap */
317 #define MMR0_RO 0020000 /* read only error */
318 #define MMR0_PL 0040000 /* page lnt error */
319 #define MMR0_NR 0100000 /* no access error */
320 #define MMR0_FREEZE 0160000 /* if set, no update */
321 #define MMR0_WR 0171401 /* writeable bits */
325 #define MMR3_UDS 001 /* user dspace enbl */
326 #define MMR3_SDS 002 /* super dspace enbl */
327 #define MMR3_KDS 004 /* krnl dspace enbl */
328 #define MMR3_CSM 010 /* CSM enable */
329 #define MMR3_M22E 020 /* 22b mem mgt enbl */
330 #define MMR3_BME 040 /* DMA bus map enbl */
334 #define PAR_18B 0007777 /* 18b addressing */
335 #define PAR_22B 0177777 /* 22b addressing */
339 #define PDR_ACF 0000007 /* access control */
340 #define PDR_ACS 0000006 /* 2b access control */
341 #define PDR_ED 0000010 /* expansion dir */
342 #define PDR_W 0000100 /* written flag */
343 #define PDR_A 0000200 /* access flag */
344 #define PDR_PLF 0077400 /* page lnt field */
345 #define PDR_NOC 0100000 /* don't cache */
347 #define PDR_PRD 0000003 /* page readable if 2 */
349 /* Virtual address */
351 #define VA_DF 0017777 /* displacement */
352 #define VA_BN 0017700 /* block number */
353 #define VA_V_APF 13 /* offset to APF */
354 #define VA_V_DS 16 /* offset to space */
355 #define VA_V_MODE 17 /* offset to mode */
356 #define VA_DS (1u << VA_V_DS) /* data space flag */
358 /* Unibus map (if present) */
360 #define UBM_LNT_LW 32 /* size in LW */
361 #define UBM_V_PN 13 /* page number */
363 #define UBM_V_OFF 0 /* offset */
364 #define UBM_M_OFF 017777
365 #define UBM_PAGSIZE (UBM_M_OFF + 1) /* page size */
366 #define UBM_GETPN(x) (((x) >> UBM_V_PN) & UBM_M_PN)
367 #define UBM_GETOFF(x) ((x) & UBM_M_OFF)
371 #define CPUE_RED 0004 /* red stack */
372 #define CPUE_YEL 0010 /* yellow stack */
373 #define CPUE_TMO 0020 /* IO page nxm */
374 #define CPUE_NXM 0040 /* memory nxm */
375 #define CPUE_ODD 0100 /* odd address */
376 #define CPUE_HALT 0200 /* HALT not kernel */
377 #define CPUE_IMP 0374 /* implemented bits */
379 /* Floating point accumulators */
382 uint32 l
; /* low 32b */
383 uint32 h
; /* high 32b */
388 #define CSR_V_GO 0 /* go */
389 #define CSR_V_IE 6 /* interrupt enable */
390 #define CSR_V_DONE 7 /* done */
391 #define CSR_V_BUSY 11 /* busy */
392 #define CSR_V_ERR 15 /* error */
393 #define CSR_GO (1u << CSR_V_GO)
394 #define CSR_IE (1u << CSR_V_IE)
395 #define CSR_DONE (1u << CSR_V_DONE)
396 #define CSR_BUSY (1u << CSR_V_BUSY)
397 #define CSR_ERR (1u << CSR_V_ERR)
399 /* Trap masks, descending priority order, following J-11
400 An interrupt summary bit is kept with traps, to minimize overhead
403 #define TRAP_V_RED 0 /* red stk abort 4 */
404 #define TRAP_V_ODD 1 /* odd address 4 */
405 #define TRAP_V_MME 2 /* mem mgt 250 */
406 #define TRAP_V_NXM 3 /* nx memory 4 */
407 #define TRAP_V_PAR 4 /* parity err 114 */
408 #define TRAP_V_PRV 5 /* priv inst 4 */
409 #define TRAP_V_ILL 6 /* illegal inst 10 */
410 #define TRAP_V_BPT 7 /* BPT 14 */
411 #define TRAP_V_IOT 8 /* IOT 20 */
412 #define TRAP_V_EMT 9 /* EMT 30 */
413 #define TRAP_V_TRAP 10 /* TRAP 34 */
414 #define TRAP_V_TRC 11 /* T bit 14 */
415 #define TRAP_V_YEL 12 /* stack 4 */
416 #define TRAP_V_PWRFL 13 /* power fail 24 */
417 #define TRAP_V_FPE 14 /* fpe 244 */
418 #define TRAP_V_MAX 15 /* intr = max trp # */
419 #define TRAP_RED (1u << TRAP_V_RED)
420 #define TRAP_ODD (1u << TRAP_V_ODD)
421 #define TRAP_MME (1u << TRAP_V_MME)
422 #define TRAP_NXM (1u << TRAP_V_NXM)
423 #define TRAP_PAR (1u << TRAP_V_PAR)
424 #define TRAP_PRV (1u << TRAP_V_PRV)
425 #define TRAP_ILL (1u << TRAP_V_ILL)
426 #define TRAP_BPT (1u << TRAP_V_BPT)
427 #define TRAP_IOT (1u << TRAP_V_IOT)
428 #define TRAP_EMT (1u << TRAP_V_EMT)
429 #define TRAP_TRAP (1u << TRAP_V_TRAP)
430 #define TRAP_TRC (1u << TRAP_V_TRC)
431 #define TRAP_YEL (1u << TRAP_V_YEL)
432 #define TRAP_PWRFL (1u << TRAP_V_PWRFL)
433 #define TRAP_FPE (1u << TRAP_V_FPE)
434 #define TRAP_INT (1u << TRAP_V_MAX)
435 #define TRAP_ALL ((1u << TRAP_V_MAX) - 1) /* all traps */
437 #define VEC_RED 0004 /* trap vectors */
447 #define VEC_TRAP 0034
450 #define VEC_PWRFL 0024
453 /* Simulator stop codes; codes 1:TRAP_V_MAX correspond to traps 0:TRAPMAX-1 */
455 #define STOP_HALT (TRAP_V_MAX + 1) /* HALT instruction */
456 #define STOP_IBKPT (TRAP_V_MAX + 2) /* instruction bkpt */
457 #define STOP_WAIT (TRAP_V_MAX + 3) /* wait, no events */
458 #define STOP_VECABORT (TRAP_V_MAX + 4) /* abort vector read */
459 #define STOP_SPABORT (TRAP_V_MAX + 5) /* abort trap push */
460 #define STOP_RQ (TRAP_V_MAX + 6) /* RQDX3 panic */
461 #define STOP_SANITY (TRAP_V_MAX + 7) /* sanity timer exp */
462 #define STOP_DTOFF (TRAP_V_MAX + 8) /* DECtape off reel */
463 #define IORETURN(f,v) ((f)? (v): SCPE_OK) /* cond error return */
467 #define TMR_CLK 0 /* line clock */
468 #define TMR_PCLK 1 /* KW11P */
472 #define DZ_MUXES 4 /* max # of DZ muxes */
473 #define DZ_LINES 8 /* lines per DZ mux */
474 #define VH_MUXES 4 /* max # of VH muxes */
475 #define DLX_LINES 16 /* max # of KL11/DL11's */
476 #define DCX_LINES 16 /* max # of DC11's */
477 #define MT_MAXFR (1 << 16) /* magtape max rec */
478 #define AUTO_LNT 34 /* autoconfig ranks */
479 #define DIB_MAX 100 /* max DIBs */
481 #define DEV_V_UBUS (DEV_V_UF + 0) /* Unibus */
482 #define DEV_V_QBUS (DEV_V_UF + 1) /* Qbus */
483 #define DEV_V_Q18 (DEV_V_UF + 2) /* Qbus with <= 256KB */
484 #define DEV_V_FLTA (DEV_V_UF + 3) /* flt addr */
485 #define DEV_V_MBUS (DEV_V_UF + 4) /* Massbus */
486 #define DEV_V_FFUF (DEV_V_UF + 5) /* first free flag */
487 #define DEV_UBUS (1u << DEV_V_UBUS)
488 #define DEV_QBUS (1u << DEV_V_QBUS)
489 #define DEV_Q18 (1u << DEV_V_Q18)
490 #define DEV_FLTA (1u << DEV_V_FLTA)
491 #define DEV_MBUS (1u << DEV_V_MBUS)
493 #define DEV_RDX 8 /* default device radix */
495 /* Device information block */
497 #define VEC_DEVMAX 4 /* max device vec */
500 uint32 ba
; /* base addr */
501 uint32 lnt
; /* length */
502 t_stat (*rd
)(int32
*dat
, int32 ad
, int32 md
);
503 t_stat (*wr
)(int32 dat
, int32 ad
, int32 md
);
504 int32 vnum
; /* vectors: number */
505 int32 vloc
; /* locator */
506 int32 vec
; /* value */
507 int32 (*ack
[VEC_DEVMAX
])(void); /* ack routines */
510 typedef struct pdp_dib DIB
;
512 /* I/O page layout - XUB, RQB,RQC,RQD float based on number of DZ's */
514 #define IOBA_DZ (IOPAGEBASE + 000100) /* DZ11 */
516 #define IOBA_XUB (IOPAGEBASE + 000330 + (020 * (DZ_MUXES / 2)))
518 #define IOBA_RQB (IOPAGEBASE + 000334 + (020 * (DZ_MUXES / 2)))
520 #define IOBA_RQC (IOPAGEBASE + IOBA_RQB + IOLN_RQB)
522 #define IOBA_RQD (IOPAGEBASE + IOBA_RQC + IOLN_RQC)
524 #define IOBA_VH (IOPAGEBASE + 000440) /* DHQ11 */
526 #define IOBA_UBM (IOPAGEBASE + 010200) /* Unibus map */
527 #define IOLN_UBM (UBM_LNT_LW * sizeof (int32))
528 #define IOBA_KG (IOPAGEBASE + 010700) /* KG11-A */
530 #define IOBA_RQ (IOPAGEBASE + 012150) /* RQDX3 */
532 #define IOBA_SUP (IOPAGEBASE + 012200) /* supervisor APR's */
533 #define IOLN_SUP 0100
534 #define IOBA_KIPDR (IOPAGEBASE + 012300) /* kernel APR's */
535 #define IOLN_KIPDR 020
536 #define IOBA_KDPDR (IOPAGEBASE + 012320)
537 #define IOLN_KDPDR 020
538 #define IOBA_KIPAR (IOPAGEBASE + 012340)
539 #define IOLN_KIPAR 020
540 #define IOBA_KDPAR (IOPAGEBASE + 012360)
541 #define IOLN_KDPAR 020
542 #define IOBA_TU (IOPAGEBASE + 012440) /* TU */
544 #define IOBA_MMR3 (IOPAGEBASE + 012516) /* MMR3 */
545 #define IOLN_MMR3 002
546 #define IOBA_TM (IOPAGEBASE + 012520) /* TM11 */
548 #define IOBA_TS (IOPAGEBASE + 012520) /* TS11 */
550 #define IOBA_PCLK (IOPAGEBASE + 012540) /* KW11P */
551 #define IOLN_PCLK 006
552 #define IOBA_DC (IOPAGEBASE + 014000) /* DC11 */
553 #define IOLN_DC (DCX_LINES * 010)
554 #define IOBA_RL (IOPAGEBASE + 014400) /* RL11 */
556 #define IOBA_XQ (IOPAGEBASE + 014440) /* DEQNA/DELQA */
558 #define IOBA_XQB (IOPAGEBASE + 014460) /* 2nd DEQNA/DELQA */
560 #define IOBA_TQ (IOPAGEBASE + 014500) /* TMSCP */
562 #define IOBA_XU (IOPAGEBASE + 014510) /* DEUNA/DELUA */
564 #define IOBA_DL (IOPAGEBASE + 016500) /* extra KL11/DL11 */
565 #define IOLN_DL (DLX_LINES * 010)
566 #define IOBA_RP (IOPAGEBASE + 016700) /* RP/RM */
568 #define IOBA_CR (IOPAGEBASE + 017160) /* CD/CR/CM */
570 #define IOBA_RX (IOPAGEBASE + 017170) /* RX11 */
572 #define IOBA_RY (IOPAGEBASE + 017170) /* RY11 */
574 #define IOBA_KE (IOPAGEBASE + 017300) /* KE11-A */
576 #define IOBA_TC (IOPAGEBASE + 017340) /* TC11 */
578 #define IOBA_RK (IOPAGEBASE + 017400) /* RK11 */
580 #define IOBA_RC (IOPAGEBASE + 017440) /* RC11/RS64 */
582 #define IOBA_HK (IOPAGEBASE + 017440) /* RK611 */
584 #define IOBA_RF (IOPAGEBASE + 017460) /* RF11 */
586 #define IOBA_TA (IOPAGEBASE + 017500) /* TA11 */
588 #define IOBA_LPT (IOPAGEBASE + 017514) /* LP11 */
590 #define IOBA_CTL (IOPAGEBASE + 017520) /* board ctrl */
592 #define IOBA_CLK (IOPAGEBASE + 017546) /* KW11L */
594 #define IOBA_PTR (IOPAGEBASE + 017550) /* PC11 reader */
596 #define IOBA_PTP (IOPAGEBASE + 017554) /* PC11 punch */
598 #define IOBA_TTI (IOPAGEBASE + 017560) /* DL11 rcv */
600 #define IOBA_TTO (IOPAGEBASE + 017564) /* DL11 xmt */
602 #define IOBA_SR (IOPAGEBASE + 017570) /* SR */
604 #define IOBA_MMR012 (IOPAGEBASE + 017572) /* MMR0-2 */
605 #define IOLN_MMR012 006
606 #define IOBA_UIPDR (IOPAGEBASE + 017600) /* user APR's */
607 #define IOLN_UIPDR 020
608 #define IOBA_UDPDR (IOPAGEBASE + 017620)
609 #define IOLN_UDPDR 020
610 #define IOBA_UIPAR (IOPAGEBASE + 017640)
611 #define IOLN_UIPAR 020
612 #define IOBA_UDPAR (IOPAGEBASE + 017660)
613 #define IOLN_UDPAR 020
614 #define IOBA_GPR (IOPAGEBASE + 017700) /* GPR's */
616 #define IOBA_UCTL (IOPAGEBASE + 017730) /* UBA ctrl */
617 #define IOLN_UCTL 010
618 #define IOBA_CPU (IOPAGEBASE + 017740) /* CPU reg */
620 #define IOBA_PSW (IOPAGEBASE + 017776) /* PSW */
623 /* Interrupt assignments; within each level, priority is right to left */
625 #define IPL_HLVL 8 /* # int levels */
627 #define INT_V_PIR7 0 /* BR7 */
629 #define INT_V_CLK 0 /* BR6 */
635 #define INT_V_RK 0 /* BR5 */
652 #define INT_V_PIR5 17
654 #define INT_V_TTI 0 /* BR4 */
666 #define INT_V_PIR4 12
668 #define INT_V_PIR3 0 /* BR3 */
669 #define INT_V_PIR2 0 /* BR2 */
670 #define INT_V_PIR1 0 /* BR1 */
672 #define INT_PIR7 (1u << INT_V_PIR7)
673 #define INT_CLK (1u << INT_V_CLK)
674 #define INT_PCLK (1u << INT_V_PCLK)
675 #define INT_DTA (1u << INT_V_DTA)
676 #define INT_TA (1u << INT_V_TA)
677 #define INT_PIR6 (1u << INT_V_PIR6)
678 #define INT_RK (1u << INT_V_RK)
679 #define INT_RL (1u << INT_V_RL)
680 #define INT_RX (1u << INT_V_RX)
681 #define INT_TM (1u << INT_V_TM)
682 #define INT_RP (1u << INT_V_RP)
683 #define INT_TS (1u << INT_V_TS)
684 #define INT_HK (1u << INT_V_HK)
685 #define INT_RQ (1u << INT_V_RQ)
686 #define INT_DZRX (1u << INT_V_DZRX)
687 #define INT_DZTX (1u << INT_V_DZTX)
688 #define INT_TQ (1u << INT_V_TQ)
689 #define INT_RY (1u << INT_V_RY)
690 #define INT_XQ (1u << INT_V_XQ)
691 #define INT_XU (1u << INT_V_XU)
692 #define INT_TU (1u << INT_V_TU)
693 #define INT_RF (1u << INT_V_RF)
694 #define INT_RC (1u << INT_V_RC)
695 #define INT_PIR5 (1u << INT_V_PIR5)
696 #define INT_PTR (1u << INT_V_PTR)
697 #define INT_PTP (1u << INT_V_PTP)
698 #define INT_TTI (1u << INT_V_TTI)
699 #define INT_TTO (1u << INT_V_TTO)
700 #define INT_LPT (1u << INT_V_LPT)
701 #define INT_VHRX (1u << INT_V_VHRX)
702 #define INT_VHTX (1u << INT_V_VHTX)
703 #define INT_CR (1u << INT_V_CR)
704 #define INT_DLI (1u << INT_V_DLI)
705 #define INT_DLO (1u << INT_V_DLO)
706 #define INT_DCI (1u << INT_V_DCI)
707 #define INT_DCO (1u << INT_V_DCO)
708 #define INT_PIR4 (1u << INT_V_PIR4)
709 #define INT_PIR3 (1u << INT_V_PIR3)
710 #define INT_PIR2 (1u << INT_V_PIR2)
711 #define INT_PIR1 (1u << INT_V_PIR1)
713 #define IPL_CLK 6 /* int pri levels */
757 #define VEC_Q 0000 /* vector base */
758 #define VEC_PIRQ 0240
764 #define VEC_PCLK 0104
788 #define VEC_DZRX 0300
789 #define VEC_DZTX 0304
790 #define VEC_VHRX 0310
791 #define VEC_VHTX 0314
793 /* Interrupt macros */
795 #define IVCL(dv) ((IPL_##dv * 32) + INT_V_##dv)
796 #define IREQ(dv) int_req[IPL_##dv]
797 #define SET_INT(dv) int_req[IPL_##dv] = int_req[IPL_##dv] | (INT_##dv)
798 #define CLR_INT(dv) int_req[IPL_##dv] = int_req[IPL_##dv] & ~(INT_##dv)
800 /* Massbus definitions */
802 #define MBA_NUM 2 /* number of MBA's */
803 #define MBA_RP 0 /* MBA for RP */
804 #define MBA_TU 1 /* MBA for TU */
805 #define MBA_RMASK 037 /* max 32 reg */
806 #define MBE_NXD 1 /* nx drive */
807 #define MBE_NXR 2 /* nx reg */
808 #define MBE_GOE 3 /* err on GO */
810 /* CPU and FPU macros */
812 #define update_MM ((MMR0 & MMR0_FREEZE) == 0)
813 #define setTRAP(name) trap_req = trap_req | (name)
814 #define setCPUERR(name) CPUERR = CPUERR | (name)
815 #define ABORT(val) longjmp (save_env, (val))
819 /* Function prototypes */
821 int32
Map_ReadB (uint32 ba
, int32 bc
, uint8
*buf
);
822 int32
Map_ReadW (uint32 ba
, int32 bc
, uint16
*buf
);
823 int32
Map_WriteB (uint32 ba
, int32 bc
, uint8
*buf
);
824 int32
Map_WriteW (uint32 ba
, int32 bc
, uint16
*buf
);
826 t_stat
set_addr (UNIT
*uptr
, int32 val
, char *cptr
, void *desc
);
827 t_stat
show_addr (FILE *st
, UNIT
*uptr
, int32 val
, void *desc
);
828 t_stat
set_addr_flt (UNIT
*uptr
, int32 val
, char *cptr
, void *desc
);
829 t_stat
set_vec (UNIT
*uptr
, int32 val
, char *cptr
, void *desc
);
830 t_stat
show_vec (FILE *st
, UNIT
*uptr
, int32 val
, void *desc
);
831 t_stat
auto_config (char *name
, int32 nctrl
);
832 t_stat
build_ubus_tab (DEVICE
*dptr
, DIB
*dibp
);
834 int32
mba_rdbufW (uint32 mbus
, int32 bc
, uint16
*buf
);
835 int32
mba_wrbufW (uint32 mbus
, int32 bc
, uint16
*buf
);
836 int32
mba_chbufW (uint32 mbus
, int32 bc
, uint16
*buf
);
837 int32
mba_get_bc (uint32 mbus
);
838 int32
mba_get_csr (uint32 mbus
);
839 void mba_upd_ata (uint32 mbus
, uint32 val
);
840 void mba_set_exc (uint32 mbus
);
841 void mba_set_don (uint32 mbus
);
842 void mba_set_enbdis (uint32 mb
, t_bool dis
);
843 t_stat
mba_show_num (FILE *st
, UNIT
*uptr
, int32 val
, void *desc
);
845 int32
clk_cosched (int32 wait
);