[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ctcpos.c -- character text cursor positioning
|
---|
| 4 | Version 12 -- 1989-11-15 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "graphdef.h"
|
---|
| 10 | #include "vsdd.h"
|
---|
| 11 | #include "hwdefs.h"
|
---|
| 12 | #include "macros.h"
|
---|
| 13 | #include "patch.h"
|
---|
| 14 |
|
---|
| 15 | #include "midas.h"
|
---|
| 16 |
|
---|
[e225e77] | 17 | #include "vsddsw.h"
|
---|
| 18 |
|
---|
| 19 | extern void vclrav(uint16_t *adr, uint16_t row, uint16_t col, uint16_t atr, uint16_t len);
|
---|
| 20 | extern void vsetav(uint16_t *adr, uint16_t row, uint16_t col, uint16_t atr, uint16_t len);
|
---|
| 21 |
|
---|
[7258c6a] | 22 | int16_t ctcsw; /* text cursor status */
|
---|
[f40a309] | 23 |
|
---|
[7258c6a] | 24 | extern int16_t CurLine; /* current patch display line */
|
---|
| 25 | extern int16_t cxval, cyval; /* patch text cursor x, y */
|
---|
| 26 | extern int16_t stcrow, stccol; /* patch text cursor row,col */
|
---|
| 27 | extern int16_t vtcrow, vtccol; /* menu text cursor row,col */
|
---|
[f40a309] | 28 |
|
---|
[7258c6a] | 29 | extern uint16_t *obj9; /* patch cursor object pointer */
|
---|
| 30 | extern uint16_t *obj11; /* menu cursor object pointer */
|
---|
[f40a309] | 31 |
|
---|
[7258c6a] | 32 | int16_t mtcoldc; /* previous cursor column location */
|
---|
| 33 | int16_t mtcoldr; /* previous cursor row location */
|
---|
[f40a309] | 34 |
|
---|
| 35 | /* |
---|
| 36 |
|
---|
| 37 | */
|
---|
| 38 |
|
---|
| 39 | /*
|
---|
| 40 | =============================================================================
|
---|
| 41 | ctcpos() -- position the patch text cursor at ('row', 'col')
|
---|
| 42 | =============================================================================
|
---|
| 43 | */
|
---|
[7258c6a] | 44 |
|
---|
[f40a309] | 45 | void ctcpos(int16_t row, int16_t col)
|
---|
[7258c6a] | 46 | {
|
---|
[f40a309] | 47 | register int16_t nrow;
|
---|
| 48 |
|
---|
| 49 | if (ctcsw) {
|
---|
| 50 |
|
---|
| 51 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 52 | vbank(0);
|
---|
| 53 |
|
---|
| 54 | nrow = CurLine + 7;
|
---|
| 55 |
|
---|
| 56 | if (stcrow EQ DATAROW) /* turn off old cursor */
|
---|
| 57 | vclrav(obj9, nrow, stccol, C_ULINE, 48);
|
---|
| 58 |
|
---|
| 59 | if (row EQ DATAROW) /* turn on new cursor */
|
---|
| 60 | vsetav(obj9, nrow, col, C_ULINE, 48);
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | stcrow = row; /* update cursor position */
|
---|
| 64 | stccol = col;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | /* |
---|
| 68 |
|
---|
| 69 | */
|
---|
| 70 |
|
---|
| 71 | /*
|
---|
| 72 | =============================================================================
|
---|
| 73 | ctcoff() -- turn off the patch text cursor
|
---|
| 74 | =============================================================================
|
---|
[0580615] | 75 | */
|
---|
[f40a309] | 76 |
|
---|
| 77 | void ctcoff(void)
|
---|
| 78 | {
|
---|
| 79 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 80 | vbank(0);
|
---|
| 81 |
|
---|
| 82 | if (stcrow EQ DATAROW) /* turn off cursor */
|
---|
| 83 | vclrav(obj9, CurLine + 7, stccol, C_ULINE, 48);
|
---|
| 84 |
|
---|
| 85 | ctcsw = FALSE;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | =============================================================================
|
---|
| 90 | ctcon() -- turn on the patch text cursor
|
---|
| 91 | =============================================================================
|
---|
[0580615] | 92 | */
|
---|
[f40a309] | 93 |
|
---|
| 94 | void ctcon(void)
|
---|
| 95 | {
|
---|
| 96 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 97 | vbank(0);
|
---|
| 98 |
|
---|
| 99 | if (stcrow EQ DATAROW) { /* turn on cursor */
|
---|
| 100 |
|
---|
| 101 | ctcsw = TRUE;
|
---|
| 102 | vsetav(obj9, CurLine + 7, stccol, C_ULINE, 48);
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | /* |
---|
| 107 |
|
---|
| 108 | */
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | =============================================================================
|
---|
| 112 | mtcpos() -- position the menu text cursor at ('row', 'col')
|
---|
[7258c6a] | 113 | =============================================================================
|
---|
[f40a309] | 114 | */
|
---|
| 115 |
|
---|
| 116 | void mtcpos(int16_t row, int16_t col)
|
---|
| 117 | {
|
---|
| 118 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 119 | vbank(0);
|
---|
| 120 |
|
---|
| 121 | if (inrange(mtcoldr, 19, 23)) { /* turn off old cursor */
|
---|
| 122 |
|
---|
| 123 | vclrav(obj11, mtcoldr - 18, mtcoldc, C_ULINE, 64);
|
---|
| 124 |
|
---|
| 125 | mtcoldr = 0; /* void old cursor location */
|
---|
| 126 | mtcoldc = 0;
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | if (inrange(row, 19, 23)) { /* turn on new cursor */
|
---|
| 130 |
|
---|
| 131 | vsetav(obj11, row - 18, col, C_ULINE, 64);
|
---|
| 132 |
|
---|
| 133 | mtcoldr = row; /* keep track of new cursor */
|
---|
| 134 | mtcoldc = col;
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | vtcrow = row; /* update cursor position */
|
---|
| 138 | vtccol = col;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | /*
|
---|
| 142 | =============================================================================
|
---|
| 143 | mtcoff() -- turn off the menu text cursor
|
---|
[0580615] | 144 | =============================================================================
|
---|
[f40a309] | 145 | */
|
---|
| 146 |
|
---|
| 147 | void mtcoff(void)
|
---|
| 148 | {
|
---|
| 149 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 150 | vbank(0);
|
---|
| 151 |
|
---|
| 152 | if (inrange(mtcoldr, 19, 23)) /* turn off cursor */
|
---|
| 153 | vclrav(obj11, mtcoldr - 18, mtcoldc, C_ULINE, 64);
|
---|
| 154 | }
|
---|