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

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

Fixed itcpos.c.

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[f40a309]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
[b28a12e]8#include "ram.h"
[f40a309]9
10#define CW_0 0x0000
11#define CW_F 0xFFFF
12
[0ca44a2]13static uint16_t itcur[] = {
[f40a309]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
[0ca44a2]39void itcini(int16_t color)
[f40a309]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
[7258c6a]53void itcpos(int16_t row, int16_t col)
[f40a309]54{
[7258c6a]55 register int16_t yrow, xcol;
[f40a309]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];
[0ca44a2]72 op->odtw1 = (uint16_t)(0x0400 | (0x03FF & (xcol >> 1)));
[f40a309]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
[0580615]86void advicur(void)
[f40a309]87{
[7258c6a]88 register int16_t newcol;
[f40a309]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
[0580615]107void bspicur(void)
[f40a309]108{
[7258c6a]109 register int16_t newcol;
[f40a309]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}
[6262b5c]121
Note: See TracBrowser for help on using the repository browser.