1 | /*
|
---|
2 | =============================================================================
|
---|
3 | ttcpos.c -- virtual typewriter cursor positioning
|
---|
4 | Version 9 -- 1988-03-08 -- 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 "libdsp.h"
|
---|
19 |
|
---|
20 | #define CW_0 0x0000
|
---|
21 | #define CW_F 0xFFFF
|
---|
22 |
|
---|
23 | extern unsigned exp_c(unsigned c);
|
---|
24 |
|
---|
25 | extern short vtcrow; /* virtual typewriter cursor row */
|
---|
26 | extern short vtccol; /* virtual typewriter cursor column */
|
---|
27 |
|
---|
28 | /* |
---|
29 |
|
---|
30 | */
|
---|
31 |
|
---|
32 | static short ttcur[] = {
|
---|
33 |
|
---|
34 | CW_0, CW_0, CW_0, CW_0, /* 0 */
|
---|
35 | CW_0, CW_0, CW_0, CW_0, /* 1 */
|
---|
36 | CW_0, CW_0, CW_0, CW_0, /* 2 */
|
---|
37 | CW_0, CW_0, CW_0, CW_0, /* 3 */
|
---|
38 | CW_0, CW_0, CW_0, CW_0, /* 4 */
|
---|
39 | CW_0, CW_0, CW_0, CW_0, /* 5 */
|
---|
40 | CW_0, CW_0, CW_0, CW_0, /* 6 */
|
---|
41 | CW_0, CW_0, CW_0, CW_0, /* 7 */
|
---|
42 | CW_0, CW_0, CW_0, CW_0, /* 8 */
|
---|
43 | CW_0, CW_0, CW_0, CW_0, /* 9 */
|
---|
44 | CW_0, CW_0, CW_0, CW_0, /* 10 */
|
---|
45 | CW_0, CW_0, CW_0, CW_0, /* 11 */
|
---|
46 | CW_F, CW_F, CW_0, CW_0, /* 12 */
|
---|
47 | CW_0, CW_0, CW_0, CW_0, /* 13 */
|
---|
48 | CW_0, CW_0, CW_0, CW_0, /* 14 */
|
---|
49 | CW_0, CW_0, CW_0, CW_0 /* 15 */
|
---|
50 | };
|
---|
51 |
|
---|
52 | /* |
---|
53 |
|
---|
54 | */
|
---|
55 |
|
---|
56 | /*
|
---|
57 | =============================================================================
|
---|
58 | ttcini() -- initialize typewriter cursor
|
---|
59 | =============================================================================
|
---|
60 | */
|
---|
61 |
|
---|
62 | void ttcini(unsigned color)
|
---|
63 | {
|
---|
64 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
65 | vbank(1);
|
---|
66 |
|
---|
67 | andcopy(v_tcur, ttcur, exp_c(color), 64);
|
---|
68 | }
|
---|
69 |
|
---|
70 | /*
|
---|
71 | =============================================================================
|
---|
72 | ttcpos() -- position the typewriter cursor at ('row', 'col')
|
---|
73 | =============================================================================
|
---|
74 | */
|
---|
75 |
|
---|
76 | void ttcpos(short row, short col)
|
---|
77 | {
|
---|
78 | register short yrow, xcol;
|
---|
79 | register struct octent *op;
|
---|
80 |
|
---|
81 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
82 | vbank(0);
|
---|
83 |
|
---|
84 | yrow = row * 14; /* get cursor display position */
|
---|
85 | xcol = col << 3;
|
---|
86 |
|
---|
87 | op = &v_obtab[TTCURS]; /* point at v_obtab entry */
|
---|
88 |
|
---|
89 | v_odtab[TTCPRI][0] |= V_BLA; /* blank the object */
|
---|
90 | objclr(TTCPRI); /* turn off the old location */
|
---|
91 |
|
---|
92 | op->objx = xcol; /* update v_obtab entry */
|
---|
93 | op->objy = yrow;
|
---|
94 | op->odtw1 = 0x0400 | (0x03FF & (xcol >> 1));
|
---|
95 |
|
---|
96 | SetPri(TTCURS, TTCPRI); /* turn on the new location */
|
---|
97 |
|
---|
98 | vtcrow = row; /* update cursor position variables */
|
---|
99 | vtccol = col;
|
---|
100 | }
|
---|