[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | stcpos.c -- text cursor positioning for the score display
|
---|
| 4 | Version 19 -- 1989-11-15 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | #define STCOBJ obj3
|
---|
| 11 |
|
---|
| 12 | #define SDLINE 4 /* dividing line color - analog stuff */
|
---|
| 13 |
|
---|
[7258c6a] | 14 | int16_t sctccon[10][64] = { /* score background color constants */
|
---|
[f40a309] | 15 |
|
---|
| 16 | /* 0 - row 0 */
|
---|
| 17 |
|
---|
| 18 | {SDBG00, SDBG00, SDBG01, SDBG01, SDBG01, SDBG01, SDBG01, SDBG01,
|
---|
| 19 | SDBG01, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00,
|
---|
| 20 | SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG00, SDBG01, SDBG01,
|
---|
| 21 | SDBG01, SDBG01, SDBG01, SDBG01, SDBG01, SDBG02, SDBG02, SDBG02,
|
---|
| 22 |
|
---|
| 23 | SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02,
|
---|
| 24 | SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02,
|
---|
| 25 | SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG02, SDBG03,
|
---|
| 26 | SDBG03, SDBG03, SDBG03, SDBG03, SDBG03, SDBG03, SDBG03, SDBG03},
|
---|
| 27 |
|
---|
| 28 | /* 1 - row 17 */
|
---|
| 29 |
|
---|
| 30 | {SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04,
|
---|
| 31 | SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG04, SDBG05, SDBG05,
|
---|
| 32 | SDBG05, SDBG05, SDBG05, SDBG05, SDBG05, SDBG06, SDBG06, SDBG06,
|
---|
| 33 | SDBG06, SDBG06, SDBG06, SDBG06, SDBG06, SDBG06, SDBG06, SDBG07,
|
---|
| 34 |
|
---|
| 35 | SDBG07, SDBG07, SDBG07, SDBG07, SDBG07, SDBG07, SDBG07, SDBG07,
|
---|
| 36 | SDBG08, SDBG08, SDBG08, SDBG08, SDBG08, SDBG08, SDBG08, SDBG08,
|
---|
| 37 | SDBG08, SDBG08, SDBG09, SDBG09, SDBG09, SDBG09, SDBG09, SDBG09,
|
---|
| 38 | SDBG09, SDBG10, SDBG10, SDBG10, SDBG10, SDBG10, SDBG10, SDBG10},
|
---|
| 39 |
|
---|
| 40 | /* 2 - row 18 */
|
---|
| 41 |
|
---|
| 42 | {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 43 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 44 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 45 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 46 |
|
---|
| 47 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 48 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 49 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 50 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
|
---|
[fa38804] | 51 |
|
---|
[f40a309] | 52 | /* 3 - row 19 */
|
---|
| 53 |
|
---|
| 54 | {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 55 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 56 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 57 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 58 |
|
---|
| 59 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 60 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 61 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 62 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
|
---|
| 63 |
|
---|
| 64 | /* 4 - row 20 */
|
---|
| 65 |
|
---|
| 66 | {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 67 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 68 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 69 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 70 |
|
---|
| 71 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 72 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 73 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 74 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
|
---|
| 75 |
|
---|
| 76 | /* 5 - row 21 */
|
---|
| 77 |
|
---|
| 78 | {SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 79 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 80 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 81 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 82 |
|
---|
| 83 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 84 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 85 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11,
|
---|
| 86 | SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11, SDBG11},
|
---|
[fa38804] | 87 |
|
---|
[f40a309] | 88 | /* 6 - row 22 */
|
---|
| 89 |
|
---|
| 90 | {SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 91 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 92 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 93 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 94 |
|
---|
| 95 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 96 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 97 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 98 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12},
|
---|
| 99 |
|
---|
| 100 | /* 7 - row 23 */
|
---|
| 101 |
|
---|
| 102 | {SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 103 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 104 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 105 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 106 |
|
---|
| 107 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 108 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 109 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12,
|
---|
| 110 | SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12, SDBG12},
|
---|
| 111 |
|
---|
| 112 | /* 8 - row 24 */
|
---|
| 113 |
|
---|
| 114 | {SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13,
|
---|
| 115 | SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13,
|
---|
| 116 | SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13, SDBG13,
|
---|
| 117 | SDBG13, SDBG13, SDBG13, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
|
---|
| 118 |
|
---|
| 119 | SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
|
---|
| 120 | SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
|
---|
| 121 | SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14, SDBG14,
|
---|
| 122 | SDBG14, SDBG15, SDBG15, SDBG15, SDBG15, SDBG15, SDBG15, SDBG15},
|
---|
| 123 |
|
---|
| 124 | /* 9 - special - bottom of row 21 - top is entry 5 */
|
---|
| 125 |
|
---|
| 126 | {SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 127 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 128 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 129 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 130 |
|
---|
| 131 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 132 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 133 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE,
|
---|
| 134 | SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE, SDLINE}
|
---|
| 135 | };
|
---|
| 136 |
|
---|
| 137 | /*
|
---|
| 138 | =============================================================================
|
---|
| 139 | stcclr() -- turn off all of the score text cursors
|
---|
| 140 | =============================================================================
|
---|
| 141 | */
|
---|
| 142 |
|
---|
[0580615] | 143 | void stcclr(void)
|
---|
[f40a309] | 144 | {
|
---|
[8c8b4e5] | 145 | volatile uint16_t *obj;
|
---|
| 146 | int16_t i, j;
|
---|
| 147 | uint16_t k;
|
---|
[f40a309] | 148 |
|
---|
| 149 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 150 | vbank(1); /* select the correct bank */
|
---|
| 151 |
|
---|
| 152 | stcrow = 0; /* leave score cursor row,col = 0,0 */
|
---|
| 153 | stccol = 0;
|
---|
| 154 |
|
---|
| 155 | obj = STCOBJ; /* intialize pointers */
|
---|
| 156 |
|
---|
| 157 | for (i = 0; i < 9; i++) { /* clear each cursor row */
|
---|
| 158 |
|
---|
| 159 | for (j = 0; j < 64; j++) { /* top cursor row */
|
---|
| 160 |
|
---|
| 161 | k = exp_c(sctctab[i][j]);
|
---|
| 162 |
|
---|
| 163 | *obj++ = k;
|
---|
| 164 | *obj++ = k;
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | for (j = 0; j < 64; j++) { /* bottom cursor row */
|
---|
| 168 |
|
---|
| 169 | k = exp_c(sctctab[i EQ 5 ? 9 : i][j]);
|
---|
| 170 |
|
---|
| 171 | *obj++ = k;
|
---|
| 172 | *obj++ = k;
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | /*
|
---|
| 178 | =============================================================================
|
---|
| 179 | stcoff() -- turn off text cursor for the score display
|
---|
| 180 | =============================================================================
|
---|
| 181 | */
|
---|
| 182 |
|
---|
[0580615] | 183 | void stcoff(void)
|
---|
[f40a309] | 184 | {
|
---|
[8c8b4e5] | 185 | uint16_t ccv;
|
---|
| 186 | volatile uint16_t *tcp;
|
---|
| 187 | int16_t tcrow;
|
---|
[f40a309] | 188 |
|
---|
| 189 | tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
|
---|
| 190 |
|
---|
| 191 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 192 | vbank(1);
|
---|
| 193 |
|
---|
| 194 | tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* object pointer */
|
---|
| 195 |
|
---|
| 196 | /* background color */
|
---|
| 197 |
|
---|
| 198 | ccv = exp_c(sctctab[tcrow][stccol]);
|
---|
| 199 |
|
---|
| 200 | *tcp++ = ccv; /* turn off the text cursor */
|
---|
| 201 | *tcp = ccv;
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 | /*
|
---|
| 205 | =============================================================================
|
---|
| 206 | stcpos() -- position the score text cursor at ('row', 'col')
|
---|
| 207 | =============================================================================
|
---|
| 208 | */
|
---|
| 209 |
|
---|
[7258c6a] | 210 | void stcpos(int16_t row, int16_t col)
|
---|
[f40a309] | 211 | {
|
---|
[8c8b4e5] | 212 | volatile uint16_t *ccp, *tcp;
|
---|
| 213 | uint16_t curson, ccv;
|
---|
| 214 | int16_t ncrow, tcrow;
|
---|
[f40a309] | 215 |
|
---|
| 216 | tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
|
---|
| 217 | ncrow = row ? (row - 16) : 0; /* get new object row */
|
---|
| 218 |
|
---|
| 219 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 220 | vbank(1); /* select the cursor bank */
|
---|
| 221 |
|
---|
| 222 | curson = exp_c(SDCURSR); /* get cursor color */
|
---|
| 223 |
|
---|
| 224 | /* get old cursor background color */
|
---|
| 225 |
|
---|
| 226 | ccv = exp_c(sctctab[tcrow][stccol]);
|
---|
| 227 |
|
---|
| 228 | tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* old cursor pointer */
|
---|
| 229 | ccp = STCOBJ + (ncrow << 8) + (col << 1); /* new cursor pointer */
|
---|
| 230 |
|
---|
| 231 | *tcp++ = ccv; /* turn off the old cursor */
|
---|
| 232 | *tcp = ccv;
|
---|
| 233 |
|
---|
| 234 | *ccp++ = curson; /* turn on the new cursor */
|
---|
| 235 | *ccp = curson;
|
---|
| 236 |
|
---|
| 237 | stcrow = row; /* update cursor position */
|
---|
| 238 | stccol = col;
|
---|
| 239 | }
|
---|
| 240 |
|
---|
| 241 | /*
|
---|
| 242 | =============================================================================
|
---|
| 243 | advscur() -- advance the score text cursor
|
---|
| 244 | =============================================================================
|
---|
| 245 | */
|
---|
| 246 |
|
---|
[0580615] | 247 | void advscur(void)
|
---|
[f40a309] | 248 | {
|
---|
[7258c6a] | 249 | register int16_t newcol;
|
---|
[f40a309] | 250 |
|
---|
| 251 | if (infield(stcrow, stccol, curfet))
|
---|
| 252 | cfetp = infetp;
|
---|
| 253 | else
|
---|
| 254 | return;
|
---|
| 255 |
|
---|
| 256 | newcol = stccol + 1;
|
---|
| 257 |
|
---|
| 258 | if (newcol LE cfetp->frcol)
|
---|
| 259 | stcpos(stcrow, newcol);
|
---|
| 260 | }
|
---|
| 261 |
|
---|
| 262 | /*
|
---|
| 263 | =============================================================================
|
---|
| 264 | stcset() -- setup the score text cursor color table
|
---|
| 265 | =============================================================================
|
---|
| 266 | */
|
---|
| 267 |
|
---|
[0580615] | 268 | void stcset(void)
|
---|
[f40a309] | 269 | {
|
---|
| 270 | memcpyw(&sctctab[0][0], &sctccon[0][0], 640);
|
---|
| 271 | }
|
---|
[6262b5c] | 272 |
|
---|