source: buchla-68k/ram/itcpos.c

Last change on this file was 0ca44a2, checked in by Thomas Lopatic <thomas@…>, 6 years ago

Fixed itcpos.c.

  • Property mode set to 100644
File size: 3.0 KB
Line 
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 "ram.h"
9
10#define CW_0 0x0000
11#define CW_F 0xFFFF
12
13static uint16_t itcur[] = {
14
15 CW_0, CW_0, CW_0, CW_0, /* 0 */
16 CW_0, CW_0, CW_0, CW_0, /* 1 */
17 CW_0, CW_0, CW_0, CW_0, /* 2 */
18 CW_0, CW_0, CW_0, CW_0, /* 3 */
19 CW_0, CW_0, CW_0, CW_0, /* 4 */
20 CW_0, CW_0, CW_0, CW_0, /* 5 */
21 CW_0, CW_0, CW_0, CW_0, /* 6 */
22 CW_0, CW_0, CW_0, CW_0, /* 7 */
23 CW_0, CW_0, CW_0, CW_0, /* 8 */
24 CW_0, CW_0, CW_0, CW_0, /* 9 */
25 CW_0, CW_0, CW_0, CW_0, /* 10 */
26 CW_0, CW_0, CW_0, CW_0, /* 11 */
27 CW_F, CW_F, CW_0, CW_0, /* 12 */
28 CW_0, CW_0, CW_0, CW_0, /* 13 */
29 CW_0, CW_0, CW_0, CW_0, /* 14 */
30 CW_0, CW_0, CW_0, CW_0 /* 15 */
31};
32
33/*
34 =============================================================================
35 itcini() -- initialize instrument text cursor
36 =============================================================================
37*/
38
39void itcini(int16_t color)
40{
41 if ((v_regs[5] & 0x0180) NE 0x0100)
42 vbank(1);
43
44 andcopy(v_cur, itcur, exp_c(color), 64);
45}
46
47/*
48 =============================================================================
49 itcpos() -- position the instrument text cursor at ('row', 'col')
50 =============================================================================
51*/
52
53void itcpos(int16_t row, int16_t col)
54{
55 register int16_t yrow, xcol;
56 register struct octent *op;
57
58 if (v_regs[5] & 0x0180) /* point at the control bank */
59 vbank(0);
60
61 yrow = row * 14; /* get cursor display position */
62 xcol = col * 8;
63
64 op = &v_obtab[TCURS]; /* point at v_obtab entry */
65 setipl(VID_DI); /* disable Vertical Interval interrupt */
66 v_odtab[TCPRI][0] &= ~V_BLA; /* blank the object */
67 objclr(TCPRI); /* turn off the old location */
68
69 op->objx = xcol; /* update v_obtab entry */
70 op->objy = yrow;
71 op->obase = &v_cur[0];
72 op->odtw1 = (uint16_t)(0x0400 | (0x03FF & (xcol >> 1)));
73
74 SetPri(TCURS, TCPRI); /* turn on the new location */
75
76 stcrow = row; /* update cursor position */
77 stccol = col;
78}
79
80/*
81 =============================================================================
82 advicur() -- advance the instrument display text cursor
83 =============================================================================
84*/
85
86void advicur(void)
87{
88 register int16_t newcol;
89
90 if (infield(stcrow, stccol, curfet))
91 cfetp = infetp;
92 else
93 return;
94
95 newcol = stccol + 1;
96
97 if (newcol LE cfetp->frcol)
98 itcpos(stcrow, newcol);
99}
100
101/*
102 =============================================================================
103 bspicur() -- backspace the instrument display text cursor
104 =============================================================================
105*/
106
107void bspicur(void)
108{
109 register int16_t newcol;
110
111 if (infield(stcrow, stccol, curfet))
112 cfetp = infetp;
113 else
114 return;
115
116 newcol = stccol - 1;
117
118 if (newcol GE cfetp->flcol)
119 itcpos(stcrow, newcol);
120}
121
Note: See TracBrowser for help on using the repository browser.