source: buchla-68k/ram/scope.c@ f4fbee9

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

Code compiles, doesn't link.

  • Property mode set to 100644
File size: 3.1 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
136short
137scptogl()
138{
139 if (NOT astat)
140 return;
141
142 scopef = NOT scopef;
143}
144
145/*
146
147*/
148
149/*
150 =============================================================================
151 scopeon() -- put up the "scope" display
152 =============================================================================
153*/
154
155scopeon()
156{
157 scopeob = &v_score[0];
158
159 curset(&dt_flds);
160
161 scopec = 0;
162 scopef = TRUE;
163 scoper = 0;
164 scopev = 0;
165
166 strcpy(scopebf, " ???? ???? ");
167
168 dswap();
169
170 vbank(0);
171
172 memsetw(scopeob, 0, 32767);
173 memsetw(scopeob+32767L, 0, 12033);
174
175 SetObj(0, 1, 0, scopeob, 512, 350, 0, 0, CHR3, -1);
176 vsndpal(scorpal);
177
178 SetPri(0, 15);
179}
Note: See TracBrowser for help on using the repository browser.