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();
|
---|
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 | ttcini(color)
|
---|
63 | unsigned color;
|
---|
64 | {
|
---|
65 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
66 | vbank(1);
|
---|
67 |
|
---|
68 | andcopy(v_tcur, ttcur, exp_c(color), 64);
|
---|
69 | }
|
---|
70 |
|
---|
71 | /*
|
---|
72 | =============================================================================
|
---|
73 | ttcpos() -- position the typewriter cursor at ('row', 'col')
|
---|
74 | =============================================================================
|
---|
75 | */
|
---|
76 |
|
---|
77 | ttcpos(row, col)
|
---|
78 | register short row, col;
|
---|
79 | {
|
---|
80 | register short yrow, xcol;
|
---|
81 | register struct octent *op;
|
---|
82 |
|
---|
83 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
84 | vbank(0);
|
---|
85 |
|
---|
86 | yrow = row * 14; /* get cursor display position */
|
---|
87 | xcol = col << 3;
|
---|
88 |
|
---|
89 | op = &v_obtab[TTCURS]; /* point at v_obtab entry */
|
---|
90 |
|
---|
91 | v_odtab[TTCPRI][0] |= V_BLA; /* blank the object */
|
---|
92 | objclr(TTCPRI); /* turn off the old location */
|
---|
93 |
|
---|
94 | op->objx = xcol; /* update v_obtab entry */
|
---|
95 | op->objy = yrow;
|
---|
96 | op->odtw1 = 0x0400 | (0x03FF & (xcol >> 1));
|
---|
97 |
|
---|
98 | SetPri(TTCURS, TTCPRI); /* turn on the new location */
|
---|
99 |
|
---|
100 | vtcrow = row; /* update cursor position variables */
|
---|
101 | vtccol = col;
|
---|
102 | }
|
---|