source: buchla-68k/ram/itcpos.c@ 6262b5c

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

Added include files for global functions and variables.

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