[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | itcpos.c -- text cursor positioning for the instrument display
|
---|
| 4 | Version 12 -- 1989-12-19 -- 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 itcur[] = {
|
---|
[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 | itcini() -- initialize instrument text cursor
|
---|
| 40 | =============================================================================
|
---|
| 41 | */
|
---|
[7258c6a] | 42 |
|
---|
[f40a309] | 43 | void itcini(uint16_t color)
|
---|
| 44 | {
|
---|
| 45 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 46 | vbank(1);
|
---|
| 47 |
|
---|
| 48 | andcopy(v_cur, itcur, exp_c(color), 64);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | /* |
---|
| 52 |
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | =============================================================================
|
---|
| 57 | itcpos() -- position the instrument text cursor at ('row', 'col')
|
---|
| 58 | =============================================================================
|
---|
[7258c6a] | 59 | */
|
---|
[f40a309] | 60 |
|
---|
[7258c6a] | 61 | void itcpos(int16_t row, int16_t col)
|
---|
[f40a309] | 62 | {
|
---|
| 63 | register int16_t yrow, xcol;
|
---|
| 64 | register struct octent *op;
|
---|
| 65 |
|
---|
| 66 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 67 | vbank(0);
|
---|
| 68 |
|
---|
| 69 | yrow = row * 14; /* get cursor display position */
|
---|
| 70 | xcol = col * 8;
|
---|
| 71 |
|
---|
| 72 | op = &v_obtab[TCURS]; /* point at v_obtab entry */
|
---|
| 73 | setipl(VID_DI); /* disable Vertical Interval interrupt */
|
---|
| 74 | v_odtab[TCPRI][0] &= ~V_BLA; /* blank the object */
|
---|
| 75 | objclr(TCPRI); /* turn off the old location */
|
---|
| 76 |
|
---|
| 77 | op->objx = xcol; /* update v_obtab entry */
|
---|
| 78 | op->objy = yrow;
|
---|
| 79 | op->obase = &v_cur[0];
|
---|
| 80 | op->odtw1 = 0x0400 | (0x03FF & (xcol >> 1));
|
---|
| 81 |
|
---|
| 82 | SetPri(TCURS, TCPRI); /* turn on the new location */
|
---|
| 83 |
|
---|
| 84 | stcrow = row; /* update cursor position */
|
---|
| 85 | stccol = col;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | /* |
---|
| 89 |
|
---|
| 90 | */
|
---|
| 91 |
|
---|
| 92 | /*
|
---|
| 93 | =============================================================================
|
---|
| 94 | advicur() -- advance the instrument display text cursor
|
---|
[0580615] | 95 | =============================================================================
|
---|
[f40a309] | 96 | */
|
---|
[7258c6a] | 97 |
|
---|
[f40a309] | 98 | void advicur(void)
|
---|
| 99 | {
|
---|
| 100 | register int16_t newcol;
|
---|
| 101 |
|
---|
| 102 | if (infield(stcrow, stccol, curfet))
|
---|
| 103 | cfetp = infetp;
|
---|
| 104 | else
|
---|
| 105 | return;
|
---|
| 106 |
|
---|
| 107 | newcol = stccol + 1;
|
---|
| 108 |
|
---|
| 109 | if (newcol LE cfetp->frcol)
|
---|
| 110 | itcpos(stcrow, newcol);
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | /*
|
---|
| 114 | =============================================================================
|
---|
| 115 | bspicur() -- backspace the instrument display text cursor
|
---|
[0580615] | 116 | =============================================================================
|
---|
[f40a309] | 117 | */
|
---|
[7258c6a] | 118 |
|
---|
[f40a309] | 119 | void bspicur(void)
|
---|
| 120 | {
|
---|
| 121 | register int16_t newcol;
|
---|
| 122 |
|
---|
| 123 | if (infield(stcrow, stccol, curfet))
|
---|
| 124 | cfetp = infetp;
|
---|
| 125 | else
|
---|
| 126 | return;
|
---|
| 127 |
|
---|
| 128 | newcol = stccol - 1;
|
---|
| 129 |
|
---|
[6262b5c] | 130 | if (newcol GE cfetp->flcol)
|
---|
| 131 | itcpos(stcrow, newcol);
|
---|
| 132 | }
|
---|
| 133 |
|
---|