1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (declare (special X Y screenheight tty-type))
19 (declare (special screenlinelen))
20 (declare (special idel-chars-availablep idel-lines-availablep tty-no-cleolp))
21
22
23 (defun DCTL-init ()
24 (setq screenheight 24.)
25 (setq screenlinelen 79.)
26 (setq tty-type 'adm3)
27 (setq idel-lines-availablep nil idel-chars-availablep nil tty-no-cleolp t)
28 (Rtyo 32)
29 (setq X 0 Y 0))
30
31
32
33 (defun DCTL-position-cursor (x y)
34 (prog (ycost
35 xcost
36 what
37 cost)
38 (and (= x X)(= y Y)
39 (return nil))
40 (setq what 1
41 cost (+ 1 y x))
42 (and (> cost 4)
43 (setq what 0
44 cost 4))
45 (setq ycost (abs (- y Y)))
46 (setq xcost (abs (- x X)))
47 (and (< (+ ycost xcost) cost)
48 (setq what 3
49 cost (+ ycost xcost)))
50 (and (< (+ 1 ycost x) cost)
51 (setq what 2))
52 (cond ((= what 0)
53
54
55
56 (Rtyo 33)
57 (Rprinc "=")
58 (Rtyo (+ 40 y))
59 (Rtyo (+ 40 x))
60 (setq X x Y y)
61 (return nil))
62
63 ((= what 1)
64 (Rtyo 36)
65 (setq X 0 Y 0))
66
67
68 ((= what 2)
69 (Rtyo 15)
70 (setq X 0)))
71
72
73
74
75 (cond ((< X x)
76 (do ex X (1+ ex)(= ex x)(Rtyo 14)))
77 ((< x X)
78 (do ex x (1+ ex)(= ex X)(Rtyo 10))))
79 (cond ((< Y y)
80 (do wy Y (1+ wy)(= wy y)(Rtyo 12)))
81 ((< y Y)
82 (do wy y (1+ wy)(= wy Y)(Rtyo 13))))
83 (setq X x Y y)
84 (return nil)))
85
86
87
88 (defun DCTL-display-char-string (string)
89 (setq X (+ X (stringlength string)))
90 (Rprinc string))
91
92
93
94 (defun DCTL-clear-rest-of-screen ()
95 (Rtyo 32)(setq X 0 Y 0))
96
97
98 (defun DCTL-clear-rest-of-screen ()
99 (Rtyo 32)(setq X 0 Y 0))