1 | /*
|
---|
2 | =============================================================================
|
---|
3 | itcpos.c -- text cursor positioning for the instrument display
|
---|
4 | Version 12 -- 1989-12-19 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "graphdef.h"
|
---|
10 | #include "vsdd.h"
|
---|
11 | #include "vsddsw.h"
|
---|
12 | #include "vsddvars.h"
|
---|
13 | #include "hwdefs.h"
|
---|
14 | #include "memory.h"
|
---|
15 | #include "fields.h"
|
---|
16 |
|
---|
17 | #include "midas.h"
|
---|
18 | #include "instdsp.h"
|
---|
19 |
|
---|
20 | #define CW_0 0x0000
|
---|
21 | #define CW_F 0xFFFF
|
---|
22 |
|
---|
23 | extern unsigned exp_c();
|
---|
24 |
|
---|
25 | extern short stcrow, stccol; /* text cursor row,col */
|
---|
26 |
|
---|
27 | extern unsigned *obj0; /* cursor object pointer */
|
---|
28 |
|
---|
29 | /* |
---|
30 |
|
---|
31 | */
|
---|
32 |
|
---|
33 | static short itcur[] = {
|
---|
34 |
|
---|
35 | CW_0, CW_0, CW_0, CW_0, /* 0 */
|
---|
36 | CW_0, CW_0, CW_0, CW_0, /* 1 */
|
---|
37 | CW_0, CW_0, CW_0, CW_0, /* 2 */
|
---|
38 | CW_0, CW_0, CW_0, CW_0, /* 3 */
|
---|
39 | CW_0, CW_0, CW_0, CW_0, /* 4 */
|
---|
40 | CW_0, CW_0, CW_0, CW_0, /* 5 */
|
---|
41 | CW_0, CW_0, CW_0, CW_0, /* 6 */
|
---|
42 | CW_0, CW_0, CW_0, CW_0, /* 7 */
|
---|
43 | CW_0, CW_0, CW_0, CW_0, /* 8 */
|
---|
44 | CW_0, CW_0, CW_0, CW_0, /* 9 */
|
---|
45 | CW_0, CW_0, CW_0, CW_0, /* 10 */
|
---|
46 | CW_0, CW_0, CW_0, CW_0, /* 11 */
|
---|
47 | CW_F, CW_F, CW_0, CW_0, /* 12 */
|
---|
48 | CW_0, CW_0, CW_0, CW_0, /* 13 */
|
---|
49 | CW_0, CW_0, CW_0, CW_0, /* 14 */
|
---|
50 | CW_0, CW_0, CW_0, CW_0 /* 15 */
|
---|
51 | };
|
---|
52 |
|
---|
53 | /* |
---|
54 |
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | =============================================================================
|
---|
59 | itcini() -- initialize instrument text cursor
|
---|
60 | =============================================================================
|
---|
61 | */
|
---|
62 |
|
---|
63 | itcini(color)
|
---|
64 | unsigned color;
|
---|
65 | {
|
---|
66 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
67 | vbank(1);
|
---|
68 |
|
---|
69 | andcopy(v_cur, itcur, exp_c(color), 64);
|
---|
70 | }
|
---|
71 |
|
---|
72 | /* |
---|
73 |
|
---|
74 | */
|
---|
75 |
|
---|
76 | /*
|
---|
77 | =============================================================================
|
---|
78 | itcpos() -- position the instrument text cursor at ('row', 'col')
|
---|
79 | =============================================================================
|
---|
80 | */
|
---|
81 |
|
---|
82 | itcpos(row, col)
|
---|
83 | register short row, col;
|
---|
84 | {
|
---|
85 | register short yrow, xcol;
|
---|
86 | register struct octent *op;
|
---|
87 |
|
---|
88 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
89 | vbank(0);
|
---|
90 |
|
---|
91 | yrow = row * 14; /* get cursor display position */
|
---|
92 | xcol = col * 8;
|
---|
93 |
|
---|
94 | op = &v_obtab[TCURS]; /* point at v_obtab entry */
|
---|
95 | setipl(VID_DI); /* disable Vertical Interval interrupt */
|
---|
96 | v_odtab[TCPRI][0] &= ~V_BLA; /* blank the object */
|
---|
97 | objclr(TCPRI); /* turn off the old location */
|
---|
98 |
|
---|
99 | op->objx = xcol; /* update v_obtab entry */
|
---|
100 | op->objy = yrow;
|
---|
101 | op->obase = &v_cur[0];
|
---|
102 | op->odtw1 = 0x0400 | (0x03FF & (xcol >> 1));
|
---|
103 |
|
---|
104 | SetPri(TCURS, TCPRI); /* turn on the new location */
|
---|
105 |
|
---|
106 | stcrow = row; /* update cursor position */
|
---|
107 | stccol = col;
|
---|
108 | }
|
---|
109 |
|
---|
110 | /* |
---|
111 |
|
---|
112 | */
|
---|
113 |
|
---|
114 | /*
|
---|
115 | =============================================================================
|
---|
116 | advicur() -- advance the instrument display text cursor
|
---|
117 | =============================================================================
|
---|
118 | */
|
---|
119 |
|
---|
120 | advicur()
|
---|
121 | {
|
---|
122 | register short newcol;
|
---|
123 |
|
---|
124 | if (infield(stcrow, stccol, curfet))
|
---|
125 | cfetp = infetp;
|
---|
126 | else
|
---|
127 | return;
|
---|
128 |
|
---|
129 | newcol = stccol + 1;
|
---|
130 |
|
---|
131 | if (newcol LE cfetp->frcol)
|
---|
132 | itcpos(stcrow, newcol);
|
---|
133 | }
|
---|
134 |
|
---|
135 | /*
|
---|
136 | =============================================================================
|
---|
137 | bspicur() -- backspace the instrument display text cursor
|
---|
138 | =============================================================================
|
---|
139 | */
|
---|
140 |
|
---|
141 | bspicur()
|
---|
142 | {
|
---|
143 | register short newcol;
|
---|
144 |
|
---|
145 | if (infield(stcrow, stccol, curfet))
|
---|
146 | cfetp = infetp;
|
---|
147 | else
|
---|
148 | return;
|
---|
149 |
|
---|
150 | newcol = stccol - 1;
|
---|
151 |
|
---|
152 | if (newcol GE cfetp->flcol)
|
---|
153 | itcpos(stcrow, newcol);
|
---|
154 | }
|
---|