[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ttcpos.c -- virtual typewriter cursor positioning
|
---|
| 4 | Version 9 -- 1988-03-08 -- 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 |
|
---|
[7258c6a] | 13 | static int16_t ttcur[] = {
|
---|
[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 | */
|
---|
| 36 |
|
---|
| 37 | /*
|
---|
| 38 | =============================================================================
|
---|
| 39 | ttcini() -- initialize typewriter cursor
|
---|
| 40 | =============================================================================
|
---|
| 41 | */
|
---|
[7258c6a] | 42 |
|
---|
[f40a309] | 43 | void ttcini(uint16_t color)
|
---|
| 44 | {
|
---|
| 45 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 46 | vbank(1);
|
---|
| 47 |
|
---|
| 48 | andcopy(v_tcur, ttcur, exp_c(color), 64);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | /*
|
---|
| 52 | =============================================================================
|
---|
| 53 | ttcpos() -- position the typewriter cursor at ('row', 'col')
|
---|
| 54 | =============================================================================
|
---|
| 55 | */
|
---|
[7258c6a] | 56 |
|
---|
[f40a309] | 57 | void ttcpos(int16_t row, int16_t col)
|
---|
[7258c6a] | 58 | {
|
---|
[f40a309] | 59 | register int16_t yrow, xcol;
|
---|
| 60 | register struct octent *op;
|
---|
| 61 |
|
---|
| 62 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 63 | vbank(0);
|
---|
| 64 |
|
---|
| 65 | yrow = row * 14; /* get cursor display position */
|
---|
| 66 | xcol = col << 3;
|
---|
| 67 |
|
---|
| 68 | op = &v_obtab[TTCURS]; /* point at v_obtab entry */
|
---|
| 69 |
|
---|
| 70 | v_odtab[TTCPRI][0] |= V_BLA; /* blank the object */
|
---|
| 71 | objclr(TTCPRI); /* turn off the old location */
|
---|
| 72 |
|
---|
| 73 | op->objx = xcol; /* update v_obtab entry */
|
---|
| 74 | op->objy = yrow;
|
---|
| 75 | op->odtw1 = 0x0400 | (0x03FF & (xcol >> 1));
|
---|
| 76 |
|
---|
| 77 | SetPri(TTCURS, TTCPRI); /* turn on the new location */
|
---|
| 78 |
|
---|
| 79 | vtcrow = row; /* update cursor position variables */
|
---|
| 80 | vtccol = col;
|
---|
[6262b5c] | 81 | }
|
---|
| 82 |
|
---|