[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 |
|
---|
[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 int16_t infield(int16_t row, int16_t col, struct fet *fetp);
|
---|
| 16 | extern uint16_t setipl(uint16_t arg);
|
---|
| 17 | extern void andcopy(uint16_t *to, uint16_t *from, uint16_t with, int16_t len);
|
---|
| 18 |
|
---|
[7258c6a] | 19 | extern int16_t stcrow, stccol; /* text cursor row,col */
|
---|
[f40a309] | 20 |
|
---|
[7258c6a] | 21 | extern uint16_t *obj0; /* cursor object pointer */
|
---|
[f40a309] | 22 |
|
---|
| 23 | /* |
---|
| 24 |
|
---|
| 25 | */
|
---|
[7258c6a] | 26 |
|
---|
[f40a309] | 27 | static int16_t itcur[] = {
|
---|
| 28 |
|
---|
| 29 | CW_0, CW_0, CW_0, CW_0, /* 0 */
|
---|
| 30 | CW_0, CW_0, CW_0, CW_0, /* 1 */
|
---|
| 31 | CW_0, CW_0, CW_0, CW_0, /* 2 */
|
---|
| 32 | CW_0, CW_0, CW_0, CW_0, /* 3 */
|
---|
| 33 | CW_0, CW_0, CW_0, CW_0, /* 4 */
|
---|
| 34 | CW_0, CW_0, CW_0, CW_0, /* 5 */
|
---|
| 35 | CW_0, CW_0, CW_0, CW_0, /* 6 */
|
---|
| 36 | CW_0, CW_0, CW_0, CW_0, /* 7 */
|
---|
| 37 | CW_0, CW_0, CW_0, CW_0, /* 8 */
|
---|
| 38 | CW_0, CW_0, CW_0, CW_0, /* 9 */
|
---|
| 39 | CW_0, CW_0, CW_0, CW_0, /* 10 */
|
---|
| 40 | CW_0, CW_0, CW_0, CW_0, /* 11 */
|
---|
| 41 | CW_F, CW_F, CW_0, CW_0, /* 12 */
|
---|
| 42 | CW_0, CW_0, CW_0, CW_0, /* 13 */
|
---|
| 43 | CW_0, CW_0, CW_0, CW_0, /* 14 */
|
---|
| 44 | CW_0, CW_0, CW_0, CW_0 /* 15 */
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | /* |
---|
| 48 |
|
---|
| 49 | */
|
---|
| 50 |
|
---|
| 51 | /*
|
---|
| 52 | =============================================================================
|
---|
| 53 | itcini() -- initialize instrument text cursor
|
---|
| 54 | =============================================================================
|
---|
[7258c6a] | 55 | */
|
---|
[f40a309] | 56 |
|
---|
| 57 | void itcini(uint16_t color)
|
---|
| 58 | {
|
---|
| 59 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 60 | vbank(1);
|
---|
| 61 |
|
---|
| 62 | andcopy(v_cur, itcur, exp_c(color), 64);
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /* |
---|
| 66 |
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | /*
|
---|
| 70 | =============================================================================
|
---|
| 71 | itcpos() -- position the instrument text cursor at ('row', 'col')
|
---|
[7258c6a] | 72 | =============================================================================
|
---|
[f40a309] | 73 | */
|
---|
[7258c6a] | 74 |
|
---|
[f40a309] | 75 | void itcpos(int16_t row, int16_t col)
|
---|
| 76 | {
|
---|
| 77 | register int16_t yrow, xcol;
|
---|
| 78 | register struct octent *op;
|
---|
| 79 |
|
---|
| 80 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 81 | vbank(0);
|
---|
| 82 |
|
---|
| 83 | yrow = row * 14; /* get cursor display position */
|
---|
| 84 | xcol = col * 8;
|
---|
| 85 |
|
---|
| 86 | op = &v_obtab[TCURS]; /* point at v_obtab entry */
|
---|
| 87 | setipl(VID_DI); /* disable Vertical Interval interrupt */
|
---|
| 88 | v_odtab[TCPRI][0] &= ~V_BLA; /* blank the object */
|
---|
| 89 | objclr(TCPRI); /* turn off the old location */
|
---|
| 90 |
|
---|
| 91 | op->objx = xcol; /* update v_obtab entry */
|
---|
| 92 | op->objy = yrow;
|
---|
| 93 | op->obase = &v_cur[0];
|
---|
| 94 | op->odtw1 = 0x0400 | (0x03FF & (xcol >> 1));
|
---|
| 95 |
|
---|
| 96 | SetPri(TCURS, TCPRI); /* turn on the new location */
|
---|
| 97 |
|
---|
| 98 | stcrow = row; /* update cursor position */
|
---|
| 99 | stccol = col;
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | /* |
---|
| 103 |
|
---|
| 104 | */
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | =============================================================================
|
---|
[0580615] | 108 | advicur() -- advance the instrument display text cursor
|
---|
[f40a309] | 109 | =============================================================================
|
---|
[7258c6a] | 110 | */
|
---|
[f40a309] | 111 |
|
---|
| 112 | void advicur(void)
|
---|
| 113 | {
|
---|
| 114 | register int16_t newcol;
|
---|
| 115 |
|
---|
| 116 | if (infield(stcrow, stccol, curfet))
|
---|
| 117 | cfetp = infetp;
|
---|
| 118 | else
|
---|
| 119 | return;
|
---|
| 120 |
|
---|
| 121 | newcol = stccol + 1;
|
---|
| 122 |
|
---|
| 123 | if (newcol LE cfetp->frcol)
|
---|
| 124 | itcpos(stcrow, newcol);
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | /*
|
---|
| 128 | =============================================================================
|
---|
[0580615] | 129 | bspicur() -- backspace the instrument display text cursor
|
---|
[f40a309] | 130 | =============================================================================
|
---|
[7258c6a] | 131 | */
|
---|
[f40a309] | 132 |
|
---|
| 133 | void bspicur(void)
|
---|
| 134 | {
|
---|
| 135 | register int16_t newcol;
|
---|
| 136 |
|
---|
| 137 | if (infield(stcrow, stccol, curfet))
|
---|
| 138 | cfetp = infetp;
|
---|
| 139 | else
|
---|
| 140 | return;
|
---|
| 141 |
|
---|
| 142 | newcol = stccol - 1;
|
---|
[6262b5c] | 143 |
|
---|
| 144 | if (newcol GE cfetp->flcol)
|
---|
| 145 | itcpos(stcrow, newcol);
|
---|
| 146 | }
|
---|
| 147 |
|
---|