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

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

Point of no return.

  • 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(void);
31extern void stdmkey(void);
32
33extern short astat;
34extern short ndisp;
35
36extern short scorpal[][3];
37
38extern short crate1[];
39
40/* forward reference */
41
42void scptogl(void);
43
44/*
45
46*/
47
48struct curpak dt_flds = {
49
50 nokey, /* curtype */
51 nokey, /* premove */
52 nokey, /* pstmove */
53 nokey, /* cx_key */
54 nokey, /* cy_key */
55 nokey, /* cx_upd */
56 nokey, /* cy_upd */
57 nokey, /* xy_up */
58 nokey, /* xy_dn */
59 nokey, /* x_key */
60 scptogl, /* e_key */
61 stdmkey, /* m_key */
62 nokey, /* d_key */
63 nokey, /* not_fld */
64 (struct fet *)NULL, /* curfet */
65 (struct selbox *)NULL, /* csbp */
66 crate1, /* cratex */
67 crate1, /* cratey */
68 CT_GRAF, /* cmtype */
69 0, /* cxval */
70 0 /* cyval */
71};
72
73/*
74
75*/
76
77/*
78 =============================================================================
79 scope() -- display a value in binary on the crt
80 =============================================================================
81*/
82
83void scope(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
136void scptogl(void)
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
154void scopeon(void)
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.