source: buchla-68k/orig/RAM/SCOPE.C@ a95b757

Last change on this file since a95b757 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 3.2 KB
Line 
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#define SCOPEOLD 0x0014 /* scope old text attribute */
18#define SCOPENEW 0x0054 /* scope new text attribute */
19
20short scopec; /* scope col position */
21short scopef; /* scope control flag */
22short scoper; /* scope row position */
23
24unsigned scopev; /* last scope value */
25
26unsigned *scopeob; /* scope display object */
27
28char scopebf[65]; /* scope display buffer */
29
30extern short nokey(), stdmkey();
31
32extern short astat;
33extern short ndisp;
34
35extern short scorpal[][3];
36
37extern short crate1[];
38
39/* forward reference */
40
41short scptogl();
42
43/*
44
45*/
46
47struct curpak dt_flds = {
48
49 nokey, /* curtype */
50 nokey, /* premove */
51 nokey, /* pstmove */
52 nokey, /* cx_key */
53 nokey, /* cy_key */
54 nokey, /* cx_upd */
55 nokey, /* cy_upd */
56 nokey, /* xy_up */
57 nokey, /* xy_dn */
58 nokey, /* x_key */
59 scptogl, /* e_key */
60 stdmkey, /* m_key */
61 nokey, /* d_key */
62 nokey, /* not_fld */
63 (struct fet *)NULL, /* curfet */
64 (struct selbox *)NULL, /* csbp */
65 crate1, /* cratex */
66 crate1, /* cratey */
67 CT_GRAF, /* cmtype */
68 0, /* cxval */
69 0 /* cyval */
70};
71
72/*
73
74*/
75
76/*
77 =============================================================================
78 scope() -- display a value in binary on the crt
79 =============================================================================
80*/
81
82scope(val)
83register unsigned val;
84{
85 register short i;
86 register char *bp = scopebf;
87
88 if ((ndisp NE 11) OR (NOT scopef))
89 return;
90
91 vputs(scopeob, scoper++, scopec, scopebf, SCOPEOLD);
92
93 *bp++ = ' ';
94
95 if (scoper > 24) {
96
97 scoper = 0;
98 scopec += 12;
99
100 if (scopec GE 60)
101 scopec = 0;
102 }
103
104 scopev = val;
105
106 for (i = 0; i < 4; i++)
107 if (val & (0x0080 >> i))
108 *bp++ = '1';
109 else
110 *bp++ = '0';
111
112 *bp++ = ' ';
113
114 for (i = 4; i < 8; i++)
115 if (val & (0x0080 >> i))
116 *bp++ = '1';
117 else
118 *bp++ = '0';
119
120 *bp++ = ' ';
121 *bp = 0;
122
123 vputs(scopeob, scoper, scopec, scopebf, SCOPENEW);
124}
125
126/*
127
128*/
129
130/*
131 =============================================================================
132 scptogl() -- toggle "scope" status
133 =============================================================================
134*/
135
136scptogl()
137{
138 if (NOT astat)
139 return;
140
141 scopef = NOT scopef;
142}
143
144/*
145
146*/
147
148/*
149 =============================================================================
150 scopeon() -- put up the "scope" display
151 =============================================================================
152*/
153
154scopeon()
155{
156 scopeob = &v_score[0];
157
158 curset(&dt_flds);
159
160 scopec = 0;
161 scopef = TRUE;
162 scoper = 0;
163 scopev = 0;
164
165 strcpy(scopebf, " ???? ???? ");
166
167 dswap();
168
169 vbank(0);
170
171 memsetw(scopeob, 0, 32767);
172 memsetw(scopeob+32767L, 0, 12033);
173
174 SetObj(0, 1, 0, scopeob, 512, 350, 0, 0, CHR3, -1);
175 vsndpal(scorpal);
176
177 SetPri(0, 15);
178}
Note: See TracBrowser for help on using the repository browser.