[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ttcpos.c -- virtual typewriter cursor positioning
|
---|
| 4 | Version 9 -- 1988-03-08 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | #define CW_0 0x0000
|
---|
| 11 | #define CW_F 0xFFFF
|
---|
| 12 |
|
---|
[7258c6a] | 13 | extern uint16_t exp_c(uint16_t c);
|
---|
[f40a309] | 14 |
|
---|
[e225e77] | 15 | extern void andcopy(uint16_t *to, uint16_t *from, uint16_t with, int16_t len);
|
---|
| 16 |
|
---|
[7258c6a] | 17 | extern int16_t vtcrow; /* virtual typewriter cursor row */
|
---|
| 18 | extern int16_t vtccol; /* virtual typewriter cursor column */
|
---|
[f40a309] | 19 |
|
---|
| 20 | /* |
---|
| 21 |
|
---|
| 22 | */
|
---|
[7258c6a] | 23 |
|
---|
[f40a309] | 24 | static 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 | =============================================================================
|
---|
[7258c6a] | 52 | */
|
---|
[f40a309] | 53 |
|
---|
| 54 | void 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 | =============================================================================
|
---|
[7258c6a] | 66 | */
|
---|
[f40a309] | 67 |
|
---|
[7258c6a] | 68 | void ttcpos(int16_t row, int16_t col)
|
---|
[f40a309] | 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 */
|
---|
[6262b5c] | 91 | vtccol = col;
|
---|
| 92 | }
|
---|
| 93 |
|
---|