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