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