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

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

Fixed scope.c.

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