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