source: trunk/lisp/lmcons/talk.lisp @ 212

Last change on this file since 212 was 212, checked in by rjs, 7 years ago

Initial versions.

File size: 3.7 KB
Line 
1;;; -*-LISP-*-
2;;; Lowest-level routines for talking to CADR
3
4;This may be grossly SI-damaged.  The alternative would be to make P11N
5;in CTALK a run-time parameter and fix DBG-READ and DBG-WRITE.  The names
6;would then not be the greatest in the world.
7
8(DECLARE (SPECIAL TALK-PATH             ;Symbol for how we're getting there
9                                        ;Values are NO-BUSINT, BUSINT, TEN11
10                                                ;These names lose!
11                  TEN11-ADDRESS         ;Map 32K like a 16-bit-address pdp11
12                  TALK-DEBUG-ADDRESS    ;Unibus address of debug interface using
13))
14
15(DEFUN LET MACRO (X)
16  (CONS (LIST 'LAMBDA (MAPCAR 'CAR (CADR X)) (CONS 'PROGN (CDDR X)))
17        (MAPCAR 'CADR (CADR X))))
18
19(DEFUN LOGAND MACRO (X)
20  (CONS 'BOOLE (CONS 1 (CDR X))))
21
22;This function sets up the TEN11 map, the value of TALK-PATH, and so forth
23(DEFUN TALK-INIT (PATH)
24  ;; Make sure we have address space allocated for 10-11
25  (COND ((NOT (BOUNDP 'TEN11-ADDRESS))
26         (LET ((ADR (LH/| 16384. 'RANDOM)))
27           (AND (ZEROP ADR) (ERROR '|COULD NOT GET LH SPACE|))
28           (SYSCALL 0 'CORBLK 0 -1 (+ (LSH -16. 18.) (LSH ADR -10.))) ;Delete pages
29           (SETQ TEN11-ADDRESS ADR))))
30  ;; Map in the appropriate 11
31  (LET ((11NO (COND ((MEMQ PATH '(NO-BUSINT BUSINT))    ;Via debugging interface in CONS
32                     2)
33                    (T 3))))                            ;Prototypical CADR
34    (DECLARE (FIXNUM 11NO 11ADR 10ADR))
35    (DO ((11ADR 0 (+ 11ADR 10000))
36         (10ADR TEN11-ADDRESS (+ 10ADR 2000)))
37        ((= 11ADR 160000))
38      (TALK-MAP-11-PAGE 11NO 11ADR 2000 10ADR))
39    (DO ((11ADR 760000 (+ 11ADR 10000))
40         (10ADR (+ TEN11-ADDRESS 34000) (+ 10ADR 2000)))
41        ((= 11ADR 1000000))
42      (TALK-MAP-11-PAGE 11NO 11ADR 2000 10ADR)))
43  (COND ((EQ PATH 'NO-BUSINT)
44         (SETQ TALK-DEBUG-ADDRESS 764500))      ;Accesses SPY registers only
45        ((EQ PATH 'BUSINT)
46         (SETQ TALK-DEBUG-ADDRESS 764540))      ;Accesses other machine's Unibus
47        ((EQ PATH 'TEN11) )
48        (T (ERROR '|UNKNOWN PATH TO CADR| PATH)))
49  (SETQ TALK-PATH PATH))
50
51(DEFUN TALK-MAP-11-PAGE (11NO 11ADR 11SIZE 10ADR)
52  (SYSCALL 0 'CORBLK 0 -1 (LSH 10ADR -10.))     ;Delete pre-existing page
53  (AND (SYSCALL 0 'T11MP (LSH 10ADR -10.)
54                         (+ (LSH 6 33.)
55                            (LSH 11NO 32)
56                            (LSH (LSH 11ADR -2) 12)
57                            (1- 11SIZE)))
58       (ERROR '|T11MP CALL FAILED|)))
59
60;;; These read and write the "wrong" Unibus
61(DECLARE (FIXNUM TALK-READ-LOCAL-UNIBUS FIXNUM))
62(DEFUN TALK-READ-LOCAL-UNIBUS (ADR)
63  (LET ((WORD (EXAMINE (+ TEN11-ADDRESS (LSH (LOGAND 177777 ADR) -4)))))
64    (DECLARE (FIXNUM WORD))
65    (LOGAND 177777 (LSH WORD (COND ((ZEROP (LOGAND 2 ADR)) -24)
66                                   (T -4))))))
67
68(DECLARE (NOTYPE (TALK-WRITE-LOCAL-UNIBUS FIXNUM FIXNUM)))
69(DEFUN TALK-WRITE-LOCAL-UNIBUS (ADR VAL)
70  (DEPOSIT (+ TEN11-ADDRESS (LSH (LOGAND 177777 ADR) -4))
71           (COND ((ZEROP (LOGAND 2 ADR))
72                  (+ (LSH VAL 24) 4))
73                 ((+ (LSH VAL 4) 10))))
74  NIL)
75
76;;; Read and write the Unibus on the other machine (if using two machines)
77(DECLARE (FIXNUM (TALK-READ-UNIBUS FIXNUM))
78         (NOTYPE (TALK-WRITE-UNIBUS FIXNUM FIXNUM)))
79
80(DEFUN TALK-READ-UNIBUS (ADR)
81  (LET ((PATH TALK-PATH))
82    (COND ((EQ PATH 'TEN11) (TALK-READ-LOCAL-UNIBUS ADR))
83          ((EQ PATH 'BUSINT)
84           (TALK-WRITE-LOCAL-UNIBUS (+ TALK-DEBUG-ADDRESS 4)    ;Store high bit of address
85                                    (LSH ADR -17.))
86           (TALK-WRITE-LOCAL-UNIBUS (+ TALK-DEBUG-ADDRESS 6)    ;Store rest of address
87                                    (LSH ADR -1))
88           (TALK-READ-LOCAL-UNIBUS TALK-DEBUG-ADDRESS))
89          ((ERROR '|BAD PATH - TALK-READ-UNIBUS| PATH)))))
90
91(DEFUN TALK-WRITE-UNIBUS (ADR VAL)
92  (LET ((PATH TALK-PATH))
93    (COND ((EQ PATH 'TEN11) (TALK-WRITE-LOCAL-UNIBUS ADR VAL))
94          ((EQ PATH 'BUSINT)
95           (TALK-WRITE-LOCAL-UNIBUS (+ TALK-DEBUG-ADDRESS 4)    ;Store high bit of address
96                                    (LSH ADR -17.))
97           (TALK-WRITE-LOCAL-UNIBUS (+ TALK-DEBUG-ADDRESS 6)    ;Store rest of address
98                                    (LSH ADR -1))
99           (TALK-WRITE-LOCAL-UNIBUS TALK-DEBUG-ADDRESS VAL))
100          ((ERROR '|BAD PATH - TALK-READ-UNIBUS| PATH)))))
Note: See TracBrowser for help on using the repository browser.