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