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