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

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

Use standard integer types.

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