[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 | {
|
---|
[7258c6a] | 145 | register uint16_t *obj;
|
---|
| 146 | register int16_t i, j;
|
---|
| 147 | register 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 | {
|
---|
[7258c6a] | 185 | register uint16_t ccv, *tcp;
|
---|
| 186 | register int16_t tcrow;
|
---|
[f40a309] | 187 |
|
---|
| 188 | tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
|
---|
| 189 |
|
---|
| 190 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 191 | vbank(1);
|
---|
| 192 |
|
---|
| 193 | tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* object pointer */
|
---|
| 194 |
|
---|
| 195 | /* background color */
|
---|
| 196 |
|
---|
| 197 | ccv = exp_c(sctctab[tcrow][stccol]);
|
---|
| 198 |
|
---|
| 199 | *tcp++ = ccv; /* turn off the text cursor */
|
---|
| 200 | *tcp = ccv;
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | /*
|
---|
| 204 | =============================================================================
|
---|
| 205 | stcpos() -- position the score text cursor at ('row', 'col')
|
---|
| 206 | =============================================================================
|
---|
| 207 | */
|
---|
| 208 |
|
---|
[7258c6a] | 209 | void stcpos(int16_t row, int16_t col)
|
---|
[f40a309] | 210 | {
|
---|
[7258c6a] | 211 | register uint16_t *ccp, *tcp;
|
---|
| 212 | register uint16_t curson, ccv;
|
---|
| 213 | register int16_t ncrow, tcrow;
|
---|
[f40a309] | 214 |
|
---|
| 215 | tcrow = stcrow ? (stcrow - 16) : 0; /* get old object row */
|
---|
| 216 | ncrow = row ? (row - 16) : 0; /* get new object row */
|
---|
| 217 |
|
---|
| 218 | if ((v_regs[5] & 0x0180) NE 0x0100)
|
---|
| 219 | vbank(1); /* select the cursor bank */
|
---|
| 220 |
|
---|
| 221 | curson = exp_c(SDCURSR); /* get cursor color */
|
---|
| 222 |
|
---|
| 223 | /* get old cursor background color */
|
---|
| 224 |
|
---|
| 225 | ccv = exp_c(sctctab[tcrow][stccol]);
|
---|
| 226 |
|
---|
| 227 | tcp = STCOBJ + (tcrow << 8) + (stccol << 1); /* old cursor pointer */
|
---|
| 228 | ccp = STCOBJ + (ncrow << 8) + (col << 1); /* new cursor pointer */
|
---|
| 229 |
|
---|
| 230 | *tcp++ = ccv; /* turn off the old cursor */
|
---|
| 231 | *tcp = ccv;
|
---|
| 232 |
|
---|
| 233 | *ccp++ = curson; /* turn on the new cursor */
|
---|
| 234 | *ccp = curson;
|
---|
| 235 |
|
---|
| 236 | stcrow = row; /* update cursor position */
|
---|
| 237 | stccol = col;
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | /*
|
---|
| 241 | =============================================================================
|
---|
| 242 | advscur() -- advance the score text cursor
|
---|
| 243 | =============================================================================
|
---|
| 244 | */
|
---|
| 245 |
|
---|
[0580615] | 246 | void advscur(void)
|
---|
[f40a309] | 247 | {
|
---|
[7258c6a] | 248 | register int16_t newcol;
|
---|
[f40a309] | 249 |
|
---|
| 250 | if (infield(stcrow, stccol, curfet))
|
---|
| 251 | cfetp = infetp;
|
---|
| 252 | else
|
---|
| 253 | return;
|
---|
| 254 |
|
---|
| 255 | newcol = stccol + 1;
|
---|
| 256 |
|
---|
| 257 | if (newcol LE cfetp->frcol)
|
---|
| 258 | stcpos(stcrow, newcol);
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | /*
|
---|
| 262 | =============================================================================
|
---|
| 263 | stcset() -- setup the score text cursor color table
|
---|
| 264 | =============================================================================
|
---|
| 265 | */
|
---|
| 266 |
|
---|
[0580615] | 267 | void stcset(void)
|
---|
[f40a309] | 268 | {
|
---|
| 269 | memcpyw(&sctctab[0][0], &sctccon[0][0], 640);
|
---|
| 270 | }
|
---|
[6262b5c] | 271 |
|
---|