src/mame/machine/snesdsp2.c
| r3455 | r3456 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | snesdsp2.c
|
| 4 | | |
| 5 | | File to handle emulation of the SNES "DSP-2" add-on chip.
|
| 6 | | |
| 7 | | Original C++ code by byuu, based on research by Overload
|
| 8 | | |
| 9 | | MAME/MESS C conversion by etabeta
|
| 10 | | |
| 11 | | ***************************************************************************/
|
| 12 | | |
| 13 | | int DSP2_waiting_for_command = 0;
|
| 14 | | int DSP2_command = 0;
|
| 15 | | int DSP2_in_count = 0, DSP2_in_index = 0;
|
| 16 | | int DSP2_out_count = 0, DSP2_out_index = 0;
|
| 17 | | |
| 18 | | UINT8 DSP2_parameters[512] = {0};
|
| 19 | | UINT8 DSP2_output[512] = {0};
|
| 20 | | |
| 21 | | UINT8 DSP2_op05transparent = 0;
|
| 22 | | int DSP2_op05haslen = 0;
|
| 23 | | int DSP2_op05len = 0;
|
| 24 | | int DSP2_op06haslen = 0;
|
| 25 | | int DSP2_op06len = 0;
|
| 26 | | UINT16 DSP2_op09word1 = 0;
|
| 27 | | UINT16 DSP2_op09word2 = 0;
|
| 28 | | int DSP2_op0dhaslen = 0;
|
| 29 | | int DSP2_op0doutlen = 0;
|
| 30 | | int DSP2_op0dinlen = 0;
|
| 31 | | |
| 32 | | |
| 33 | | //convert bitmap to bitplane tile
|
| 34 | | void DSP2_op01( void )
|
| 35 | | {
|
| 36 | | //op01 size is always 32 bytes input and output
|
| 37 | | //the hardware does strange things if you vary the size
|
| 38 | | |
| 39 | | unsigned char c0, c1, c2, c3;
|
| 40 | | unsigned char *p1 = DSP2_parameters;
|
| 41 | | unsigned char *p2a = DSP2_output;
|
| 42 | | unsigned char *p2b = DSP2_output + 16; //halfway
|
| 43 | | int j;
|
| 44 | | |
| 45 | | //process 8 blocks of 4 bytes each
|
| 46 | | for (j = 0; j < 8; j++)
|
| 47 | | {
|
| 48 | | c0 = *p1++;
|
| 49 | | c1 = *p1++;
|
| 50 | | c2 = *p1++;
|
| 51 | | c3 = *p1++;
|
| 52 | | |
| 53 | | *p2a++ = (c0 & 0x10) << 3 |
|
| 54 | | (c0 & 0x01) << 6 |
|
| 55 | | (c1 & 0x10) << 1 |
|
| 56 | | (c1 & 0x01) << 4 |
|
| 57 | | (c2 & 0x10) >> 1 |
|
| 58 | | (c2 & 0x01) << 2 |
|
| 59 | | (c3 & 0x10) >> 3 |
|
| 60 | | (c3 & 0x01);
|
| 61 | | |
| 62 | | *p2a++ = (c0 & 0x20) << 2 |
|
| 63 | | (c0 & 0x02) << 5 |
|
| 64 | | (c1 & 0x20) |
|
| 65 | | (c1 & 0x02) << 3 |
|
| 66 | | (c2 & 0x20) >> 2 |
|
| 67 | | (c2 & 0x02) << 1 |
|
| 68 | | (c3 & 0x20) >> 4 |
|
| 69 | | (c3 & 0x02) >> 1;
|
| 70 | | |
| 71 | | *p2b++ = (c0 & 0x40) << 1 |
|
| 72 | | (c0 & 0x04) << 4 |
|
| 73 | | (c1 & 0x40) >> 1 |
|
| 74 | | (c1 & 0x04) << 2 |
|
| 75 | | (c2 & 0x40) >> 3 |
|
| 76 | | (c2 & 0x04) |
|
| 77 | | (c3 & 0x40) >> 5 |
|
| 78 | | (c3 & 0x04) >> 2;
|
| 79 | | |
| 80 | | *p2b++ = (c0 & 0x80) |
|
| 81 | | (c0 & 0x08) << 3 |
|
| 82 | | (c1 & 0x80) >> 2 |
|
| 83 | | (c1 & 0x08) << 1 |
|
| 84 | | (c2 & 0x80) >> 4 |
|
| 85 | | (c2 & 0x08) >> 1 |
|
| 86 | | (c3 & 0x80) >> 6 |
|
| 87 | | (c3 & 0x08) >> 3;
|
| 88 | | }
|
| 89 | | }
|
| 90 | | |
| 91 | | //set transparent color
|
| 92 | | void DSP2_op03( void )
|
| 93 | | {
|
| 94 | | DSP2_op05transparent = DSP2_parameters[0];
|
| 95 | | }
|
| 96 | | |
| 97 | | //replace bitmap using transparent color
|
| 98 | | void DSP2_op05( void )
|
| 99 | | {
|
| 100 | | UINT8 color;
|
| 101 | | // Overlay bitmap with transparency.
|
| 102 | | // Input:
|
| 103 | | //
|
| 104 | | // Bitmap 1: i[0] <=> i[size-1]
|
| 105 | | // Bitmap 2: i[size] <=> i[2*size-1]
|
| 106 | | //
|
| 107 | | // Output:
|
| 108 | | //
|
| 109 | | // Bitmap 3: o[0] <=> o[size-1]
|
| 110 | | //
|
| 111 | | // Processing:
|
| 112 | | //
|
| 113 | | // Process all 4-bit pixels (nibbles) in the bitmap
|
| 114 | | //
|
| 115 | | // if ( BM2_pixel == transparent_color )
|
| 116 | | // pixelout = BM1_pixel
|
| 117 | | // else
|
| 118 | | // pixelout = BM2_pixel
|
| 119 | | |
| 120 | | // The max size bitmap is limited to 255 because the size parameter is a byte
|
| 121 | | // I think size=0 is an error. The behavior of the chip on size=0 is to
|
| 122 | | // return the last value written to DR if you read DR on Op05 with
|
| 123 | | // size = 0. I don't think it's worth implementing this quirk unless it's
|
| 124 | | // proven necessary.
|
| 125 | | |
| 126 | | unsigned char c1, c2;
|
| 127 | | unsigned char *p1 = DSP2_parameters;
|
| 128 | | unsigned char *p2 = DSP2_parameters + DSP2_op05len;
|
| 129 | | unsigned char *p3 = DSP2_output;
|
| 130 | | int n;
|
| 131 | | |
| 132 | | color = DSP2_op05transparent & 0x0f;
|
| 133 | | |
| 134 | | for (n = 0; n < DSP2_op05len; n++)
|
| 135 | | {
|
| 136 | | c1 = *p1++;
|
| 137 | | c2 = *p2++;
|
| 138 | | *p3++ = ( ((c2 >> 4) == color ) ? c1 & 0xf0 : c2 & 0xf0 ) |
|
| 139 | | ( ((c2 & 0x0f) == color ) ? c1 & 0x0f : c2 & 0x0f );
|
| 140 | | }
|
| 141 | | }
|
| 142 | | |
| 143 | | //reverse bitmap
|
| 144 | | void DSP2_op06( void )
|
| 145 | | {
|
| 146 | | // Input:
|
| 147 | | // size
|
| 148 | | // bitmap
|
| 149 | | int i, j;
|
| 150 | | for (i = 0, j = DSP2_op06len - 1; i < DSP2_op06len; i++, j--)
|
| 151 | | {
|
| 152 | | DSP2_output[j] = (DSP2_parameters[i] << 4) | (DSP2_parameters[i] >> 4);
|
| 153 | | }
|
| 154 | | }
|
| 155 | | |
| 156 | | //multiply
|
| 157 | | void DSP2_op09( void )
|
| 158 | | {
|
| 159 | | UINT32 r = 0;
|
| 160 | | DSP2_out_count = 4;
|
| 161 | | |
| 162 | | DSP2_op09word1 = DSP2_parameters[0] | (DSP2_parameters[1] << 8);
|
| 163 | | DSP2_op09word2 = DSP2_parameters[2] | (DSP2_parameters[3] << 8);
|
| 164 | | |
| 165 | | r = DSP2_op09word1 * DSP2_op09word2;
|
| 166 | | DSP2_output[0] = r;
|
| 167 | | DSP2_output[1] = r >> 8;
|
| 168 | | DSP2_output[2] = r >> 16;
|
| 169 | | DSP2_output[3] = r >> 24;
|
| 170 | | }
|
| 171 | | |
| 172 | | //scale bitmap
|
| 173 | | void DSP2_op0d( void )
|
| 174 | | {
|
| 175 | | // Bit accurate hardware algorithm - uses fixed point math
|
| 176 | | // This should match the DSP2 Op0D output exactly
|
| 177 | | // I wouldn't recommend using this unless you're doing hardware debug.
|
| 178 | | // In some situations it has small visual artifacts that
|
| 179 | | // are not readily apparent on a TV screen but show up clearly
|
| 180 | | // on a monitor. Use Overload's scaling instead.
|
| 181 | | // This is for hardware verification testing.
|
| 182 | | //
|
| 183 | | // One note: the HW can do odd byte scaling but since we divide
|
| 184 | | // by two to get the count of bytes this won't work well for
|
| 185 | | // odd byte scaling (in any of the current algorithm implementations).
|
| 186 | | // So far I haven't seen Dungeon Master use it.
|
| 187 | | // If it does we can adjust the parameters and code to work with it
|
| 188 | | |
| 189 | | UINT32 multiplier; // Any size int >= 32-bits
|
| 190 | | UINT32 pixloc; // match size of multiplier
|
| 191 | | int i, j;
|
| 192 | | UINT8 pixelarray[512];
|
| 193 | | if (DSP2_op0dinlen <= DSP2_op0doutlen)
|
| 194 | | {
|
| 195 | | multiplier = 0x10000; // In our self defined fixed point 0x10000 == 1
|
| 196 | | }
|
| 197 | | else
|
| 198 | | {
|
| 199 | | multiplier = (DSP2_op0dinlen << 17) / ((DSP2_op0doutlen << 1) + 1);
|
| 200 | | }
|
| 201 | | |
| 202 | | pixloc = 0;
|
| 203 | | for (i = 0; i < DSP2_op0doutlen * 2; i++)
|
| 204 | | {
|
| 205 | | j = pixloc >> 16;
|
| 206 | | |
| 207 | | if (j & 1)
|
| 208 | | pixelarray[i] = (DSP2_parameters[j >> 1] & 0x0f);
|
| 209 | | else
|
| 210 | | pixelarray[i] = (DSP2_parameters[j >> 1] & 0xf0) >> 4;
|
| 211 | | |
| 212 | | pixloc += multiplier;
|
| 213 | | }
|
| 214 | | |
| 215 | | for (i = 0; i < DSP2_op0doutlen; i++)
|
| 216 | | {
|
| 217 | | DSP2_output[i] = (pixelarray[i << 1] << 4) | pixelarray[(i << 1) + 1];
|
| 218 | | }
|
| 219 | | }
|
| 220 | | |
| 221 | | |
| 222 | | void DSP2_reset( void )
|
| 223 | | {
|
| 224 | | DSP2_waiting_for_command = 1;
|
| 225 | | DSP2_in_count = 0;
|
| 226 | | DSP2_in_index = 0;
|
| 227 | | DSP2_out_count = 0;
|
| 228 | | DSP2_out_index = 0;
|
| 229 | | |
| 230 | | DSP2_op05transparent = 0;
|
| 231 | | DSP2_op05haslen = 0;
|
| 232 | | DSP2_op05len = 0;
|
| 233 | | DSP2_op06haslen = 0;
|
| 234 | | DSP2_op06len = 0;
|
| 235 | | DSP2_op09word1 = 0;
|
| 236 | | DSP2_op09word2 = 0;
|
| 237 | | DSP2_op0dhaslen = 0;
|
| 238 | | DSP2_op0doutlen = 0;
|
| 239 | | DSP2_op0dinlen = 0;
|
| 240 | | }
|
| 241 | | |
| 242 | | UINT8 DSP2_read( void )
|
| 243 | | {
|
| 244 | | UINT8 r = 0xff;
|
| 245 | | if (DSP2_out_count)
|
| 246 | | {
|
| 247 | | r = DSP2_output[DSP2_out_index++];
|
| 248 | | DSP2_out_index &= 511;
|
| 249 | | if (DSP2_out_count == DSP2_out_index)
|
| 250 | | DSP2_out_count = 0;
|
| 251 | | }
|
| 252 | | return r;
|
| 253 | | }
|
| 254 | | |
| 255 | | void DSP2_write(UINT8 data)
|
| 256 | | {
|
| 257 | | if(DSP2_waiting_for_command)
|
| 258 | | {
|
| 259 | | DSP2_command = data;
|
| 260 | | DSP2_in_index = 0;
|
| 261 | | DSP2_waiting_for_command = 0;
|
| 262 | | |
| 263 | | switch (data)
|
| 264 | | {
|
| 265 | | case 0x01: DSP2_in_count = 32; break;
|
| 266 | | case 0x03: DSP2_in_count = 1; break;
|
| 267 | | case 0x05: DSP2_in_count = 1; break;
|
| 268 | | case 0x06: DSP2_in_count = 1; break;
|
| 269 | | case 0x07: break;
|
| 270 | | case 0x08: break;
|
| 271 | | case 0x09: DSP2_in_count = 4; break;
|
| 272 | | case 0x0d: DSP2_in_count = 2; break;
|
| 273 | | case 0x0f: DSP2_in_count = 0; break;
|
| 274 | | }
|
| 275 | | }
|
| 276 | | else
|
| 277 | | {
|
| 278 | | DSP2_parameters[DSP2_in_index++] = data;
|
| 279 | | DSP2_in_index &= 511;
|
| 280 | | }
|
| 281 | | |
| 282 | | if (DSP2_in_count == DSP2_in_index)
|
| 283 | | {
|
| 284 | | DSP2_waiting_for_command = 1;
|
| 285 | | DSP2_out_index = 0;
|
| 286 | | switch (DSP2_command)
|
| 287 | | {
|
| 288 | | case 0x01:
|
| 289 | | DSP2_out_count = 32;
|
| 290 | | DSP2_op01();
|
| 291 | | break;
|
| 292 | | |
| 293 | | case 0x03:
|
| 294 | | DSP2_op03();
|
| 295 | | break;
|
| 296 | | |
| 297 | | case 0x05:
|
| 298 | | if (DSP2_op05haslen)
|
| 299 | | {
|
| 300 | | DSP2_op05haslen = 0;
|
| 301 | | DSP2_out_count = DSP2_op05len;
|
| 302 | | DSP2_op05();
|
| 303 | | }
|
| 304 | | else
|
| 305 | | {
|
| 306 | | DSP2_op05len = DSP2_parameters[0];
|
| 307 | | DSP2_in_index = 0;
|
| 308 | | DSP2_in_count = DSP2_op05len * 2;
|
| 309 | | DSP2_op05haslen = 1;
|
| 310 | | if (data)
|
| 311 | | DSP2_waiting_for_command = 0;
|
| 312 | | }
|
| 313 | | break;
|
| 314 | | |
| 315 | | case 0x06:
|
| 316 | | if (DSP2_op06haslen)
|
| 317 | | {
|
| 318 | | DSP2_op06haslen = 0;
|
| 319 | | DSP2_out_count = DSP2_op06len;
|
| 320 | | DSP2_op06();
|
| 321 | | }
|
| 322 | | else
|
| 323 | | {
|
| 324 | | DSP2_op06len = DSP2_parameters[0];
|
| 325 | | DSP2_in_index = 0;
|
| 326 | | DSP2_in_count = DSP2_op06len;
|
| 327 | | DSP2_op06haslen = 1;
|
| 328 | | if (data)
|
| 329 | | DSP2_waiting_for_command = 0;
|
| 330 | | }
|
| 331 | | break;
|
| 332 | | |
| 333 | | case 0x07: break;
|
| 334 | | case 0x08: break;
|
| 335 | | |
| 336 | | case 0x09:
|
| 337 | | DSP2_op09();
|
| 338 | | break;
|
| 339 | | |
| 340 | | case 0x0d:
|
| 341 | | if (DSP2_op0dhaslen)
|
| 342 | | {
|
| 343 | | DSP2_op0dhaslen = 0;
|
| 344 | | DSP2_out_count = DSP2_op0doutlen;
|
| 345 | | DSP2_op0d();
|
| 346 | | }
|
| 347 | | else
|
| 348 | | {
|
| 349 | | DSP2_op0dinlen = DSP2_parameters[0];
|
| 350 | | DSP2_op0doutlen = DSP2_parameters[1];
|
| 351 | | DSP2_in_index = 0;
|
| 352 | | DSP2_in_count = (DSP2_op0dinlen + 1) >> 1;
|
| 353 | | DSP2_op0dhaslen = 1;
|
| 354 | | if(data)
|
| 355 | | DSP2_waiting_for_command = 0;
|
| 356 | | }
|
| 357 | | break;
|
| 358 | | |
| 359 | | case 0x0f:
|
| 360 | | break;
|
| 361 | | }
|
| 362 | | }
|
| 363 | | }
|
| 1 | /*************************************************************************** |
| 2 | |
| 3 | snesdsp2.c |
| 4 | |
| 5 | File to handle emulation of the SNES "DSP-2" add-on chip. |
| 6 | |
| 7 | Original C++ code by byuu, based on research by Overload |
| 8 | |
| 9 | MAME/MESS C conversion by etabeta |
| 10 | |
| 11 | ***************************************************************************/ |
| 12 | |
| 13 | int DSP2_waiting_for_command = 0; |
| 14 | int DSP2_command = 0; |
| 15 | int DSP2_in_count = 0, DSP2_in_index = 0; |
| 16 | int DSP2_out_count = 0, DSP2_out_index = 0; |
| 17 | |
| 18 | UINT8 DSP2_parameters[512] = {0}; |
| 19 | UINT8 DSP2_output[512] = {0}; |
| 20 | |
| 21 | UINT8 DSP2_op05transparent = 0; |
| 22 | int DSP2_op05haslen = 0; |
| 23 | int DSP2_op05len = 0; |
| 24 | int DSP2_op06haslen = 0; |
| 25 | int DSP2_op06len = 0; |
| 26 | UINT16 DSP2_op09word1 = 0; |
| 27 | UINT16 DSP2_op09word2 = 0; |
| 28 | int DSP2_op0dhaslen = 0; |
| 29 | int DSP2_op0doutlen = 0; |
| 30 | int DSP2_op0dinlen = 0; |
| 31 | |
| 32 | |
| 33 | //convert bitmap to bitplane tile |
| 34 | void DSP2_op01( void ) |
| 35 | { |
| 36 | //op01 size is always 32 bytes input and output |
| 37 | //the hardware does strange things if you vary the size |
| 38 | |
| 39 | unsigned char c0, c1, c2, c3; |
| 40 | unsigned char *p1 = DSP2_parameters; |
| 41 | unsigned char *p2a = DSP2_output; |
| 42 | unsigned char *p2b = DSP2_output + 16; //halfway |
| 43 | int j; |
| 44 | |
| 45 | //process 8 blocks of 4 bytes each |
| 46 | for (j = 0; j < 8; j++) |
| 47 | { |
| 48 | c0 = *p1++; |
| 49 | c1 = *p1++; |
| 50 | c2 = *p1++; |
| 51 | c3 = *p1++; |
| 52 | |
| 53 | *p2a++ = (c0 & 0x10) << 3 | |
| 54 | (c0 & 0x01) << 6 | |
| 55 | (c1 & 0x10) << 1 | |
| 56 | (c1 & 0x01) << 4 | |
| 57 | (c2 & 0x10) >> 1 | |
| 58 | (c2 & 0x01) << 2 | |
| 59 | (c3 & 0x10) >> 3 | |
| 60 | (c3 & 0x01); |
| 61 | |
| 62 | *p2a++ = (c0 & 0x20) << 2 | |
| 63 | (c0 & 0x02) << 5 | |
| 64 | (c1 & 0x20) | |
| 65 | (c1 & 0x02) << 3 | |
| 66 | (c2 & 0x20) >> 2 | |
| 67 | (c2 & 0x02) << 1 | |
| 68 | (c3 & 0x20) >> 4 | |
| 69 | (c3 & 0x02) >> 1; |
| 70 | |
| 71 | *p2b++ = (c0 & 0x40) << 1 | |
| 72 | (c0 & 0x04) << 4 | |
| 73 | (c1 & 0x40) >> 1 | |
| 74 | (c1 & 0x04) << 2 | |
| 75 | (c2 & 0x40) >> 3 | |
| 76 | (c2 & 0x04) | |
| 77 | (c3 & 0x40) >> 5 | |
| 78 | (c3 & 0x04) >> 2; |
| 79 | |
| 80 | *p2b++ = (c0 & 0x80) | |
| 81 | (c0 & 0x08) << 3 | |
| 82 | (c1 & 0x80) >> 2 | |
| 83 | (c1 & 0x08) << 1 | |
| 84 | (c2 & 0x80) >> 4 | |
| 85 | (c2 & 0x08) >> 1 | |
| 86 | (c3 & 0x80) >> 6 | |
| 87 | (c3 & 0x08) >> 3; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | //set transparent color |
| 92 | void DSP2_op03( void ) |
| 93 | { |
| 94 | DSP2_op05transparent = DSP2_parameters[0]; |
| 95 | } |
| 96 | |
| 97 | //replace bitmap using transparent color |
| 98 | void DSP2_op05( void ) |
| 99 | { |
| 100 | UINT8 color; |
| 101 | // Overlay bitmap with transparency. |
| 102 | // Input: |
| 103 | // |
| 104 | // Bitmap 1: i[0] <=> i[size-1] |
| 105 | // Bitmap 2: i[size] <=> i[2*size-1] |
| 106 | // |
| 107 | // Output: |
| 108 | // |
| 109 | // Bitmap 3: o[0] <=> o[size-1] |
| 110 | // |
| 111 | // Processing: |
| 112 | // |
| 113 | // Process all 4-bit pixels (nibbles) in the bitmap |
| 114 | // |
| 115 | // if ( BM2_pixel == transparent_color ) |
| 116 | // pixelout = BM1_pixel |
| 117 | // else |
| 118 | // pixelout = BM2_pixel |
| 119 | |
| 120 | // The max size bitmap is limited to 255 because the size parameter is a byte |
| 121 | // I think size=0 is an error. The behavior of the chip on size=0 is to |
| 122 | // return the last value written to DR if you read DR on Op05 with |
| 123 | // size = 0. I don't think it's worth implementing this quirk unless it's |
| 124 | // proven necessary. |
| 125 | |
| 126 | unsigned char c1, c2; |
| 127 | unsigned char *p1 = DSP2_parameters; |
| 128 | unsigned char *p2 = DSP2_parameters + DSP2_op05len; |
| 129 | unsigned char *p3 = DSP2_output; |
| 130 | int n; |
| 131 | |
| 132 | color = DSP2_op05transparent & 0x0f; |
| 133 | |
| 134 | for (n = 0; n < DSP2_op05len; n++) |
| 135 | { |
| 136 | c1 = *p1++; |
| 137 | c2 = *p2++; |
| 138 | *p3++ = ( ((c2 >> 4) == color ) ? c1 & 0xf0 : c2 & 0xf0 ) | |
| 139 | ( ((c2 & 0x0f) == color ) ? c1 & 0x0f : c2 & 0x0f ); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | //reverse bitmap |
| 144 | void DSP2_op06( void ) |
| 145 | { |
| 146 | // Input: |
| 147 | // size |
| 148 | // bitmap |
| 149 | int i, j; |
| 150 | for (i = 0, j = DSP2_op06len - 1; i < DSP2_op06len; i++, j--) |
| 151 | { |
| 152 | DSP2_output[j] = (DSP2_parameters[i] << 4) | (DSP2_parameters[i] >> 4); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | //multiply |
| 157 | void DSP2_op09( void ) |
| 158 | { |
| 159 | UINT32 r = 0; |
| 160 | DSP2_out_count = 4; |
| 161 | |
| 162 | DSP2_op09word1 = DSP2_parameters[0] | (DSP2_parameters[1] << 8); |
| 163 | DSP2_op09word2 = DSP2_parameters[2] | (DSP2_parameters[3] << 8); |
| 164 | |
| 165 | r = DSP2_op09word1 * DSP2_op09word2; |
| 166 | DSP2_output[0] = r; |
| 167 | DSP2_output[1] = r >> 8; |
| 168 | DSP2_output[2] = r >> 16; |
| 169 | DSP2_output[3] = r >> 24; |
| 170 | } |
| 171 | |
| 172 | //scale bitmap |
| 173 | void DSP2_op0d( void ) |
| 174 | { |
| 175 | // Bit accurate hardware algorithm - uses fixed point math |
| 176 | // This should match the DSP2 Op0D output exactly |
| 177 | // I wouldn't recommend using this unless you're doing hardware debug. |
| 178 | // In some situations it has small visual artifacts that |
| 179 | // are not readily apparent on a TV screen but show up clearly |
| 180 | // on a monitor. Use Overload's scaling instead. |
| 181 | // This is for hardware verification testing. |
| 182 | // |
| 183 | // One note: the HW can do odd byte scaling but since we divide |
| 184 | // by two to get the count of bytes this won't work well for |
| 185 | // odd byte scaling (in any of the current algorithm implementations). |
| 186 | // So far I haven't seen Dungeon Master use it. |
| 187 | // If it does we can adjust the parameters and code to work with it |
| 188 | |
| 189 | UINT32 multiplier; // Any size int >= 32-bits |
| 190 | UINT32 pixloc; // match size of multiplier |
| 191 | int i, j; |
| 192 | UINT8 pixelarray[512]; |
| 193 | if (DSP2_op0dinlen <= DSP2_op0doutlen) |
| 194 | { |
| 195 | multiplier = 0x10000; // In our self defined fixed point 0x10000 == 1 |
| 196 | } |
| 197 | else |
| 198 | { |
| 199 | multiplier = (DSP2_op0dinlen << 17) / ((DSP2_op0doutlen << 1) + 1); |
| 200 | } |
| 201 | |
| 202 | pixloc = 0; |
| 203 | for (i = 0; i < DSP2_op0doutlen * 2; i++) |
| 204 | { |
| 205 | j = pixloc >> 16; |
| 206 | |
| 207 | if (j & 1) |
| 208 | pixelarray[i] = (DSP2_parameters[j >> 1] & 0x0f); |
| 209 | else |
| 210 | pixelarray[i] = (DSP2_parameters[j >> 1] & 0xf0) >> 4; |
| 211 | |
| 212 | pixloc += multiplier; |
| 213 | } |
| 214 | |
| 215 | for (i = 0; i < DSP2_op0doutlen; i++) |
| 216 | { |
| 217 | DSP2_output[i] = (pixelarray[i << 1] << 4) | pixelarray[(i << 1) + 1]; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | |
| 222 | void DSP2_reset( void ) |
| 223 | { |
| 224 | DSP2_waiting_for_command = 1; |
| 225 | DSP2_in_count = 0; |
| 226 | DSP2_in_index = 0; |
| 227 | DSP2_out_count = 0; |
| 228 | DSP2_out_index = 0; |
| 229 | |
| 230 | DSP2_op05transparent = 0; |
| 231 | DSP2_op05haslen = 0; |
| 232 | DSP2_op05len = 0; |
| 233 | DSP2_op06haslen = 0; |
| 234 | DSP2_op06len = 0; |
| 235 | DSP2_op09word1 = 0; |
| 236 | DSP2_op09word2 = 0; |
| 237 | DSP2_op0dhaslen = 0; |
| 238 | DSP2_op0doutlen = 0; |
| 239 | DSP2_op0dinlen = 0; |
| 240 | } |
| 241 | |
| 242 | UINT8 DSP2_read( void ) |
| 243 | { |
| 244 | UINT8 r = 0xff; |
| 245 | if (DSP2_out_count) |
| 246 | { |
| 247 | r = DSP2_output[DSP2_out_index++]; |
| 248 | DSP2_out_index &= 511; |
| 249 | if (DSP2_out_count == DSP2_out_index) |
| 250 | DSP2_out_count = 0; |
| 251 | } |
| 252 | return r; |
| 253 | } |
| 254 | |
| 255 | void DSP2_write(UINT8 data) |
| 256 | { |
| 257 | if(DSP2_waiting_for_command) |
| 258 | { |
| 259 | DSP2_command = data; |
| 260 | DSP2_in_index = 0; |
| 261 | DSP2_waiting_for_command = 0; |
| 262 | |
| 263 | switch (data) |
| 264 | { |
| 265 | case 0x01: DSP2_in_count = 32; break; |
| 266 | case 0x03: DSP2_in_count = 1; break; |
| 267 | case 0x05: DSP2_in_count = 1; break; |
| 268 | case 0x06: DSP2_in_count = 1; break; |
| 269 | case 0x07: break; |
| 270 | case 0x08: break; |
| 271 | case 0x09: DSP2_in_count = 4; break; |
| 272 | case 0x0d: DSP2_in_count = 2; break; |
| 273 | case 0x0f: DSP2_in_count = 0; break; |
| 274 | } |
| 275 | } |
| 276 | else |
| 277 | { |
| 278 | DSP2_parameters[DSP2_in_index++] = data; |
| 279 | DSP2_in_index &= 511; |
| 280 | } |
| 281 | |
| 282 | if (DSP2_in_count == DSP2_in_index) |
| 283 | { |
| 284 | DSP2_waiting_for_command = 1; |
| 285 | DSP2_out_index = 0; |
| 286 | switch (DSP2_command) |
| 287 | { |
| 288 | case 0x01: |
| 289 | DSP2_out_count = 32; |
| 290 | DSP2_op01(); |
| 291 | break; |
| 292 | |
| 293 | case 0x03: |
| 294 | DSP2_op03(); |
| 295 | break; |
| 296 | |
| 297 | case 0x05: |
| 298 | if (DSP2_op05haslen) |
| 299 | { |
| 300 | DSP2_op05haslen = 0; |
| 301 | DSP2_out_count = DSP2_op05len; |
| 302 | DSP2_op05(); |
| 303 | } |
| 304 | else |
| 305 | { |
| 306 | DSP2_op05len = DSP2_parameters[0]; |
| 307 | DSP2_in_index = 0; |
| 308 | DSP2_in_count = DSP2_op05len * 2; |
| 309 | DSP2_op05haslen = 1; |
| 310 | if (data) |
| 311 | DSP2_waiting_for_command = 0; |
| 312 | } |
| 313 | break; |
| 314 | |
| 315 | case 0x06: |
| 316 | if (DSP2_op06haslen) |
| 317 | { |
| 318 | DSP2_op06haslen = 0; |
| 319 | DSP2_out_count = DSP2_op06len; |
| 320 | DSP2_op06(); |
| 321 | } |
| 322 | else |
| 323 | { |
| 324 | DSP2_op06len = DSP2_parameters[0]; |
| 325 | DSP2_in_index = 0; |
| 326 | DSP2_in_count = DSP2_op06len; |
| 327 | DSP2_op06haslen = 1; |
| 328 | if (data) |
| 329 | DSP2_waiting_for_command = 0; |
| 330 | } |
| 331 | break; |
| 332 | |
| 333 | case 0x07: break; |
| 334 | case 0x08: break; |
| 335 | |
| 336 | case 0x09: |
| 337 | DSP2_op09(); |
| 338 | break; |
| 339 | |
| 340 | case 0x0d: |
| 341 | if (DSP2_op0dhaslen) |
| 342 | { |
| 343 | DSP2_op0dhaslen = 0; |
| 344 | DSP2_out_count = DSP2_op0doutlen; |
| 345 | DSP2_op0d(); |
| 346 | } |
| 347 | else |
| 348 | { |
| 349 | DSP2_op0dinlen = DSP2_parameters[0]; |
| 350 | DSP2_op0doutlen = DSP2_parameters[1]; |
| 351 | DSP2_in_index = 0; |
| 352 | DSP2_in_count = (DSP2_op0dinlen + 1) >> 1; |
| 353 | DSP2_op0dhaslen = 1; |
| 354 | if(data) |
| 355 | DSP2_waiting_for_command = 0; |
| 356 | } |
| 357 | break; |
| 358 | |
| 359 | case 0x0f: |
| 360 | break; |
| 361 | } |
| 362 | } |
| 363 | } |
src/mess/audio/cdp1863.c
| r3455 | r3456 | |
| 1 | | /*
|
| 2 | | |
| 3 | | TODO:
|
| 4 | | |
| 5 | | - what happens if you connect both clocks?
|
| 6 | | - convert to sound device when possible
|
| 7 | | |
| 8 | | */
|
| 9 | | |
| 10 | | #include "driver.h"
|
| 11 | | #include "sndintrf.h"
|
| 12 | | #include "streams.h"
|
| 13 | | #include "cpu/cdp1802/cdp1802.h"
|
| 14 | | #include "audio/cdp1863.h"
|
| 15 | | |
| 16 | | #define CDP1863_DEFAULT_LATCH 0x35
|
| 17 | | |
| 18 | | typedef struct _cdp1863_t cdp1863_t;
|
| 19 | | struct _cdp1863_t
|
| 20 | | {
|
| 21 | | const cdp1863_interface *intf; /* interface */
|
| 22 | | |
| 23 | | sound_stream *stream; /* sound output */
|
| 24 | | |
| 25 | | /* sound state */
|
| 26 | | int oe; /* output enable */
|
| 27 | | int latch; /* sound latch */
|
| 28 | | INT16 signal; /* current signal */
|
| 29 | | int incr; /* initial wave state */
|
| 30 | | };
|
| 31 | | |
| 32 | | INLINE cdp1863_t *get_safe_token(const device_config *device)
|
| 33 | | {
|
| 34 | | assert(device != NULL);
|
| 35 | | assert(device->token != NULL);
|
| 36 | | |
| 37 | | return (cdp1863_t *)device->token;
|
| 38 | | }
|
| 39 | | |
| 40 | | /* Load Tone Latch */
|
| 41 | | |
| 42 | | WRITE8_DEVICE_HANDLER( cdp1863_str_w )
|
| 43 | | {
|
| 44 | | cdp1863_t *cdp1863 = get_safe_token(device);
|
| 45 | | double frequency;
|
| 46 | | |
| 47 | | cdp1863->latch = data;
|
| 48 | | |
| 49 | | if (cdp1863->intf->clock1 > 0)
|
| 50 | | {
|
| 51 | | /* CLK1 is pre-divided by 4 */
|
| 52 | | frequency = cdp1863->intf->clock1 / 4 / (data + 1) / 2;
|
| 53 | | }
|
| 54 | | else
|
| 55 | | {
|
| 56 | | /* CLK2 is pre-divided by 8 */
|
| 57 | | frequency = cdp1863->intf->clock2 / 8 / (data + 1) / 2;
|
| 58 | | }
|
| 59 | | |
| 60 | | beep_set_frequency(0, frequency);
|
| 61 | | }
|
| 62 | | |
| 63 | | /* Output Enable */
|
| 64 | | |
| 65 | | void cdp1863_oe_w(const device_config *device, int level)
|
| 66 | | {
|
| 67 | | cdp1863_t *cdp1863 = get_safe_token(device);
|
| 68 | | |
| 69 | | cdp1863->oe = level;
|
| 70 | | |
| 71 | | beep_set_state(0, level);
|
| 72 | | }
|
| 73 | | |
| 74 | | #ifdef UNUSED_FUNCTION
|
| 75 | | static void cdp1863_sound_update(const device_config *device, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
| 76 | | {
|
| 77 | | cdp1863_t *cdp1863 = get_safe_token(device);
|
| 78 | | |
| 79 | | INT16 signal = cdp1863->signal;
|
| 80 | | stream_sample_t *buffer = _buffer[0];
|
| 81 | | |
| 82 | | memset(buffer, 0, length * sizeof(*buffer));
|
| 83 | | |
| 84 | | if (cdp1863->oe)
|
| 85 | | {
|
| 86 | | double frequency;
|
| 87 | | int rate = device->machine->sample_rate / 2;
|
| 88 | | |
| 89 | | /* get progress through wave */
|
| 90 | | int incr = cdp1863->incr;
|
| 91 | | |
| 92 | | if (cdp1863->intf->clock1 > 0)
|
| 93 | | {
|
| 94 | | /* CLK1 is pre-divided by 4 */
|
| 95 | | frequency = cdp1863->intf->clock1 / 4 / (cdp1863->latch + 1) / 2;
|
| 96 | | }
|
| 97 | | else
|
| 98 | | {
|
| 99 | | /* CLK2 is pre-divided by 8 */
|
| 100 | | frequency = cdp1863->intf->clock2 / 8 / (cdp1863->latch + 1) / 2;
|
| 101 | | }
|
| 102 | | |
| 103 | | if (signal < 0)
|
| 104 | | {
|
| 105 | | signal = -0x7fff;
|
| 106 | | }
|
| 107 | | else
|
| 108 | | {
|
| 109 | | signal = 0x7fff;
|
| 110 | | }
|
| 111 | | |
| 112 | | while( length-- > 0 )
|
| 113 | | {
|
| 114 | | *buffer++ = signal;
|
| 115 | | incr -= frequency;
|
| 116 | | while( incr < 0 )
|
| 117 | | {
|
| 118 | | incr += rate;
|
| 119 | | signal = -signal;
|
| 120 | | }
|
| 121 | | }
|
| 122 | | |
| 123 | | /* store progress through wave */
|
| 124 | | cdp1863->incr = incr;
|
| 125 | | cdp1863->signal = signal;
|
| 126 | | }
|
| 127 | | }
|
| 128 | | #endif
|
| 129 | | |
| 130 | | /* Device Interface */
|
| 131 | | |
| 132 | | static DEVICE_START( cdp1863 )
|
| 133 | | {
|
| 134 | | cdp1863_t *cdp1863 = get_safe_token(device);
|
| 135 | | char unique_tag[30];
|
| 136 | | |
| 137 | | /* validate arguments */
|
| 138 | | assert(device != NULL);
|
| 139 | | assert(device->tag != NULL);
|
| 140 | | assert(strlen(device->tag) < 20);
|
| 141 | | |
| 142 | | cdp1863->intf = device->static_config;
|
| 143 | | |
| 144 | | assert(cdp1863->intf != NULL);
|
| 145 | | assert((cdp1863->intf->clock1 > 0) || (cdp1863->intf->clock2 > 0));
|
| 146 | | |
| 147 | | cdp1863->oe = 1;
|
| 148 | | |
| 149 | | /* register for state saving */
|
| 150 | | state_save_combine_module_and_tag(unique_tag, "CDP1863", device->tag);
|
| 151 | | |
| 152 | | state_save_register_item(unique_tag, 0, cdp1863->oe);
|
| 153 | | state_save_register_item(unique_tag, 0, cdp1863->latch);
|
| 154 | | state_save_register_item(unique_tag, 0, cdp1863->signal);
|
| 155 | | state_save_register_item(unique_tag, 0, cdp1863->incr);
|
| 156 | | |
| 157 | | return DEVICE_START_OK;
|
| 158 | | }
|
| 159 | | |
| 160 | | static DEVICE_RESET( cdp1863 )
|
| 161 | | {
|
| 162 | | cdp1863_t *cdp1863 = get_safe_token(device);
|
| 163 | | |
| 164 | | cdp1863->latch = CDP1863_DEFAULT_LATCH;
|
| 165 | | }
|
| 166 | | |
| 167 | | static DEVICE_SET_INFO( cdp1863 )
|
| 168 | | {
|
| 169 | | switch (state)
|
| 170 | | {
|
| 171 | | /* no parameters to set */
|
| 172 | | }
|
| 173 | | }
|
| 174 | | |
| 175 | | DEVICE_GET_INFO( cdp1863 )
|
| 176 | | {
|
| 177 | | switch (state)
|
| 178 | | {
|
| 179 | | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 180 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1863_t); break;
|
| 181 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 182 | | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
| 183 | | |
| 184 | | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 185 | | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cdp1863); break;
|
| 186 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1863); break;
|
| 187 | | case DEVINFO_FCT_STOP: /* Nothing */ break;
|
| 188 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(cdp1863); break;
|
| 189 | | |
| 190 | | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 191 | | case DEVINFO_STR_NAME: info->s = "RCA CDP1863"; break;
|
| 192 | | case DEVINFO_STR_FAMILY: info->s = "RCA CDP1800"; break;
|
| 193 | | case DEVINFO_STR_VERSION: info->s = "1.0"; break;
|
| 194 | | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break;
|
| 195 | | case DEVINFO_STR_CREDITS: info->s = "Copyright MESS Team"; break;
|
| 196 | | }
|
| 197 | | }
|
| 1 | /* |
| 2 | |
| 3 | TODO: |
| 4 | |
| 5 | - what happens if you connect both clocks? |
| 6 | - convert to sound device when possible |
| 7 | |
| 8 | */ |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "sndintrf.h" |
| 12 | #include "streams.h" |
| 13 | #include "cpu/cdp1802/cdp1802.h" |
| 14 | #include "audio/cdp1863.h" |
| 15 | |
| 16 | #define CDP1863_DEFAULT_LATCH 0x35 |
| 17 | |
| 18 | typedef struct _cdp1863_t cdp1863_t; |
| 19 | struct _cdp1863_t |
| 20 | { |
| 21 | const cdp1863_interface *intf; /* interface */ |
| 22 | |
| 23 | sound_stream *stream; /* sound output */ |
| 24 | |
| 25 | /* sound state */ |
| 26 | int oe; /* output enable */ |
| 27 | int latch; /* sound latch */ |
| 28 | INT16 signal; /* current signal */ |
| 29 | int incr; /* initial wave state */ |
| 30 | }; |
| 31 | |
| 32 | INLINE cdp1863_t *get_safe_token(const device_config *device) |
| 33 | { |
| 34 | assert(device != NULL); |
| 35 | assert(device->token != NULL); |
| 36 | |
| 37 | return (cdp1863_t *)device->token; |
| 38 | } |
| 39 | |
| 40 | /* Load Tone Latch */ |
| 41 | |
| 42 | WRITE8_DEVICE_HANDLER( cdp1863_str_w ) |
| 43 | { |
| 44 | cdp1863_t *cdp1863 = get_safe_token(device); |
| 45 | double frequency; |
| 46 | |
| 47 | cdp1863->latch = data; |
| 48 | |
| 49 | if (cdp1863->intf->clock1 > 0) |
| 50 | { |
| 51 | /* CLK1 is pre-divided by 4 */ |
| 52 | frequency = cdp1863->intf->clock1 / 4 / (data + 1) / 2; |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | /* CLK2 is pre-divided by 8 */ |
| 57 | frequency = cdp1863->intf->clock2 / 8 / (data + 1) / 2; |
| 58 | } |
| 59 | |
| 60 | beep_set_frequency(0, frequency); |
| 61 | } |
| 62 | |
| 63 | /* Output Enable */ |
| 64 | |
| 65 | void cdp1863_oe_w(const device_config *device, int level) |
| 66 | { |
| 67 | cdp1863_t *cdp1863 = get_safe_token(device); |
| 68 | |
| 69 | cdp1863->oe = level; |
| 70 | |
| 71 | beep_set_state(0, level); |
| 72 | } |
| 73 | |
| 74 | #ifdef UNUSED_FUNCTION |
| 75 | static void cdp1863_sound_update(const device_config *device, stream_sample_t **inputs, stream_sample_t **_buffer, int length) |
| 76 | { |
| 77 | cdp1863_t *cdp1863 = get_safe_token(device); |
| 78 | |
| 79 | INT16 signal = cdp1863->signal; |
| 80 | stream_sample_t *buffer = _buffer[0]; |
| 81 | |
| 82 | memset(buffer, 0, length * sizeof(*buffer)); |
| 83 | |
| 84 | if (cdp1863->oe) |
| 85 | { |
| 86 | double frequency; |
| 87 | int rate = device->machine->sample_rate / 2; |
| 88 | |
| 89 | /* get progress through wave */ |
| 90 | int incr = cdp1863->incr; |
| 91 | |
| 92 | if (cdp1863->intf->clock1 > 0) |
| 93 | { |
| 94 | /* CLK1 is pre-divided by 4 */ |
| 95 | frequency = cdp1863->intf->clock1 / 4 / (cdp1863->latch + 1) / 2; |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | /* CLK2 is pre-divided by 8 */ |
| 100 | frequency = cdp1863->intf->clock2 / 8 / (cdp1863->latch + 1) / 2; |
| 101 | } |
| 102 | |
| 103 | if (signal < 0) |
| 104 | { |
| 105 | signal = -0x7fff; |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | signal = 0x7fff; |
| 110 | } |
| 111 | |
| 112 | while( length-- > 0 ) |
| 113 | { |
| 114 | *buffer++ = signal; |
| 115 | incr -= frequency; |
| 116 | while( incr < 0 ) |
| 117 | { |
| 118 | incr += rate; |
| 119 | signal = -signal; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | /* store progress through wave */ |
| 124 | cdp1863->incr = incr; |
| 125 | cdp1863->signal = signal; |
| 126 | } |
| 127 | } |
| 128 | #endif |
| 129 | |
| 130 | /* Device Interface */ |
| 131 | |
| 132 | static DEVICE_START( cdp1863 ) |
| 133 | { |
| 134 | cdp1863_t *cdp1863 = get_safe_token(device); |
| 135 | char unique_tag[30]; |
| 136 | |
| 137 | /* validate arguments */ |
| 138 | assert(device != NULL); |
| 139 | assert(device->tag != NULL); |
| 140 | assert(strlen(device->tag) < 20); |
| 141 | |
| 142 | cdp1863->intf = device->static_config; |
| 143 | |
| 144 | assert(cdp1863->intf != NULL); |
| 145 | assert((cdp1863->intf->clock1 > 0) || (cdp1863->intf->clock2 > 0)); |
| 146 | |
| 147 | cdp1863->oe = 1; |
| 148 | |
| 149 | /* register for state saving */ |
| 150 | state_save_combine_module_and_tag(unique_tag, "CDP1863", device->tag); |
| 151 | |
| 152 | state_save_register_item(unique_tag, 0, cdp1863->oe); |
| 153 | state_save_register_item(unique_tag, 0, cdp1863->latch); |
| 154 | state_save_register_item(unique_tag, 0, cdp1863->signal); |
| 155 | state_save_register_item(unique_tag, 0, cdp1863->incr); |
| 156 | |
| 157 | return DEVICE_START_OK; |
| 158 | } |
| 159 | |
| 160 | static DEVICE_RESET( cdp1863 ) |
| 161 | { |
| 162 | cdp1863_t *cdp1863 = get_safe_token(device); |
| 163 | |
| 164 | cdp1863->latch = CDP1863_DEFAULT_LATCH; |
| 165 | } |
| 166 | |
| 167 | static DEVICE_SET_INFO( cdp1863 ) |
| 168 | { |
| 169 | switch (state) |
| 170 | { |
| 171 | /* no parameters to set */ |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | DEVICE_GET_INFO( cdp1863 ) |
| 176 | { |
| 177 | switch (state) |
| 178 | { |
| 179 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 180 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1863_t); break; |
| 181 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 182 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 183 | |
| 184 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 185 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cdp1863); break; |
| 186 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1863); break; |
| 187 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 188 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(cdp1863); break; |
| 189 | |
| 190 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 191 | case DEVINFO_STR_NAME: info->s = "RCA CDP1863"; break; |
| 192 | case DEVINFO_STR_FAMILY: info->s = "RCA CDP1800"; break; |
| 193 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; |
| 194 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; |
| 195 | case DEVINFO_STR_CREDITS: info->s = "Copyright MESS Team"; break; |
| 196 | } |
| 197 | } |
src/mess/video/cdp1862.c
| r3455 | r3456 | |
| 1 | | /*
|
| 2 | | |
| 3 | | TODO:
|
| 4 | | |
| 5 | | - NTSC output, currently using RGB
|
| 6 | | |
| 7 | | */
|
| 8 | | |
| 9 | | #include "driver.h"
|
| 10 | | #include "cdp1862.h"
|
| 11 | | |
| 12 | | typedef struct _cdp1862_t cdp1862_t;
|
| 13 | | struct _cdp1862_t
|
| 14 | | {
|
| 15 | | const cdp1862_interface *intf;
|
| 16 | | |
| 17 | | const device_config *screen; /* screen */
|
| 18 | | bitmap_t *bitmap; /* bitmap */
|
| 19 | | |
| 20 | | int bgcolor; /* background color */
|
| 21 | | int con; /* color on */
|
| 22 | | };
|
| 23 | | |
| 24 | | static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
|
| 25 | | |
| 26 | | INLINE cdp1862_t *get_safe_token(const device_config *device)
|
| 27 | | {
|
| 28 | | assert(device != NULL);
|
| 29 | | assert(device->token != NULL);
|
| 30 | | |
| 31 | | return (cdp1862_t *)device->token;
|
| 32 | | }
|
| 33 | | |
| 34 | | /* Palette Initialization */
|
| 35 | | |
| 36 | | static void cdp1862_init_palette(const device_config *device)
|
| 37 | | {
|
| 38 | | cdp1862_t *cdp1862 = get_safe_token(device);
|
| 39 | | int i;
|
| 40 | | |
| 41 | | double res_total = cdp1862->intf->res_r + cdp1862->intf->res_g + cdp1862->intf->res_b + cdp1862->intf->res_bkg;
|
| 42 | | |
| 43 | | int weight_r = (cdp1862->intf->res_r / res_total) * 100;
|
| 44 | | int weight_g = (cdp1862->intf->res_g / res_total) * 100;
|
| 45 | | int weight_b = (cdp1862->intf->res_b / res_total) * 100;
|
| 46 | | int weight_bkg = (cdp1862->intf->res_bkg / res_total) * 100;
|
| 47 | | |
| 48 | | for (i = 0; i < 16; i++)
|
| 49 | | {
|
| 50 | | int r, g, b, luma = 0;
|
| 51 | | |
| 52 | | luma += (i & 4) ? weight_r : 0;
|
| 53 | | luma += (i & 1) ? weight_g : 0;
|
| 54 | | luma += (i & 2) ? weight_b : 0;
|
| 55 | | luma += (i & 8) ? 0 : weight_bkg;
|
| 56 | | |
| 57 | | luma = (luma * 0xff) / 100;
|
| 58 | | |
| 59 | | r = (i & 4) ? luma : 0;
|
| 60 | | g = (i & 1) ? luma : 0;
|
| 61 | | b = (i & 2) ? luma : 0;
|
| 62 | | |
| 63 | | palette_set_color_rgb( device->machine, i, r, g, b );
|
| 64 | | }
|
| 65 | | }
|
| 66 | | |
| 67 | | /* Step Background Color */
|
| 68 | | |
| 69 | | WRITE8_DEVICE_HANDLER( cdp1862_bkg_w )
|
| 70 | | {
|
| 71 | | cdp1862_t *cdp1862 = get_safe_token(device);
|
| 72 | | |
| 73 | | if (++cdp1862->bgcolor > 3) cdp1862->bgcolor = 0;
|
| 74 | | }
|
| 75 | | |
| 76 | | /* DMA write */
|
| 77 | | |
| 78 | | void cdp1862_dma_w(const device_config *device, UINT8 data, int color_on, int rdata, int gdata, int bdata)
|
| 79 | | {
|
| 80 | | cdp1862_t *cdp1862 = get_safe_token(device);
|
| 81 | | |
| 82 | | int sx = video_screen_get_hpos(cdp1862->screen) + 4;
|
| 83 | | int y = video_screen_get_vpos(cdp1862->screen);
|
| 84 | | int x;
|
| 85 | | |
| 86 | | if (color_on == ASSERT_LINE)
|
| 87 | | {
|
| 88 | | /* enable color data input latch */
|
| 89 | | cdp1862->con = ASSERT_LINE;
|
| 90 | | }
|
| 91 | |
|
| 92 | | if (cdp1862->con == CLEAR_LINE)
|
| 93 | | {
|
| 94 | | /* latch white dot color */
|
| 95 | | rdata = 1;
|
| 96 | | gdata = 1;
|
| 97 | | bdata = 1;
|
| 98 | | }
|
| 99 | | |
| 100 | | for (x = 0; x < 8; x++)
|
| 101 | | {
|
| 102 | | int color = CDP1862_BACKGROUND_COLOR_SEQUENCE[cdp1862->bgcolor] + 8;
|
| 103 | | |
| 104 | | if (BIT(data, 7))
|
| 105 | | {
|
| 106 | | color = (gdata << 2) | (bdata << 1) | rdata;
|
| 107 | | }
|
| 108 | | |
| 109 | | *BITMAP_ADDR16(cdp1862->bitmap, y, sx + x) = color;
|
| 110 | | |
| 111 | | data <<= 1;
|
| 112 | | }
|
| 113 | | }
|
| 114 | | |
| 115 | | /* Screen Update */
|
| 116 | | |
| 117 | | void cdp1862_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
|
| 118 | | {
|
| 119 | | cdp1862_t *cdp1862 = get_safe_token(device);
|
| 120 | | |
| 121 | | copybitmap(bitmap, cdp1862->bitmap, 0, 0, 0, 0, cliprect);
|
| 122 | | fillbitmap(cdp1862->bitmap, CDP1862_BACKGROUND_COLOR_SEQUENCE[cdp1862->bgcolor] + 8, cliprect);
|
| 123 | | }
|
| 124 | | |
| 125 | | /* Device Interface */
|
| 126 | | |
| 127 | | static DEVICE_START( cdp1862 )
|
| 128 | | {
|
| 129 | | cdp1862_t *cdp1862 = get_safe_token(device);
|
| 130 | | char unique_tag[30];
|
| 131 | | |
| 132 | | /* validate arguments */
|
| 133 | | assert(device != NULL);
|
| 134 | | assert(device->tag != NULL);
|
| 135 | | assert(strlen(device->tag) < 20);
|
| 136 | | |
| 137 | | cdp1862->intf = device->static_config;
|
| 138 | | |
| 139 | | assert(cdp1862->intf != NULL);
|
| 140 | | assert(cdp1862->intf->clock > 0);
|
| 141 | | |
| 142 | | /* get the screen device */
|
| 143 | | cdp1862->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1862->intf->screen_tag);
|
| 144 | | assert(cdp1862->screen != NULL);
|
| 145 | | |
| 146 | | /* allocate the temporary bitmap */
|
| 147 | | cdp1862->bitmap = auto_bitmap_alloc(video_screen_get_width(cdp1862->screen), video_screen_get_height(cdp1862->screen), video_screen_get_format(cdp1862->screen));
|
| 148 | | |
| 149 | | /* initialize the palette */
|
| 150 | | cdp1862_init_palette(device);
|
| 151 | | |
| 152 | | /* register for state saving */
|
| 153 | | state_save_combine_module_and_tag(unique_tag, "cdp1862", device->tag);
|
| 154 | | |
| 155 | | state_save_register_item(unique_tag, 0, cdp1862->bgcolor);
|
| 156 | | state_save_register_item(unique_tag, 0, cdp1862->con);
|
| 157 | | |
| 158 | | state_save_register_bitmap(unique_tag, 0, "cdp1862->bitmap", cdp1862->bitmap);
|
| 159 | | |
| 160 | | return DEVICE_START_OK;
|
| 161 | | }
|
| 162 | | |
| 163 | | static DEVICE_RESET( cdp1862 )
|
| 164 | | {
|
| 165 | | cdp1862_t *cdp1862 = get_safe_token(device);
|
| 166 | | |
| 167 | | cdp1862->bgcolor = 0;
|
| 168 | | cdp1862->con = CLEAR_LINE;
|
| 169 | | }
|
| 170 | | |
| 171 | | static DEVICE_SET_INFO( cdp1862 )
|
| 172 | | {
|
| 173 | | switch (state)
|
| 174 | | {
|
| 175 | | /* no parameters to set */
|
| 176 | | }
|
| 177 | | }
|
| 178 | | |
| 179 | | DEVICE_GET_INFO( cdp1862 )
|
| 180 | | {
|
| 181 | | switch (state)
|
| 182 | | {
|
| 183 | | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 184 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1862_t); break;
|
| 185 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 186 | | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
| 187 | | |
| 188 | | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 189 | | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cdp1862); break;
|
| 190 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1862); break;
|
| 191 | | case DEVINFO_FCT_STOP: /* Nothing */ break;
|
| 192 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(cdp1862); break;
|
| 193 | | |
| 194 | | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 195 | | case DEVINFO_STR_NAME: info->s = "RCA CDP1862"; break;
|
| 196 | | case DEVINFO_STR_FAMILY: info->s = "RCA CDP1800"; break;
|
| 197 | | case DEVINFO_STR_VERSION: info->s = "1.0"; break;
|
| 198 | | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break;
|
| 199 | | case DEVINFO_STR_CREDITS: info->s = "Copyright MESS Team"; break;
|
| 200 | | }
|
| 201 | | }
|
| 1 | /* |
| 2 | |
| 3 | TODO: |
| 4 | |
| 5 | - NTSC output, currently using RGB |
| 6 | |
| 7 | */ |
| 8 | |
| 9 | #include "driver.h" |
| 10 | #include "cdp1862.h" |
| 11 | |
| 12 | typedef struct _cdp1862_t cdp1862_t; |
| 13 | struct _cdp1862_t |
| 14 | { |
| 15 | const cdp1862_interface *intf; |
| 16 | |
| 17 | const device_config *screen; /* screen */ |
| 18 | bitmap_t *bitmap; /* bitmap */ |
| 19 | |
| 20 | int bgcolor; /* background color */ |
| 21 | int con; /* color on */ |
| 22 | }; |
| 23 | |
| 24 | static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 }; |
| 25 | |
| 26 | INLINE cdp1862_t *get_safe_token(const device_config *device) |
| 27 | { |
| 28 | assert(device != NULL); |
| 29 | assert(device->token != NULL); |
| 30 | |
| 31 | return (cdp1862_t *)device->token; |
| 32 | } |
| 33 | |
| 34 | /* Palette Initialization */ |
| 35 | |
| 36 | static void cdp1862_init_palette(const device_config *device) |
| 37 | { |
| 38 | cdp1862_t *cdp1862 = get_safe_token(device); |
| 39 | int i; |
| 40 | |
| 41 | double res_total = cdp1862->intf->res_r + cdp1862->intf->res_g + cdp1862->intf->res_b + cdp1862->intf->res_bkg; |
| 42 | |
| 43 | int weight_r = (cdp1862->intf->res_r / res_total) * 100; |
| 44 | int weight_g = (cdp1862->intf->res_g / res_total) * 100; |
| 45 | int weight_b = (cdp1862->intf->res_b / res_total) * 100; |
| 46 | int weight_bkg = (cdp1862->intf->res_bkg / res_total) * 100; |
| 47 | |
| 48 | for (i = 0; i < 16; i++) |
| 49 | { |
| 50 | int r, g, b, luma = 0; |
| 51 | |
| 52 | luma += (i & 4) ? weight_r : 0; |
| 53 | luma += (i & 1) ? weight_g : 0; |
| 54 | luma += (i & 2) ? weight_b : 0; |
| 55 | luma += (i & 8) ? 0 : weight_bkg; |
| 56 | |
| 57 | luma = (luma * 0xff) / 100; |
| 58 | |
| 59 | r = (i & 4) ? luma : 0; |
| 60 | g = (i & 1) ? luma : 0; |
| 61 | b = (i & 2) ? luma : 0; |
| 62 | |
| 63 | palette_set_color_rgb( device->machine, i, r, g, b ); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /* Step Background Color */ |
| 68 | |
| 69 | WRITE8_DEVICE_HANDLER( cdp1862_bkg_w ) |
| 70 | { |
| 71 | cdp1862_t *cdp1862 = get_safe_token(device); |
| 72 | |
| 73 | if (++cdp1862->bgcolor > 3) cdp1862->bgcolor = 0; |
| 74 | } |
| 75 | |
| 76 | /* DMA write */ |
| 77 | |
| 78 | void cdp1862_dma_w(const device_config *device, UINT8 data, int color_on, int rdata, int gdata, int bdata) |
| 79 | { |
| 80 | cdp1862_t *cdp1862 = get_safe_token(device); |
| 81 | |
| 82 | int sx = video_screen_get_hpos(cdp1862->screen) + 4; |
| 83 | int y = video_screen_get_vpos(cdp1862->screen); |
| 84 | int x; |
| 85 | |
| 86 | if (color_on == ASSERT_LINE) |
| 87 | { |
| 88 | /* enable color data input latch */ |
| 89 | cdp1862->con = ASSERT_LINE; |
| 90 | } |
| 91 | |
| 92 | if (cdp1862->con == CLEAR_LINE) |
| 93 | { |
| 94 | /* latch white dot color */ |
| 95 | rdata = 1; |
| 96 | gdata = 1; |
| 97 | bdata = 1; |
| 98 | } |
| 99 | |
| 100 | for (x = 0; x < 8; x++) |
| 101 | { |
| 102 | int color = CDP1862_BACKGROUND_COLOR_SEQUENCE[cdp1862->bgcolor] + 8; |
| 103 | |
| 104 | if (BIT(data, 7)) |
| 105 | { |
| 106 | color = (gdata << 2) | (bdata << 1) | rdata; |
| 107 | } |
| 108 | |
| 109 | *BITMAP_ADDR16(cdp1862->bitmap, y, sx + x) = color; |
| 110 | |
| 111 | data <<= 1; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /* Screen Update */ |
| 116 | |
| 117 | void cdp1862_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect) |
| 118 | { |
| 119 | cdp1862_t *cdp1862 = get_safe_token(device); |
| 120 | |
| 121 | copybitmap(bitmap, cdp1862->bitmap, 0, 0, 0, 0, cliprect); |
| 122 | fillbitmap(cdp1862->bitmap, CDP1862_BACKGROUND_COLOR_SEQUENCE[cdp1862->bgcolor] + 8, cliprect); |
| 123 | } |
| 124 | |
| 125 | /* Device Interface */ |
| 126 | |
| 127 | static DEVICE_START( cdp1862 ) |
| 128 | { |
| 129 | cdp1862_t *cdp1862 = get_safe_token(device); |
| 130 | char unique_tag[30]; |
| 131 | |
| 132 | /* validate arguments */ |
| 133 | assert(device != NULL); |
| 134 | assert(device->tag != NULL); |
| 135 | assert(strlen(device->tag) < 20); |
| 136 | |
| 137 | cdp1862->intf = device->static_config; |
| 138 | |
| 139 | assert(cdp1862->intf != NULL); |
| 140 | assert(cdp1862->intf->clock > 0); |
| 141 | |
| 142 | /* get the screen device */ |
| 143 | cdp1862->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1862->intf->screen_tag); |
| 144 | assert(cdp1862->screen != NULL); |
| 145 | |
| 146 | /* allocate the temporary bitmap */ |
| 147 | cdp1862->bitmap = auto_bitmap_alloc(video_screen_get_width(cdp1862->screen), video_screen_get_height(cdp1862->screen), video_screen_get_format(cdp1862->screen)); |
| 148 | |
| 149 | /* initialize the palette */ |
| 150 | cdp1862_init_palette(device); |
| 151 | |
| 152 | /* register for state saving */ |
| 153 | state_save_combine_module_and_tag(unique_tag, "cdp1862", device->tag); |
| 154 | |
| 155 | state_save_register_item(unique_tag, 0, cdp1862->bgcolor); |
| 156 | state_save_register_item(unique_tag, 0, cdp1862->con); |
| 157 | |
| 158 | state_save_register_bitmap(unique_tag, 0, "cdp1862->bitmap", cdp1862->bitmap); |
| 159 | |
| 160 | return DEVICE_START_OK; |
| 161 | } |
| 162 | |
| 163 | static DEVICE_RESET( cdp1862 ) |
| 164 | { |
| 165 | cdp1862_t *cdp1862 = get_safe_token(device); |
| 166 | |
| 167 | cdp1862->bgcolor = 0; |
| 168 | cdp1862->con = CLEAR_LINE; |
| 169 | } |
| 170 | |
| 171 | static DEVICE_SET_INFO( cdp1862 ) |
| 172 | { |
| 173 | switch (state) |
| 174 | { |
| 175 | /* no parameters to set */ |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | DEVICE_GET_INFO( cdp1862 ) |
| 180 | { |
| 181 | switch (state) |
| 182 | { |
| 183 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 184 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1862_t); break; |
| 185 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 186 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 187 | |
| 188 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 189 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cdp1862); break; |
| 190 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1862); break; |
| 191 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 192 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(cdp1862); break; |
| 193 | |
| 194 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 195 | case DEVINFO_STR_NAME: info->s = "RCA CDP1862"; break; |
| 196 | case DEVINFO_STR_FAMILY: info->s = "RCA CDP1800"; break; |
| 197 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; |
| 198 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; |
| 199 | case DEVINFO_STR_CREDITS: info->s = "Copyright MESS Team"; break; |
| 200 | } |
| 201 | } |
src/mess/video/sapi1.c
| r3455 | r3456 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | SAPI-1 driver by Miodrag Milanovic
|
| 4 | | |
| 5 | | 09/09/2008 Preliminary driver.
|
| 6 | | |
| 7 | | ****************************************************************************/
|
| 8 | | |
| 9 | | |
| 10 | | #include "driver.h"
|
| 11 | | #include "includes/sapi1.h"
|
| 12 | | |
| 13 | | UINT8 MHB2501[] = {
|
| 14 | | 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @
|
| 15 | | 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A
|
| 16 | | 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B
|
| 17 | | 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C
|
| 18 | | 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D
|
| 19 | | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E
|
| 20 | | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F
|
| 21 | | 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G
|
| 22 | |
|
| 23 | | 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H
|
| 24 | | 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I
|
| 25 | | 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J
|
| 26 | | 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K
|
| 27 | | 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L
|
| 28 | | 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M
|
| 29 | | 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N
|
| 30 | | 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O
|
| 31 | |
|
| 32 | | 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P
|
| 33 | | 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q
|
| 34 | | 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R
|
| 35 | | 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S
|
| 36 | | 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T
|
| 37 | | 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U
|
| 38 | | 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V
|
| 39 | | 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W
|
| 40 | |
|
| 41 | | 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X
|
| 42 | | 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y
|
| 43 | | 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z
|
| 44 | | 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [
|
| 45 | | 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash
|
| 46 | | 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ]
|
| 47 | | 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^
|
| 48 | | 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _
|
| 49 | |
|
| 50 | | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // |
| 51 | | 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // !
|
| 52 | | 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // "
|
| 53 | | 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // #
|
| 54 | | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // |
| 55 | | 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // %
|
| 56 | | 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // &
|
| 57 | | 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // '
|
| 58 | |
|
| 59 | | 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // (
|
| 60 | | 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // )
|
| 61 | | 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // *
|
| 62 | | 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // +
|
| 63 | | 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // ,
|
| 64 | | 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // -
|
| 65 | | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // .
|
| 66 | | 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // /
|
| 67 | |
|
| 68 | | 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0
|
| 69 | | 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1
|
| 70 | | 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2
|
| 71 | | 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3
|
| 72 | | 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4
|
| 73 | | 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5
|
| 74 | | 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6
|
| 75 | | 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7
|
| 76 | |
|
| 77 | | 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8
|
| 78 | | 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9
|
| 79 | | 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // :
|
| 80 | | 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ;
|
| 81 | | 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // <
|
| 82 | | 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // =
|
| 83 | | 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // >
|
| 84 | | 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ?
|
| 85 | | };
|
| 86 | | |
| 87 | | static UINT8 refresh_counter;
|
| 88 | | |
| 89 | | VIDEO_START( sapi1 )
|
| 90 | | {
|
| 91 | | refresh_counter = 0;
|
| 92 | | }
|
| 93 | | |
| 94 | | VIDEO_UPDATE( sapi1 )
|
| 95 | | {
|
| 96 | | int x,y,j,b;
|
| 97 | | UINT16 addr;
|
| 98 | | int xpos;
|
| 99 | | |
| 100 | | for(y = 0; y < 24; y++ )
|
| 101 | | {
|
| 102 | | addr = 0x3800 + y*64;
|
| 103 | | xpos = 0;
|
| 104 | | for(x = 0; x < 40; x++ )
|
| 105 | | {
|
| 106 | | UINT8 code = program_read_byte(addr + x);
|
| 107 | | UINT8 attr = (code >> 6) & 3;
|
| 108 | | code &= 0x3f; |
| 109 | | for(j = 0; j < 9; j++ )
|
| 110 | | { |
| 111 | | for(b = 0; b < 6; b++ )
|
| 112 | | {
|
| 113 | | UINT8 val;
|
| 114 | | if (j==8) {
|
| 115 | | if (attr==2) {
|
| 116 | | val = (refresh_counter & 0x20) ? 1 : 0;
|
| 117 | | } else {
|
| 118 | | val = 0;
|
| 119 | | }
|
| 120 | | } else {
|
| 121 | | val = (MHB2501[code*8 + j] >> (5-b)) & 1;
|
| 122 | | if (attr==1) {
|
| 123 | | val = (refresh_counter & 0x20) ? val : 0;
|
| 124 | | }
|
| 125 | | }
|
| 126 | | if(attr==3) {
|
| 127 | | *BITMAP_ADDR16(bitmap, y*9+j, xpos+2*b ) = val;
|
| 128 | | *BITMAP_ADDR16(bitmap, y*9+j, xpos+2*b+1 ) = val;
|
| 129 | | } else {
|
| 130 | | *BITMAP_ADDR16(bitmap, y*9+j, xpos+b ) = val;
|
| 131 | | }
|
| 132 | | } |
| 133 | | }
|
| 134 | | xpos+= (attr==3) ? 12 : 6;
|
| 135 | | if (xpos>=6*40) break;
|
| 136 | | }
|
| 137 | | }
|
| 138 | | refresh_counter++;
|
| 139 | | return 0;
|
| 140 | | }
|
| 141 | | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | SAPI-1 driver by Miodrag Milanovic |
| 4 | |
| 5 | 09/09/2008 Preliminary driver. |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "includes/sapi1.h" |
| 12 | |
| 13 | UINT8 MHB2501[] = { |
| 14 | 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ |
| 15 | 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A |
| 16 | 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B |
| 17 | 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C |
| 18 | 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D |
| 19 | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E |
| 20 | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F |
| 21 | 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G |
| 22 | |
| 23 | 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H |
| 24 | 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I |
| 25 | 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J |
| 26 | 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K |
| 27 | 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L |
| 28 | 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M |
| 29 | 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N |
| 30 | 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O |
| 31 | |
| 32 | 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P |
| 33 | 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q |
| 34 | 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R |
| 35 | 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S |
| 36 | 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T |
| 37 | 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U |
| 38 | 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V |
| 39 | 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W |
| 40 | |
| 41 | 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X |
| 42 | 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y |
| 43 | 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z |
| 44 | 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [ |
| 45 | 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash |
| 46 | 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] |
| 47 | 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ |
| 48 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ |
| 49 | |
| 50 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // |
| 51 | 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! |
| 52 | 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " |
| 53 | 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # |
| 54 | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // |
| 55 | 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % |
| 56 | 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & |
| 57 | 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' |
| 58 | |
| 59 | 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( |
| 60 | 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) |
| 61 | 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * |
| 62 | 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // + |
| 63 | 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // , |
| 64 | 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - |
| 65 | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . |
| 66 | 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / |
| 67 | |
| 68 | 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 |
| 69 | 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 |
| 70 | 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 |
| 71 | 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3 |
| 72 | 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4 |
| 73 | 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 |
| 74 | 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 |
| 75 | 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 |
| 76 | |
| 77 | 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 |
| 78 | 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 |
| 79 | 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : |
| 80 | 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ; |
| 81 | 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // < |
| 82 | 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // = |
| 83 | 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // > |
| 84 | 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ? |
| 85 | }; |
| 86 | |
| 87 | static UINT8 refresh_counter; |
| 88 | |
| 89 | VIDEO_START( sapi1 ) |
| 90 | { |
| 91 | refresh_counter = 0; |
| 92 | } |
| 93 | |
| 94 | VIDEO_UPDATE( sapi1 ) |
| 95 | { |
| 96 | int x,y,j,b; |
| 97 | UINT16 addr; |
| 98 | int xpos; |
| 99 | |
| 100 | for(y = 0; y < 24; y++ ) |
| 101 | { |
| 102 | addr = 0x3800 + y*64; |
| 103 | xpos = 0; |
| 104 | for(x = 0; x < 40; x++ ) |
| 105 | { |
| 106 | UINT8 code = program_read_byte(addr + x); |
| 107 | UINT8 attr = (code >> 6) & 3; |
| 108 | code &= 0x3f; |
| 109 | for(j = 0; j < 9; j++ ) |
| 110 | { |
| 111 | for(b = 0; b < 6; b++ ) |
| 112 | { |
| 113 | UINT8 val; |
| 114 | if (j==8) { |
| 115 | if (attr==2) { |
| 116 | val = (refresh_counter & 0x20) ? 1 : 0; |
| 117 | } else { |
| 118 | val = 0; |
| 119 | } |
| 120 | } else { |
| 121 | val = (MHB2501[code*8 + j] >> (5-b)) & 1; |
| 122 | if (attr==1) { |
| 123 | val = (refresh_counter & 0x20) ? val : 0; |
| 124 | } |
| 125 | } |
| 126 | if(attr==3) { |
| 127 | *BITMAP_ADDR16(bitmap, y*9+j, xpos+2*b ) = val; |
| 128 | *BITMAP_ADDR16(bitmap, y*9+j, xpos+2*b+1 ) = val; |
| 129 | } else { |
| 130 | *BITMAP_ADDR16(bitmap, y*9+j, xpos+b ) = val; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | xpos+= (attr==3) ? 12 : 6; |
| 135 | if (xpos>=6*40) break; |
| 136 | } |
| 137 | } |
| 138 | refresh_counter++; |
| 139 | return 0; |
| 140 | } |
| 141 | |
src/mess/video/abc806.c
| r3455 | r3456 | |
| 1 | | /*****************************************************************************
|
| 2 | | *
|
| 3 | | * video/abc806.c
|
| 4 | | *
|
| 5 | | ****************************************************************************/
|
| 6 | | |
| 7 | | /*
|
| 8 | | |
| 9 | | TODO:
|
| 10 | | |
| 11 | | - selection between 512x240, 256x240, and 240x240 HR modes
|
| 12 | | - add proper screen parameters to startup
|
| 13 | | - palette configuration from PAL/PROM
|
| 14 | | - vertical sync delay
|
| 15 | | - horizontal positioning of the text and HR screens
|
| 16 | | - protection device @ 16H
|
| 17 | |
|
| 18 | | */
|
| 19 | | |
| 20 | | #include "driver.h"
|
| 21 | | #include "includes/abc80x.h"
|
| 22 | | #include "machine/z80dart.h"
|
| 23 | | #include "machine/e0516.h"
|
| 24 | | #include "video/mc6845.h"
|
| 25 | | |
| 26 | | /* Palette Initialization */
|
| 27 | | |
| 28 | | static PALETTE_INIT( abc806 )
|
| 29 | | {
|
| 30 | | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black
|
| 31 | | palette_set_color_rgb(machine, 1, 0x00, 0x00, 0xff); // blue
|
| 32 | | palette_set_color_rgb(machine, 2, 0xff, 0x00, 0x00); // red
|
| 33 | | palette_set_color_rgb(machine, 3, 0xff, 0x00, 0xff); // magenta
|
| 34 | | palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green
|
| 35 | | palette_set_color_rgb(machine, 5, 0x00, 0xff, 0xff); // cyan
|
| 36 | | palette_set_color_rgb(machine, 6, 0xff, 0xff, 0x00); // yellow
|
| 37 | | palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white
|
| 38 | | }
|
| 39 | | |
| 40 | | /* Timer Callbacks */
|
| 41 | | |
| 42 | | static TIMER_CALLBACK( abc806_flash_tick )
|
| 43 | | {
|
| 44 | | abc806_state *state = machine->driver_data;
|
| 45 | | |
| 46 | | state->flshclk = !state->flshclk;
|
| 47 | | }
|
| 48 | | |
| 49 | | /* High Resolution Screen Select */
|
| 50 | | |
| 51 | | WRITE8_HANDLER( abc806_hrs_w )
|
| 52 | | {
|
| 53 | | /*
|
| 54 | | |
| 55 | | bit signal description
|
| 56 | | |
| 57 | | 0 VM14 visible screen memory area bit 0
|
| 58 | | 1 VM15 visible screen memory area bit 1
|
| 59 | | 2 VM16 visible screen memory area bit 2 (unused)
|
| 60 | | 3 VM17 visible screen memory area bit 3 (unused)
|
| 61 | | 4 F14 cpu accessible screen memory area bit 0
|
| 62 | | 5 F15 cpu accessible screen memory area bit 1
|
| 63 | | 6 F16 cpu accessible screen memory area bit 2 (unused)
|
| 64 | | 7 F17 cpu accessible screen memory area bit 3 (unused)
|
| 65 | | |
| 66 | | */
|
| 67 | | |
| 68 | | abc806_state *state = machine->driver_data;
|
| 69 | |
|
| 70 | | state->hrs = data;
|
| 71 | | }
|
| 72 | | |
| 73 | | /* High Resolution Palette */
|
| 74 | | |
| 75 | | WRITE8_HANDLER( abc806_hrc_w )
|
| 76 | | {
|
| 77 | | abc806_state *state = machine->driver_data;
|
| 78 | | |
| 79 | | int reg = (offset >> 8) & 0x0f;
|
| 80 | | |
| 81 | | state->hrc[reg] = data & 0x0f;
|
| 82 | | }
|
| 83 | | |
| 84 | | /* Character Memory */
|
| 85 | | |
| 86 | | READ8_HANDLER( abc806_charram_r )
|
| 87 | | {
|
| 88 | | abc806_state *state = machine->driver_data;
|
| 89 | | |
| 90 | | state->attr_data = state->colorram[offset];
|
| 91 | | |
| 92 | | return state->charram[offset];
|
| 93 | | }
|
| 94 | | |
| 95 | | WRITE8_HANDLER( abc806_charram_w )
|
| 96 | | {
|
| 97 | | abc806_state *state = machine->driver_data;
|
| 98 | | |
| 99 | | state->colorram[offset] = state->attr_data;
|
| 100 | | state->charram[offset] = data;
|
| 101 | | }
|
| 102 | | |
| 103 | | /* Attribute Memory */
|
| 104 | | |
| 105 | | READ8_HANDLER( abc806_ami_r )
|
| 106 | | {
|
| 107 | | abc806_state *state = machine->driver_data;
|
| 108 | | |
| 109 | | return state->attr_data;
|
| 110 | | }
|
| 111 | | |
| 112 | | WRITE8_HANDLER( abc806_amo_w )
|
| 113 | | {
|
| 114 | | abc806_state *state = machine->driver_data;
|
| 115 | | |
| 116 | | state->attr_data = data;
|
| 117 | | }
|
| 118 | | |
| 119 | | /* High Resolution Palette / Real-Time Clock */
|
| 120 | | |
| 121 | | READ8_HANDLER( abc806_cli_r )
|
| 122 | | {
|
| 123 | | abc806_state *state = machine->driver_data;
|
| 124 | | |
| 125 | | /*
|
| 126 | | |
| 127 | | bit description
|
| 128 | | |
| 129 | | 0 HRU II data bit 0
|
| 130 | | 1 HRU II data bit 1
|
| 131 | | 2 HRU II data bit 2
|
| 132 | | 3 HRU II data bit 3
|
| 133 | | 4 |
| 134 | | 5 |
| 135 | | 6 |
| 136 | | 7 RTC data output
|
| 137 | | |
| 138 | | */
|
| 139 | | |
| 140 | | UINT16 hru2_addr = (state->hru2_a8 << 8) | (offset >> 8);
|
| 141 | | UINT8 data = state->hru2_prom[hru2_addr] & 0x0f;
|
| 142 | | |
| 143 | | data |= e0516_dio_r(state->e0516) << 7;
|
| 144 | | |
| 145 | | return data;
|
| 146 | | }
|
| 147 | | |
| 148 | | /* Special */
|
| 149 | | |
| 150 | | READ8_HANDLER( abc806_sti_r )
|
| 151 | | {
|
| 152 | | /* this is some weird device marked PROT @ 16H */
|
| 153 | | |
| 154 | | /*
|
| 155 | | |
| 156 | | bit description
|
| 157 | | |
| 158 | | 0 |
| 159 | | 1 |
| 160 | | 2 |
| 161 | | 3 |
| 162 | | 4 |
| 163 | | 5 |
| 164 | | 6 |
| 165 | | 7 PROT DOUT
|
| 166 | | |
| 167 | | */
|
| 168 | | |
| 169 | | return 0;
|
| 170 | | }
|
| 171 | | |
| 172 | | WRITE8_HANDLER( abc806_sto_w )
|
| 173 | | {
|
| 174 | | abc806_state *state = machine->driver_data;
|
| 175 | | |
| 176 | | int level = BIT(data, 7);
|
| 177 | | |
| 178 | | switch (data & 0x07)
|
| 179 | | {
|
| 180 | | case 0:
|
| 181 | | /* external memory enable */
|
| 182 | | state->eme = level;
|
| 183 | | break;
|
| 184 | | case 1:
|
| 185 | | /* 40/80 column display */
|
| 186 | | state->_40 = level;
|
| 187 | | break;
|
| 188 | | case 2:
|
| 189 | | /* HRU II address line 8, PROT A0 */
|
| 190 | | state->hru2_a8 = level;
|
| 191 | | break;
|
| 192 | | case 3:
|
| 193 | | /* PROT INI */
|
| 194 | | break;
|
| 195 | | case 4:
|
| 196 | | /* text display enable */
|
| 197 | | state->txoff = level;
|
| 198 | | break;
|
| 199 | | case 5:
|
| 200 | | /* RTC chip select */
|
| 201 | | e0516_cs_w(state->e0516, !level);
|
| 202 | | break;
|
| 203 | | case 6:
|
| 204 | | /* RTC clock */
|
| 205 | | e0516_clk_w(state->e0516, level);
|
| 206 | | break;
|
| 207 | | case 7:
|
| 208 | | /* RTC data in, PROT DIN */
|
| 209 | | e0516_dio_w(state->e0516, level);
|
| 210 | | break;
|
| 211 | | }
|
| 212 | | }
|
| 213 | | |
| 214 | | /* Sync Delay */
|
| 215 | | |
| 216 | | WRITE8_HANDLER( abc806_sso_w )
|
| 217 | | {
|
| 218 | | abc806_state *state = machine->driver_data;
|
| 219 | | |
| 220 | | state->sync = data & 0x3f;
|
| 221 | | }
|
| 222 | | |
| 223 | | /* MC6845 */
|
| 224 | | |
| 225 | | static MC6845_UPDATE_ROW( abc806_update_row )
|
| 226 | | {
|
| 227 | | abc806_state *state = device->machine->driver_data;
|
| 228 | | |
| 229 | | int column;
|
| 230 | | |
| 231 | | UINT8 old_data = 0xff;
|
| 232 | | int fg_color = 7;
|
| 233 | | int bg_color = 0;
|
| 234 | | int underline = 0;
|
| 235 | | int flash = 0;
|
| 236 | | int e5 = 0;
|
| 237 | | int e6 = 0;
|
| 238 | | int th = 0;
|
| 239 | | |
| 240 | | if (state->_40)
|
| 241 | | {
|
| 242 | | e5 = 1;
|
| 243 | | e6 = 1;
|
| 244 | | }
|
| 245 | | |
| 246 | | for (column = 0; column < x_count; column++)
|
| 247 | | {
|
| 248 | | UINT8 data = state->charram[(ma + column) & 0x7ff];
|
| 249 | | UINT8 attr = state->colorram[(ma + column) & 0x7ff];
|
| 250 | | UINT16 rad_addr, chargen_addr;
|
| 251 | | UINT8 rad_data, chargen_data;
|
| 252 | | int bit, x;
|
| 253 | | |
| 254 | | if ((attr & 0x07) == ((attr >> 3) & 0x07))
|
| 255 | | {
|
| 256 | | /* special case */
|
| 257 | | |
| 258 | | switch (attr >> 6)
|
| 259 | | {
|
| 260 | | case 0:
|
| 261 | | /* use previously selected attributes */
|
| 262 | | break;
|
| 263 | | case 1:
|
| 264 | | /* reserved for future use */
|
| 265 | | break;
|
| 266 | | case 2:
|
| 267 | | /* blank */
|
| 268 | | fg_color = 0;
|
| 269 | | bg_color = 0;
|
| 270 | | underline = 0;
|
| 271 | | flash = 0;
|
| 272 | | break;
|
| 273 | | case 3:
|
| 274 | | /* double width */
|
| 275 | | e5 = BIT(attr, 0);
|
| 276 | | e6 = BIT(attr, 1);
|
| 277 | | |
| 278 | | /* read attributes from next byte */
|
| 279 | | attr = state->colorram[(ma + column + 1) & 0x7ff];
|
| 280 | | |
| 281 | | if (attr != 0x00)
|
| 282 | | {
|
| 283 | | fg_color = attr & 0x07;
|
| 284 | | bg_color = (attr >> 3) & 0x07;
|
| 285 | | underline = BIT(attr, 6);
|
| 286 | | flash = BIT(attr, 7);
|
| 287 | | }
|
| 288 | | break;
|
| 289 | | }
|
| 290 | | }
|
| 291 | | else
|
| 292 | | {
|
| 293 | | /* normal case */
|
| 294 | | |
| 295 | | fg_color = attr & 0x07;
|
| 296 | | bg_color = (attr >> 3) & 0x07;
|
| 297 | | underline = BIT(attr, 6);
|
| 298 | | flash = BIT(attr, 7);
|
| 299 | | e5 = state->_40 ? 1 : 0;
|
| 300 | | e6 = state->_40 ? 1 : 0;
|
| 301 | | }
|
| 302 | | |
| 303 | | if (column == cursor_x)
|
| 304 | | {
|
| 305 | | rad_data = 0x0f;
|
| 306 | | }
|
| 307 | | else
|
| 308 | | {
|
| 309 | | rad_addr = (e6 << 8) | (e5 << 7) | (flash << 6) | (underline << 5) | (state->flshclk << 4) | ra;
|
| 310 | | rad_data = state->rad_prom[rad_addr] & 0x0f;
|
| 311 | | |
| 312 | | rad_data = ra; // HACK because the RAD prom is not dumped yet
|
| 313 | | }
|
| 314 | | |
| 315 | | chargen_addr = (th << 12) | (data << 4) | rad_data;
|
| 316 | | chargen_data = state->char_rom[chargen_addr & 0xfff] << 2;
|
| 317 | | x = column * ABC800_CHAR_WIDTH;
|
| 318 | | |
| 319 | | for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++)
|
| 320 | | {
|
| 321 | | int color = BIT(chargen_data, 7) ? fg_color : bg_color;
|
| 322 | | |
| 323 | | if (state->txoff)
|
| 324 | | {
|
| 325 | | color = 0;
|
| 326 | | }
|
| 327 | | |
| 328 | | *BITMAP_ADDR16(bitmap, y, x++) = color;
|
| 329 | | |
| 330 | | if (e5 || e6)
|
| 331 | | {
|
| 332 | | *BITMAP_ADDR16(bitmap, y, x++) = color;
|
| 333 | | }
|
| 334 | | |
| 335 | | chargen_data <<= 1;
|
| 336 | | }
|
| 337 | | |
| 338 | | if (e5 || e6)
|
| 339 | | {
|
| 340 | | column++;
|
| 341 | | }
|
| 342 | | |
| 343 | | old_data = data;
|
| 344 | | }
|
| 345 | | }
|
| 346 | | |
| 347 | | static MC6845_ON_HSYNC_CHANGED(abc806_hsync_changed)
|
| 348 | | {
|
| 349 | | abc806_state *state = device->machine->driver_data;
|
| 350 | | |
| 351 | | if (!hsync)
|
| 352 | | {
|
| 353 | | state->v50_addr++;
|
| 354 | | }
|
| 355 | | }
|
| 356 | | |
| 357 | | static MC6845_ON_VSYNC_CHANGED(abc806_vsync_changed)
|
| 358 | | {
|
| 359 | | abc806_state *state = device->machine->driver_data;
|
| 360 | |
|
| 361 | | if (vsync)
|
| 362 | | {
|
| 363 | | state->v50_addr = 0;
|
| 364 | | }
|
| 365 | | |
| 366 | | z80dart_set_ri(state->z80dart, 1, vsync);
|
| 367 | | }
|
| 368 | | |
| 369 | | /* MC6845 Interfaces */
|
| 370 | | |
| 371 | | static const mc6845_interface abc806_mc6845_interface = {
|
| 372 | | SCREEN_TAG,
|
| 373 | | ABC800_CCLK,
|
| 374 | | ABC800_CHAR_WIDTH,
|
| 375 | | NULL,
|
| 376 | | abc806_update_row,
|
| 377 | | NULL,
|
| 378 | | NULL,
|
| 379 | | abc806_hsync_changed,
|
| 380 | | abc806_vsync_changed
|
| 381 | | };
|
| 382 | | |
| 383 | | /* HR */
|
| 384 | | |
| 385 | | static void abc806_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
| 386 | | {
|
| 387 | | abc806_state *state = machine->driver_data;
|
| 388 | | |
| 389 | | UINT16 addr = (state->hrs & 0x03) << 14;
|
| 390 | | int sx, y, dot;
|
| 391 | | |
| 392 | | for (y = 0; y < 240; y++)
|
| 393 | | {
|
| 394 | | /* 240x240 */
|
| 395 | | for (sx = 0; sx < 60; sx++)
|
| 396 | | {
|
| 397 | | UINT16 data = (state->videoram[addr++] << 8) | state->videoram[addr++];
|
| 398 | | |
| 399 | | for (dot = 0; dot < 4; dot++)
|
| 400 | | {
|
| 401 | | int color = state->hrc[(data >> 12) & 0x0f]; // TODO get colors from HRU II prom
|
| 402 | | int x = (sx << 3) | (dot << 1);
|
| 403 | | |
| 404 | | *BITMAP_ADDR16(bitmap, y, x) = color;
|
| 405 | | *BITMAP_ADDR16(bitmap, y, x + 1) = color;
|
| 406 | | |
| 407 | | data <<= 4;
|
| 408 | | }
|
| 409 | | }
|
| 410 | | |
| 411 | | /* 256x240 */
|
| 412 | | for (sx = 0; sx < 64; sx++)
|
| 413 | | {
|
| 414 | | UINT16 data = (state->videoram[addr++] << 8) | state->videoram[addr++];
|
| 415 | | |
| 416 | | for (dot = 0; dot < 4; dot++)
|
| 417 | | {
|
| 418 | | int color = state->hrc[(data >> 12) & 0x0f];
|
| 419 | | int x = (sx << 3) | (dot << 1);
|
| 420 | | |
| 421 | | *BITMAP_ADDR16(bitmap, y, x) = color;
|
| 422 | | *BITMAP_ADDR16(bitmap, y, x + 1) = color;
|
| 423 | | |
| 424 | | data <<= 4;
|
| 425 | | }
|
| 426 | | }
|
| 427 | | |
| 428 | | /* 512x240 */
|
| 429 | | for (sx = 0; sx < 64; sx++)
|
| 430 | | {
|
| 431 | | UINT16 data = (state->videoram[addr++] << 8) | state->videoram[addr++];
|
| 432 | | |
| 433 | | for (dot = 0; dot < 8; dot++)
|
| 434 | | {
|
| 435 | | int color = (data >> 14) & 0x03;
|
| 436 | | int x = (sx << 3) | dot;
|
| 437 | | |
| 438 | | *BITMAP_ADDR16(bitmap, y, x) = color;
|
| 439 | | |
| 440 | | data <<= 4;
|
| 441 | | }
|
| 442 | | }
|
| 443 | | }
|
| 444 | | }
|
| 445 | | |
| 446 | | /* Video Start */
|
| 447 | | |
| 448 | | static VIDEO_START(abc806)
|
| 449 | | {
|
| 450 | | abc806_state *state = machine->driver_data;
|
| 451 | |
|
| 452 | | int i;
|
| 453 | | |
| 454 | | /* initialize variables */
|
| 455 | | |
| 456 | | for (i = 0; i < 16; i++)
|
| 457 | | {
|
| 458 | | state->hrc[i] = 0;
|
| 459 | | }
|
| 460 | | |
| 461 | | state->sync = 10;
|
| 462 | | |
| 463 | | /* find devices */
|
| 464 | | |
| 465 | | state->mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG);
|
| 466 | | |
| 467 | | /* find memory regions */
|
| 468 | | |
| 469 | | state->char_rom = memory_region(machine, "chargen");
|
| 470 | | state->rad_prom = memory_region(machine, "rad");
|
| 471 | | state->hru2_prom = memory_region(machine, "hru2");
|
| 472 | | |
| 473 | | /* allocate memory */
|
| 474 | | |
| 475 | | state->charram = auto_malloc(ABC806_CHAR_RAM_SIZE);
|
| 476 | | state->colorram = auto_malloc(ABC806_ATTR_RAM_SIZE);
|
| 477 | | |
| 478 | | /* allocate timer */
|
| 479 | | |
| 480 | | state->flash_timer = timer_alloc(abc806_flash_tick, NULL);
|
| 481 | | timer_adjust_periodic(state->flash_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2));
|
| 482 | | |
| 483 | | /* register for state saving */
|
| 484 | | |
| 485 | | state_save_register_global_pointer(state->charram, ABC806_CHAR_RAM_SIZE);
|
| 486 | | state_save_register_global_pointer(state->colorram, ABC806_ATTR_RAM_SIZE);
|
| 487 | | state_save_register_global_pointer(state->videoram, ABC806_VIDEO_RAM_SIZE);
|
| 488 | | |
| 489 | | state_save_register_global(state->v50_addr);
|
| 490 | | state_save_register_global(state->attr_data);
|
| 491 | | state_save_register_global(state->hrs);
|
| 492 | | state_save_register_global(state->sync);
|
| 493 | | state_save_register_global_array(state->hrc);
|
| 494 | | state_save_register_global(state->eme);
|
| 495 | | state_save_register_global(state->txoff);
|
| 496 | | state_save_register_global(state->_40);
|
| 497 | | state_save_register_global(state->flshclk);
|
| 498 | | state_save_register_global(state->hru2_a8);
|
| 499 | | }
|
| 500 | | |
| 501 | | /* Video Update */
|
| 502 | | |
| 503 | | static VIDEO_UPDATE( abc806 )
|
| 504 | | {
|
| 505 | | abc806_state *state = screen->machine->driver_data;
|
| 506 | |
|
| 507 | | abc806_hr_update(screen->machine, bitmap, cliprect);
|
| 508 | | mc6845_update(state->mc6845, bitmap, cliprect);
|
| 509 | |
|
| 510 | | return 0;
|
| 511 | | }
|
| 512 | | |
| 513 | | /* Machine Drivers */
|
| 514 | | |
| 515 | | MACHINE_DRIVER_START( abc806_video )
|
| 516 | | /* device interface */
|
| 517 | | MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
|
| 518 | | MDRV_DEVICE_CONFIG(abc806_mc6845_interface)
|
| 519 | | |
| 520 | | /* video hardware */
|
| 521 | | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
|
| 522 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 523 | | |
| 524 | | MDRV_SCREEN_REFRESH_RATE(60)
|
| 525 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
|
| 526 | | MDRV_SCREEN_SIZE(640, 400)
|
| 527 | | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
|
| 528 | | |
| 529 | | MDRV_PALETTE_LENGTH(8)
|
| 530 | | |
| 531 | | MDRV_PALETTE_INIT(abc806)
|
| 532 | | MDRV_VIDEO_START(abc806)
|
| 533 | | MDRV_VIDEO_UPDATE(abc806)
|
| 534 | | MACHINE_DRIVER_END
|
| 1 | /***************************************************************************** |
| 2 | * |
| 3 | * video/abc806.c |
| 4 | * |
| 5 | ****************************************************************************/ |
| 6 | |
| 7 | /* |
| 8 | |
| 9 | TODO: |
| 10 | |
| 11 | - selection between 512x240, 256x240, and 240x240 HR modes |
| 12 | - add proper screen parameters to startup |
| 13 | - palette configuration from PAL/PROM |
| 14 | - vertical sync delay |
| 15 | - horizontal positioning of the text and HR screens |
| 16 | - protection device @ 16H |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | #include "driver.h" |
| 21 | #include "includes/abc80x.h" |
| 22 | #include "machine/z80dart.h" |
| 23 | #include "machine/e0516.h" |
| 24 | #include "video/mc6845.h" |
| 25 | |
| 26 | /* Palette Initialization */ |
| 27 | |
| 28 | static PALETTE_INIT( abc806 ) |
| 29 | { |
| 30 | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black |
| 31 | palette_set_color_rgb(machine, 1, 0x00, 0x00, 0xff); // blue |
| 32 | palette_set_color_rgb(machine, 2, 0xff, 0x00, 0x00); // red |
| 33 | palette_set_color_rgb(machine, 3, 0xff, 0x00, 0xff); // magenta |
| 34 | palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green |
| 35 | palette_set_color_rgb(machine, 5, 0x00, 0xff, 0xff); // cyan |
| 36 | palette_set_color_rgb(machine, 6, 0xff, 0xff, 0x00); // yellow |
| 37 | palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white |
| 38 | } |
| 39 | |
| 40 | /* Timer Callbacks */ |
| 41 | |
| 42 | static TIMER_CALLBACK( abc806_flash_tick ) |
| 43 | { |
| 44 | abc806_state *state = machine->driver_data; |
| 45 | |
| 46 | state->flshclk = !state->flshclk; |
| 47 | } |
| 48 | |
| 49 | /* High Resolution Screen Select */ |
| 50 | |
| 51 | WRITE8_HANDLER( abc806_hrs_w ) |
| 52 | { |
| 53 | /* |
| 54 | |
| 55 | bit signal description |
| 56 | |
| 57 | 0 VM14 visible screen memory area bit 0 |
| 58 | 1 VM15 visible screen memory area bit 1 |
| 59 | 2 VM16 visible screen memory area bit 2 (unused) |
| 60 | 3 VM17 visible screen memory area bit 3 (unused) |
| 61 | 4 F14 cpu accessible screen memory area bit 0 |
| 62 | 5 F15 cpu accessible screen memory area bit 1 |
| 63 | 6 F16 cpu accessible screen memory area bit 2 (unused) |
| 64 | 7 F17 cpu accessible screen memory area bit 3 (unused) |
| 65 | |
| 66 | */ |
| 67 | |
| 68 | abc806_state *state = machine->driver_data; |
| 69 | |
| 70 | state->hrs = data; |
| 71 | } |
| 72 | |
| 73 | /* High Resolution Palette */ |
| 74 | |
| 75 | WRITE8_HANDLER( abc806_hrc_w ) |
| 76 | { |
| 77 | abc806_state *state = machine->driver_data; |
| 78 | |
| 79 | int reg = (offset >> 8) & 0x0f; |
| 80 | |
| 81 | state->hrc[reg] = data & 0x0f; |
| 82 | } |
| 83 | |
| 84 | /* Character Memory */ |
| 85 | |
| 86 | READ8_HANDLER( abc806_charram_r ) |
| 87 | { |
| 88 | abc806_state *state = machine->driver_data; |
| 89 | |
| 90 | state->attr_data = state->colorram[offset]; |
| 91 | |
| 92 | return state->charram[offset]; |
| 93 | } |
| 94 | |
| 95 | WRITE8_HANDLER( abc806_charram_w ) |
| 96 | { |
| 97 | abc806_state *state = machine->driver_data; |
| 98 | |
| 99 | state->colorram[offset] = state->attr_data; |
| 100 | state->charram[offset] = data; |
| 101 | } |
| 102 | |
| 103 | /* Attribute Memory */ |
| 104 | |
| 105 | READ8_HANDLER( abc806_ami_r ) |
| 106 | { |
| 107 | abc806_state *state = machine->driver_data; |
| 108 | |
| 109 | return state->attr_data; |
| 110 | } |
| 111 | |
| 112 | WRITE8_HANDLER( abc806_amo_w ) |
| 113 | { |
| 114 | abc806_state *state = machine->driver_data; |
| 115 | |
| 116 | state->attr_data = data; |
| 117 | } |
| 118 | |
| 119 | /* High Resolution Palette / Real-Time Clock */ |
| 120 | |
| 121 | READ8_HANDLER( abc806_cli_r ) |
| 122 | { |
| 123 | abc806_state *state = machine->driver_data; |
| 124 | |
| 125 | /* |
| 126 | |
| 127 | bit description |
| 128 | |
| 129 | 0 HRU II data bit 0 |
| 130 | 1 HRU II data bit 1 |
| 131 | 2 HRU II data bit 2 |
| 132 | 3 HRU II data bit 3 |
| 133 | 4 |
| 134 | 5 |
| 135 | 6 |
| 136 | 7 RTC data output |
| 137 | |
| 138 | */ |
| 139 | |
| 140 | UINT16 hru2_addr = (state->hru2_a8 << 8) | (offset >> 8); |
| 141 | UINT8 data = state->hru2_prom[hru2_addr] & 0x0f; |
| 142 | |
| 143 | data |= e0516_dio_r(state->e0516) << 7; |
| 144 | |
| 145 | return data; |
| 146 | } |
| 147 | |
| 148 | /* Special */ |
| 149 | |
| 150 | READ8_HANDLER( abc806_sti_r ) |
| 151 | { |
| 152 | /* this is some weird device marked PROT @ 16H */ |
| 153 | |
| 154 | /* |
| 155 | |
| 156 | bit description |
| 157 | |
| 158 | 0 |
| 159 | 1 |
| 160 | 2 |
| 161 | 3 |
| 162 | 4 |
| 163 | 5 |
| 164 | 6 |
| 165 | 7 PROT DOUT |
| 166 | |
| 167 | */ |
| 168 | |
| 169 | return 0; |
| 170 | } |
| 171 | |
| 172 | WRITE8_HANDLER( abc806_sto_w ) |
| 173 | { |
| 174 | abc806_state *state = machine->driver_data; |
| 175 | |
| 176 | int level = BIT(data, 7); |
| 177 | |
| 178 | switch (data & 0x07) |
| 179 | { |
| 180 | case 0: |
| 181 | /* external memory enable */ |
| 182 | state->eme = level; |
| 183 | break; |
| 184 | case 1: |
| 185 | /* 40/80 column display */ |
| 186 | state->_40 = level; |
| 187 | break; |
| 188 | case 2: |
| 189 | /* HRU II address line 8, PROT A0 */ |
| 190 | state->hru2_a8 = level; |
| 191 | break; |
| 192 | case 3: |
| 193 | /* PROT INI */ |
| 194 | break; |
| 195 | case 4: |
| 196 | /* text display enable */ |
| 197 | state->txoff = level; |
| 198 | break; |
| 199 | case 5: |
| 200 | /* RTC chip select */ |
| 201 | e0516_cs_w(state->e0516, !level); |
| 202 | break; |
| 203 | case 6: |
| 204 | /* RTC clock */ |
| 205 | e0516_clk_w(state->e0516, level); |
| 206 | break; |
| 207 | case 7: |
| 208 | /* RTC data in, PROT DIN */ |
| 209 | e0516_dio_w(state->e0516, level); |
| 210 | break; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /* Sync Delay */ |
| 215 | |
| 216 | WRITE8_HANDLER( abc806_sso_w ) |
| 217 | { |
| 218 | abc806_state *state = machine->driver_data; |
| 219 | |
| 220 | state->sync = data & 0x3f; |
| 221 | } |
| 222 | |
| 223 | /* MC6845 */ |
| 224 | |
| 225 | static MC6845_UPDATE_ROW( abc806_update_row ) |
| 226 | { |
| 227 | abc806_state *state = device->machine->driver_data; |
| 228 | |
| 229 | int column; |
| 230 | |
| 231 | UINT8 old_data = 0xff; |
| 232 | int fg_color = 7; |
| 233 | int bg_color = 0; |
| 234 | int underline = 0; |
| 235 | int flash = 0; |
| 236 | int e5 = 0; |
| 237 | int e6 = 0; |
| 238 | int th = 0; |
| 239 | |
| 240 | if (state->_40) |
| 241 | { |
| 242 | e5 = 1; |
| 243 | e6 = 1; |
| 244 | } |
| 245 | |
| 246 | for (column = 0; column < x_count; column++) |
| 247 | { |
| 248 | UINT8 data = state->charram[(ma + column) & 0x7ff]; |
| 249 | UINT8 attr = state->colorram[(ma + column) & 0x7ff]; |
| 250 | UINT16 rad_addr, chargen_addr; |
| 251 | UINT8 rad_data, chargen_data; |
| 252 | int bit, x; |
| 253 | |
| 254 | if ((attr & 0x07) == ((attr >> 3) & 0x07)) |
| 255 | { |
| 256 | /* special case */ |
| 257 | |
| 258 | switch (attr >> 6) |
| 259 | { |
| 260 | case 0: |
| 261 | /* use previously selected attributes */ |
| 262 | break; |
| 263 | case 1: |
| 264 | /* reserved for future use */ |
| 265 | break; |
| 266 | case 2: |
| 267 | /* blank */ |
| 268 | fg_color = 0; |
| 269 | bg_color = 0; |
| 270 | underline = 0; |
| 271 | flash = 0; |
| 272 | break; |
| 273 | case 3: |
| 274 | /* double width */ |
| 275 | e5 = BIT(attr, 0); |
| 276 | e6 = BIT(attr, 1); |
| 277 | |
| 278 | /* read attributes from next byte */ |
| 279 | attr = state->colorram[(ma + column + 1) & 0x7ff]; |
| 280 | |
| 281 | if (attr != 0x00) |
| 282 | { |
| 283 | fg_color = attr & 0x07; |
| 284 | bg_color = (attr >> 3) & 0x07; |
| 285 | underline = BIT(attr, 6); |
| 286 | flash = BIT(attr, 7); |
| 287 | } |
| 288 | break; |
| 289 | } |
| 290 | } |
| 291 | else |
| 292 | { |
| 293 | /* normal case */ |
| 294 | |
| 295 | fg_color = attr & 0x07; |
| 296 | bg_color = (attr >> 3) & 0x07; |
| 297 | underline = BIT(attr, 6); |
| 298 | flash = BIT(attr, 7); |
| 299 | e5 = state->_40 ? 1 : 0; |
| 300 | e6 = state->_40 ? 1 : 0; |
| 301 | } |
| 302 | |
| 303 | if (column == cursor_x) |
| 304 | { |
| 305 | rad_data = 0x0f; |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | rad_addr = (e6 << 8) | (e5 << 7) | (flash << 6) | (underline << 5) | (state->flshclk << 4) | ra; |
| 310 | rad_data = state->rad_prom[rad_addr] & 0x0f; |
| 311 | |
| 312 | rad_data = ra; // HACK because the RAD prom is not dumped yet |
| 313 | } |
| 314 | |
| 315 | chargen_addr = (th << 12) | (data << 4) | rad_data; |
| 316 | chargen_data = state->char_rom[chargen_addr & 0xfff] << 2; |
| 317 | x = column * ABC800_CHAR_WIDTH; |
| 318 | |
| 319 | for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++) |
| 320 | { |
| 321 | int color = BIT(chargen_data, 7) ? fg_color : bg_color; |
| 322 | |
| 323 | if (state->txoff) |
| 324 | { |
| 325 | color = 0; |
| 326 | } |
| 327 | |
| 328 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 329 | |
| 330 | if (e5 || e6) |
| 331 | { |
| 332 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 333 | } |
| 334 | |
| 335 | chargen_data <<= 1; |
| 336 | } |
| 337 | |
| 338 | if (e5 || e6) |
| 339 | { |
| 340 | column++; |
| 341 | } |
| 342 | |
| 343 | old_data = data; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | static MC6845_ON_HSYNC_CHANGED(abc806_hsync_changed) |
| 348 | { |
| 349 | abc806_state *state = device->machine->driver_data; |
| 350 | |
| 351 | if (!hsync) |
| 352 | { |
| 353 | state->v50_addr++; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | static MC6845_ON_VSYNC_CHANGED(abc806_vsync_changed) |
| 358 | { |
| 359 | abc806_state *state = device->machine->driver_data; |
| 360 | |
| 361 | if (vsync) |
| 362 | { |
| 363 | state->v50_addr = 0; |
| 364 | } |
| 365 | |
| 366 | z80dart_set_ri(state->z80dart, 1, vsync); |
| 367 | } |
| 368 | |
| 369 | /* MC6845 Interfaces */ |
| 370 | |
| 371 | static const mc6845_interface abc806_mc6845_interface = { |
| 372 | SCREEN_TAG, |
| 373 | ABC800_CCLK, |
| 374 | ABC800_CHAR_WIDTH, |
| 375 | NULL, |
| 376 | abc806_update_row, |
| 377 | NULL, |
| 378 | NULL, |
| 379 | abc806_hsync_changed, |
| 380 | abc806_vsync_changed |
| 381 | }; |
| 382 | |
| 383 | /* HR */ |
| 384 | |
| 385 | static void abc806_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 386 | { |
| 387 | abc806_state *state = machine->driver_data; |
| 388 | |
| 389 | UINT16 addr = (state->hrs & 0x03) << 14; |
| 390 | int sx, y, dot; |
| 391 | |
| 392 | for (y = 0; y < 240; y++) |
| 393 | { |
| 394 | /* 240x240 */ |
| 395 | for (sx = 0; sx < 60; sx++) |
| 396 | { |
| 397 | UINT16 data = (state->videoram[addr++] << 8) | state->videoram[addr++]; |
| 398 | |
| 399 | for (dot = 0; dot < 4; dot++) |
| 400 | { |
| 401 | int color = state->hrc[(data >> 12) & 0x0f]; // TODO get colors from HRU II prom |
| 402 | int x = (sx << 3) | (dot << 1); |
| 403 | |
| 404 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 405 | *BITMAP_ADDR16(bitmap, y, x + 1) = color; |
| 406 | |
| 407 | data <<= 4; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | /* 256x240 */ |
| 412 | for (sx = 0; sx < 64; sx++) |
| 413 | { |
| 414 | UINT16 data = (state->videoram[addr++] << 8) | state->videoram[addr++]; |
| 415 | |
| 416 | for (dot = 0; dot < 4; dot++) |
| 417 | { |
| 418 | int color = state->hrc[(data >> 12) & 0x0f]; |
| 419 | int x = (sx << 3) | (dot << 1); |
| 420 | |
| 421 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 422 | *BITMAP_ADDR16(bitmap, y, x + 1) = color; |
| 423 | |
| 424 | data <<= 4; |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | /* 512x240 */ |
| 429 | for (sx = 0; sx < 64; sx++) |
| 430 | { |
| 431 | UINT16 data = (state->videoram[addr++] << 8) | state->videoram[addr++]; |
| 432 | |
| 433 | for (dot = 0; dot < 8; dot++) |
| 434 | { |
| 435 | int color = (data >> 14) & 0x03; |
| 436 | int x = (sx << 3) | dot; |
| 437 | |
| 438 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 439 | |
| 440 | data <<= 4; |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | /* Video Start */ |
| 447 | |
| 448 | static VIDEO_START(abc806) |
| 449 | { |
| 450 | abc806_state *state = machine->driver_data; |
| 451 | |
| 452 | int i; |
| 453 | |
| 454 | /* initialize variables */ |
| 455 | |
| 456 | for (i = 0; i < 16; i++) |
| 457 | { |
| 458 | state->hrc[i] = 0; |
| 459 | } |
| 460 | |
| 461 | state->sync = 10; |
| 462 | |
| 463 | /* find devices */ |
| 464 | |
| 465 | state->mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG); |
| 466 | |
| 467 | /* find memory regions */ |
| 468 | |
| 469 | state->char_rom = memory_region(machine, "chargen"); |
| 470 | state->rad_prom = memory_region(machine, "rad"); |
| 471 | state->hru2_prom = memory_region(machine, "hru2"); |
| 472 | |
| 473 | /* allocate memory */ |
| 474 | |
| 475 | state->charram = auto_malloc(ABC806_CHAR_RAM_SIZE); |
| 476 | state->colorram = auto_malloc(ABC806_ATTR_RAM_SIZE); |
| 477 | |
| 478 | /* allocate timer */ |
| 479 | |
| 480 | state->flash_timer = timer_alloc(abc806_flash_tick, NULL); |
| 481 | timer_adjust_periodic(state->flash_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2)); |
| 482 | |
| 483 | /* register for state saving */ |
| 484 | |
| 485 | state_save_register_global_pointer(state->charram, ABC806_CHAR_RAM_SIZE); |
| 486 | state_save_register_global_pointer(state->colorram, ABC806_ATTR_RAM_SIZE); |
| 487 | state_save_register_global_pointer(state->videoram, ABC806_VIDEO_RAM_SIZE); |
| 488 | |
| 489 | state_save_register_global(state->v50_addr); |
| 490 | state_save_register_global(state->attr_data); |
| 491 | state_save_register_global(state->hrs); |
| 492 | state_save_register_global(state->sync); |
| 493 | state_save_register_global_array(state->hrc); |
| 494 | state_save_register_global(state->eme); |
| 495 | state_save_register_global(state->txoff); |
| 496 | state_save_register_global(state->_40); |
| 497 | state_save_register_global(state->flshclk); |
| 498 | state_save_register_global(state->hru2_a8); |
| 499 | } |
| 500 | |
| 501 | /* Video Update */ |
| 502 | |
| 503 | static VIDEO_UPDATE( abc806 ) |
| 504 | { |
| 505 | abc806_state *state = screen->machine->driver_data; |
| 506 | |
| 507 | abc806_hr_update(screen->machine, bitmap, cliprect); |
| 508 | mc6845_update(state->mc6845, bitmap, cliprect); |
| 509 | |
| 510 | return 0; |
| 511 | } |
| 512 | |
| 513 | /* Machine Drivers */ |
| 514 | |
| 515 | MACHINE_DRIVER_START( abc806_video ) |
| 516 | /* device interface */ |
| 517 | MDRV_DEVICE_ADD(MC6845_TAG, MC6845) |
| 518 | MDRV_DEVICE_CONFIG(abc806_mc6845_interface) |
| 519 | |
| 520 | /* video hardware */ |
| 521 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 522 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 523 | |
| 524 | MDRV_SCREEN_REFRESH_RATE(60) |
| 525 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 526 | MDRV_SCREEN_SIZE(640, 400) |
| 527 | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 528 | |
| 529 | MDRV_PALETTE_LENGTH(8) |
| 530 | |
| 531 | MDRV_PALETTE_INIT(abc806) |
| 532 | MDRV_VIDEO_START(abc806) |
| 533 | MDRV_VIDEO_UPDATE(abc806) |
| 534 | MACHINE_DRIVER_END |
src/mess/machine/vector06.c
| r3455 | r3456 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | Vector06c driver by Miodrag Milanovic
|
| 4 | | |
| 5 | | 10/07/2008 Preliminary driver.
|
| 6 | | |
| 7 | | ****************************************************************************/
|
| 8 | | |
| 9 | | |
| 10 | | #include "driver.h"
|
| 11 | | #include "cpu/i8085/i8085.h"
|
| 12 | | #include "devices/cassette.h"
|
| 13 | | #include "machine/8255ppi.h"
|
| 14 | | |
| 15 | | static int vector06_keyboard_mask;
|
| 16 | | static UINT8 vector_color_index;
|
| 17 | | |
| 18 | | /* Driver initialization */
|
| 19 | | DRIVER_INIT(vector06)
|
| 20 | | {
|
| 21 | | memset(mess_ram,0,64*1024);
|
| 22 | | }
|
| 23 | | |
| 24 | | READ8_DEVICE_HANDLER (vector06_8255_portb_r )
|
| 25 | | {
|
| 26 | | UINT8 key = 0xff;
|
| 27 | | if ((vector06_keyboard_mask & 0x01)!=0) { key &= input_port_read(device->machine,"LINE0"); }
|
| 28 | | if ((vector06_keyboard_mask & 0x02)!=0) { key &= input_port_read(device->machine,"LINE1"); }
|
| 29 | | if ((vector06_keyboard_mask & 0x04)!=0) { key &= input_port_read(device->machine,"LINE2"); }
|
| 30 | | if ((vector06_keyboard_mask & 0x08)!=0) { key &= input_port_read(device->machine,"LINE3"); }
|
| 31 | | if ((vector06_keyboard_mask & 0x10)!=0) { key &= input_port_read(device->machine,"LINE4"); }
|
| 32 | | if ((vector06_keyboard_mask & 0x20)!=0) { key &= input_port_read(device->machine,"LINE5"); }
|
| 33 | | if ((vector06_keyboard_mask & 0x40)!=0) { key &= input_port_read(device->machine,"LINE6"); }
|
| 34 | | if ((vector06_keyboard_mask & 0x80)!=0) { key &= input_port_read(device->machine,"LINE7"); }
|
| 35 | | return key;
|
| 36 | | }
|
| 37 | | |
| 38 | | READ8_DEVICE_HANDLER (vector06_8255_portc_r )
|
| 39 | | {
|
| 40 | | return input_port_read(device->machine, "LINE8");
|
| 41 | | }
|
| 42 | | |
| 43 | | WRITE8_DEVICE_HANDLER (vector06_8255_porta_w )
|
| 44 | | {
|
| 45 | | vector06_keyboard_mask = data ^ 0xff;
|
| 46 | | }
|
| 47 | | |
| 48 | | WRITE8_DEVICE_HANDLER (vector06_8255_portb_w )
|
| 49 | | {
|
| 50 | | vector_color_index = data;
|
| 51 | | }
|
| 52 | | |
| 53 | | WRITE8_HANDLER(vector06_color_set)
|
| 54 | | {
|
| 55 | | UINT8 r = (data & 7) << 4;
|
| 56 | | UINT8 g = ((data >> 3) & 7) << 4;
|
| 57 | | UINT8 b = ((data >>6) & 3) << 5;
|
| 58 | | palette_set_color( machine, vector_color_index, MAKE_RGB(r,g,b) );
|
| 59 | | }
|
| 60 | | |
| 61 | | const ppi8255_interface vector06_ppi8255_interface =
|
| 62 | | {
|
| 63 | | NULL,
|
| 64 | | vector06_8255_portb_r,
|
| 65 | | vector06_8255_portc_r,
|
| 66 | | vector06_8255_porta_w,
|
| 67 | | vector06_8255_portb_w,
|
| 68 | | NULL
|
| 69 | | };
|
| 70 | | |
| 71 | | READ8_HANDLER(vector_8255_1_r) {
|
| 72 | | return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), (offset ^ 0x03));
|
| 73 | | }
|
| 74 | | |
| 75 | | WRITE8_HANDLER(vector_8255_1_w) {
|
| 76 | | ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), (offset ^0x03) , data );
|
| 77 | | |
| 78 | | }
|
| 79 | | |
| 80 | | |
| 81 | | INTERRUPT_GEN( vector06_interrupt )
|
| 82 | | {
|
| 83 | | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
|
| 84 | | }
|
| 85 | | |
| 86 | | static IRQ_CALLBACK ( vector06_irq_callback )
|
| 87 | | {
|
| 88 | | // Interupt is RST 7
|
| 89 | | return 0xcd0038;
|
| 90 | | }
|
| 91 | | |
| 92 | | MACHINE_RESET( vector06 )
|
| 93 | | {
|
| 94 | | cpunum_set_irq_callback(0, vector06_irq_callback);
|
| 95 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x7fff, 0, 0, SMH_BANK1);
|
| 96 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x7fff, 0, 0, SMH_BANK2);
|
| 97 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_BANK3);
|
| 98 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_BANK4);
|
| 99 | | |
| 100 | | memory_set_bankptr(1, memory_region(machine, "main") + 0x10000);
|
| 101 | | memory_set_bankptr(2, mess_ram + 0x0000);
|
| 102 | | memory_set_bankptr(3, mess_ram + 0x8000);
|
| 103 | | memory_set_bankptr(4, mess_ram + 0x8000);
|
| 104 | | |
| 105 | | vector06_keyboard_mask = 0;
|
| 106 | | }
|
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Vector06c driver by Miodrag Milanovic |
| 4 | |
| 5 | 10/07/2008 Preliminary driver. |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "devices/cassette.h" |
| 13 | #include "machine/8255ppi.h" |
| 14 | |
| 15 | static int vector06_keyboard_mask; |
| 16 | static UINT8 vector_color_index; |
| 17 | |
| 18 | /* Driver initialization */ |
| 19 | DRIVER_INIT(vector06) |
| 20 | { |
| 21 | memset(mess_ram,0,64*1024); |
| 22 | } |
| 23 | |
| 24 | READ8_DEVICE_HANDLER (vector06_8255_portb_r ) |
| 25 | { |
| 26 | UINT8 key = 0xff; |
| 27 | if ((vector06_keyboard_mask & 0x01)!=0) { key &= input_port_read(device->machine,"LINE0"); } |
| 28 | if ((vector06_keyboard_mask & 0x02)!=0) { key &= input_port_read(device->machine,"LINE1"); } |
| 29 | if ((vector06_keyboard_mask & 0x04)!=0) { key &= input_port_read(device->machine,"LINE2"); } |
| 30 | if ((vector06_keyboard_mask & 0x08)!=0) { key &= input_port_read(device->machine,"LINE3"); } |
| 31 | if ((vector06_keyboard_mask & 0x10)!=0) { key &= input_port_read(device->machine,"LINE4"); } |
| 32 | if ((vector06_keyboard_mask & 0x20)!=0) { key &= input_port_read(device->machine,"LINE5"); } |
| 33 | if ((vector06_keyboard_mask & 0x40)!=0) { key &= input_port_read(device->machine,"LINE6"); } |
| 34 | if ((vector06_keyboard_mask & 0x80)!=0) { key &= input_port_read(device->machine,"LINE7"); } |
| 35 | return key; |
| 36 | } |
| 37 | |
| 38 | READ8_DEVICE_HANDLER (vector06_8255_portc_r ) |
| 39 | { |
| 40 | return input_port_read(device->machine, "LINE8"); |
| 41 | } |
| 42 | |
| 43 | WRITE8_DEVICE_HANDLER (vector06_8255_porta_w ) |
| 44 | { |
| 45 | vector06_keyboard_mask = data ^ 0xff; |
| 46 | } |
| 47 | |
| 48 | WRITE8_DEVICE_HANDLER (vector06_8255_portb_w ) |
| 49 | { |
| 50 | vector_color_index = data; |
| 51 | } |
| 52 | |
| 53 | WRITE8_HANDLER(vector06_color_set) |
| 54 | { |
| 55 | UINT8 r = (data & 7) << 4; |
| 56 | UINT8 g = ((data >> 3) & 7) << 4; |
| 57 | UINT8 b = ((data >>6) & 3) << 5; |
| 58 | palette_set_color( machine, vector_color_index, MAKE_RGB(r,g,b) ); |
| 59 | } |
| 60 | |
| 61 | const ppi8255_interface vector06_ppi8255_interface = |
| 62 | { |
| 63 | NULL, |
| 64 | vector06_8255_portb_r, |
| 65 | vector06_8255_portc_r, |
| 66 | vector06_8255_porta_w, |
| 67 | vector06_8255_portb_w, |
| 68 | NULL |
| 69 | }; |
| 70 | |
| 71 | READ8_HANDLER(vector_8255_1_r) { |
| 72 | return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), (offset ^ 0x03)); |
| 73 | } |
| 74 | |
| 75 | WRITE8_HANDLER(vector_8255_1_w) { |
| 76 | ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), (offset ^0x03) , data ); |
| 77 | |
| 78 | } |
| 79 | |
| 80 | |
| 81 | INTERRUPT_GEN( vector06_interrupt ) |
| 82 | { |
| 83 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); |
| 84 | } |
| 85 | |
| 86 | static IRQ_CALLBACK ( vector06_irq_callback ) |
| 87 | { |
| 88 | // Interupt is RST 7 |
| 89 | return 0xcd0038; |
| 90 | } |
| 91 | |
| 92 | MACHINE_RESET( vector06 ) |
| 93 | { |
| 94 | cpunum_set_irq_callback(0, vector06_irq_callback); |
| 95 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x7fff, 0, 0, SMH_BANK1); |
| 96 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x7fff, 0, 0, SMH_BANK2); |
| 97 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_BANK3); |
| 98 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_BANK4); |
| 99 | |
| 100 | memory_set_bankptr(1, memory_region(machine, "main") + 0x10000); |
| 101 | memory_set_bankptr(2, mess_ram + 0x0000); |
| 102 | memory_set_bankptr(3, mess_ram + 0x8000); |
| 103 | memory_set_bankptr(4, mess_ram + 0x8000); |
| 104 | |
| 105 | vector06_keyboard_mask = 0; |
| 106 | } |
src/mess/machine/ondra.c
| r3455 | r3456 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | Ondra driver by Miodrag Milanovic
|
| 4 | | |
| 5 | | 08/09/2008 Preliminary driver.
|
| 6 | | |
| 7 | | ****************************************************************************/
|
| 8 | | |
| 9 | | |
| 10 | | #include "driver.h"
|
| 11 | | #include "cpu/z80/z80.h"
|
| 12 | | #include "includes/ondra.h"
|
| 13 | | |
| 14 | | |
| 15 | | /* Driver initialization */
|
| 16 | | DRIVER_INIT(ondra)
|
| 17 | | {
|
| 18 | | memset(mess_ram,0,64*1024);
|
| 19 | | }
|
| 20 | | |
| 21 | | UINT8 ondra_video_enable;
|
| 22 | | UINT8 ondra_bank1_status;
|
| 23 | | UINT8 ondra_bank2_status;
|
| 24 | | |
| 25 | | static void ondra_update_banks(running_machine *machine)
|
| 26 | | {
|
| 27 | | UINT8 *mem = memory_region(machine, "main");
|
| 28 | | if (ondra_bank1_status==0) {
|
| 29 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x07ff, 0, 0, SMH_UNMAP);
|
| 30 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0fff, 0, 0, SMH_UNMAP);
|
| 31 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, SMH_UNMAP);
|
| 32 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, SMH_UNMAP);
|
| 33 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x27ff, 0, 0, SMH_UNMAP);
|
| 34 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2fff, 0, 0, SMH_UNMAP);
|
| 35 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x37ff, 0, 0, SMH_UNMAP);
|
| 36 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3fff, 0, 0, SMH_UNMAP);
|
| 37 | | |
| 38 | | memory_set_bankptr(1, mem + 0x010000);
|
| 39 | | memory_set_bankptr(2, mem + 0x010000);
|
| 40 | | memory_set_bankptr(3, mem + 0x010000);
|
| 41 | | memory_set_bankptr(4, mem + 0x010000);
|
| 42 | | memory_set_bankptr(5, mem + 0x010800);
|
| 43 | | memory_set_bankptr(6, mem + 0x010800);
|
| 44 | | memory_set_bankptr(7, mem + 0x010800);
|
| 45 | | memory_set_bankptr(8, mem + 0x010800);
|
| 46 | | } else {
|
| 47 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x07ff, 0, 0, SMH_BANK1);
|
| 48 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0fff, 0, 0, SMH_BANK2);
|
| 49 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, SMH_BANK3);
|
| 50 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, SMH_BANK4);
|
| 51 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x27ff, 0, 0, SMH_BANK5);
|
| 52 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2fff, 0, 0, SMH_BANK6);
|
| 53 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x37ff, 0, 0, SMH_BANK7);
|
| 54 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3fff, 0, 0, SMH_BANK8);
|
| 55 | | |
| 56 | | memory_set_bankptr(1, mess_ram + 0x0000);
|
| 57 | | memory_set_bankptr(2, mess_ram + 0x0800);
|
| 58 | | memory_set_bankptr(3, mess_ram + 0x1000);
|
| 59 | | memory_set_bankptr(4, mess_ram + 0x1800);
|
| 60 | | memory_set_bankptr(5, mess_ram + 0x2000);
|
| 61 | | memory_set_bankptr(6, mess_ram + 0x2800);
|
| 62 | | memory_set_bankptr(7, mess_ram + 0x3000);
|
| 63 | | memory_set_bankptr(8, mess_ram + 0x3800);
|
| 64 | | }
|
| 65 | | memory_set_bankptr(9, mess_ram + 0x4000);
|
| 66 | | if (ondra_bank2_status==0) {
|
| 67 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK10);
|
| 68 | | memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK10);
|
| 69 | | memory_set_bankptr(10, mess_ram + 0xe000);
|
| 70 | | } else {
|
| 71 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
|
| 72 | | memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
|
| 73 | | }
|
| 74 | | }
|
| 75 | | |
| 76 | | WRITE8_HANDLER( ondra_port_03_w )
|
| 77 | | {
|
| 78 | | ondra_video_enable = data & 1;
|
| 79 | | ondra_bank1_status = (data >> 1) & 1;
|
| 80 | | ondra_bank2_status = (data >> 2) & 1;
|
| 81 | | ondra_update_banks(machine);
|
| 82 | | }
|
| 83 | | |
| 84 | | WRITE8_HANDLER( ondra_port_09_w )
|
| 85 | | {
|
| 86 | | |
| 87 | | }
|
| 88 | | |
| 89 | | WRITE8_HANDLER( ondra_port_0a_w )
|
| 90 | | {
|
| 91 | | }
|
| 92 | | |
| 93 | | |
| 94 | | MACHINE_RESET( ondra )
|
| 95 | | {
|
| 96 | | ondra_bank1_status = 0;
|
| 97 | | ondra_bank2_status = 0;
|
| 98 | | ondra_update_banks(machine);
|
| 99 | | }
|
| 100 | | |
| 101 | | MACHINE_START(ondra)
|
| 102 | | {
|
| 103 | | }
|
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Ondra driver by Miodrag Milanovic |
| 4 | |
| 5 | 08/09/2008 Preliminary driver. |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "cpu/z80/z80.h" |
| 12 | #include "includes/ondra.h" |
| 13 | |
| 14 | |
| 15 | /* Driver initialization */ |
| 16 | DRIVER_INIT(ondra) |
| 17 | { |
| 18 | memset(mess_ram,0,64*1024); |
| 19 | } |
| 20 | |
| 21 | UINT8 ondra_video_enable; |
| 22 | UINT8 ondra_bank1_status; |
| 23 | UINT8 ondra_bank2_status; |
| 24 | |
| 25 | static void ondra_update_banks(running_machine *machine) |
| 26 | { |
| 27 | UINT8 *mem = memory_region(machine, "main"); |
| 28 | if (ondra_bank1_status==0) { |
| 29 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x07ff, 0, 0, SMH_UNMAP); |
| 30 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0fff, 0, 0, SMH_UNMAP); |
| 31 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, SMH_UNMAP); |
| 32 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, SMH_UNMAP); |
| 33 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x27ff, 0, 0, SMH_UNMAP); |
| 34 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); |
| 35 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x37ff, 0, 0, SMH_UNMAP); |
| 36 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3fff, 0, 0, SMH_UNMAP); |
| 37 | |
| 38 | memory_set_bankptr(1, mem + 0x010000); |
| 39 | memory_set_bankptr(2, mem + 0x010000); |
| 40 | memory_set_bankptr(3, mem + 0x010000); |
| 41 | memory_set_bankptr(4, mem + 0x010000); |
| 42 | memory_set_bankptr(5, mem + 0x010800); |
| 43 | memory_set_bankptr(6, mem + 0x010800); |
| 44 | memory_set_bankptr(7, mem + 0x010800); |
| 45 | memory_set_bankptr(8, mem + 0x010800); |
| 46 | } else { |
| 47 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x07ff, 0, 0, SMH_BANK1); |
| 48 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0fff, 0, 0, SMH_BANK2); |
| 49 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, SMH_BANK3); |
| 50 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, SMH_BANK4); |
| 51 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x27ff, 0, 0, SMH_BANK5); |
| 52 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2fff, 0, 0, SMH_BANK6); |
| 53 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x37ff, 0, 0, SMH_BANK7); |
| 54 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3fff, 0, 0, SMH_BANK8); |
| 55 | |
| 56 | memory_set_bankptr(1, mess_ram + 0x0000); |
| 57 | memory_set_bankptr(2, mess_ram + 0x0800); |
| 58 | memory_set_bankptr(3, mess_ram + 0x1000); |
| 59 | memory_set_bankptr(4, mess_ram + 0x1800); |
| 60 | memory_set_bankptr(5, mess_ram + 0x2000); |
| 61 | memory_set_bankptr(6, mess_ram + 0x2800); |
| 62 | memory_set_bankptr(7, mess_ram + 0x3000); |
| 63 | memory_set_bankptr(8, mess_ram + 0x3800); |
| 64 | } |
| 65 | memory_set_bankptr(9, mess_ram + 0x4000); |
| 66 | if (ondra_bank2_status==0) { |
| 67 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK10); |
| 68 | memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK10); |
| 69 | memory_set_bankptr(10, mess_ram + 0xe000); |
| 70 | } else { |
| 71 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 72 | memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | WRITE8_HANDLER( ondra_port_03_w ) |
| 77 | { |
| 78 | ondra_video_enable = data & 1; |
| 79 | ondra_bank1_status = (data >> 1) & 1; |
| 80 | ondra_bank2_status = (data >> 2) & 1; |
| 81 | ondra_update_banks(machine); |
| 82 | } |
| 83 | |
| 84 | WRITE8_HANDLER( ondra_port_09_w ) |
| 85 | { |
| 86 | |
| 87 | } |
| 88 | |
| 89 | WRITE8_HANDLER( ondra_port_0a_w ) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | |
| 94 | MACHINE_RESET( ondra ) |
| 95 | { |
| 96 | ondra_bank1_status = 0; |
| 97 | ondra_bank2_status = 0; |
| 98 | ondra_update_banks(machine); |
| 99 | } |
| 100 | |
| 101 | MACHINE_START(ondra) |
| 102 | { |
| 103 | } |
src/mess/machine/abc77.c
| r3455 | r3456 | |
| 1 | | #include "driver.h"
|
| 2 | | #include "abc77.h"
|
| 3 | | #include "cpu/mcs48/mcs48.h"
|
| 4 | | #include "sound/discrete.h"
|
| 5 | | |
| 6 | | typedef struct _abc77_t abc77_t;
|
| 7 | | struct _abc77_t
|
| 8 | | {
|
| 9 | | const abc77_interface *intf; /* interface */
|
| 10 | | |
| 11 | | int cpunum; /* CPU index of the 8035 */
|
| 12 | | |
| 13 | | int keylatch; /* keyboard row latch */
|
| 14 | | int clock; /* transmit clock */
|
| 15 | | int hys; /* hysteresis */
|
| 16 | | int reset; /* reset */
|
| 17 | | |
| 18 | | /* timers */
|
| 19 | | emu_timer *reset_timer; /* reset timer */
|
| 20 | | };
|
| 21 | | |
| 22 | | INLINE abc77_t *get_safe_token(const device_config *device)
|
| 23 | | {
|
| 24 | | assert(device != NULL);
|
| 25 | | assert(device->token != NULL);
|
| 26 | | |
| 27 | | return (abc77_t *)device->token;
|
| 28 | | }
|
| 29 | | |
| 30 | | /* Discrete Sound */
|
| 31 | | |
| 32 | | static const discrete_555_desc abc77_ne556_a =
|
| 33 | | {
|
| 34 | | DISC_555_OUT_SQW | DISC_555_OUT_DC,
|
| 35 | | 5, // B+ voltage of 555
|
| 36 | | DEFAULT_555_VALUES
|
| 37 | | };
|
| 38 | | |
| 39 | | DISCRETE_SOUND_START( abc77 )
|
| 40 | | DISCRETE_INPUT_LOGIC(NODE_01)
|
| 41 | | DISCRETE_555_ASTABLE(NODE_02, NODE_01, RES_K(2.7), RES_K(15), CAP_N(22), &abc77_ne556_a)
|
| 42 | | DISCRETE_OUTPUT(NODE_02, 5000)
|
| 43 | | DISCRETE_SOUND_END
|
| 44 | | |
| 45 | | /* Read/Write Handlers */
|
| 46 | | |
| 47 | | void abc77_rxd_w(const device_config *device, int level)
|
| 48 | | {
|
| 49 | | abc77_t *abc77 = get_safe_token(device);
|
| 50 | | |
| 51 | | cpunum_set_input_line(device->machine, abc77->cpunum, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE);
|
| 52 | | }
|
| 53 | | |
| 54 | | void abc77_clock_w(const device_config *device, int level)
|
| 55 | | {
|
| 56 | | abc77_t *abc77 = get_safe_token(device);
|
| 57 | | |
| 58 | | abc77->clock = level;
|
| 59 | | }
|
| 60 | | |
| 61 | | static TIMER_CALLBACK( reset_tick )
|
| 62 | | {
|
| 63 | | const device_config *device = ptr;
|
| 64 | | abc77_t *abc77 = get_safe_token(device);
|
| 65 | | |
| 66 | | cpunum_set_input_line(device->machine, abc77->cpunum, INPUT_LINE_RESET, CLEAR_LINE);
|
| 67 | | }
|
| 68 | | |
| 69 | | void abc77_reset_w(const device_config *device, int level)
|
| 70 | | {
|
| 71 | | abc77_t *abc77 = get_safe_token(device);
|
| 72 | | |
| 73 | | if (abc77->reset && !level)
|
| 74 | | {
|
| 75 | | /* trigger reset */
|
| 76 | | int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1
|
| 77 | | int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7);
|
| 78 | | |
| 79 | | cpunum_set_input_line(device->machine, abc77->cpunum, INPUT_LINE_RESET, ASSERT_LINE);
|
| 80 | | timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0);
|
| 81 | | |
| 82 | | cpunum_set_input_line(device->machine, abc77->cpunum, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE);
|
| 83 | | }
|
| 84 | | |
| 85 | | abc77->reset = level;
|
| 86 | | }
|
| 87 | | |
| 88 | | static READ8_HANDLER( abc77_clock_r )
|
| 89 | | {
|
| 90 | | const device_config *device = devtag_get_device(machine, ABC77, ABC77_TAG);
|
| 91 | | abc77_t *abc77 = get_safe_token(device);
|
| 92 | | |
| 93 | | return abc77->clock;
|
| 94 | | }
|
| 95 | | |
| 96 | | static READ8_HANDLER( abc77_data_r )
|
| 97 | | {
|
| 98 | | const device_config *device = devtag_get_device(machine, ABC77, ABC77_TAG);
|
| 99 | | abc77_t *abc77 = get_safe_token(device);
|
| 100 | | |
| 101 | | static const char *keynames[] = { "ABC77_X0", "ABC77_X1", "ABC77_X2", "ABC77_X3", "ABC77_X4", "ABC77_X5", "ABC77_X6", "ABC77_X7", "ABC77_X8", "ABC77_X9", "ABC77_X10", "ABC77_X11" };
|
| 102 | | |
| 103 | | return input_port_read(device->machine, keynames[abc77->keylatch]);
|
| 104 | | }
|
| 105 | | |
| 106 | | static WRITE8_HANDLER( abc77_data_w )
|
| 107 | | {
|
| 108 | | const device_config *device = devtag_get_device(machine, ABC77, ABC77_TAG);
|
| 109 | | abc77_t *abc77 = get_safe_token(device);
|
| 110 | | |
| 111 | | abc77->keylatch = data & 0x0f;
|
| 112 | | |
| 113 | | if (abc77->keylatch == 1)
|
| 114 | | {
|
| 115 | | watchdog_reset(device->machine);
|
| 116 | | }
|
| 117 | | |
| 118 | | /* beep */
|
| 119 | | discrete_sound_w(device->machine, NODE_01, BIT(data, 4));
|
| 120 | | |
| 121 | | /* transmit data */
|
| 122 | | abc77->intf->txd_w(device, BIT(data, 5));
|
| 123 | | |
| 124 | | /* key down */
|
| 125 | | abc77->intf->keydown_w(device, BIT(data, 6));
|
| 126 | | |
| 127 | | /* hysteresis */
|
| 128 | | abc77->hys = BIT(data, 7);
|
| 129 | | }
|
| 130 | | |
| 131 | | /* Memory Maps */
|
| 132 | | |
| 133 | | static ADDRESS_MAP_START( abc77_map, ADDRESS_SPACE_PROGRAM, 8 )
|
| 134 | | AM_RANGE(0x000, 0xfff) AM_ROM
|
| 135 | | ADDRESS_MAP_END
|
| 136 | | |
| 137 | | static ADDRESS_MAP_START( abc77_io_map, ADDRESS_SPACE_IO, 8 )
|
| 138 | | AM_RANGE(0x00, 0x3f) AM_RAM
|
| 139 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(abc77_data_r)
|
| 140 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(abc77_data_w)
|
| 141 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(abc77_clock_r)
|
| 142 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_PORT("ABC77_DSW")
|
| 143 | | ADDRESS_MAP_END
|
| 144 | | |
| 145 | | /* Input Ports */
|
| 146 | | |
| 147 | | INPUT_PORTS_START( abc77 )
|
| 148 | | PORT_START("ABC77_X0")
|
| 149 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 150 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 151 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 152 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 153 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE
|
| 154 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
|
| 155 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
| 156 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
| 157 | | |
| 158 | | PORT_START("ABC77_X1")
|
| 159 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 160 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 161 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 162 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 163 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 164 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 165 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 166 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 167 | | |
| 168 | | PORT_START("ABC77_X2")
|
| 169 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 170 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>')
|
| 171 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
|
| 172 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 173 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
|
| 174 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 175 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 176 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
| 177 | | |
| 178 | | PORT_START("ABC77_X3")
|
| 179 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00E9) PORT_CHAR(0x00C9)
|
| 180 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?')
|
| 181 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5)
|
| 182 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC)
|
| 183 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4)
|
| 184 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*')
|
| 185 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 186 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
| 187 | | |
| 188 | | PORT_START("ABC77_X4")
|
| 189 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
|
| 190 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
|
| 191 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
|
| 192 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
|
| 193 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
|
| 194 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6)
|
| 195 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
|
| 196 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
|
| 197 | | |
| 198 | | PORT_START("ABC77_X5")
|
| 199 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
|
| 200 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/')
|
| 201 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
|
| 202 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
|
| 203 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
|
| 204 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
|
| 205 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
|
| 206 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
|
| 207 | | |
| 208 | | PORT_START("ABC77_X6")
|
| 209 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
|
| 210 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
|
| 211 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
|
| 212 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
|
| 213 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
|
| 214 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
|
| 215 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
|
| 216 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
|
| 217 | | |
| 218 | | PORT_START("ABC77_X7")
|
| 219 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 \xC2\xA4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00A4)
|
| 220 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
|
| 221 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
|
| 222 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
|
| 223 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
|
| 224 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
|
| 225 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
|
| 226 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
|
| 227 | | |
| 228 | | PORT_START("ABC77_X8")
|
| 229 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
|
| 230 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
|
| 231 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
|
| 232 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
|
| 233 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
|
| 234 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
|
| 235 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
|
| 236 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
|
| 237 | | |
| 238 | | PORT_START("ABC77_X9")
|
| 239 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
|
| 240 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
|
| 241 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
|
| 242 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
|
| 243 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
|
| 244 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD RETURN") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
|
| 245 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 246 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
|
| 247 | | |
| 248 | | PORT_START("ABC77_X10")
|
| 249 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
|
| 250 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
|
| 251 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
|
| 252 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
|
| 253 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
|
| 254 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
|
| 255 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
|
| 256 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 257 | | |
| 258 | | PORT_START("ABC77_X11")
|
| 259 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
|
| 260 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
|
| 261 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
|
| 262 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
|
| 263 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
|
| 264 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
|
| 265 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
|
| 266 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
|
| 267 | | |
| 268 | | PORT_START("ABC77_DSW")
|
| 269 | | PORT_DIPNAME( 0x01, 0x01, "Keyboard Program" )
|
| 270 | | PORT_DIPSETTING( 0x00, "Internal (8048)" )
|
| 271 | | PORT_DIPSETTING( 0x01, "External PROM" )
|
| 272 | | PORT_DIPNAME( 0x02, 0x00, "Character Set" )
|
| 273 | | PORT_DIPSETTING( 0x00, "Swedish" )
|
| 274 | | PORT_DIPSETTING( 0x02, "US ASCII" )
|
| 275 | | PORT_DIPNAME( 0x04, 0x04, "External PROM" )
|
| 276 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
|
| 277 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
| 278 | | PORT_DIPNAME( 0x18, 0x18, "Keyboard Type" )
|
| 279 | | PORT_DIPSETTING( 0x00, "Danish" )
|
| 280 | | PORT_DIPSETTING( 0x10, DEF_STR( French ) )
|
| 281 | | PORT_DIPSETTING( 0x08, DEF_STR( German ) )
|
| 282 | | PORT_DIPSETTING( 0x18, DEF_STR( Spanish ) )
|
| 283 | | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
|
| 284 | | INPUT_PORTS_END
|
| 285 | | |
| 286 | | /* Machine Driver */
|
| 287 | | |
| 288 | | MACHINE_DRIVER_START( abc77 )
|
| 289 | | /* keyboard cpu */
|
| 290 | | MDRV_CPU_ADD(I8035_TAG, I8035, 4608000)
|
| 291 | | MDRV_CPU_PROGRAM_MAP(abc77_map, 0)
|
| 292 | | MDRV_CPU_IO_MAP(abc77_io_map, 0)
|
| 293 | | |
| 294 | | /* discrete sound */
|
| 295 | | MDRV_SOUND_ADD("discrete", DISCRETE, 0)
|
| 296 | | MDRV_SOUND_CONFIG_DISCRETE(abc77)
|
| 297 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
| 298 | | MACHINE_DRIVER_END
|
| 299 | | |
| 300 | | /* ROMs */
|
| 301 | | |
| 302 | | ROM_START( abc77 )
|
| 303 | | ROM_REGION( 0x1000, I8035_TAG, 0 )
|
| 304 | | ROM_LOAD( "65-02486.z10", 0x0000, 0x0800, NO_DUMP ) /* 2716 ABC55/77 keyboard controller Swedish EPROM */
|
| 305 | | ROM_LOAD( "keyboard.z14", 0x0800, 0x0800, NO_DUMP ) /* 2716 ABC55/77 keyboard controller non-Swedish EPROM */
|
| 306 | | ROM_FILL( 0, 0x1000, 0 )
|
| 307 | | ROM_END
|
| 308 | | |
| 309 | | /* Device Interface */
|
| 310 | | |
| 311 | | static DEVICE_START( abc77 )
|
| 312 | | {
|
| 313 | | abc77_t *abc77 = device->token;
|
| 314 | | char unique_tag[30];
|
| 315 | | astring *tempstring = astring_alloc();
|
| 316 | | |
| 317 | | /* validate arguments */
|
| 318 | | |
| 319 | | assert(device->machine != NULL);
|
| 320 | | assert(device->tag != NULL);
|
| 321 | | assert(strlen(device->tag) < 20);
|
| 322 | | abc77->intf = device->static_config;
|
| 323 | | assert(abc77->intf != NULL);
|
| 324 | | assert(abc77->intf->txd_w != NULL);
|
| 325 | | assert(abc77->intf->keydown_w != NULL);
|
| 326 | | |
| 327 | | /* find our CPU */
|
| 328 | | |
| 329 | | astring_printf(tempstring, "%s:%s", device->tag, I8035_TAG);
|
| 330 | | abc77->cpunum = mame_find_cpu_index(device->machine, astring_c(tempstring));
|
| 331 | | astring_free(tempstring);
|
| 332 | | |
| 333 | | /* allocate timer */
|
| 334 | | |
| 335 | | abc77->reset_timer = timer_alloc(reset_tick, (FPTR *) device);
|
| 336 | | |
| 337 | | /* register for state saving */
|
| 338 | | |
| 339 | | state_save_combine_module_and_tag(unique_tag, "ABC77", device->tag);
|
| 340 | | |
| 341 | | state_save_register_item(unique_tag, 0, abc77->keylatch);
|
| 342 | | state_save_register_item(unique_tag, 0, abc77->clock);
|
| 343 | | state_save_register_item(unique_tag, 0, abc77->hys);
|
| 344 | | state_save_register_item(unique_tag, 0, abc77->reset);
|
| 345 | | |
| 346 | | return DEVICE_START_OK;
|
| 347 | | }
|
| 348 | | |
| 349 | | static DEVICE_SET_INFO( abc77 )
|
| 350 | | {
|
| 351 | | switch (state)
|
| 352 | | {
|
| 353 | | /* no parameters to set */
|
| 354 | | }
|
| 355 | | }
|
| 356 | | |
| 357 | | DEVICE_GET_INFO( abc77 )
|
| 358 | | {
|
| 359 | | switch (state)
|
| 360 | | {
|
| 361 | | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 362 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 363 | | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
| 364 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(abc77_t); break;
|
| 365 | | |
| 366 | | /* --- the following bits of info are returned as pointers --- */
|
| 367 | | case DEVINFO_PTR_ROM_REGION: info->romregion = rom_abc77; break;
|
| 368 | | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = machine_config_abc77; break;
|
| 369 | | |
| 370 | | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 371 | | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(abc77); break;
|
| 372 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(abc77); break;
|
| 373 | | case DEVINFO_FCT_STOP: /* Nothing */ break;
|
| 374 | | case DEVINFO_FCT_RESET: /* Nothing */ break;
|
| 375 | | |
| 376 | | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 377 | | case DEVINFO_STR_NAME: info->s = "Luxor ABC-77"; break;
|
| 378 | | case DEVINFO_STR_FAMILY: info->s = "Luxor ABC"; break;
|
| 379 | | case DEVINFO_STR_VERSION: info->s = "1.0"; break;
|
| 380 | | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break;
|
| 381 | | case DEVINFO_STR_CREDITS: info->s = "Copyright the MESS Team"; break;
|
| 382 | | }
|
| 383 | | }
|
| 1 | #include "driver.h" |
| 2 | #include "abc77.h" |
| 3 | #include "cpu/mcs48/mcs48.h" |
| 4 | #include "sound/discrete.h" |
| 5 | |
| 6 | typedef struct _abc77_t abc77_t; |
| 7 | struct _abc77_t |
| 8 | { |
| 9 | const abc77_interface *intf; /* interface */ |
| 10 | |
| 11 | int cpunum; /* CPU index of the 8035 */ |
| 12 | |
| 13 | int keylatch; /* keyboard row latch */ |
| 14 | int clock; /* transmit clock */ |
| 15 | int hys; /* hysteresis */ |
| 16 | int reset; /* reset */ |
| 17 | |
| 18 | /* timers */ |
| 19 | emu_timer *reset_timer; /* reset timer */ |
| 20 | }; |
| 21 | |
| 22 | INLINE abc77_t *get_safe_token(const device_config *device) |
| 23 | { |
| 24 | assert(device != NULL); |
| 25 | assert(device->token != NULL); |
| 26 | |
| 27 | return (abc77_t *)device->token; |
| 28 | } |
| 29 | |
| 30 | /* Discrete Sound */ |
| 31 | |
| 32 | static const discrete_555_desc abc77_ne556_a = |
| 33 | { |
| 34 | DISC_555_OUT_SQW | DISC_555_OUT_DC, |
| 35 | 5, // B+ voltage of 555 |
| 36 | DEFAULT_555_VALUES |
| 37 | }; |
| 38 | |
| 39 | DISCRETE_SOUND_START( abc77 ) |
| 40 | DISCRETE_INPUT_LOGIC(NODE_01) |
| 41 | DISCRETE_555_ASTABLE(NODE_02, NODE_01, RES_K(2.7), RES_K(15), CAP_N(22), &abc77_ne556_a) |
| 42 | DISCRETE_OUTPUT(NODE_02, 5000) |
| 43 | DISCRETE_SOUND_END |
| 44 | |
| 45 | /* Read/Write Handlers */ |
| 46 | |
| 47 | void abc77_rxd_w(const device_config *device, int level) |
| 48 | { |
| 49 | abc77_t *abc77 = get_safe_token(device); |
| 50 | |
| 51 | cpunum_set_input_line(device->machine, abc77->cpunum, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE); |
| 52 | } |
| 53 | |
| 54 | void abc77_clock_w(const device_config *device, int level) |
| 55 | { |
| 56 | abc77_t *abc77 = get_safe_token(device); |
| 57 | |
| 58 | abc77->clock = level; |
| 59 | } |
| 60 | |
| 61 | static TIMER_CALLBACK( reset_tick ) |
| 62 | { |
| 63 | const device_config *device = ptr; |
| 64 | abc77_t *abc77 = get_safe_token(device); |
| 65 | |
| 66 | cpunum_set_input_line(device->machine, abc77->cpunum, INPUT_LINE_RESET, CLEAR_LINE); |
| 67 | } |
| 68 | |
| 69 | void abc77_reset_w(const device_config *device, int level) |
| 70 | { |
| 71 | abc77_t *abc77 = get_safe_token(device); |
| 72 | |
| 73 | if (abc77->reset && !level) |
| 74 | { |
| 75 | /* trigger reset */ |
| 76 | int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1 |
| 77 | int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7); |
| 78 | |
| 79 | cpunum_set_input_line(device->machine, abc77->cpunum, INPUT_LINE_RESET, ASSERT_LINE); |
| 80 | timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0); |
| 81 | |
| 82 | cpunum_set_input_line(device->machine, abc77->cpunum, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE); |
| 83 | } |
| 84 | |
| 85 | abc77->reset = level; |
| 86 | } |
| 87 | |
| 88 | static READ8_HANDLER( abc77_clock_r ) |
| 89 | { |
| 90 | const device_config *device = devtag_get_device(machine, ABC77, ABC77_TAG); |
| 91 | abc77_t *abc77 = get_safe_token(device); |
| 92 | |
| 93 | return abc77->clock; |
| 94 | } |
| 95 | |
| 96 | static READ8_HANDLER( abc77_data_r ) |
| 97 | { |
| 98 | const device_config *device = devtag_get_device(machine, ABC77, ABC77_TAG); |
| 99 | abc77_t *abc77 = get_safe_token(device); |
| 100 | |
| 101 | static const char *keynames[] = { "ABC77_X0", "ABC77_X1", "ABC77_X2", "ABC77_X3", "ABC77_X4", "ABC77_X5", "ABC77_X6", "ABC77_X7", "ABC77_X8", "ABC77_X9", "ABC77_X10", "ABC77_X11" }; |
| 102 | |
| 103 | return input_port_read(device->machine, keynames[abc77->keylatch]); |
| 104 | } |
| 105 | |
| 106 | static WRITE8_HANDLER( abc77_data_w ) |
| 107 | { |
| 108 | const device_config *device = devtag_get_device(machine, ABC77, ABC77_TAG); |
| 109 | abc77_t *abc77 = get_safe_token(device); |
| 110 | |
| 111 | abc77->keylatch = data & 0x0f; |
| 112 | |
| 113 | if (abc77->keylatch == 1) |
| 114 | { |
| 115 | watchdog_reset(device->machine); |
| 116 | } |
| 117 | |
| 118 | /* beep */ |
| 119 | discrete_sound_w(device->machine, NODE_01, BIT(data, 4)); |
| 120 | |
| 121 | /* transmit data */ |
| 122 | abc77->intf->txd_w(device, BIT(data, 5)); |
| 123 | |
| 124 | /* key down */ |
| 125 | abc77->intf->keydown_w(device, BIT(data, 6)); |
| 126 | |
| 127 | /* hysteresis */ |
| 128 | abc77->hys = BIT(data, 7); |
| 129 | } |
| 130 | |
| 131 | /* Memory Maps */ |
| 132 | |
| 133 | static ADDRESS_MAP_START( abc77_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 134 | AM_RANGE(0x000, 0xfff) AM_ROM |
| 135 | ADDRESS_MAP_END |
| 136 | |
| 137 | static ADDRESS_MAP_START( abc77_io_map, ADDRESS_SPACE_IO, 8 ) |
| 138 | AM_RANGE(0x00, 0x3f) AM_RAM |
| 139 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(abc77_data_r) |
| 140 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(abc77_data_w) |
| 141 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(abc77_clock_r) |
| 142 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_PORT("ABC77_DSW") |
| 143 | ADDRESS_MAP_END |
| 144 | |
| 145 | /* Input Ports */ |
| 146 | |
| 147 | INPUT_PORTS_START( abc77 ) |
| 148 | PORT_START("ABC77_X0") |
| 149 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 150 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 151 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 152 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 153 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE |
| 154 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 155 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 157 | |
| 158 | PORT_START("ABC77_X1") |
| 159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 161 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 162 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 163 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 164 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 165 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 166 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 167 | |
| 168 | PORT_START("ABC77_X2") |
| 169 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 170 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') |
| 171 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') |
| 172 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 173 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 174 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 175 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 176 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 177 | |
| 178 | PORT_START("ABC77_X3") |
| 179 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00E9) PORT_CHAR(0x00C9) |
| 180 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') |
| 181 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) |
| 182 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) |
| 183 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) |
| 184 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*') |
| 185 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 186 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 187 | |
| 188 | PORT_START("ABC77_X4") |
| 189 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') |
| 190 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 191 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 192 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 193 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 194 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) |
| 195 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') |
| 196 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') |
| 197 | |
| 198 | PORT_START("ABC77_X5") |
| 199 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 200 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') |
| 201 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 202 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 203 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 204 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 205 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 206 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') |
| 207 | |
| 208 | PORT_START("ABC77_X6") |
| 209 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 210 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 211 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 212 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 213 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 214 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 215 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 216 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 217 | |
| 218 | PORT_START("ABC77_X7") |
| 219 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 \xC2\xA4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00A4) |
| 220 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 221 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 222 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 223 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 224 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 225 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 226 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 227 | |
| 228 | PORT_START("ABC77_X8") |
| 229 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 230 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 231 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 232 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 233 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 234 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 235 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 236 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 237 | |
| 238 | PORT_START("ABC77_X9") |
| 239 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 240 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 241 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 242 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 243 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 244 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD RETURN") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 245 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 246 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 247 | |
| 248 | PORT_START("ABC77_X10") |
| 249 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 250 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 251 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 252 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 253 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 254 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 255 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KEYPAD 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 256 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 257 | |
| 258 | PORT_START("ABC77_X11") |
| 259 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 260 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 261 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 262 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 263 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 264 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 265 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 266 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 267 | |
| 268 | PORT_START("ABC77_DSW") |
| 269 | PORT_DIPNAME( 0x01, 0x01, "Keyboard Program" ) |
| 270 | PORT_DIPSETTING( 0x00, "Internal (8048)" ) |
| 271 | PORT_DIPSETTING( 0x01, "External PROM" ) |
| 272 | PORT_DIPNAME( 0x02, 0x00, "Character Set" ) |
| 273 | PORT_DIPSETTING( 0x00, "Swedish" ) |
| 274 | PORT_DIPSETTING( 0x02, "US ASCII" ) |
| 275 | PORT_DIPNAME( 0x04, 0x04, "External PROM" ) |
| 276 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 277 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 278 | PORT_DIPNAME( 0x18, 0x18, "Keyboard Type" ) |
| 279 | PORT_DIPSETTING( 0x00, "Danish" ) |
| 280 | PORT_DIPSETTING( 0x10, DEF_STR( French ) ) |
| 281 | PORT_DIPSETTING( 0x08, DEF_STR( German ) ) |
| 282 | PORT_DIPSETTING( 0x18, DEF_STR( Spanish ) ) |
| 283 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 284 | INPUT_PORTS_END |
| 285 | |
| 286 | /* Machine Driver */ |
| 287 | |
| 288 | MACHINE_DRIVER_START( abc77 ) |
| 289 | /* keyboard cpu */ |
| 290 | MDRV_CPU_ADD(I8035_TAG, I8035, 4608000) |
| 291 | MDRV_CPU_PROGRAM_MAP(abc77_map, 0) |
| 292 | MDRV_CPU_IO_MAP(abc77_io_map, 0) |
| 293 | |
| 294 | /* discrete sound */ |
| 295 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| 296 | MDRV_SOUND_CONFIG_DISCRETE(abc77) |
| 297 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 298 | MACHINE_DRIVER_END |
| 299 | |
| 300 | /* ROMs */ |
| 301 | |
| 302 | ROM_START( abc77 ) |
| 303 | ROM_REGION( 0x1000, I8035_TAG, 0 ) |
| 304 | ROM_LOAD( "65-02486.z10", 0x0000, 0x0800, NO_DUMP ) /* 2716 ABC55/77 keyboard controller Swedish EPROM */ |
| 305 | ROM_LOAD( "keyboard.z14", 0x0800, 0x0800, NO_DUMP ) /* 2716 ABC55/77 keyboard controller non-Swedish EPROM */ |
| 306 | ROM_FILL( 0, 0x1000, 0 ) |
| 307 | ROM_END |
| 308 | |
| 309 | /* Device Interface */ |
| 310 | |
| 311 | static DEVICE_START( abc77 ) |
| 312 | { |
| 313 | abc77_t *abc77 = device->token; |
| 314 | char unique_tag[30]; |
| 315 | astring *tempstring = astring_alloc(); |
| 316 | |
| 317 | /* validate arguments */ |
| 318 | |
| 319 | assert(device->machine != NULL); |
| 320 | assert(device->tag != NULL); |
| 321 | assert(strlen(device->tag) < 20); |
| 322 | abc77->intf = device->static_config; |
| 323 | assert(abc77->intf != NULL); |
| 324 | assert(abc77->intf->txd_w != NULL); |
| 325 | assert(abc77->intf->keydown_w != NULL); |
| 326 | |
| 327 | /* find our CPU */ |
| 328 | |
| 329 | astring_printf(tempstring, "%s:%s", device->tag, I8035_TAG); |
| 330 | abc77->cpunum = mame_find_cpu_index(device->machine, astring_c(tempstring)); |
| 331 | astring_free(tempstring); |
| 332 | |
| 333 | /* allocate timer */ |
| 334 | |
| 335 | abc77->reset_timer = timer_alloc(reset_tick, (FPTR *) device); |
| 336 | |
| 337 | /* register for state saving */ |
| 338 | |
| 339 | state_save_combine_module_and_tag(unique_tag, "ABC77", device->tag); |
| 340 | |
| 341 | state_save_register_item(unique_tag, 0, abc77->keylatch); |
| 342 | state_save_register_item(unique_tag, 0, abc77->clock); |
| 343 | state_save_register_item(unique_tag, 0, abc77->hys); |
| 344 | state_save_register_item(unique_tag, 0, abc77->reset); |
| 345 | |
| 346 | return DEVICE_START_OK; |
| 347 | } |
| 348 | |
| 349 | static DEVICE_SET_INFO( abc77 ) |
| 350 | { |
| 351 | switch (state) |
| 352 | { |
| 353 | /* no parameters to set */ |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | DEVICE_GET_INFO( abc77 ) |
| 358 | { |
| 359 | switch (state) |
| 360 | { |
| 361 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 362 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 363 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 364 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(abc77_t); break; |
| 365 | |
| 366 | /* --- the following bits of info are returned as pointers --- */ |
| 367 | case DEVINFO_PTR_ROM_REGION: info->romregion = rom_abc77; break; |
| 368 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = machine_config_abc77; break; |
| 369 | |
| 370 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 371 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(abc77); break; |
| 372 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(abc77); break; |
| 373 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 374 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 375 | |
| 376 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 377 | case DEVINFO_STR_NAME: info->s = "Luxor ABC-77"; break; |
| 378 | case DEVINFO_STR_FAMILY: info->s = "Luxor ABC"; break; |
| 379 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; |
| 380 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; |
| 381 | case DEVINFO_STR_CREDITS: info->s = "Copyright the MESS Team"; break; |
| 382 | } |
| 383 | } |
src/mess/machine/pk8020.c
| r3455 | r3456 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | PK-8020 driver by Miodrag Milanovic
|
| 4 | | |
| 5 | | 18/07/2008 Preliminary driver.
|
| 6 | | |
| 7 | | ****************************************************************************/
|
| 8 | | |
| 9 | | |
| 10 | | #include "driver.h"
|
| 11 | | #include "cpu/i8085/i8085.h"
|
| 12 | | |
| 13 | | /* Driver initialization */
|
| 14 | | DRIVER_INIT(pk8020)
|
| 15 | | {
|
| 16 | | memset(mess_ram,0,128*1024);
|
| 17 | | }
|
| 18 | | |
| 19 | | |
| 20 | | MACHINE_RESET( pk8020 )
|
| 21 | | {
|
| 22 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, SMH_BANK1);
|
| 23 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x7fff, 0, 0, SMH_UNMAP);
|
| 24 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x37ff, 0, 0, SMH_BANK2);
|
| 25 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x37ff, 0, 0, SMH_UNMAP);
|
| 26 | | |
| 27 | | |
| 28 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, SMH_BANK7);
|
| 29 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK8);
|
| 30 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbeff, 0, 0, SMH_BANK9);
|
| 31 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xbf00, 0xbfff, 0, 0, SMH_BANK10);
|
| 32 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xf7ff, 0, 0, SMH_BANK11);
|
| 33 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xf9ff, 0, 0, SMH_BANK12);
|
| 34 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfa00, 0xfaff, 0, 0, SMH_BANK13);
|
| 35 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfb00, 0xfbff, 0, 0, SMH_BANK14);
|
| 36 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfc00, 0xfdff, 0, 0, SMH_BANK15);
|
| 37 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfe00, 0xfeff, 0, 0, SMH_BANK16);
|
| 38 | | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xff00, 0xffff, 0, 0, SMH_BANK17);
|
| 39 | | |
| 40 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, SMH_BANK7);
|
| 41 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK8);
|
| 42 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbeff, 0, 0, SMH_BANK9);
|
| 43 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xbf00, 0xbfff, 0, 0, SMH_BANK10);
|
| 44 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xf7ff, 0, 0, SMH_BANK11);
|
| 45 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xf9ff, 0, 0, SMH_BANK12);
|
| 46 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfa00, 0xfaff, 0, 0, SMH_BANK13);
|
| 47 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfb00, 0xfbff, 0, 0, SMH_BANK14);
|
| 48 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfc00, 0xfdff, 0, 0, SMH_BANK15);
|
| 49 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfe00, 0xfeff, 0, 0, SMH_BANK16);
|
| 50 | | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xff00, 0xffff, 0, 0, SMH_BANK17);
|
| 51 | | |
| 52 | | memory_set_bankptr(1, memory_region(machine,"main") + 0x10000);
|
| 53 | | memory_set_bankptr(2, memory_region(machine,"main") + 0x12000);
|
| 54 | | |
| 55 | | memory_set_bankptr(7, mess_ram + 0x4000);
|
| 56 | | memory_set_bankptr(8, mess_ram + 0x6000);
|
| 57 | | memory_set_bankptr(9, mess_ram + 0x8000);
|
| 58 | | memory_set_bankptr(10, mess_ram + 0xbf00);
|
| 59 | | memory_set_bankptr(11, mess_ram + 0xc000);
|
| 60 | | memory_set_bankptr(12, mess_ram + 0xf800);
|
| 61 | | memory_set_bankptr(13, mess_ram + 0xfa00);
|
| 62 | | memory_set_bankptr(14, mess_ram + 0xfb00);
|
| 63 | | memory_set_bankptr(15, mess_ram + 0xfc00);
|
| 64 | | memory_set_bankptr(16, mess_ram + 0xfe00);
|
| 65 | | memory_set_bankptr(17, mess_ram + 0xff00);
|
| 66 | | }
|
| 1 | /*************************************************************************** |
| 2 | |
| 3 | PK-8020 driver by Miodrag Milanovic |
| 4 | |
| 5 | 18/07/2008 Preliminary driver. |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "cpu/i8085/i8085.h" |
| 12 | |
| 13 | /* Driver initialization */ |
| 14 | DRIVER_INIT(pk8020) |
| 15 | { |
| 16 | memset(mess_ram,0,128*1024); |
| 17 | } |
| 18 | |
| 19 | |
| 20 | MACHINE_RESET( pk8020 ) |
| 21 | { |
| 22 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, SMH_BANK1); |
| 23 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x7fff, 0, 0, SMH_UNMAP); |
| 24 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x37ff, 0, 0, SMH_BANK2); |
| 25 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x37ff, 0, 0, SMH_UNMAP); |
| 26 | |
| 27 | |
| 28 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, SMH_BANK7); |
| 29 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK8); |
| 30 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbeff, 0, 0, SMH_BANK9); |
| 31 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xbf00, 0xbfff, 0, 0, SMH_BANK10); |
| 32 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xf7ff, 0, 0, SMH_BANK11); |
| 33 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xf9ff, 0, 0, SMH_BANK12); |
| 34 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfa00, 0xfaff, 0, 0, SMH_BANK13); |
| 35 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfb00, 0xfbff, 0, 0, SMH_BANK14); |
| 36 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfc00, 0xfdff, 0, 0, SMH_BANK15); |
| 37 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xfe00, 0xfeff, 0, 0, SMH_BANK16); |
| 38 | memory_install_read8_handler (machine,0, ADDRESS_SPACE_PROGRAM, 0xff00, 0xffff, 0, 0, SMH_BANK17); |
| 39 | |
| 40 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, SMH_BANK7); |
| 41 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK8); |
| 42 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbeff, 0, 0, SMH_BANK9); |
| 43 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xbf00, 0xbfff, 0, 0, SMH_BANK10); |
| 44 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xf7ff, 0, 0, SMH_BANK11); |
| 45 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xf9ff, 0, 0, SMH_BANK12); |
| 46 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfa00, 0xfaff, 0, 0, SMH_BANK13); |
| 47 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfb00, 0xfbff, 0, 0, SMH_BANK14); |
| 48 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfc00, 0xfdff, 0, 0, SMH_BANK15); |
| 49 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xfe00, 0xfeff, 0, 0, SMH_BANK16); |
| 50 | memory_install_write8_handler(machine,0, ADDRESS_SPACE_PROGRAM, 0xff00, 0xffff, 0, 0, SMH_BANK17); |
| 51 | |
| 52 | memory_set_bankptr(1, memory_region(machine,"main") + 0x10000); |
| 53 | memory_set_bankptr(2, memory_region(machine,"main") + 0x12000); |
| 54 | |
| 55 | memory_set_bankptr(7, mess_ram + 0x4000); |
| 56 | memory_set_bankptr(8, mess_ram + 0x6000); |
| 57 | memory_set_bankptr(9, mess_ram + 0x8000); |
| 58 | memory_set_bankptr(10, mess_ram + 0xbf00); |
| 59 | memory_set_bankptr(11, mess_ram + 0xc000); |
| 60 | memory_set_bankptr(12, mess_ram + 0xf800); |
| 61 | memory_set_bankptr(13, mess_ram + 0xfa00); |
| 62 | memory_set_bankptr(14, mess_ram + 0xfb00); |
| 63 | memory_set_bankptr(15, mess_ram + 0xfc00); |
| 64 | memory_set_bankptr(16, mess_ram + 0xfe00); |
| 65 | memory_set_bankptr(17, mess_ram + 0xff00); |
| 66 | } |
src/mess/drivers/sapi1.c
| r3455 | r3456 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | SAPI-1 driver by Miodrag Milanovic
|
| 4 | | |
| 5 | | 09/09/2008 Preliminary driver.
|
| 6 | | |
| 7 | | ****************************************************************************/
|
| 8 | | |
| 9 | | |
| 10 | | #include "driver.h"
|
| 11 | | #include "cpu/i8085/i8085.h"
|
| 12 | | #include "includes/sapi1.h"
|
| 13 | | |
| 14 | | |
| 15 | | /* Address maps */
|
| 16 | | static ADDRESS_MAP_START(sapi1_mem, ADDRESS_SPACE_PROGRAM, 8)
|
| 17 | | ADDRESS_MAP_UNMAP_HIGH
|
| 18 | | AM_RANGE(0x0000, 0x0fff) AM_ROM
|
| 19 | | AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM
|
| 20 | | AM_RANGE(0x2000, 0x23ff) AM_RAM
|
| 21 | | AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard
|
| 22 | | //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1
|
| 23 | | //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2
|
| 24 | | //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214 |
| 25 | | AM_RANGE(0x3800, 0x3fff) AM_RAM // AND-1 (video RAM)
|
| 26 | | AM_RANGE(0x4000, 0x4000) AM_RAM // REM-1
|
| 27 | | ADDRESS_MAP_END
|
| 28 | | |
| 29 | | static ADDRESS_MAP_START( sapi1_io, ADDRESS_SPACE_IO, 8 )
|
| 30 | | ADDRESS_MAP_UNMAP_HIGH
|
| 31 | | ADDRESS_MAP_END
|
| 32 | | |
| 33 | | /* Input ports */
|
| 34 | | static INPUT_PORTS_START( sapi1 )
|
| 35 | | PORT_START("LINE0")
|
| 36 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
|
| 37 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
|
| 38 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
|
| 39 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
|
| 40 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
|
| 41 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
|
| 42 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
|
| 43 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
|
| 44 | | PORT_START("LINE1")
|
| 45 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
|
| 46 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
|
| 47 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
|
| 48 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
|
| 49 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
|
| 50 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
|
| 51 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
|
| 52 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
|
| 53 | | PORT_START("LINE2")
|
| 54 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
|
| 55 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
|
| 56 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
|
| 57 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
|
| 58 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
|
| 59 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
|
| 60 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
|
| 61 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
|
| 62 | | PORT_START("LINE3")
|
| 63 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
|
| 64 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
|
| 65 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
|
| 66 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
|
| 67 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE)
|
| 68 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
|
| 69 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
|
| 70 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
|
| 71 | | PORT_START("LINE4")
|
| 72 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
|
| 73 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
|
| 74 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
|
| 75 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
|
| 76 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE)
|
| 77 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER)
|
| 78 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
|
| 79 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
|
| 80 | | |
| 81 | | INPUT_PORTS_END
|
| 82 | | |
| 83 | | /* Machine driver */
|
| 84 | | static MACHINE_DRIVER_START( sapi1 )
|
| 85 | | /* basic machine hardware */
|
| 86 | | MDRV_CPU_ADD("main", 8080, 2000000)
|
| 87 | | MDRV_CPU_PROGRAM_MAP(sapi1_mem, 0)
|
| 88 | | MDRV_CPU_IO_MAP(sapi1_io, 0)
|
| 89 | | |
| 90 | | MDRV_MACHINE_START( sapi1 )
|
| 91 | | MDRV_MACHINE_RESET( sapi1 )
|
| 92 | | |
| 93 | | /* video hardware */
|
| 94 | | MDRV_SCREEN_ADD("main", RASTER)
|
| 95 | | MDRV_SCREEN_REFRESH_RATE(50)
|
| 96 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 97 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 98 | | MDRV_SCREEN_SIZE(40*6, 24*9)
|
| 99 | | MDRV_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*9-1)
|
| 100 | | |
| 101 | | MDRV_PALETTE_LENGTH(2)
|
| 102 | | MDRV_PALETTE_INIT(black_and_white)
|
| 103 | | |
| 104 | | MDRV_VIDEO_START(sapi1)
|
| 105 | | MDRV_VIDEO_UPDATE(sapi1)
|
| 106 | | MACHINE_DRIVER_END
|
| 107 | | |
| 108 | | static SYSTEM_CONFIG_START(sapi1)
|
| 109 | | CONFIG_RAM_DEFAULT(64 * 1024)
|
| 110 | | SYSTEM_CONFIG_END
|
| 111 | | |
| 112 | | /* ROM definition */
|
| 113 | | |
| 114 | | ROM_START( sapi1 )
|
| 115 | | ROM_REGION( 0x10000, "main", ROMREGION_ERASEFF )
|
| 116 | | ROM_LOAD( "sapi1.rom", 0x0000, 0x1000, CRC(c6e85b01) SHA1(2a26668249c6161aef7215a1e2b92bfdf6fe3671) )
|
| 117 | | ROM_END
|
| 118 | | |
| 119 | | |
| 120 | | /* Driver */
|
| 121 | | |
| 122 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */
|
| 123 | | COMP( 1985, sapi1, 0, 0, sapi1, sapi1, sapi1, sapi1, "Tesla", "SAPI-1 ZPS 1", 0)
|
| 124 | | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | SAPI-1 driver by Miodrag Milanovic |
| 4 | |
| 5 | 09/09/2008 Preliminary driver. |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "includes/sapi1.h" |
| 13 | |
| 14 | |
| 15 | /* Address maps */ |
| 16 | static ADDRESS_MAP_START(sapi1_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 17 | ADDRESS_MAP_UNMAP_HIGH |
| 18 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 19 | AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM |
| 20 | AM_RANGE(0x2000, 0x23ff) AM_RAM |
| 21 | AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard |
| 22 | //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1 |
| 23 | //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2 |
| 24 | //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214 |
| 25 | AM_RANGE(0x3800, 0x3fff) AM_RAM // AND-1 (video RAM) |
| 26 | AM_RANGE(0x4000, 0x4000) AM_RAM // REM-1 |
| 27 | ADDRESS_MAP_END |
| 28 | |
| 29 | static ADDRESS_MAP_START( sapi1_io, ADDRESS_SPACE_IO, 8 ) |
| 30 | ADDRESS_MAP_UNMAP_HIGH |
| 31 | ADDRESS_MAP_END |
| 32 | |
| 33 | /* Input ports */ |
| 34 | static INPUT_PORTS_START( sapi1 ) |
| 35 | PORT_START("LINE0") |
| 36 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 37 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) |
| 38 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| 39 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 40 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) |
| 41 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 42 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) |
| 43 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 44 | PORT_START("LINE1") |
| 45 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 46 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 47 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 48 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 49 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) |
| 50 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) |
| 51 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 52 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 53 | PORT_START("LINE2") |
| 54 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 55 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| 56 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| 57 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 58 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 59 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 60 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 61 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 62 | PORT_START("LINE3") |
| 63 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 64 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 65 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 66 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 67 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 68 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| 69 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 70 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 71 | PORT_START("LINE4") |
| 72 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 73 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 74 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 75 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 76 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) |
| 77 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) |
| 78 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 79 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 80 | |
| 81 | INPUT_PORTS_END |
| 82 | |
| 83 | /* Machine driver */ |
| 84 | static MACHINE_DRIVER_START( sapi1 ) |
| 85 | /* basic machine hardware */ |
| 86 | MDRV_CPU_ADD("main", 8080, 2000000) |
| 87 | MDRV_CPU_PROGRAM_MAP(sapi1_mem, 0) |
| 88 | MDRV_CPU_IO_MAP(sapi1_io, 0) |
| 89 | |
| 90 | MDRV_MACHINE_START( sapi1 ) |
| 91 | MDRV_MACHINE_RESET( sapi1 ) |
| 92 | |
| 93 | /* video hardware */ |
| 94 | MDRV_SCREEN_ADD("main", RASTER) |
| 95 | MDRV_SCREEN_REFRESH_RATE(50) |
| 96 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 97 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 98 | MDRV_SCREEN_SIZE(40*6, 24*9) |
| 99 | MDRV_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*9-1) |
| 100 | |
| 101 | MDRV_PALETTE_LENGTH(2) |
| 102 | MDRV_PALETTE_INIT(black_and_white) |
| 103 | |
| 104 | MDRV_VIDEO_START(sapi1) |
| 105 | MDRV_VIDEO_UPDATE(sapi1) |
| 106 | MACHINE_DRIVER_END |
| 107 | |
| 108 | static SYSTEM_CONFIG_START(sapi1) |
| 109 | CONFIG_RAM_DEFAULT(64 * 1024) |
| 110 | SYSTEM_CONFIG_END |
| 111 | |
| 112 | /* ROM definition */ |
| 113 | |
| 114 | ROM_START( sapi1 ) |
| 115 | ROM_REGION( 0x10000, "main", ROMREGION_ERASEFF ) |
| 116 | ROM_LOAD( "sapi1.rom", 0x0000, 0x1000, CRC(c6e85b01) SHA1(2a26668249c6161aef7215a1e2b92bfdf6fe3671) ) |
| 117 | ROM_END |
| 118 | |
| 119 | |
| 120 | /* Driver */ |
| 121 | |
| 122 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 123 | COMP( 1985, sapi1, 0, 0, sapi1, sapi1, sapi1, sapi1, "Tesla", "SAPI-1 ZPS 1", 0) |
| 124 | |