1 | /*
|
---|
2 | =============================================================================
|
---|
3 | scope.c -- MIDAS-VII diagnostic scope functions
|
---|
4 | Version 6 -- 1988-10-12 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "hwdefs.h"
|
---|
10 | #include "vsdd.h"
|
---|
11 | #include "graphdef.h"
|
---|
12 | #include "fields.h"
|
---|
13 | #include "curpak.h"
|
---|
14 |
|
---|
15 | #include "midas.h"
|
---|
16 |
|
---|
17 | #include "memory.h"
|
---|
18 | #include "strings.h"
|
---|
19 | #include "vsddsw.h"
|
---|
20 |
|
---|
21 | #define SCOPEOLD 0x0014 /* scope old text attribute */
|
---|
22 | #define SCOPENEW 0x0054 /* scope new text attribute */
|
---|
23 |
|
---|
24 | int16_t scopec; /* scope col position */
|
---|
25 | int16_t scopef; /* scope control flag */
|
---|
26 | int16_t scoper; /* scope row position */
|
---|
27 |
|
---|
28 | uint16_t scopev; /* last scope value */
|
---|
29 |
|
---|
30 | uint16_t *scopeob; /* scope display object */
|
---|
31 |
|
---|
32 | int8_t scopebf[65]; /* scope display buffer */
|
---|
33 |
|
---|
34 | extern int16_t stdctp2(void);
|
---|
35 | extern void nokey(void);
|
---|
36 | extern void nodkey(int16_t k);
|
---|
37 | extern int16_t nonf(int16_t k);
|
---|
38 | extern void stdmkey(void);
|
---|
39 |
|
---|
40 | extern int16_t astat;
|
---|
41 | extern int16_t ndisp;
|
---|
42 |
|
---|
43 | extern int16_t scorpal[][3];
|
---|
44 |
|
---|
45 | extern int16_t crate1[];
|
---|
46 |
|
---|
47 | /* forward reference */
|
---|
48 |
|
---|
49 | void scptogl(void);
|
---|
50 |
|
---|
51 | extern void curset(struct curpak *s);
|
---|
52 | extern void dswap(void);
|
---|
53 | extern void vsndpal(int16_t pp[16][3]);
|
---|
54 |
|
---|
55 | /* |
---|
56 |
|
---|
57 | */
|
---|
58 |
|
---|
59 | struct curpak dt_flds = {
|
---|
60 |
|
---|
61 | stdctp2, /* curtype */
|
---|
62 | nokey, /* premove */
|
---|
63 | nokey, /* pstmove */
|
---|
64 | nokey, /* cx_key */
|
---|
65 | nokey, /* cy_key */
|
---|
66 | nokey, /* cx_upd */
|
---|
67 | nokey, /* cy_upd */
|
---|
68 | nokey, /* xy_up */
|
---|
69 | nokey, /* xy_dn */
|
---|
70 | nokey, /* x_key */
|
---|
71 | scptogl, /* e_key */
|
---|
72 | stdmkey, /* m_key */
|
---|
73 | nodkey, /* d_key */
|
---|
74 | nonf, /* not_fld */
|
---|
75 | (struct fet *)NULL, /* curfet */
|
---|
76 | (struct selbox *)NULL, /* csbp */
|
---|
77 | crate1, /* cratex */
|
---|
78 | crate1, /* cratey */
|
---|
79 | CT_GRAF, /* cmtype */
|
---|
80 | 0, /* cxval */
|
---|
81 | 0 /* cyval */
|
---|
82 | };
|
---|
83 |
|
---|
84 | /* |
---|
85 |
|
---|
86 | */
|
---|
87 |
|
---|
88 | /*
|
---|
89 | =============================================================================
|
---|
90 | scope() -- display a value in binary on the crt
|
---|
91 | =============================================================================
|
---|
92 | */
|
---|
93 |
|
---|
94 | void scope(uint16_t val)
|
---|
95 | {
|
---|
96 | register int16_t i;
|
---|
97 | register int8_t *bp = scopebf;
|
---|
98 |
|
---|
99 | if ((ndisp NE 11) OR (NOT scopef))
|
---|
100 | return;
|
---|
101 |
|
---|
102 | vputs(scopeob, scoper++, scopec, scopebf, SCOPEOLD);
|
---|
103 |
|
---|
104 | *bp++ = ' ';
|
---|
105 |
|
---|
106 | if (scoper > 24) {
|
---|
107 |
|
---|
108 | scoper = 0;
|
---|
109 | scopec += 12;
|
---|
110 |
|
---|
111 | if (scopec GE 60)
|
---|
112 | scopec = 0;
|
---|
113 | }
|
---|
114 |
|
---|
115 | scopev = val;
|
---|
116 |
|
---|
117 | for (i = 0; i < 4; i++)
|
---|
118 | if (val & (0x0080 >> i))
|
---|
119 | *bp++ = '1';
|
---|
120 | else
|
---|
121 | *bp++ = '0';
|
---|
122 |
|
---|
123 | *bp++ = ' ';
|
---|
124 |
|
---|
125 | for (i = 4; i < 8; i++)
|
---|
126 | if (val & (0x0080 >> i))
|
---|
127 | *bp++ = '1';
|
---|
128 | else
|
---|
129 | *bp++ = '0';
|
---|
130 |
|
---|
131 | *bp++ = ' ';
|
---|
132 | *bp = 0;
|
---|
133 |
|
---|
134 | vputs(scopeob, scoper, scopec, scopebf, SCOPENEW);
|
---|
135 | }
|
---|
136 |
|
---|
137 | /* |
---|
138 |
|
---|
139 | */
|
---|
140 |
|
---|
141 | /*
|
---|
142 | =============================================================================
|
---|
143 | scptogl() -- toggle "scope" status
|
---|
144 | =============================================================================
|
---|
145 | */
|
---|
146 |
|
---|
147 | void scptogl(void)
|
---|
148 | {
|
---|
149 | if (NOT astat)
|
---|
150 | return;
|
---|
151 |
|
---|
152 | scopef = NOT scopef;
|
---|
153 | }
|
---|
154 |
|
---|
155 | /* |
---|
156 |
|
---|
157 | */
|
---|
158 |
|
---|
159 | /*
|
---|
160 | =============================================================================
|
---|
161 | scopeon() -- put up the "scope" display
|
---|
162 | =============================================================================
|
---|
163 | */
|
---|
164 |
|
---|
165 | void scopeon(void)
|
---|
166 | {
|
---|
167 | scopeob = &v_score[0];
|
---|
168 |
|
---|
169 | curset(&dt_flds);
|
---|
170 |
|
---|
171 | scopec = 0;
|
---|
172 | scopef = TRUE;
|
---|
173 | scoper = 0;
|
---|
174 | scopev = 0;
|
---|
175 |
|
---|
176 | strcpy(scopebf, " ???? ???? ");
|
---|
177 |
|
---|
178 | dswap();
|
---|
179 |
|
---|
180 | vbank(0);
|
---|
181 |
|
---|
182 | memsetw(scopeob, 0, 32767);
|
---|
183 | memsetw(scopeob+32767L, 0, 12033);
|
---|
184 |
|
---|
185 | SetObj(0, 1, 0, scopeob, 512, 350, 0, 0, CHR3, -1);
|
---|
186 | vsndpal(scorpal);
|
---|
187 |
|
---|
188 | SetPri(0, 15);
|
---|
189 | }
|
---|