src/mess/drivers/einstein.c
| r5067 | r5068 | |
| 1 | | /****************************************************************************** |
| 2 | | |
| 3 | | Tatung Einstein |
| 4 | | system driver |
| 5 | | |
| 6 | | |
| 7 | | TMS9129 VDP Graphics |
| 8 | | 16k ram |
| 9 | | |
| 10 | | Z80 CPU (4 MHz) |
| 11 | | |
| 12 | | Z80 CTC (4 MHz) |
| 13 | | channel 0 is serial transmit clock |
| 14 | | channel 1 is serial receive clock |
| 15 | | trigger for channel 0,1 and 2 is a 2 MHz clock |
| 16 | | trigger for channel 3 is the terminal count of channel 2 |
| 17 | | |
| 18 | | Intel 8251 Serial (2 MHz clock?) |
| 19 | | |
| 20 | | WD1770 Floppy Disc controller |
| 21 | | density is fixed, 4 drives and double sided supported |
| 22 | | |
| 23 | | AY-3-8910 PSG (2 MHz) |
| 24 | | port A and port B are connected to the keyboard. Port A is keyboard |
| 25 | | line select, Port B is data. |
| 26 | | |
| 27 | | printer connected to port A of PIO. /ACK from printer is connected to /ASTB. |
| 28 | | D7-D0 of PIO port A is printer data lines. |
| 29 | | ARDY of PIO is connected to /STROBE on printer. |
| 30 | | |
| 31 | | user port is port B of PIO |
| 32 | | keyboard connected to port A and port B of PSG |
| 33 | | |
| 34 | | TODO: |
| 35 | | - The ADC is not emulated! |
| 36 | | - printer emulation needs checking! |
| 37 | | |
| 38 | | Many thanks to Chris Coxall for the schematics of the TC-01, the dump of the |
| 39 | | system rom and a dump of a Xtal boot disc. |
| 40 | | |
| 41 | | Many thanks to Andrew Dunipace for his help with the 80-column card |
| 42 | | and Speculator hardware (Spectrum emulator). |
| 43 | | |
| 44 | | Kevin Thacker [MESS driver] |
| 45 | | |
| 46 | | |
| 47 | | |
| 48 | | ******************************************************************************/ |
| 49 | | |
| 50 | | |
| 51 | | /* I/O ports */ |
| 52 | | /* 0x00-0x07 PSG */ |
| 53 | | /* 0x08-0x0f VDP */ |
| 54 | | /* 0x10-0x17 SERIAL */ |
| 55 | | /* 0x18-0x1f FDC */ |
| 56 | | /* 0x20-0x27 MISC (see below) */ |
| 57 | | /* 0x28-0x2f CTC */ |
| 58 | | /* 0x30-0x37 PIO */ |
| 59 | | /* 0x38-0x3f ADC */ |
| 60 | | |
| 61 | | /* MISC */ |
| 62 | | /* 0x20 - bit 0 is keyboard int mask; read to get state of some keys and /fire button states; |
| 63 | | set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; write to set mask. */ |
| 64 | | /* 0x21 - bit 0 is adc int mask; set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; |
| 65 | | write to set mask; read has no effect */ |
| 66 | | /* 0x22 - alph */ |
| 67 | | /* 0x23 - drive select and side select */ |
| 68 | | /* 0x24 - rom */ |
| 69 | | /* 0x25 - bit 0 is fire int mask; set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; |
| 70 | | write to set mask; read has no effect */ |
| 71 | | /* 0x25 - */ |
| 72 | | /* 0x26 - */ |
| 73 | | /* 0x27 - */ |
| 74 | | |
| 75 | | /* 0x40-0xff for expansion */ |
| 76 | | |
| 77 | | |
| 78 | | /* speculator */ |
| 79 | | /* 7e = 0, read from fe, 7e = 1, read from fe */ |
| 80 | | |
| 81 | | #include "driver.h" |
| 82 | | #include "machine/z80ctc.h" |
| 83 | | #include "machine/z80pio.h" |
| 84 | | #include "machine/z80sio.h" |
| 85 | | #include "video/tms9928a.h" |
| 86 | | #include "cpu/z80/z80.h" |
| 87 | | #include "cpu/z80/z80daisy.h" |
| 88 | | #include "machine/wd17xx.h" |
| 89 | | #include "machine/ctronics.h" |
| 90 | | #include "machine/msm8251.h" |
| 91 | | #include "devices/dsk.h" |
| 92 | | #include "devices/basicdsk.h" |
| 93 | | #include "sound/ay8910.h" |
| 94 | | #include "video/mc6845.h" |
| 95 | | |
| 96 | | #define EINSTEIN_SYSTEM_CLOCK 4000000 |
| 97 | | |
| 98 | | #define EINSTEIN_KEY_INT (1<<0) |
| 99 | | #define EINSTEIN_ADC_INT (1<<1) |
| 100 | | #define EINSTEIN_FIRE_INT (1<<2) |
| 101 | | |
| 102 | | static int einstein_rom_enabled = 1; |
| 103 | | |
| 104 | | static int einstein_int = 0; |
| 105 | | static int einstein_int_mask = 0; |
| 106 | | |
| 107 | | static int einstein_ctc_trigger = 0; |
| 108 | | |
| 109 | | static const device_config *einstein_z80pio; |
| 110 | | |
| 111 | | /* KEYBOARD */ |
| 112 | | static int einstein_keyboard_line = 0; |
| 113 | | static int einstein_keyboard_data = 0x0ff; |
| 114 | | |
| 115 | | #define EINSTEIN_DUMP_RAM |
| 116 | | |
| 117 | | #ifdef EINSTEIN_DUMP_RAM |
| 118 | | static void einstein_dump_ram(void) |
| 119 | | { |
| 120 | | ram_dump("einstein.bin"); |
| 121 | | } |
| 122 | | #endif |
| 123 | | |
| 124 | | /**********************************************************/ |
| 125 | | /* |
| 126 | | 80 column board has a UM6845,2K ram and a char rom: |
| 127 | | |
| 128 | | 0x040-0x047 used to access 2K ram. (bits 3-0 define a 256 byte row, bits 15-8 define |
| 129 | | the offset in the row) |
| 130 | | 0x048 = crtc register index (w), |
| 131 | | 0x049 = crtc data register (w) |
| 132 | | |
| 133 | | 0x04c |
| 134 | | bit 2 = 50/60Hz mode? |
| 135 | | bit 1 = 1 |
| 136 | | bit 0 = vsync state? |
| 137 | | |
| 138 | | 0: 126 (127) horizontal total |
| 139 | | 1: 80 horizontal displayed |
| 140 | | 2: 97 horizontal sync position |
| 141 | | 3: &38 |
| 142 | | 4: 26 vertical total |
| 143 | | 5: 19 vertical adjust |
| 144 | | 6: 25 vertical displayed |
| 145 | | 7: 26 vertical sync pos |
| 146 | | 8: 0 no interlace |
| 147 | | 9: 8 (9 scanlines tall) |
| 148 | | 10: 32 |
| 149 | | |
| 150 | | total scanlines: ((reg 9+1) * (reg 4+1))+reg 5 = 262 |
| 151 | | 127 cycles per line |
| 152 | | 127*262 = 33274 cycles per frame, vsync len 375 cycles |
| 153 | | |
| 154 | | |
| 155 | | */ |
| 156 | | static int einstein_80col_state; |
| 157 | | static char *einstein_80col_ram = NULL; |
| 158 | | |
| 159 | | static WRITE8_HANDLER(einstein_80col_ram_w) |
| 160 | | { |
| 161 | | /* lower 3 bits of address define a 256-byte "row". |
| 162 | | upper 8 bits define the offset in the row, |
| 163 | | data bits define data to write */ |
| 164 | | einstein_80col_ram[((offset & 0x07)<<8)|((offset>>8) & 0x0ff)] = data; |
| 165 | | } |
| 166 | | |
| 167 | | static READ8_HANDLER(einstein_80col_ram_r) |
| 168 | | { |
| 169 | | return einstein_80col_ram[((offset & 0x07)<<8)|((offset>>8) & 0x0ff)]; |
| 170 | | } |
| 171 | | |
| 172 | | static READ8_HANDLER(einstein_80col_state_r) |
| 173 | | { |
| 174 | | /* fake vsync for now */ |
| 175 | | einstein_80col_state^=0x01; |
| 176 | | return einstein_80col_state; |
| 177 | | } |
| 178 | | |
| 179 | | //static int Einstein_6845_RA = 0; |
| 180 | | //static int Einstein_scr_x = 0; |
| 181 | | static int Einstein_scr_y = 0; |
| 182 | | //static int Einstein_HSync = 0; |
| 183 | | //static int Einstein_VSync = 0; |
| 184 | | //static int Einstein_DE = 0; |
| 185 | | |
| 186 | | //// called when the 6845 changes the character row |
| 187 | | //static void Einstein_Set_RA(int offset, int data) |
| 188 | | //{ |
| 189 | | // Einstein_6845_RA=data; |
| 190 | | //} |
| 191 | | // |
| 192 | | // |
| 193 | | //// called when the 6845 changes the HSync |
| 194 | | //static void Einstein_Set_HSync(running_machine *machine, int offset, int data) |
| 195 | | //{ |
| 196 | | // Einstein_HSync=data; |
| 197 | | // if(!Einstein_HSync) |
| 198 | | // { |
| 199 | | // Einstein_scr_y++; |
| 200 | | // Einstein_scr_x = -40; |
| 201 | | // } |
| 202 | | //} |
| 203 | | // |
| 204 | | //// called when the 6845 changes the VSync |
| 205 | | //static void Einstein_Set_VSync(running_machine *machine, int offset, int data) |
| 206 | | //{ |
| 207 | | // Einstein_VSync=data; |
| 208 | | // if (!Einstein_VSync) |
| 209 | | // { |
| 210 | | // Einstein_scr_y = 0; |
| 211 | | // } |
| 212 | | //} |
| 213 | | // |
| 214 | | //static void Einstein_Set_DE(int offset, int data) |
| 215 | | //{ |
| 216 | | // Einstein_DE = data; |
| 217 | | //} |
| 218 | | |
| 219 | | |
| 220 | | //static const struct m6845_interface einstein_m6845_interface = { |
| 221 | | // 0,// Memory Address register |
| 222 | | // Einstein_Set_RA,// Row Address register |
| 223 | | // Einstein_Set_HSync,// Horizontal status |
| 224 | | // Einstein_Set_VSync,// Vertical status |
| 225 | | // Einstein_Set_DE,// Display Enabled status |
| 226 | | // 0,// Cursor status |
| 227 | | //}; |
| 228 | | |
| 229 | | static MC6845_UPDATE_ROW( einstein_6845_update_row ) |
| 230 | | { |
| 231 | | /* TODO: Verify implementation */ |
| 232 | | unsigned char *data = memory_region(device->machine, "maincpu") + 0x012000; |
| 233 | | unsigned char data_byte; |
| 234 | | int char_code; |
| 235 | | int i, x; |
| 236 | | |
| 237 | | for ( i = 0, x = 0; i < x_count; i++, x+=8 ) |
| 238 | | { |
| 239 | | int w; |
| 240 | | char_code = einstein_80col_ram[(ma + i)&0x07ff]; |
| 241 | | data_byte = data[(char_code<<3) + ra]; |
| 242 | | for (w=0; w<8;w++) |
| 243 | | { |
| 244 | | *BITMAP_ADDR16(bitmap, y, x+w) = (data_byte & 0x080) ? 1 : 0; |
| 245 | | data_byte = data_byte<<1; |
| 246 | | } |
| 247 | | } |
| 248 | | } |
| 249 | | |
| 250 | | static WRITE_LINE_DEVICE_HANDLER( einstein_6845_display_enable_changed ) |
| 251 | | { |
| 252 | | /* TODO: Implement me properly */ |
| 253 | | if ( state ) { |
| 254 | | Einstein_scr_y = ( Einstein_scr_y + 1 ) % 240 /*?*/; |
| 255 | | } |
| 256 | | } |
| 257 | | |
| 258 | | static const mc6845_interface einstein_crtc6845_interface = { |
| 259 | | "screen", |
| 260 | | 8 /*?*/, |
| 261 | | NULL, |
| 262 | | einstein_6845_update_row, |
| 263 | | NULL, |
| 264 | | DEVCB_LINE(einstein_6845_display_enable_changed), |
| 265 | | DEVCB_NULL, |
| 266 | | DEVCB_NULL, |
| 267 | | DEVCB_NULL, |
| 268 | | NULL |
| 269 | | }; |
| 270 | | |
| 271 | | /* 80 column card init */ |
| 272 | | static void einstein_80col_init(running_machine *machine) |
| 273 | | { |
| 274 | | /* 2K RAM */ |
| 275 | | einstein_80col_ram = auto_alloc_array(machine, char, 2048); |
| 276 | | |
| 277 | | einstein_80col_state=(1<<2)|(1<<1); |
| 278 | | } |
| 279 | | |
| 280 | | static READ8_HANDLER(einstein_80col_r) |
| 281 | | { |
| 282 | | switch (offset & 0x0f) |
| 283 | | { |
| 284 | | case 0: |
| 285 | | case 1: |
| 286 | | case 2: |
| 287 | | case 3: |
| 288 | | case 4: |
| 289 | | case 5: |
| 290 | | case 6: |
| 291 | | case 7: |
| 292 | | return einstein_80col_ram_r(space, offset); |
| 293 | | case 0x0c: |
| 294 | | return einstein_80col_state_r(space, offset); |
| 295 | | default: |
| 296 | | break; |
| 297 | | } |
| 298 | | return 0x0ff; |
| 299 | | } |
| 300 | | |
| 301 | | |
| 302 | | static WRITE8_HANDLER(einstein_80col_w) |
| 303 | | { |
| 304 | | const device_config *mc6845 = devtag_get_device(space->machine, "crtc"); |
| 305 | | |
| 306 | | switch (offset & 0x0f) |
| 307 | | { |
| 308 | | case 0: |
| 309 | | case 1: |
| 310 | | case 2: |
| 311 | | case 3: |
| 312 | | case 4: |
| 313 | | case 5: |
| 314 | | case 6: |
| 315 | | case 7: |
| 316 | | einstein_80col_ram_w(space, offset,data); |
| 317 | | break; |
| 318 | | case 8: |
| 319 | | mc6845_address_w( mc6845, offset, data ); |
| 320 | | break; |
| 321 | | case 9: |
| 322 | | mc6845_register_w( mc6845, offset, data ); |
| 323 | | break; |
| 324 | | default: |
| 325 | | break; |
| 326 | | } |
| 327 | | } |
| 328 | | |
| 329 | | static TIMER_CALLBACK(einstein_ctc_trigger_callback) |
| 330 | | { |
| 331 | | const device_config *device = ptr; |
| 332 | | |
| 333 | | einstein_ctc_trigger^=1; |
| 334 | | |
| 335 | | /* channel 0 and 1 have a 2 MHz input clock for triggering */ |
| 336 | | z80ctc_trg0_w(device, 0, einstein_ctc_trigger); |
| 337 | | z80ctc_trg1_w(device, 0, einstein_ctc_trigger); |
| 338 | | } |
| 339 | | |
| 340 | | /* refresh keyboard data. It is refreshed when the keyboard line is written */ |
| 341 | | static void einstein_scan_keyboard(running_machine *machine) |
| 342 | | { |
| 343 | | unsigned char data = 0x0ff; |
| 344 | | int i; |
| 345 | | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; |
| 346 | | |
| 347 | | for (i=0; i<8; i++) |
| 348 | | { |
| 349 | | if ((einstein_keyboard_line & (1<<i)) == 0) |
| 350 | | { |
| 351 | | data &= input_port_read(machine, keynames[i]); |
| 352 | | } |
| 353 | | } |
| 354 | | |
| 355 | | einstein_keyboard_data = data; |
| 356 | | } |
| 357 | | |
| 358 | | static void einstein_update_interrupts(running_machine *machine) |
| 359 | | { |
| 360 | | /* NPW 21-Jul-2005 - Not sure how to update this for MAME 0.98u2 */ |
| 361 | | /* |
| 362 | | if (einstein_int & einstein_int_mask & EINSTEIN_KEY_INT) |
| 363 | | cputag_set_input_line(machine, "maincpu", Z80_INT_REQ, PULSE_LINE); |
| 364 | | else |
| 365 | | cputag_set_input_line(machine, "maincpu", Z80_INT_IEO, PULSE_LINE); |
| 366 | | |
| 367 | | if (einstein_int & einstein_int_mask & EINSTEIN_ADC_INT) |
| 368 | | cputag_set_input_line(machine, "maincpu", Z80_INT_REQ, PULSE_LINE); |
| 369 | | else |
| 370 | | cputag_set_input_line(machine, "maincpu", Z80_INT_IEO, PULSE_LINE); |
| 371 | | |
| 372 | | if (einstein_int & einstein_int_mask & EINSTEIN_FIRE_INT) |
| 373 | | cputag_set_input_line(machine, "maincpu", Z80_INT_REQ, PULSE_LINE); |
| 374 | | else |
| 375 | | cputag_set_input_line(machine, "maincpu", Z80_INT_IEO, PULSE_LINE); |
| 376 | | */ |
| 377 | | } |
| 378 | | |
| 379 | | static TIMER_CALLBACK(einstein_keyboard_timer_callback) |
| 380 | | { |
| 381 | | einstein_scan_keyboard(machine); |
| 382 | | |
| 383 | | /* if /fire1 or /fire2 is 0, then trigger a fire interrupt if the interrupt is enabled */ |
| 384 | | if ((input_port_read(machine, "BUTTONS") & 0x03)!=0) |
| 385 | | { |
| 386 | | einstein_int |= EINSTEIN_FIRE_INT; |
| 387 | | } |
| 388 | | else |
| 389 | | { |
| 390 | | einstein_int &= ~EINSTEIN_FIRE_INT; |
| 391 | | } |
| 392 | | |
| 393 | | /* keyboard data changed? */ |
| 394 | | if (einstein_keyboard_data!=0x0ff) |
| 395 | | { |
| 396 | | /* generate interrupt */ |
| 397 | | einstein_int |= EINSTEIN_KEY_INT; |
| 398 | | } |
| 399 | | else |
| 400 | | { |
| 401 | | einstein_int &= ~EINSTEIN_KEY_INT; |
| 402 | | } |
| 403 | | |
| 404 | | einstein_update_interrupts(machine); |
| 405 | | } |
| 406 | | |
| 407 | | |
| 408 | | /* interrupt state callback for ctc */ |
| 409 | | static void einstein_ctc_interrupt(const device_config *device, int state) |
| 410 | | { |
| 411 | | logerror("ctc irq state: %02x\n", state); |
| 412 | | cputag_set_input_line(device->machine, "maincpu", 1, state); |
| 413 | | } |
| 414 | | |
| 415 | | static void einstein_pio_interrupt(const device_config *device, int state) |
| 416 | | { |
| 417 | | logerror("pio irq state: %02x\n", state); |
| 418 | | cputag_set_input_line(device->machine, "maincpu", 3, state); |
| 419 | | } |
| 420 | | |
| 421 | | static WRITE8_DEVICE_HANDLER(einstein_serial_transmit_clock) |
| 422 | | { |
| 423 | | const device_config *uart = devtag_get_device(device->machine, "uart"); |
| 424 | | msm8251_transmit_clock(uart); |
| 425 | | } |
| 426 | | |
| 427 | | static WRITE8_DEVICE_HANDLER(einstein_serial_receive_clock) |
| 428 | | { |
| 429 | | const device_config *uart = devtag_get_device(device->machine, "uart"); |
| 430 | | msm8251_receive_clock(uart); |
| 431 | | } |
| 432 | | |
| 433 | | static const z80ctc_interface einstein_ctc_intf = |
| 434 | | { |
| 435 | | 0, |
| 436 | | einstein_ctc_interrupt, |
| 437 | | einstein_serial_transmit_clock, |
| 438 | | einstein_serial_receive_clock, |
| 439 | | z80ctc_trg3_w |
| 440 | | }; |
| 441 | | |
| 442 | | |
| 443 | | static void einstein_pio_ardy(const device_config *device, int state) |
| 444 | | { |
| 445 | | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 446 | | centronics_strobe_w(printer, state); |
| 447 | | } |
| 448 | | |
| 449 | | static WRITE8_DEVICE_HANDLER( einstein_pio_port_a_w ) |
| 450 | | { |
| 451 | | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 452 | | centronics_data_w(printer, 0, data); |
| 453 | | } |
| 454 | | |
| 455 | | |
| 456 | | static const z80pio_interface einstein_pio_intf = |
| 457 | | { |
| 458 | | DEVCB_LINE(einstein_pio_interrupt), |
| 459 | | DEVCB_NULL, |
| 460 | | DEVCB_NULL, |
| 461 | | DEVCB_HANDLER(einstein_pio_port_a_w), |
| 462 | | DEVCB_NULL, |
| 463 | | DEVCB_LINE(einstein_pio_ardy), |
| 464 | | DEVCB_NULL |
| 465 | | }; |
| 466 | | |
| 467 | | |
| 468 | | /**************************************************************** |
| 469 | | Einstein specific keyboard daisy chain code |
| 470 | | ****************************************************************/ |
| 471 | | |
| 472 | | static int einstein_daisy_irq_state(const device_config *device) |
| 473 | | { |
| 474 | | return 0xFF; |
| 475 | | } |
| 476 | | |
| 477 | | |
| 478 | | static void einstein_daisy_irq_reti(const device_config *device) |
| 479 | | { |
| 480 | | } |
| 481 | | |
| 482 | | |
| 483 | | static DEVICE_START( einstein_daisy ) |
| 484 | | { |
| 485 | | } |
| 486 | | |
| 487 | | |
| 488 | | static DEVICE_RESET( einstein_daisy ) |
| 489 | | { |
| 490 | | } |
| 491 | | |
| 492 | | |
| 493 | | static DEVICE_GET_INFO( einstein_daisy ) |
| 494 | | { |
| 495 | | switch (state) |
| 496 | | { |
| 497 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 498 | | case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break; |
| 499 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 500 | | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 501 | | |
| 502 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 503 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break; |
| 504 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 505 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(einstein_daisy); break; |
| 506 | | case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_daisy_irq_state; break; |
| 507 | | case DEVINFO_FCT_IRQ_RETI: info->f = (genf *)einstein_daisy_irq_reti; break; |
| 508 | | |
| 509 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 510 | | case DEVINFO_STR_NAME: strcpy(info->s, "Einstein daisy"); break; |
| 511 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Z80"); break; |
| 512 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 513 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 514 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 515 | | } |
| 516 | | } |
| 517 | | |
| 518 | | |
| 519 | | #ifdef UNUSED_FUNCTION |
| 520 | | /* not required for this interrupt source */ |
| 521 | | static void einstein_fire_int_reset(int which) |
| 522 | | { |
| 523 | | einstein_int_mask &= ~EINSTEIN_FIRE_INT; |
| 524 | | |
| 525 | | einstein_update_interrupts(Machine); |
| 526 | | } |
| 527 | | |
| 528 | | |
| 529 | | static int einstein_fire_interrupt(int which) |
| 530 | | { |
| 531 | | logerror("fire int routine in daisy chain\n"); |
| 532 | | /* return vector */ |
| 533 | | return 0x0ff; |
| 534 | | } |
| 535 | | |
| 536 | | |
| 537 | | /* reti has no effect on this interrupt */ |
| 538 | | static void einstein_fire_reti(int which) |
| 539 | | { |
| 540 | | } |
| 541 | | #endif |
| 542 | | |
| 543 | | static const z80_daisy_chain einstein_daisy_chain[] = |
| 544 | | { |
| 545 | | { "keyboard_daisy" }, |
| 546 | | // {einstein_keyboard_int_reset, einstein_keyboard_interrupt, 0, einstein_keyboard_reti, 0}, |
| 547 | | { "z80ctc" }, |
| 548 | | { "adc_daisy" }, |
| 549 | | // {einstein_adc_int_reset,einstein_adc_interrupt, 0, einstein_adc_reti, 0}, |
| 550 | | { "z80pio" }, |
| 551 | | // {einstein_fire_int_reset,einstein_fire_interrupt, einstein_fire_reti, 0}, |
| 552 | | { NULL } |
| 553 | | }; |
| 554 | | |
| 555 | | static READ8_HANDLER(einstein_vdp_r) |
| 556 | | { |
| 557 | | /*logerror("vdp r: %04x\n",offset); */ |
| 558 | | |
| 559 | | if (offset & 0x01) |
| 560 | | { |
| 561 | | return TMS9928A_register_r(space, offset & 0x01); |
| 562 | | } |
| 563 | | |
| 564 | | return TMS9928A_vram_r(space, offset & 0x01); |
| 565 | | } |
| 566 | | |
| 567 | | static WRITE8_HANDLER(einstein_vdp_w) |
| 568 | | { |
| 569 | | /* logerror("vdp w: %04x %02x\n",offset,data); */ |
| 570 | | |
| 571 | | if (offset & 0x01) |
| 572 | | { |
| 573 | | TMS9928A_register_w(space, offset & 0x01,data); |
| 574 | | return; |
| 575 | | } |
| 576 | | |
| 577 | | TMS9928A_vram_w(space, offset & 0x01,data); |
| 578 | | } |
| 579 | | |
| 580 | | static WRITE8_HANDLER(einstein_fdc_w) |
| 581 | | { |
| 582 | | int reg = offset & 0x03; |
| 583 | | const device_config *fdc = devtag_get_device(space->machine, "wd177x"); |
| 584 | | |
| 585 | | logerror("fdc w: PC: %04x %04x %02x\n", cpu_get_pc(cputag_get_cpu(space->machine,"maincpu")), offset, data); |
| 586 | | |
| 587 | | switch (reg) |
| 588 | | { |
| 589 | | case 0: |
| 590 | | { |
| 591 | | wd17xx_command_w(fdc, reg, data); |
| 592 | | } |
| 593 | | break; |
| 594 | | |
| 595 | | case 1: |
| 596 | | { |
| 597 | | wd17xx_track_w(fdc, reg, data); |
| 598 | | } |
| 599 | | break; |
| 600 | | |
| 601 | | case 2: |
| 602 | | { |
| 603 | | wd17xx_sector_w(fdc, reg, data); |
| 604 | | } |
| 605 | | break; |
| 606 | | |
| 607 | | case 3: |
| 608 | | { |
| 609 | | wd17xx_data_w(fdc, reg, data); |
| 610 | | } |
| 611 | | break; |
| 612 | | } |
| 613 | | } |
| 614 | | |
| 615 | | |
| 616 | | static READ8_HANDLER(einstein_fdc_r) |
| 617 | | { |
| 618 | | int reg = offset & 0x03; |
| 619 | | const device_config *fdc = devtag_get_device(space->machine, "wd177x"); |
| 620 | | |
| 621 | | logerror("fdc r: PC: %04x %04x\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset); |
| 622 | | |
| 623 | | switch (reg) |
| 624 | | { |
| 625 | | case 0: |
| 626 | | { |
| 627 | | return wd17xx_status_r(fdc, reg); |
| 628 | | } |
| 629 | | break; |
| 630 | | |
| 631 | | case 1: |
| 632 | | { |
| 633 | | return wd17xx_track_r(fdc, reg); |
| 634 | | } |
| 635 | | break; |
| 636 | | |
| 637 | | case 2: |
| 638 | | { |
| 639 | | return wd17xx_sector_r(fdc, reg); |
| 640 | | } |
| 641 | | break; |
| 642 | | |
| 643 | | case 3: |
| 644 | | { |
| 645 | | return wd17xx_data_r(fdc, reg); |
| 646 | | } |
| 647 | | break; |
| 648 | | } |
| 649 | | |
| 650 | | return 0x0ff; |
| 651 | | } |
| 652 | | |
| 653 | | static WRITE8_HANDLER(einstein_pio_w) |
| 654 | | { |
| 655 | | logerror("pio w: %04x %02x\n",offset,data); |
| 656 | | |
| 657 | | z80pio_w( einstein_z80pio, offset, data ); |
| 658 | | } |
| 659 | | |
| 660 | | static READ8_HANDLER(einstein_pio_r) |
| 661 | | { |
| 662 | | logerror("pio r: %04x\n",offset); |
| 663 | | |
| 664 | | return z80pio_r( einstein_z80pio, offset ); |
| 665 | | } |
| 666 | | |
| 667 | | static READ8_DEVICE_HANDLER(einstein_ctc_r) |
| 668 | | { |
| 669 | | logerror("ctc r: %04x\n",offset); |
| 670 | | |
| 671 | | return z80ctc_r(device, offset & 0x03); |
| 672 | | } |
| 673 | | |
| 674 | | static WRITE8_DEVICE_HANDLER(einstein_ctc_w) |
| 675 | | { |
| 676 | | logerror("ctc w: %04x %02x\n",offset,data); |
| 677 | | |
| 678 | | z80ctc_w(device, offset & 0x03,data); |
| 679 | | } |
| 680 | | |
| 681 | | static WRITE8_HANDLER(einstein_serial_w) |
| 682 | | { |
| 683 | | const device_config *uart = devtag_get_device(space->machine, "uart"); |
| 684 | | int reg = offset & 0x01; |
| 685 | | |
| 686 | | /* logerror("serial w: %04x %02x\n",offset,data); */ |
| 687 | | |
| 688 | | if ((reg)==0) |
| 689 | | { |
| 690 | | msm8251_data_w(uart, reg,data); |
| 691 | | return; |
| 692 | | } |
| 693 | | |
| 694 | | msm8251_control_w(uart, reg,data); |
| 695 | | } |
| 696 | | |
| 697 | | |
| 698 | | static READ8_HANDLER(einstein_serial_r) |
| 699 | | { |
| 700 | | const device_config *uart = devtag_get_device(space->machine, "uart"); |
| 701 | | int reg = offset & 0x01; |
| 702 | | |
| 703 | | /* logerror("serial r: %04x\n",offset); */ |
| 704 | | |
| 705 | | if ((reg)==0) |
| 706 | | { |
| 707 | | return msm8251_data_r(uart, reg); |
| 708 | | } |
| 709 | | |
| 710 | | return msm8251_status_r(uart, reg); |
| 711 | | } |
| 712 | | |
| 713 | | /* |
| 714 | | |
| 715 | | AY-3-8912 PSG: |
| 716 | | |
| 717 | | NOTE: BC2 is connected to +5v |
| 718 | | |
| 719 | | BDIR BC1 FUNCTION |
| 720 | | 0 0 INACTIVE |
| 721 | | 0 1 READ FROM PSG |
| 722 | | 1 0 WRITE TO PSG |
| 723 | | 1 1 LATCH ADDRESS |
| 724 | | |
| 725 | | /PSG select, /WR connected to NOR -> BDIR |
| 726 | | |
| 727 | | when /PSG=0 and /WR=0, BDIR is 1. (write to psg or latch address) |
| 728 | | |
| 729 | | /PSG select, A0 connected to NOR -> BC1 |
| 730 | | when A0 = 0, BC1 is 1. when A0 = 1, BC1 is 0. |
| 731 | | |
| 732 | | when /PSG = 1, BDIR is 0 and BC1 is 0. |
| 733 | | |
| 734 | | |
| 735 | | */ |
| 736 | | |
| 737 | | |
| 738 | | static WRITE8_HANDLER(einstein_psg_w) |
| 739 | | { |
| 740 | | const device_config *ay8910 = devtag_get_device(space->machine, "ay8910"); |
| 741 | | int reg = offset & 0x03; |
| 742 | | |
| 743 | | /*logerror("psg w: %04x %02x\n",offset,data); */ |
| 744 | | |
| 745 | | switch (reg) |
| 746 | | { |
| 747 | | /* case 0 and 1 are not handled */ |
| 748 | | case 2: |
| 749 | | { |
| 750 | | ay8910_address_w(ay8910, 0, data); |
| 751 | | } |
| 752 | | break; |
| 753 | | |
| 754 | | case 3: |
| 755 | | { |
| 756 | | ay8910_data_w(ay8910, 0, data); |
| 757 | | } |
| 758 | | break; |
| 759 | | |
| 760 | | default: |
| 761 | | break; |
| 762 | | } |
| 763 | | } |
| 764 | | |
| 765 | | static READ8_HANDLER(einstein_psg_r) |
| 766 | | { |
| 767 | | const device_config *ay8910 = devtag_get_device(space->machine, "ay8910"); |
| 768 | | int reg = offset & 0x03; |
| 769 | | |
| 770 | | switch (reg) |
| 771 | | { |
| 772 | | /* case 0 and 1 are not handled */ |
| 773 | | case 2: |
| 774 | | return ay8910_r(ay8910, 0); |
| 775 | | |
| 776 | | default: |
| 777 | | break; |
| 778 | | } |
| 779 | | |
| 780 | | return 0x0ff; |
| 781 | | } |
| 782 | | |
| 783 | | |
| 784 | | /* int priority */ |
| 785 | | /* keyboard int->ctc/adc->pio */ |
| 786 | | |
| 787 | | |
| 788 | | static ADDRESS_MAP_START( einstein_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 789 | | AM_RANGE(0x0000, 0x01fff) AM_READWRITE(SMH_BANK(1), SMH_BANK(3)) |
| 790 | | AM_RANGE(0x2000, 0x0ffff) AM_READWRITE(SMH_BANK(2), SMH_BANK(4)) |
| 791 | | ADDRESS_MAP_END |
| 792 | | |
| 793 | | |
| 794 | | |
| 795 | | static void einstein_page_rom(running_machine *machine) |
| 796 | | { |
| 797 | | if (einstein_rom_enabled) |
| 798 | | { |
| 799 | | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")+0x010000); |
| 800 | | } |
| 801 | | else |
| 802 | | { |
| 803 | | #ifdef EINSTEIN_DUMP_RAM |
| 804 | | einstein_dump_ram(); |
| 805 | | #endif |
| 806 | | memory_set_bankptr(machine, 1, mess_ram); |
| 807 | | } |
| 808 | | } |
| 809 | | |
| 810 | | static WRITE8_HANDLER(einstein_drive_w) |
| 811 | | { |
| 812 | | const device_config *fdc = devtag_get_device(space->machine, "wd177x"); |
| 813 | | |
| 814 | | /* bit 4: side select */ |
| 815 | | /* bit 3: select drive 3 */ |
| 816 | | /* bit 2: select drive 2 */ |
| 817 | | /* bit 1: select drive 1 */ |
| 818 | | /* bit 0: select drive 0 */ |
| 819 | | |
| 820 | | logerror("drive w: PC: %04x %04x %02x\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data); |
| 821 | | |
| 822 | | wd17xx_set_side(fdc, (data >> 4) & 0x01); |
| 823 | | |
| 824 | | if (data & 0x01) |
| 825 | | { |
| 826 | | wd17xx_set_drive(fdc, 0); |
| 827 | | } |
| 828 | | else |
| 829 | | if (data & 0x02) |
| 830 | | { |
| 831 | | wd17xx_set_drive(fdc, 1); |
| 832 | | } |
| 833 | | else |
| 834 | | if (data & 0x04) |
| 835 | | { |
| 836 | | wd17xx_set_drive(fdc, 2); |
| 837 | | } |
| 838 | | else |
| 839 | | if (data & 0x08) |
| 840 | | { |
| 841 | | wd17xx_set_drive(fdc, 3); |
| 842 | | } |
| 843 | | } |
| 844 | | |
| 845 | | static WRITE8_HANDLER(einstein_rom_w) |
| 846 | | { |
| 847 | | einstein_rom_enabled ^= 1; |
| 848 | | einstein_page_rom(space->machine); |
| 849 | | } |
| 850 | | |
| 851 | | static READ8_HANDLER(einstein_key_int_r) |
| 852 | | { |
| 853 | | const device_config *printer = devtag_get_device(space->machine, "centronics"); |
| 854 | | int data; |
| 855 | | |
| 856 | | /* clear key int. a read of this I/O port will do this or a reset */ |
| 857 | | einstein_int &= ~EINSTEIN_KEY_INT; |
| 858 | | |
| 859 | | einstein_update_interrupts(space->machine); |
| 860 | | |
| 861 | | /* bit 7: 0=shift pressed */ |
| 862 | | /* bit 6: 0=control pressed */ |
| 863 | | /* bit 5: 0=graph pressed */ |
| 864 | | /* bit 4: 0=error from printer? */ |
| 865 | | /* bit 3: 0=paper empty */ |
| 866 | | /* bit 2: 1=printer busy */ |
| 867 | | /* bit 1: fire 1 */ |
| 868 | | /* bit 0: fire 0 */ |
| 869 | | data = ((input_port_read(space->machine, "EXTRA") & 0x07)<<5) | (input_port_read(space->machine, "BUTTONS") & 0x03) | 0x01c; |
| 870 | | |
| 871 | | data |= centronics_fault_r(printer) << 4; |
| 872 | | data |= centronics_pe_r(printer) << 3; |
| 873 | | data |= centronics_busy_r(printer) << 2; |
| 874 | | |
| 875 | | logerror("key int r: %02x\n",data); |
| 876 | | |
| 877 | | return data; |
| 878 | | } |
| 879 | | |
| 880 | | |
| 881 | | static WRITE8_HANDLER(einstein_key_int_w) |
| 882 | | { |
| 883 | | logerror("key int w: %02x\n",data); |
| 884 | | |
| 885 | | /* set mask from bit 0 */ |
| 886 | | if (data & 0x01) |
| 887 | | { |
| 888 | | logerror("key int is disabled\n"); |
| 889 | | einstein_int_mask &= ~EINSTEIN_KEY_INT; |
| 890 | | } |
| 891 | | else |
| 892 | | { |
| 893 | | logerror("key int is enabled\n"); |
| 894 | | einstein_int_mask |= EINSTEIN_KEY_INT; |
| 895 | | } |
| 896 | | |
| 897 | | einstein_update_interrupts(space->machine); |
| 898 | | } |
| 899 | | |
| 900 | | static WRITE8_HANDLER(einstein_adc_int_w) |
| 901 | | { |
| 902 | | logerror("adc int w: %02x\n",data); |
| 903 | | /* writing to this I/O port sets the state of the mask; D0 is used */ |
| 904 | | /* writing 0 enables the /ADC interrupt */ |
| 905 | | |
| 906 | | if (data & 0x01) |
| 907 | | { |
| 908 | | logerror("adc int is disabled\n"); |
| 909 | | einstein_int_mask &= ~EINSTEIN_ADC_INT; |
| 910 | | } |
| 911 | | else |
| 912 | | { |
| 913 | | logerror("adc int is enabled\n"); |
| 914 | | einstein_int_mask |= EINSTEIN_ADC_INT; |
| 915 | | } |
| 916 | | |
| 917 | | einstein_update_interrupts(space->machine); |
| 918 | | } |
| 919 | | |
| 920 | | static WRITE8_HANDLER(einstein_fire_int_w) |
| 921 | | { |
| 922 | | logerror("fire int w: %02x\n",data); |
| 923 | | |
| 924 | | /* writing to this I/O port sets the state of the mask; D0 is used */ |
| 925 | | /* writing 0 enables the /FIRE interrupt */ |
| 926 | | |
| 927 | | if (data & 0x01) |
| 928 | | { |
| 929 | | logerror("fire int is disabled\n"); |
| 930 | | einstein_int_mask &= ~EINSTEIN_FIRE_INT; |
| 931 | | } |
| 932 | | else |
| 933 | | { |
| 934 | | logerror("fire int is enabled\n"); |
| 935 | | einstein_int_mask |= EINSTEIN_FIRE_INT; |
| 936 | | } |
| 937 | | |
| 938 | | einstein_update_interrupts(space->machine); |
| 939 | | } |
| 940 | | |
| 941 | | |
| 942 | | static READ8_HANDLER(einstein2_port_r) |
| 943 | | { |
| 944 | | switch (offset & 0x0ff) |
| 945 | | { |
| 946 | | case 0x00: |
| 947 | | case 0x01: |
| 948 | | case 0x02: |
| 949 | | case 0x03: |
| 950 | | case 0x04: |
| 951 | | case 0x05: |
| 952 | | case 0x06: |
| 953 | | case 0x07: |
| 954 | | return einstein_psg_r(space, offset); |
| 955 | | case 0x08: |
| 956 | | case 0x09: |
| 957 | | case 0x0a: |
| 958 | | case 0x0b: |
| 959 | | case 0x0c: |
| 960 | | case 0x0d: |
| 961 | | case 0x0e: |
| 962 | | case 0x0f: |
| 963 | | return einstein_vdp_r(space, offset); |
| 964 | | case 0x10: |
| 965 | | case 0x11: |
| 966 | | case 0x12: |
| 967 | | case 0x13: |
| 968 | | case 0x14: |
| 969 | | case 0x15: |
| 970 | | case 0x16: |
| 971 | | case 0x17: |
| 972 | | return einstein_serial_r(space, offset); |
| 973 | | case 0x18: |
| 974 | | case 0x19: |
| 975 | | case 0x1a: |
| 976 | | case 0x1b: |
| 977 | | case 0x1c: |
| 978 | | case 0x1d: |
| 979 | | case 0x1e: |
| 980 | | case 0x1f: |
| 981 | | return einstein_fdc_r(space, offset); |
| 982 | | case 0x20: |
| 983 | | return einstein_key_int_r(space, offset); |
| 984 | | case 0x28: |
| 985 | | case 0x29: |
| 986 | | case 0x2a: |
| 987 | | case 0x2b: |
| 988 | | case 0x2c: |
| 989 | | case 0x2d: |
| 990 | | case 0x2e: |
| 991 | | case 0x2f: |
| 992 | | return einstein_ctc_r( devtag_get_device(space->machine, "z80ctc"), offset); |
| 993 | | case 0x30: |
| 994 | | case 0x31: |
| 995 | | case 0x32: |
| 996 | | case 0x33: |
| 997 | | case 0x34: |
| 998 | | case 0x35: |
| 999 | | case 0x36: |
| 1000 | | case 0x37: |
| 1001 | | return einstein_pio_r(space, offset); |
| 1002 | | case 0x40: |
| 1003 | | case 0x41: |
| 1004 | | case 0x42: |
| 1005 | | case 0x43: |
| 1006 | | case 0x44: |
| 1007 | | case 0x45: |
| 1008 | | case 0x46: |
| 1009 | | case 0x47: |
| 1010 | | case 0x48: |
| 1011 | | case 0x49: |
| 1012 | | case 0x4a: |
| 1013 | | case 0x4b: |
| 1014 | | case 0x4c: |
| 1015 | | case 0x4d: |
| 1016 | | case 0x4e: |
| 1017 | | case 0x4f: |
| 1018 | | return einstein_80col_r(space, offset); |
| 1019 | | |
| 1020 | | default: |
| 1021 | | break; |
| 1022 | | } |
| 1023 | | |
| 1024 | | logerror("unhandled port r: %04x\n",offset); |
| 1025 | | |
| 1026 | | return 0xff; |
| 1027 | | } |
| 1028 | | |
| 1029 | | static WRITE8_HANDLER(einstein2_port_w) |
| 1030 | | { |
| 1031 | | switch (offset & 0x0ff) |
| 1032 | | { |
| 1033 | | case 0x00: |
| 1034 | | case 0x01: |
| 1035 | | case 0x02: |
| 1036 | | case 0x03: |
| 1037 | | case 0x04: |
| 1038 | | case 0x05: |
| 1039 | | case 0x06: |
| 1040 | | case 0x07: |
| 1041 | | einstein_psg_w(space, offset,data); |
| 1042 | | return; |
| 1043 | | case 0x08: |
| 1044 | | case 0x09: |
| 1045 | | case 0x0a: |
| 1046 | | case 0x0b: |
| 1047 | | case 0x0c: |
| 1048 | | case 0x0d: |
| 1049 | | case 0x0e: |
| 1050 | | case 0x0f: |
| 1051 | | einstein_vdp_w(space, offset,data); |
| 1052 | | return; |
| 1053 | | case 0x10: |
| 1054 | | case 0x11: |
| 1055 | | case 0x12: |
| 1056 | | case 0x13: |
| 1057 | | case 0x14: |
| 1058 | | case 0x15: |
| 1059 | | case 0x16: |
| 1060 | | case 0x17: |
| 1061 | | einstein_serial_w(space, offset,data); |
| 1062 | | return; |
| 1063 | | case 0x18: |
| 1064 | | case 0x19: |
| 1065 | | case 0x1a: |
| 1066 | | case 0x1b: |
| 1067 | | case 0x1c: |
| 1068 | | case 0x1d: |
| 1069 | | case 0x1e: |
| 1070 | | case 0x1f: |
| 1071 | | einstein_fdc_w(space, offset,data); |
| 1072 | | return; |
| 1073 | | case 0x20: |
| 1074 | | einstein_key_int_w(space, offset,data); |
| 1075 | | return; |
| 1076 | | case 0x21: |
| 1077 | | einstein_adc_int_w(space, offset,data); |
| 1078 | | return; |
| 1079 | | case 0x23: |
| 1080 | | einstein_drive_w(space, offset,data); |
| 1081 | | return; |
| 1082 | | case 0x24: |
| 1083 | | einstein_rom_w(space, offset,data); |
| 1084 | | return; |
| 1085 | | case 0x25: |
| 1086 | | einstein_fire_int_w(space, offset,data); |
| 1087 | | return; |
| 1088 | | case 0x28: |
| 1089 | | case 0x29: |
| 1090 | | case 0x2a: |
| 1091 | | case 0x2b: |
| 1092 | | case 0x2c: |
| 1093 | | case 0x2d: |
| 1094 | | case 0x2e: |
| 1095 | | case 0x2f: |
| 1096 | | einstein_ctc_w( devtag_get_device(space->machine, "z80ctc"), offset,data); |
| 1097 | | return; |
| 1098 | | case 0x30: |
| 1099 | | case 0x31: |
| 1100 | | case 0x32: |
| 1101 | | case 0x33: |
| 1102 | | case 0x34: |
| 1103 | | case 0x35: |
| 1104 | | case 0x36: |
| 1105 | | case 0x37: |
| 1106 | | einstein_pio_w(space, offset,data); |
| 1107 | | return; |
| 1108 | | case 0x40: |
| 1109 | | case 0x41: |
| 1110 | | case 0x42: |
| 1111 | | case 0x43: |
| 1112 | | case 0x44: |
| 1113 | | case 0x45: |
| 1114 | | case 0x46: |
| 1115 | | case 0x47: |
| 1116 | | case 0x48: |
| 1117 | | case 0x49: |
| 1118 | | case 0x4a: |
| 1119 | | case 0x4b: |
| 1120 | | case 0x4c: |
| 1121 | | case 0x4d: |
| 1122 | | case 0x4e: |
| 1123 | | case 0x4f: |
| 1124 | | einstein_80col_w(space, offset,data); |
| 1125 | | return; |
| 1126 | | |
| 1127 | | default: |
| 1128 | | break; |
| 1129 | | } |
| 1130 | | |
| 1131 | | logerror("unhandled port w: %04x %02x\n",offset,data); |
| 1132 | | } |
| 1133 | | |
| 1134 | | |
| 1135 | | static READ8_HANDLER(einstein_port_r) |
| 1136 | | { |
| 1137 | | switch (offset & 0x0ff) |
| 1138 | | { |
| 1139 | | case 0x00: |
| 1140 | | case 0x01: |
| 1141 | | case 0x02: |
| 1142 | | case 0x03: |
| 1143 | | case 0x04: |
| 1144 | | case 0x05: |
| 1145 | | case 0x06: |
| 1146 | | case 0x07: |
| 1147 | | return einstein_psg_r(space, offset); |
| 1148 | | case 0x08: |
| 1149 | | case 0x09: |
| 1150 | | case 0x0a: |
| 1151 | | case 0x0b: |
| 1152 | | case 0x0c: |
| 1153 | | case 0x0d: |
| 1154 | | case 0x0e: |
| 1155 | | case 0x0f: |
| 1156 | | return einstein_vdp_r(space, offset); |
| 1157 | | case 0x10: |
| 1158 | | case 0x11: |
| 1159 | | case 0x12: |
| 1160 | | case 0x13: |
| 1161 | | case 0x14: |
| 1162 | | case 0x15: |
| 1163 | | case 0x16: |
| 1164 | | case 0x17: |
| 1165 | | return einstein_serial_r(space, offset); |
| 1166 | | case 0x18: |
| 1167 | | case 0x19: |
| 1168 | | case 0x1a: |
| 1169 | | case 0x1b: |
| 1170 | | case 0x1c: |
| 1171 | | case 0x1d: |
| 1172 | | case 0x1e: |
| 1173 | | case 0x1f: |
| 1174 | | return einstein_fdc_r(space, offset); |
| 1175 | | case 0x20: |
| 1176 | | return einstein_key_int_r(space, offset); |
| 1177 | | case 0x28: |
| 1178 | | case 0x29: |
| 1179 | | case 0x2a: |
| 1180 | | case 0x2b: |
| 1181 | | case 0x2c: |
| 1182 | | case 0x2d: |
| 1183 | | case 0x2e: |
| 1184 | | case 0x2f: |
| 1185 | | return einstein_ctc_r( devtag_get_device(space->machine, "z80ctc"), offset); |
| 1186 | | case 0x30: |
| 1187 | | case 0x31: |
| 1188 | | case 0x32: |
| 1189 | | case 0x33: |
| 1190 | | case 0x34: |
| 1191 | | case 0x35: |
| 1192 | | case 0x36: |
| 1193 | | case 0x37: |
| 1194 | | return einstein_pio_r(space, offset); |
| 1195 | | |
| 1196 | | default: |
| 1197 | | break; |
| 1198 | | } |
| 1199 | | |
| 1200 | | logerror("unhandled port r: %04x\n",offset); |
| 1201 | | |
| 1202 | | return 0xff; |
| 1203 | | } |
| 1204 | | |
| 1205 | | static WRITE8_HANDLER(einstein_port_w) |
| 1206 | | { |
| 1207 | | switch (offset & 0x0ff) |
| 1208 | | { |
| 1209 | | case 0x00: |
| 1210 | | case 0x01: |
| 1211 | | case 0x02: |
| 1212 | | case 0x03: |
| 1213 | | case 0x04: |
| 1214 | | case 0x05: |
| 1215 | | case 0x06: |
| 1216 | | case 0x07: |
| 1217 | | einstein_psg_w(space, offset,data); |
| 1218 | | return; |
| 1219 | | case 0x08: |
| 1220 | | case 0x09: |
| 1221 | | case 0x0a: |
| 1222 | | case 0x0b: |
| 1223 | | case 0x0c: |
| 1224 | | case 0x0d: |
| 1225 | | case 0x0e: |
| 1226 | | case 0x0f: |
| 1227 | | einstein_vdp_w(space, offset,data); |
| 1228 | | return; |
| 1229 | | case 0x10: |
| 1230 | | case 0x11: |
| 1231 | | case 0x12: |
| 1232 | | case 0x13: |
| 1233 | | case 0x14: |
| 1234 | | case 0x15: |
| 1235 | | case 0x16: |
| 1236 | | case 0x17: |
| 1237 | | einstein_serial_w(space, offset,data); |
| 1238 | | return; |
| 1239 | | case 0x18: |
| 1240 | | case 0x19: |
| 1241 | | case 0x1a: |
| 1242 | | case 0x1b: |
| 1243 | | case 0x1c: |
| 1244 | | case 0x1d: |
| 1245 | | case 0x1e: |
| 1246 | | case 0x1f: |
| 1247 | | einstein_fdc_w(space, offset,data); |
| 1248 | | return; |
| 1249 | | case 0x20: |
| 1250 | | einstein_key_int_w(space, offset,data); |
| 1251 | | return; |
| 1252 | | case 0x21: |
| 1253 | | einstein_adc_int_w(space, offset,data); |
| 1254 | | return; |
| 1255 | | case 0x23: |
| 1256 | | einstein_drive_w(space, offset,data); |
| 1257 | | return; |
| 1258 | | case 0x24: |
| 1259 | | einstein_rom_w(space, offset,data); |
| 1260 | | return; |
| 1261 | | case 0x25: |
| 1262 | | einstein_fire_int_w(space, offset,data); |
| 1263 | | return; |
| 1264 | | case 0x28: |
| 1265 | | case 0x29: |
| 1266 | | case 0x2a: |
| 1267 | | case 0x2b: |
| 1268 | | case 0x2c: |
| 1269 | | case 0x2d: |
| 1270 | | case 0x2e: |
| 1271 | | case 0x2f: |
| 1272 | | einstein_ctc_w( devtag_get_device(space->machine, "z80ctc"), offset,data); |
| 1273 | | return; |
| 1274 | | case 0x30: |
| 1275 | | case 0x31: |
| 1276 | | case 0x32: |
| 1277 | | case 0x33: |
| 1278 | | case 0x34: |
| 1279 | | case 0x35: |
| 1280 | | case 0x36: |
| 1281 | | case 0x37: |
| 1282 | | einstein_pio_w(space, offset,data); |
| 1283 | | return; |
| 1284 | | |
| 1285 | | default: |
| 1286 | | break; |
| 1287 | | } |
| 1288 | | logerror("unhandled port w: %04x %02x\n",offset,data); |
| 1289 | | } |
| 1290 | | |
| 1291 | | |
| 1292 | | static ADDRESS_MAP_START( einstein2_io , ADDRESS_SPACE_IO, 8) |
| 1293 | | AM_RANGE(0x0000,0x0ffff) AM_READWRITE(einstein2_port_r, einstein2_port_w) |
| 1294 | | ADDRESS_MAP_END |
| 1295 | | |
| 1296 | | static ADDRESS_MAP_START( einstein_io , ADDRESS_SPACE_IO, 8) |
| 1297 | | AM_RANGE(0x0000,0x0ffff) AM_READWRITE(einstein_port_r, einstein_port_w) |
| 1298 | | ADDRESS_MAP_END |
| 1299 | | |
| 1300 | | #if 0 |
| 1301 | | ADDRESS_MAP_START( readport_einstein , ADDRESS_SPACE_IO, 8) |
| 1302 | | AM_RANGE(0x000, 0x007) AM_READ( einstein_psg_r) |
| 1303 | | AM_RANGE(0x008, 0x00f) AM_READ( einstein_vdp_r) |
| 1304 | | AM_RANGE(0x010, 0x017) AM_READ( einstein_serial_r) |
| 1305 | | AM_RANGE(0x018, 0x01f) AM_READ( einstein_fdc_r) |
| 1306 | | AM_RANGE(0x020, 0x020) AM_READ( einstein_key_int_r) |
| 1307 | | AM_RANGE(0x028, 0x02f) AM_READ( einstein_ctc_r) |
| 1308 | | AM_RANGE(0x030, 0x037) AM_READ( einstein_pio_r) |
| 1309 | | // {0x040, 0x0ff, einstein_unmapped_r}, |
| 1310 | | ADDRESS_MAP_END |
| 1311 | | |
| 1312 | | ADDRESS_MAP_START( writeport_einstein , ADDRESS_SPACE_IO, 8) |
| 1313 | | AM_RANGE(0x000, 0x007) AM_WRITE( einstein_psg_w) |
| 1314 | | AM_RANGE(0x008, 0x00f) AM_WRITE( einstein_vdp_w) |
| 1315 | | AM_RANGE(0x010, 0x017) AM_WRITE( einstein_serial_w) |
| 1316 | | AM_RANGE(0x018, 0x01f) AM_WRITE( einstein_fdc_w) |
| 1317 | | AM_RANGE(0x020, 0x020) AM_WRITE( einstein_key_int_w) |
| 1318 | | AM_RANGE(0x023, 0x023) AM_WRITE( einstein_drive_w) |
| 1319 | | AM_RANGE(0x024, 0x024) AM_WRITE( einstein_rom_w) |
| 1320 | | AM_RANGE(0x028, 0x02f) AM_WRITE( einstein_ctc_w) |
| 1321 | | AM_RANGE(0x030, 0x037) AM_WRITE( einstein_pio_w) |
| 1322 | | // {0x040, 0x0ff, einstein_unmapped_w}, |
| 1323 | | ADDRESS_MAP_END |
| 1324 | | #endif |
| 1325 | | |
| 1326 | | |
| 1327 | | |
| 1328 | | /* when Z80 acknowledges int, /IORQ and /M1 will be low */ |
| 1329 | | /* this allows I057 octal latch to output data onto the bus */ |
| 1330 | | static IRQ_CALLBACK(einstein_cpu_acknowledge_int) |
| 1331 | | { |
| 1332 | | int vector = 0; |
| 1333 | | |
| 1334 | | /* 8 different values for vector */ |
| 1335 | | |
| 1336 | | /* vector */ |
| 1337 | | /* bits 7,6,5,4 and 0 are forced to "0" */ |
| 1338 | | |
| 1339 | | /* if /adc int OR /ctc int, then pio is not allowed to interrupt */ |
| 1340 | | |
| 1341 | | /* 4d set to 1 */ |
| 1342 | | /* 1d is set to 0 if key int has occured */ |
| 1343 | | /* 2d is set to 0 if adc int has occured and CTC int hasn't occured */ |
| 1344 | | /* 3d is set to 0 if fire int has occured but not if adc or CTC or PIO int has occured */ |
| 1345 | | |
| 1346 | | /* priority (highest to lowest): */ |
| 1347 | | /* keyboard */ |
| 1348 | | /* ctc */ |
| 1349 | | /* adc */ |
| 1350 | | /* pio */ |
| 1351 | | /* fire */ |
| 1352 | | |
| 1353 | | return (vector<<1); |
| 1354 | | } |
| 1355 | | |
| 1356 | | static const TMS9928a_interface tms9928a_interface = |
| 1357 | | { |
| 1358 | | TMS9929A, |
| 1359 | | 0x4000, |
| 1360 | | 0, 0, |
| 1361 | | NULL |
| 1362 | | }; |
| 1363 | | |
| 1364 | | static MACHINE_START( einstein ) |
| 1365 | | { |
| 1366 | | TMS9928A_configure(&tms9928a_interface); |
| 1367 | | |
| 1368 | | einstein_z80pio = devtag_get_device(machine, "z80pio"); |
| 1369 | | } |
| 1370 | | |
| 1371 | | static MACHINE_RESET( einstein ) |
| 1372 | | { |
| 1373 | | memory_set_bankptr(machine, 2, mess_ram+0x02000); |
| 1374 | | memory_set_bankptr(machine, 3, mess_ram); |
| 1375 | | memory_set_bankptr(machine, 4, mess_ram+0x02000); |
| 1376 | | |
| 1377 | | TMS9928A_reset (); |
| 1378 | | |
| 1379 | | einstein_rom_enabled = 1; |
| 1380 | | einstein_page_rom(machine); |
| 1381 | | |
| 1382 | | einstein_ctc_trigger = 0; |
| 1383 | | |
| 1384 | | einstein_int=0; |
| 1385 | | /* a reset causes the fire int, adc int, keyboard int mask |
| 1386 | | to be set to 1, which causes all these to be DISABLED */ |
| 1387 | | einstein_int_mask = 0; |
| 1388 | | floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40); |
| 1389 | | |
| 1390 | | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), einstein_cpu_acknowledge_int); |
| 1391 | | |
| 1392 | | /* the einstein keyboard can generate a interrupt */ |
| 1393 | | /* the int is actually clocked at the system clock 4 MHz, but this would be too fast for our |
| 1394 | | driver. So we update at 50Hz and hope this is good enough. */ |
| 1395 | | timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, einstein_keyboard_timer_callback); |
| 1396 | | |
| 1397 | | /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */ |
| 1398 | | einstein_ctc_trigger = 0; |
| 1399 | | timer_pulse(machine, ATTOTIME_IN_HZ(2000000), (void *)devtag_get_device(machine, "z80ctc"), 0, einstein_ctc_trigger_callback); |
| 1400 | | } |
| 1401 | | |
| 1402 | | static MACHINE_RESET( einstein2 ) |
| 1403 | | { |
| 1404 | | MACHINE_RESET_CALL(einstein); |
| 1405 | | einstein_80col_init(machine); |
| 1406 | | } |
| 1407 | | |
| 1408 | | static INPUT_PORTS_START(einstein) |
| 1409 | | PORT_START("LINE0") |
| 1410 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT) |
| 1411 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) |
| 1412 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) |
| 1413 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) |
| 1414 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) |
| 1415 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 1416 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 1417 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 1418 | | |
| 1419 | | PORT_START("LINE1") |
| 1420 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 1421 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 1422 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 1423 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 1424 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\xA3') |
| 1425 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 1426 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xBA') PORT_CHAR('\xBD') // is \xBA correct for double vertical bar || ? |
| 1427 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') |
| 1428 | | |
| 1429 | | PORT_START("LINE2") |
| 1430 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 1431 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 1432 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 1433 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') |
| 1434 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 1435 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 1436 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 1437 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 1438 | | |
| 1439 | | PORT_START("LINE3") |
| 1440 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 1441 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 1442 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 1443 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 1444 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 1445 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-') |
| 1446 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 1447 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 1448 | | |
| 1449 | | PORT_START("LINE4") |
| 1450 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 1451 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 1452 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 1453 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 1454 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 1455 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') |
| 1456 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 1457 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| 1458 | | |
| 1459 | | PORT_START("LINE5") |
| 1460 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 1461 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 1462 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 1463 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 1464 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 1465 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 1466 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 1467 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 1468 | | |
| 1469 | | PORT_START("LINE6") |
| 1470 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 1471 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 1472 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 1473 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 1474 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 1475 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 1476 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 1477 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 1478 | | |
| 1479 | | PORT_START("LINE7") |
| 1480 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 1481 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 1482 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 1483 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 1484 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 1485 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 1486 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 1487 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 1488 | | |
| 1489 | | PORT_START("EXTRA") |
| 1490 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_F8) |
| 1491 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 1492 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 1493 | | |
| 1494 | | /* fire buttons for analogue joysticks */ |
| 1495 | | PORT_START("BUTTONS") |
| 1496 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1") |
| 1497 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_PLAYER(2) |
| 1498 | | |
| 1499 | | /* analog joystick 1 x axis */ |
| 1500 | | PORT_START("JOY1_X") |
| 1501 | | PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_REVERSE |
| 1502 | | |
| 1503 | | /* analog joystick 1 y axis */ |
| 1504 | | PORT_START("JOY1_Y") |
| 1505 | | PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_REVERSE |
| 1506 | | |
| 1507 | | /* analog joystick 2 x axis */ |
| 1508 | | PORT_START("JOY2_X") |
| 1509 | | PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_REVERSE |
| 1510 | | |
| 1511 | | /* analog joystick 2 Y axis */ |
| 1512 | | PORT_START("JOY2_Y") |
| 1513 | | PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE |
| 1514 | | |
| 1515 | | INPUT_PORTS_END |
| 1516 | | |
| 1517 | | static WRITE8_HANDLER(einstein_port_a_write) |
| 1518 | | { |
| 1519 | | einstein_keyboard_line = data; |
| 1520 | | |
| 1521 | | // logerror("line: %02x\n",einstein_keyboard_line); |
| 1522 | | |
| 1523 | | /* re-scan the keyboard */ |
| 1524 | | einstein_scan_keyboard(space->machine); |
| 1525 | | } |
| 1526 | | |
| 1527 | | static READ8_HANDLER(einstein_port_b_read) |
| 1528 | | { |
| 1529 | | einstein_scan_keyboard(space->machine); |
| 1530 | | |
| 1531 | | // logerror("key: %02x\n",einstein_keyboard_data); |
| 1532 | | |
| 1533 | | return einstein_keyboard_data; |
| 1534 | | } |
| 1535 | | |
| 1536 | | static const ay8910_interface einstein_ay_interface = |
| 1537 | | { |
| 1538 | | AY8910_LEGACY_OUTPUT, |
| 1539 | | AY8910_DEFAULT_LOADS, |
| 1540 | | DEVCB_NULL, |
| 1541 | | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, einstein_port_b_read), |
| 1542 | | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, einstein_port_a_write), |
| 1543 | | DEVCB_NULL |
| 1544 | | }; |
| 1545 | | |
| 1546 | | static const centronics_interface einstein_centronics_config = |
| 1547 | | { |
| 1548 | | FALSE, |
| 1549 | | DEVCB_DEVICE_LINE("z80pio", z80pio_astb_w), |
| 1550 | | DEVCB_NULL, |
| 1551 | | DEVCB_NULL |
| 1552 | | }; |
| 1553 | | |
| 1554 | | /* |
| 1555 | | 0: 126 (127) horizontal total |
| 1556 | | 1: 80 horizontal displayed |
| 1557 | | 2: 97 horizontal sync position |
| 1558 | | 3: &38 |
| 1559 | | 4: 26 vertical total |
| 1560 | | 5: 19 vertical adjust |
| 1561 | | 6: 25 vertical displayed |
| 1562 | | 7: 26 vertical sync pos |
| 1563 | | 8: 0 no interlace |
| 1564 | | 9: 8 (9 scanlines tall) |
| 1565 | | 10: 32 |
| 1566 | | |
| 1567 | | total scanlines: ((reg 9+1) * (reg 4+1))+reg 5 = 262 |
| 1568 | | 127 cycles per line |
| 1569 | | 127*262 = 33274 cycles per frame, vsync len 375 cycles |
| 1570 | | */ |
| 1571 | | |
| 1572 | | //static void einstein_80col_plot_char_line(int x,int y, bitmap_t *bitmap) |
| 1573 | | //{ |
| 1574 | | // int w; |
| 1575 | | // if (Einstein_DE) |
| 1576 | | // { |
| 1577 | | // |
| 1578 | | // unsigned char *data = memory_region(machine, "maincpu")+0x012000; |
| 1579 | | // unsigned char data_byte; |
| 1580 | | // int char_code; |
| 1581 | | // |
| 1582 | | // char_code = einstein_80col_ram[m6845_memory_address_r(0)&0x07ff]; |
| 1583 | | // |
| 1584 | | // data_byte = data[(char_code<<3) + Einstein_6845_RA]; |
| 1585 | | // |
| 1586 | | // for (w=0; w<8;w++) |
| 1587 | | // { |
| 1588 | | // *BITMAP_ADDR16(bitmap, y, x+w) = (data_byte & 0x080) ? 1 : 0; |
| 1589 | | // |
| 1590 | | // data_byte = data_byte<<1; |
| 1591 | | // |
| 1592 | | // } |
| 1593 | | // } |
| 1594 | | // else |
| 1595 | | // { |
| 1596 | | // for (w=0; w<8;w++) |
| 1597 | | // *BITMAP_ADDR16(bitmap, y, x+w) = 0; |
| 1598 | | // } |
| 1599 | | // |
| 1600 | | //} |
| 1601 | | // |
| 1602 | | //static VIDEO_UPDATE( einstein_80col ) |
| 1603 | | //{ |
| 1604 | | // long c=0; // this is used to time out the screen redraw, in the case that the 6845 is in some way out state. |
| 1605 | | // |
| 1606 | | // c=0; |
| 1607 | | // |
| 1608 | | // // loop until the end of the Vertical Sync pulse |
| 1609 | | // while((Einstein_VSync)&&(c<33274)) |
| 1610 | | // { |
| 1611 | | // // Clock the 6845 |
| 1612 | | // m6845_clock(screen->machine); |
| 1613 | | // c++; |
| 1614 | | // } |
| 1615 | | // |
| 1616 | | // // loop until the Vertical Sync pulse goes high |
| 1617 | | // // or until a timeout (this catches the 6845 with silly register values that would not give a VSYNC signal) |
| 1618 | | // while((!Einstein_VSync)&&(c<33274)) |
| 1619 | | // { |
| 1620 | | // while ((Einstein_HSync)&&(c<33274)) |
| 1621 | | // { |
| 1622 | | // m6845_clock(screen->machine); |
| 1623 | | // c++; |
| 1624 | | // } |
| 1625 | | // // Do all the clever split mode changes in here before the next while loop |
| 1626 | | // |
| 1627 | | // while ((!Einstein_HSync)&&(c<33274)) |
| 1628 | | // { |
| 1629 | | // // check that we are on the emulated screen area. |
| 1630 | | // if ((Einstein_scr_x>=0) && (Einstein_scr_x<640) && (Einstein_scr_y>=0) && (Einstein_scr_y<400)) |
| 1631 | | // { |
| 1632 | | // einstein_80col_plot_char_line(Einstein_scr_x, Einstein_scr_y, bitmap); |
| 1633 | | // } |
| 1634 | | // |
| 1635 | | // Einstein_scr_x+=8; |
| 1636 | | // |
| 1637 | | // // Clock the 6845 |
| 1638 | | // m6845_clock(screen->machine); |
| 1639 | | // c++; |
| 1640 | | // } |
| 1641 | | // } |
| 1642 | | // return 0; |
| 1643 | | //} |
| 1644 | | |
| 1645 | | static VIDEO_UPDATE( einstein2 ) |
| 1646 | | { |
| 1647 | | const device_config *mc6845 = devtag_get_device(screen->machine, "crtc"); |
| 1648 | | |
| 1649 | | VIDEO_UPDATE_CALL(tms9928a); |
| 1650 | | mc6845_update(mc6845, bitmap, cliprect); |
| 1651 | | // VIDEO_UPDATE_CALL(einstein_80col); |
| 1652 | | return 0; |
| 1653 | | } |
| 1654 | | |
| 1655 | | static MACHINE_DRIVER_START( einstein ) |
| 1656 | | /* basic machine hardware */ |
| 1657 | | MDRV_CPU_ADD("maincpu", Z80, EINSTEIN_SYSTEM_CLOCK) |
| 1658 | | MDRV_CPU_PROGRAM_MAP(einstein_mem) |
| 1659 | | MDRV_CPU_IO_MAP(einstein_io) |
| 1660 | | MDRV_CPU_CONFIG(einstein_daisy_chain) |
| 1661 | | MDRV_QUANTUM_TIME(HZ(60)) |
| 1662 | | |
| 1663 | | MDRV_MACHINE_START( einstein ) |
| 1664 | | MDRV_MACHINE_RESET( einstein ) |
| 1665 | | |
| 1666 | | MDRV_Z80PIO_ADD( "z80pio", einstein_pio_intf ) |
| 1667 | | MDRV_Z80CTC_ADD( "z80ctc", EINSTEIN_SYSTEM_CLOCK, einstein_ctc_intf ) |
| 1668 | | MDRV_DEVICE_ADD( "keyboard_daisy", DEVICE_GET_INFO_NAME( einstein_daisy ), 0 ) |
| 1669 | | MDRV_DEVICE_ADD( "adc_daisy", DEVICE_GET_INFO_NAME( einstein_daisy ), 0 ) |
| 1670 | | |
| 1671 | | /* video hardware */ |
| 1672 | | MDRV_IMPORT_FROM(tms9928a) |
| 1673 | | MDRV_SCREEN_MODIFY("screen") |
| 1674 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 1675 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1676 | | |
| 1677 | | /* sound hardware */ |
| 1678 | | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1679 | | MDRV_SOUND_ADD("ay8910", AY8910, 2000000) |
| 1680 | | MDRV_SOUND_CONFIG(einstein_ay_interface) |
| 1681 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 1682 | | |
| 1683 | | /* printer */ |
| 1684 | | MDRV_CENTRONICS_ADD("centronics", einstein_centronics_config) |
| 1685 | | |
| 1686 | | /* uart */ |
| 1687 | | MDRV_MSM8251_ADD("uart", default_msm8251_interface) |
| 1688 | | |
| 1689 | | MDRV_WD177X_ADD("wd177x", default_wd17xx_interface ) |
| 1690 | | MACHINE_DRIVER_END |
| 1691 | | |
| 1692 | | |
| 1693 | | static MACHINE_DRIVER_START( einstei2 ) |
| 1694 | | MDRV_IMPORT_FROM( einstein ) |
| 1695 | | |
| 1696 | | MDRV_CPU_MODIFY( "maincpu" ) |
| 1697 | | MDRV_CPU_IO_MAP(einstein2_io) |
| 1698 | | MDRV_MACHINE_RESET( einstein2 ) |
| 1699 | | |
| 1700 | | /* video hardware */ |
| 1701 | | MDRV_SCREEN_MODIFY("screen") |
| 1702 | | MDRV_SCREEN_SIZE(640, 400) |
| 1703 | | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 1704 | | |
| 1705 | | MDRV_MC6845_ADD("crtc", MC6845, EINSTEIN_SYSTEM_CLOCK /*?*/, einstein_crtc6845_interface) |
| 1706 | | |
| 1707 | | MDRV_VIDEO_UPDATE( einstein2 ) |
| 1708 | | MACHINE_DRIVER_END |
| 1709 | | |
| 1710 | | |
| 1711 | | /*************************************************************************** |
| 1712 | | |
| 1713 | | Game driver(s) |
| 1714 | | |
| 1715 | | ***************************************************************************/ |
| 1716 | | |
| 1717 | | ROM_START(einstein) |
| 1718 | | ROM_REGION(0x010000+0x02000, "maincpu",0) |
| 1719 | | ROM_LOAD("einstein.rom",0x10000, 0x02000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77)) |
| 1720 | | ROM_END |
| 1721 | | |
| 1722 | | ROM_START(einstei2) |
| 1723 | | ROM_REGION(0x010000+0x02000+0x0800, "maincpu",0) |
| 1724 | | ROM_LOAD("einstein.rom",0x10000, 0x02000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77)) |
| 1725 | | ROM_LOAD("charrom.rom",0x012000, 0x0800, NO_DUMP) |
| 1726 | | ROM_END |
| 1727 | | |
| 1728 | | static void einstein_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 1729 | | { |
| 1730 | | /* floppy */ |
| 1731 | | switch(state) |
| 1732 | | { |
| 1733 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 1734 | | case MESS_DEVINFO_INT_COUNT: info->i = 4; break; |
| 1735 | | |
| 1736 | | default: legacydsk_device_getinfo(devclass, state, info); break; |
| 1737 | | } |
| 1738 | | } |
| 1739 | | |
| 1740 | | static SYSTEM_CONFIG_START(einstein) |
| 1741 | | CONFIG_RAM_DEFAULT(65536) |
| 1742 | | CONFIG_DEVICE(einstein_floppy_getinfo) |
| 1743 | | SYSTEM_CONFIG_END |
| 1744 | | |
| 1745 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG, COMPANY FULLNAME */ |
| 1746 | | COMP( 1984, einstein, 0, 0, einstein, einstein, 0, einstein, "Tatung", "Tatung Einstein TC-01", 0) |
| 1747 | | COMP( 1984, einstei2, 0, 0, einstei2, einstein, 0, einstein, "Tatung", "Tatung Einstein TC-01 + 80 column device", GAME_NOT_WORKING) |
| 1 | /******************************************************************************
|
| 2 | |
| 3 | Tatung Einstein
|
| 4 | system driver
|
| 5 | |
| 6 | |
| 7 | TMS9129 VDP Graphics
|
| 8 | 16k ram
|
| 9 | |
| 10 | Z80 CPU (4 MHz)
|
| 11 | |
| 12 | Z80 CTC (4 MHz)
|
| 13 | channel 0 is serial transmit clock
|
| 14 | channel 1 is serial receive clock
|
| 15 | trigger for channel 0,1 and 2 is a 2 MHz clock
|
| 16 | trigger for channel 3 is the terminal count of channel 2
|
| 17 | |
| 18 | Intel 8251 Serial (2 MHz clock?)
|
| 19 | |
| 20 | WD1770 Floppy Disc controller
|
| 21 | density is fixed, 4 drives and double sided supported
|
| 22 | |
| 23 | AY-3-8910 PSG (2 MHz)
|
| 24 | port A and port B are connected to the keyboard. Port A is keyboard
|
| 25 | line select, Port B is data.
|
| 26 | |
| 27 | printer connected to port A of PIO. /ACK from printer is connected to /ASTB.
|
| 28 | D7-D0 of PIO port A is printer data lines.
|
| 29 | ARDY of PIO is connected to /STROBE on printer.
|
| 30 | |
| 31 | user port is port B of PIO
|
| 32 | keyboard connected to port A and port B of PSG
|
| 33 | |
| 34 | TODO:
|
| 35 | - The ADC is not emulated!
|
| 36 | - printer emulation needs checking!
|
| 37 | |
| 38 | Many thanks to Chris Coxall for the schematics of the TC-01, the dump of the
|
| 39 | system rom and a dump of a Xtal boot disc.
|
| 40 | |
| 41 | Many thanks to Andrew Dunipace for his help with the 80-column card
|
| 42 | and Speculator hardware (Spectrum emulator).
|
| 43 | |
| 44 | Kevin Thacker [MESS driver]
|
| 45 | |
| 46 | |
| 47 | |
| 48 | ******************************************************************************/
|
| 49 | |
| 50 | #include "driver.h"
|
| 51 | #include "machine/z80ctc.h"
|
| 52 | #include "machine/z80pio.h"
|
| 53 | #include "machine/z80sio.h"
|
| 54 | #include "video/tms9928a.h"
|
| 55 | #include "cpu/z80/z80.h"
|
| 56 | #include "cpu/z80/z80daisy.h"
|
| 57 | #include "machine/wd17xx.h"
|
| 58 | #include "machine/ctronics.h"
|
| 59 | #include "machine/msm8251.h"
|
| 60 | #include "devices/dsk.h"
|
| 61 | #include "devices/basicdsk.h"
|
| 62 | #include "sound/ay8910.h"
|
| 63 | #include "video/mc6845.h"
|
| 64 | #include "einstei2.lh"
|
| 65 | |
| 66 | |
| 67 | /***************************************************************************
|
| 68 | CONSTANTS
|
| 69 | ***************************************************************************/
|
| 70 | |
| 71 | /* xtals */
|
| 72 | #define XTAL_X001 XTAL_10_738635MHz
|
| 73 | #define XTAL_X002 XTAL_8MHz
|
| 74 | |
| 75 | /* integrated circuits */
|
| 76 | #define IC_I001 "i001" /* Z8400A */
|
| 77 | #define IC_I030 "i030" /* AY-3-8910 */
|
| 78 | #define IC_I038 "i038" /* TMM9129 */
|
| 79 | #define IC_I042 "i042" /* WD1770-PH */
|
| 80 | #define IC_I050 "i050" /* ADC0844CCN */
|
| 81 | #define IC_I058 "i058" /* Z8430A */
|
| 82 | #define IC_I060 "i060" /* uPD8251A */
|
| 83 | #define IC_I063 "i063" /* Z8420A */
|
| 84 | |
| 85 | /* interrupt sources */
|
| 86 | #define EINSTEIN_KEY_INT (1<<0)
|
| 87 | #define EINSTEIN_ADC_INT (1<<1)
|
| 88 | #define EINSTEIN_FIRE_INT (1<<2)
|
| 89 | |
| 90 | |
| 91 | /***************************************************************************
|
| 92 | TYPE DEFINITIONS
|
| 93 | ***************************************************************************/
|
| 94 | |
| 95 | typedef struct _einstein_state einstein_state;
|
| 96 | struct _einstein_state
|
| 97 | {
|
| 98 | const device_config *color_screen;
|
| 99 | const device_config *ctc;
|
| 100 | |
| 101 | int rom_enabled;
|
| 102 | int interrupt;
|
| 103 | int interrupt_mask;
|
| 104 | int ctc_trigger;
|
| 105 | |
| 106 | /* keyboard */
|
| 107 | UINT8 keyboard_line;
|
| 108 | UINT8 keyboard_data;
|
| 109 | |
| 110 | /* 80 column device */
|
| 111 | const device_config *mc6845;
|
| 112 | const device_config *crtc_screen;
|
| 113 | UINT8 *crtc_ram;
|
| 114 | };
|
| 115 | |
| 116 | |
| 117 | /***************************************************************************
|
| 118 | 80 COLUMN DEVICE
|
| 119 | ***************************************************************************/
|
| 120 | |
| 121 | /* lower 3 bits of address define a 256-byte "row".
|
| 122 | * upper 8 bits define the offset in the row,
|
| 123 | * data bits define data to write
|
| 124 | */
|
| 125 | static WRITE8_HANDLER( einstein_80col_ram_w )
|
| 126 | {
|
| 127 | einstein_state *einstein = space->machine->driver_data;
|
| 128 | einstein->crtc_ram[((offset & 0x07) << 8) | ((offset >> 8) & 0xff)] = data;
|
| 129 | }
|
| 130 | |
| 131 | static READ8_HANDLER( einstein_80col_ram_r )
|
| 132 | {
|
| 133 | einstein_state *einstein = space->machine->driver_data;
|
| 134 | return einstein->crtc_ram[((offset & 0x07) << 8) | ((offset >> 8) & 0xff)];
|
| 135 | }
|
| 136 | |
| 137 | /* TODO: Verify implementation */
|
| 138 | static MC6845_UPDATE_ROW( einstein_6845_update_row )
|
| 139 | {
|
| 140 | einstein_state *einstein = device->machine->driver_data;
|
| 141 | UINT8 *data = memory_region(device->machine, "gfx1");
|
| 142 | UINT8 char_code, data_byte;
|
| 143 | int i, x;
|
| 144 | |
| 145 | for (i = 0, x = 0; i < x_count; i++, x += 8)
|
| 146 | {
|
| 147 | char_code = einstein->crtc_ram[(ma + i) & 0x07ff];
|
| 148 | data_byte = data[(char_code << 3) + ra];
|
| 149 | |
| 150 | *BITMAP_ADDR16(bitmap, y, x + 0) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 7);
|
| 151 | *BITMAP_ADDR16(bitmap, y, x + 1) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 6);
|
| 152 | *BITMAP_ADDR16(bitmap, y, x + 2) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 5);
|
| 153 | *BITMAP_ADDR16(bitmap, y, x + 3) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 4);
|
| 154 | *BITMAP_ADDR16(bitmap, y, x + 4) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 3);
|
| 155 | *BITMAP_ADDR16(bitmap, y, x + 5) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 2);
|
| 156 | *BITMAP_ADDR16(bitmap, y, x + 6) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 1);
|
| 157 | *BITMAP_ADDR16(bitmap, y, x + 7) = TMS9928A_PALETTE_SIZE + BIT(data_byte, 0);
|
| 158 | }
|
| 159 | }
|
| 160 | |
| 161 | /* bit 0 - vsync state?
|
| 162 | * bit 1 - 0 = 40 column mode (color monitor), 1 = 80 column mode (b/w monitor)
|
| 163 | * bit 2 - 0 = 50Hz, 1 = 60Hz |
| 164 | */
|
| 165 | static READ8_HANDLER( einstein_80col_state_r )
|
| 166 | {
|
| 167 | einstein_state *einstein = space->machine->driver_data;
|
| 168 | UINT8 result = 0;
|
| 169 | |
| 170 | result |= video_screen_get_vblank(einstein->crtc_screen);
|
| 171 | result |= input_port_read(space->machine, "80column_dips") & 0x06;
|
| 172 | |
| 173 | logerror("%s: einstein_80col_state_r %02x\n", cpuexec_describe_context(space->machine), result);
|
| 174 | |
| 175 | return result;
|
| 176 | }
|
| 177 | |
| 178 | |
| 179 | /****************************************************************
|
| 180 | EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT
|
| 181 | ****************************************************************/
|
| 182 | |
| 183 | static DEVICE_START( einstein_daisy ) { }
|
| 184 | |
| 185 | static int einstein_keyboard_daisy_irq_state(const device_config *device)
|
| 186 | {
|
| 187 | einstein_state *einstein = device->machine->driver_data;
|
| 188 | |
| 189 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_KEY_INT)
|
| 190 | return Z80_DAISY_INT;
|
| 191 | |
| 192 | return 0;
|
| 193 | }
|
| 194 | |
| 195 | static int einstein_keyboard_daisy_irq_ack(const device_config *device)
|
| 196 | {
|
| 197 | return 0xf7;
|
| 198 | }
|
| 199 | |
| 200 | static DEVICE_GET_INFO( einstein_keyboard_daisy )
|
| 201 | {
|
| 202 | switch (state)
|
| 203 | {
|
| 204 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 205 | case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break;
|
| 206 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 207 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
| 208 | |
| 209 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 210 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break;
|
| 211 | case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_keyboard_daisy_irq_state; break;
|
| 212 | case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)einstein_keyboard_daisy_irq_ack; break;
|
| 213 | |
| 214 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 215 | case DEVINFO_STR_NAME: strcpy(info->s, "Einstein keyboard daisy chain"); break;
|
| 216 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Einstein daisy chain"); break;
|
| 217 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
|
| 218 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
|
| 219 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break;
|
| 220 | }
|
| 221 | }
|
| 222 | |
| 223 | static int einstein_adc_daisy_irq_state(const device_config *device)
|
| 224 | {
|
| 225 | einstein_state *einstein = device->machine->driver_data;
|
| 226 | |
| 227 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_ADC_INT)
|
| 228 | return Z80_DAISY_INT;
|
| 229 | |
| 230 | return 0;
|
| 231 | }
|
| 232 | |
| 233 | static int einstein_adc_daisy_irq_ack(const device_config *device)
|
| 234 | {
|
| 235 | return 0xfb;
|
| 236 | }
|
| 237 | |
| 238 | static DEVICE_GET_INFO( einstein_adc_daisy )
|
| 239 | {
|
| 240 | switch (state)
|
| 241 | {
|
| 242 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 243 | case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break;
|
| 244 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 245 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
| 246 | |
| 247 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 248 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break;
|
| 249 | case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_adc_daisy_irq_state; break;
|
| 250 | case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)einstein_adc_daisy_irq_ack; break;
|
| 251 | |
| 252 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 253 | case DEVINFO_STR_NAME: strcpy(info->s, "Einstein ADC daisy chain"); break;
|
| 254 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Einstein daisy chain"); break;
|
| 255 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
|
| 256 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
|
| 257 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break;
|
| 258 | }
|
| 259 | }
|
| 260 | |
| 261 | static int einstein_fire_daisy_irq_state(const device_config *device)
|
| 262 | {
|
| 263 | einstein_state *einstein = device->machine->driver_data;
|
| 264 | |
| 265 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_FIRE_INT)
|
| 266 | return Z80_DAISY_INT;
|
| 267 | |
| 268 | return 0;
|
| 269 | }
|
| 270 | |
| 271 | static int einstein_fire_daisy_irq_ack(const device_config *device)
|
| 272 | {
|
| 273 | return 0xfd;
|
| 274 | }
|
| 275 | |
| 276 | static DEVICE_GET_INFO( einstein_fire_daisy )
|
| 277 | {
|
| 278 | switch (state)
|
| 279 | {
|
| 280 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 281 | case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break;
|
| 282 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 283 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
| 284 | |
| 285 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 286 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break;
|
| 287 | case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_fire_daisy_irq_state; break;
|
| 288 | case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)einstein_fire_daisy_irq_ack; break;
|
| 289 | |
| 290 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 291 | case DEVINFO_STR_NAME: strcpy(info->s, "Einstein fire button daisy chain"); break;
|
| 292 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Einstein daisy chain"); break;
|
| 293 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
|
| 294 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
|
| 295 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break;
|
| 296 | }
|
| 297 | }
|
| 298 | |
| 299 | /* int priority */
|
| 300 | /* keyboard int->ctc/adc->pio */
|
| 301 | static const z80_daisy_chain einstein_daisy_chain[] =
|
| 302 | {
|
| 303 | { "keyboard_daisy" },
|
| 304 | { IC_I058 },
|
| 305 | { "adc_daisy" },
|
| 306 | { IC_I063 },
|
| 307 | { "fire_daisy" },
|
| 308 | { NULL }
|
| 309 | };
|
| 310 | |
| 311 | |
| 312 | /***************************************************************************
|
| 313 | KEYBOARD
|
| 314 | ***************************************************************************/
|
| 315 | |
| 316 | /* refresh keyboard data. It is refreshed when the keyboard line is written */
|
| 317 | static void einstein_scan_keyboard(running_machine *machine)
|
| 318 | {
|
| 319 | einstein_state *einstein = machine->driver_data;
|
| 320 | UINT8 data = 0xff;
|
| 321 | |
| 322 | if (!BIT(einstein->keyboard_line, 0)) data &= input_port_read(machine, "LINE0");
|
| 323 | if (!BIT(einstein->keyboard_line, 1)) data &= input_port_read(machine, "LINE1");
|
| 324 | if (!BIT(einstein->keyboard_line, 2)) data &= input_port_read(machine, "LINE2");
|
| 325 | if (!BIT(einstein->keyboard_line, 3)) data &= input_port_read(machine, "LINE3");
|
| 326 | if (!BIT(einstein->keyboard_line, 4)) data &= input_port_read(machine, "LINE4");
|
| 327 | if (!BIT(einstein->keyboard_line, 5)) data &= input_port_read(machine, "LINE5");
|
| 328 | if (!BIT(einstein->keyboard_line, 6)) data &= input_port_read(machine, "LINE6");
|
| 329 | if (!BIT(einstein->keyboard_line, 7)) data &= input_port_read(machine, "LINE7");
|
| 330 | |
| 331 | einstein->keyboard_data = data;
|
| 332 | }
|
| 333 | |
| 334 | static TIMER_DEVICE_CALLBACK( einstein_keyboard_timer_callback )
|
| 335 | {
|
| 336 | einstein_state *einstein = timer->machine->driver_data;
|
| 337 | |
| 338 | /* re-scan keyboard */
|
| 339 | einstein_scan_keyboard(timer->machine);
|
| 340 | |
| 341 | /* if /fire1 or /fire2 is 0, signal a fire interrupt */
|
| 342 | if ((input_port_read(timer->machine, "BUTTONS") & 0x03) != 0)
|
| 343 | {
|
| 344 | einstein->interrupt |= EINSTEIN_FIRE_INT;
|
| 345 | }
|
| 346 | |
| 347 | /* keyboard data changed? */
|
| 348 | if (einstein->keyboard_data != 0xff)
|
| 349 | {
|
| 350 | /* generate interrupt */
|
| 351 | einstein->interrupt |= EINSTEIN_KEY_INT;
|
| 352 | }
|
| 353 | }
|
| 354 | |
| 355 | static WRITE8_HANDLER( einstein_keyboard_line_write )
|
| 356 | {
|
| 357 | einstein_state *einstein = space->machine->driver_data;
|
| 358 | |
| 359 | logerror("einstein_keyboard_line_write: %02x\n", data);
|
| 360 | |
| 361 | einstein->keyboard_line = data;
|
| 362 | |
| 363 | /* re-scan the keyboard */
|
| 364 | einstein_scan_keyboard(space->machine);
|
| 365 | }
|
| 366 | |
| 367 | static READ8_HANDLER( einstein_keyboard_data_read )
|
| 368 | {
|
| 369 | einstein_state *einstein = space->machine->driver_data;
|
| 370 | |
| 371 | /* re-scan the keyboard */
|
| 372 | einstein_scan_keyboard(space->machine);
|
| 373 | |
| 374 | logerror("einstein_keyboard_data_read: %02x\n", einstein->keyboard_data);
|
| 375 | |
| 376 | return einstein->keyboard_data;
|
| 377 | }
|
| 378 | |
| 379 | |
| 380 | /***************************************************************************
|
| 381 | FLOPPY DRIVES
|
| 382 | ***************************************************************************/
|
| 383 | |
| 384 | static WRITE8_DEVICE_HANDLER( einstein_drsel_w )
|
| 385 | {
|
| 386 | logerror("%s: einstein_drsel_w %02x\n", cpuexec_describe_context(device->machine), data);
|
| 387 | |
| 388 | /* bit 0 to 3 select the drive */
|
| 389 | if (BIT(data, 0)) wd17xx_set_drive(device, 0);
|
| 390 | if (BIT(data, 1)) wd17xx_set_drive(device, 1);
|
| 391 | if (BIT(data, 2)) wd17xx_set_drive(device, 2);
|
| 392 | if (BIT(data, 3)) wd17xx_set_drive(device, 3);
|
| 393 | |
| 394 | /* bit 4 selects the side */
|
| 395 | wd17xx_set_side(device, BIT(data, 4));
|
| 396 | }
|
| 397 | |
| 398 | |
| 399 | /***************************************************************************
|
| 400 | CTC
|
| 401 | ***************************************************************************/
|
| 402 | |
| 403 | /* channel 0 and 1 have a 2 MHz input clock for triggering */
|
| 404 | static TIMER_DEVICE_CALLBACK( einstein_ctc_trigger_callback )
|
| 405 | {
|
| 406 | einstein_state *einstein = timer->machine->driver_data;
|
| 407 | |
| 408 | /* toggle line status */
|
| 409 | einstein->ctc_trigger ^= 1;
|
| 410 | |
| 411 | z80ctc_trg0_w(einstein->ctc, 0, einstein->ctc_trigger);
|
| 412 | z80ctc_trg1_w(einstein->ctc, 0, einstein->ctc_trigger);
|
| 413 | }
|
| 414 | |
| 415 | |
| 416 | /***************************************************************************
|
| 417 | UART
|
| 418 | ***************************************************************************/
|
| 419 | |
| 420 | static WRITE8_DEVICE_HANDLER( einstein_serial_transmit_clock )
|
| 421 | {
|
| 422 | const device_config *uart = devtag_get_device(device->machine, IC_I060);
|
| 423 | msm8251_transmit_clock(uart);
|
| 424 | }
|
| 425 | |
| 426 | static WRITE8_DEVICE_HANDLER( einstein_serial_receive_clock )
|
| 427 | {
|
| 428 | const device_config *uart = devtag_get_device(device->machine, IC_I060);
|
| 429 | msm8251_receive_clock(uart);
|
| 430 | }
|
| 431 | |
| 432 | |
| 433 | /***************************************************************************
|
| 434 | MEMORY BANKING
|
| 435 | ***************************************************************************/
|
| 436 | |
| 437 | static void einstein_page_rom(running_machine *machine)
|
| 438 | {
|
| 439 | einstein_state *einstein = machine->driver_data;
|
| 440 | memory_set_bankptr(machine, 1, einstein->rom_enabled ? memory_region(machine, "bios") : mess_ram);
|
| 441 | }
|
| 442 | |
| 443 | /* writing to this port is a simple trigger, and switches between RAM and ROM */
|
| 444 | static WRITE8_HANDLER( einstein_rom_w )
|
| 445 | {
|
| 446 | einstein_state *einstein = space->machine->driver_data;
|
| 447 | einstein->rom_enabled ^= 1;
|
| 448 | einstein_page_rom(space->machine);
|
| 449 | }
|
| 450 | |
| 451 | |
| 452 | /***************************************************************************
|
| 453 | INTERRUPTS
|
| 454 | ***************************************************************************/
|
| 455 | |
| 456 | static READ8_HANDLER( einstein_kybintmsk_r )
|
| 457 | {
|
| 458 | const device_config *printer = devtag_get_device(space->machine, "centronics");
|
| 459 | einstein_state *einstein = space->machine->driver_data;
|
| 460 | UINT8 data = 0;
|
| 461 | |
| 462 | /* clear key int. a read of this I/O port will do this or a reset */
|
| 463 | einstein->interrupt &= ~EINSTEIN_KEY_INT;
|
| 464 | |
| 465 | /* bit 0 and 1: fire buttons on the joysticks */
|
| 466 | data |= input_port_read(space->machine, "BUTTONS");
|
| 467 | |
| 468 | /* bit 2 to 4: printer status */
|
| 469 | data |= centronics_busy_r(printer) << 2;
|
| 470 | data |= centronics_pe_r(printer) << 3;
|
| 471 | data |= centronics_fault_r(printer) << 4;
|
| 472 | |
| 473 | /* bit 5 to 7: graph, control and shift key */
|
| 474 | data |= input_port_read(space->machine, "EXTRA");
|
| 475 | |
| 476 | logerror("%s: einstein_kybintmsk_r %02x\n", cpuexec_describe_context(space->machine), data);
|
| 477 | |
| 478 | return data;
|
| 479 | }
|
| 480 | |
| 481 | static WRITE8_HANDLER( einstein_kybintmsk_w )
|
| 482 | {
|
| 483 | einstein_state *einstein = space->machine->driver_data;
|
| 484 | |
| 485 | logerror("%s: einstein_kybintmsk_w %02x\n", cpuexec_describe_context(space->machine), data);
|
| 486 | |
| 487 | /* set mask from bit 0 */
|
| 488 | if (data & 0x01)
|
| 489 | {
|
| 490 | logerror("key int is disabled\n");
|
| 491 | einstein->interrupt_mask &= ~EINSTEIN_KEY_INT;
|
| 492 | }
|
| 493 | else
|
| 494 | {
|
| 495 | logerror("key int is enabled\n");
|
| 496 | einstein->interrupt_mask |= EINSTEIN_KEY_INT;
|
| 497 | }
|
| 498 | }
|
| 499 | |
| 500 | /* writing to this I/O port sets the state of the mask; D0 is used */
|
| 501 | /* writing 0 enables the /ADC interrupt */
|
| 502 | static WRITE8_HANDLER( einstein_adcintmsk_w )
|
| 503 | {
|
| 504 | einstein_state *einstein = space->machine->driver_data;
|
| 505 | |
| 506 | logerror("%s: einstein_adcintmsk_w %02x\n", cpuexec_describe_context(space->machine), data);
|
| 507 | |
| 508 | if (data & 0x01)
|
| 509 | {
|
| 510 | logerror("adc int is disabled\n");
|
| 511 | einstein->interrupt_mask &= ~EINSTEIN_ADC_INT;
|
| 512 | }
|
| 513 | else
|
| 514 | {
|
| 515 | logerror("adc int is enabled\n");
|
| 516 | einstein->interrupt_mask |= EINSTEIN_ADC_INT;
|
| 517 | }
|
| 518 | }
|
| 519 | |
| 520 | /* writing to this I/O port sets the state of the mask; D0 is used */
|
| 521 | /* writing 0 enables the /FIRE interrupt */
|
| 522 | static WRITE8_HANDLER( einstein_fire_int_w )
|
| 523 | {
|
| 524 | einstein_state *einstein = space->machine->driver_data;
|
| 525 | |
| 526 | logerror("%s: einstein_fire_int_w %02x\n", cpuexec_describe_context(space->machine), data);
|
| 527 | |
| 528 | if (data & 0x01)
|
| 529 | {
|
| 530 | logerror("fire int is disabled\n");
|
| 531 | einstein->interrupt_mask &= ~EINSTEIN_FIRE_INT;
|
| 532 | }
|
| 533 | else
|
| 534 | {
|
| 535 | logerror("fire int is enabled\n");
|
| 536 | einstein->interrupt_mask |= EINSTEIN_FIRE_INT;
|
| 537 | }
|
| 538 | }
|
| 539 | |
| 540 | |
| 541 | /***************************************************************************
|
| 542 | MACHINE EMULATION
|
| 543 | ***************************************************************************/
|
| 544 | |
| 545 | static const TMS9928a_interface tms9928a_interface =
|
| 546 | {
|
| 547 | TMS9929A,
|
| 548 | 0x4000, /* 16k RAM, provided by IC i040 and i041 */
|
| 549 | 0, 0,
|
| 550 | NULL
|
| 551 | };
|
| 552 | |
| 553 | static MACHINE_START( einstein )
|
| 554 | {
|
| 555 | TMS9928A_configure(&tms9928a_interface);
|
| 556 | }
|
| 557 | |
| 558 | static MACHINE_RESET( einstein )
|
| 559 | {
|
| 560 | einstein_state *einstein = machine->driver_data;
|
| 561 | |
| 562 | /* save pointers to our devices */
|
| 563 | einstein->color_screen = devtag_get_device(machine, "screen");
|
| 564 | einstein->ctc = devtag_get_device(machine, IC_I058);
|
| 565 | |
| 566 | /* initialize memory mapping */
|
| 567 | memory_set_bankptr(machine, 2, mess_ram);
|
| 568 | memory_set_bankptr(machine, 3, mess_ram + 0x8000);
|
| 569 | einstein->rom_enabled = 1;
|
| 570 | einstein_page_rom(machine);
|
| 571 | |
| 572 | TMS9928A_reset();
|
| 573 | |
| 574 | /* a reset causes the fire int, adc int, keyboard int mask
|
| 575 | to be set to 1, which causes all these to be DISABLED */
|
| 576 | einstein->interrupt = 0;
|
| 577 | einstein->interrupt_mask = 0;
|
| 578 | |
| 579 | floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
|
| 580 | |
| 581 | einstein->ctc_trigger = 0;
|
| 582 | }
|
| 583 | |
| 584 | static MACHINE_RESET( einstein2 )
|
| 585 | {
|
| 586 | einstein_state *einstein = machine->driver_data;
|
| 587 | |
| 588 | /* call standard initialization first */
|
| 589 | MACHINE_RESET_CALL(einstein);
|
| 590 | |
| 591 | /* get 80 column specific devices */
|
| 592 | einstein->mc6845 = devtag_get_device(machine, "crtc");
|
| 593 | einstein->crtc_screen = devtag_get_device(machine, "80column");
|
| 594 | |
| 595 | /* 80 column card palette */
|
| 596 | palette_set_color(machine, TMS9928A_PALETTE_SIZE, RGB_BLACK);
|
| 597 | palette_set_color(machine, TMS9928A_PALETTE_SIZE + 1, MAKE_RGB(0, 224, 0));
|
| 598 | |
| 599 | einstein->crtc_ram = auto_alloc_array(machine, UINT8, 2048);
|
| 600 | }
|
| 601 | |
| 602 | |
| 603 | /***************************************************************************
|
| 604 | VIDEO EMULATION
|
| 605 | ***************************************************************************/
|
| 606 | |
| 607 | static VIDEO_UPDATE( einstein2 )
|
| 608 | {
|
| 609 | einstein_state *einstein = screen->machine->driver_data;
|
| 610 | |
| 611 | if (screen == einstein->color_screen)
|
| 612 | VIDEO_UPDATE_CALL(tms9928a);
|
| 613 | else if (screen == einstein->crtc_screen)
|
| 614 | mc6845_update(einstein->mc6845, bitmap, cliprect);
|
| 615 | else
|
| 616 | fatalerror("Unknown screen '%s'\n", screen->tag);
|
| 617 | |
| 618 | return 0;
|
| 619 | }
|
| 620 | |
| 621 | |
| 622 | /***************************************************************************
|
| 623 | ADDRESS MAPS
|
| 624 | ***************************************************************************/
|
| 625 | |
| 626 | static ADDRESS_MAP_START( einstein_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 627 | AM_RANGE(0x0000, 0x07fff) AM_READWRITE(SMH_BANK(1), SMH_BANK(2))
|
| 628 | AM_RANGE(0x8000, 0x0ffff) AM_RAMBANK(3)
|
| 629 | ADDRESS_MAP_END
|
| 630 | |
| 631 | /* The I/O ports are decoded into 8 blocks using address lines A3 to A7 */
|
| 632 | static ADDRESS_MAP_START( einstein_io, ADDRESS_SPACE_IO, 8 )
|
| 633 | /* block 0, ay8910 psg */
|
| 634 | AM_RANGE(0x02, 0x02) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I030, ay8910_r, ay8910_address_w)
|
| 635 | AM_RANGE(0x03, 0x03) AM_MIRROR(0xff04) AM_DEVWRITE(IC_I030, ay8910_data_w)
|
| 636 | /* block 1, tms9928a vdp */
|
| 637 | AM_RANGE(0x08, 0x08) AM_MIRROR(0xff06) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
|
| 638 | AM_RANGE(0x09, 0x09) AM_MIRROR(0xff06) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
|
| 639 | /* block 2, msm8251 uart */
|
| 640 | AM_RANGE(0x10, 0x10) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, msm8251_data_r, msm8251_data_w)
|
| 641 | AM_RANGE(0x11, 0x11) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, msm8251_status_r, msm8251_control_w)
|
| 642 | /* block 3, wd1770 floppy controller */
|
| 643 | AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I042, wd17xx_r, wd17xx_w)
|
| 644 | /* block 4, internal controls */
|
| 645 | AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_READWRITE(einstein_kybintmsk_r, einstein_kybintmsk_w)
|
| 646 | AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_WRITE(einstein_adcintmsk_w)
|
| 647 | AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_DEVWRITE(IC_I042, einstein_drsel_w)
|
| 648 | AM_RANGE(0x24, 0x24) AM_MIRROR(0xff00) AM_WRITE(einstein_rom_w)
|
| 649 | AM_RANGE(0x25, 0x25) AM_MIRROR(0xff00) AM_WRITE(einstein_fire_int_w)
|
| 650 | /* block 5, z80ctc */
|
| 651 | AM_RANGE(0x28, 0x2b) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I058, z80ctc_r, z80ctc_w)
|
| 652 | /* block 6, z80pio */
|
| 653 | AM_RANGE(0x30, 0x33) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I063, z80pio_r, z80pio_w)
|
| 654 | #if 0
|
| 655 | /* block 7, adc */
|
| 656 | AM_RANGE(0x38, 0x38) AM_MIRROR(0xff07) AM_DEVREADWRITE(IC_I050, adc0844_r, adc0844_w)
|
| 657 | #endif
|
| 658 | ADDRESS_MAP_END
|
| 659 | |
| 660 | static ADDRESS_MAP_START( einstein2_io, ADDRESS_SPACE_IO, 8 )
|
| 661 | AM_IMPORT_FROM(einstein_io)
|
| 662 | AM_RANGE(0x40, 0x47) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(einstein_80col_ram_r, einstein_80col_ram_w)
|
| 663 | AM_RANGE(0x48, 0x48) AM_MIRROR(0xff00) AM_DEVWRITE("crtc", mc6845_address_w)
|
| 664 | AM_RANGE(0x49, 0x49) AM_MIRROR(0xff00) AM_DEVWRITE("crtc", mc6845_register_w)
|
| 665 | AM_RANGE(0x4c, 0x4c) AM_MIRROR(0xff00) AM_READ(einstein_80col_state_r)
|
| 666 | ADDRESS_MAP_END
|
| 667 | |
| 668 | |
| 669 | /***************************************************************************
|
| 670 | INPUT PORTS
|
| 671 | ***************************************************************************/
|
| 672 | |
| 673 | static INPUT_PORTS_START( einstein )
|
| 674 | PORT_START("LINE0")
|
| 675 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT)
|
| 676 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD)
|
| 677 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1)
|
| 678 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD)
|
| 679 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK)
|
| 680 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
|
| 681 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
| 682 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
| 683 | |
| 684 | PORT_START("LINE1")
|
| 685 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
|
| 686 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
|
| 687 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
|
| 688 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
|
| 689 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\xA3')
|
| 690 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
|
| 691 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xBA') PORT_CHAR('\xBD') // is \xBA correct for double vertical bar || ?
|
| 692 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@')
|
| 693 | |
| 694 | PORT_START("LINE2")
|
| 695 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
|
| 696 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
|
| 697 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+')
|
| 698 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
|
| 699 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
| 700 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
|
| 701 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
|
| 702 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F5))
|
| 703 | |
| 704 | PORT_START("LINE3")
|
| 705 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
|
| 706 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
|
| 707 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
|
| 708 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
|
| 709 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
|
| 710 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-')
|
| 711 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
|
| 712 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F4))
|
| 713 | |
| 714 | PORT_START("LINE4")
|
| 715 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
|
| 716 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
|
| 717 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
|
| 718 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
|
| 719 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
|
| 720 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
|
| 721 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
|
| 722 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F3))
|
| 723 | |
| 724 | PORT_START("LINE5")
|
| 725 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
|
| 726 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
|
| 727 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
|
| 728 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
|
| 729 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
|
| 730 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
|
| 731 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
|
| 732 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F2))
|
| 733 | |
| 734 | PORT_START("LINE6")
|
| 735 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
|
| 736 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
|
| 737 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
|
| 738 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
|
| 739 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
|
| 740 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
|
| 741 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
|
| 742 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F1))
|
| 743 | |
| 744 | PORT_START("LINE7")
|
| 745 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
|
| 746 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
|
| 747 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
|
| 748 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
|
| 749 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
|
| 750 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
|
| 751 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
|
| 752 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F6))
|
| 753 | |
| 754 | PORT_START("EXTRA")
|
| 755 | PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED)
|
| 756 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_F8)
|
| 757 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
|
| 758 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
| 759 | |
| 760 | /* fire buttons for analogue joysticks */
|
| 761 | PORT_START("BUTTONS")
|
| 762 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1") PORT_PLAYER(1)
|
| 763 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_PLAYER(2)
|
| 764 | PORT_BIT(0xfc, IP_ACTIVE_HIGH, IPT_UNUSED)
|
| 765 | |
| 766 | /* analog joystick 1 x axis */
|
| 767 | PORT_START("JOY1_X")
|
| 768 | PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_REVERSE
|
| 769 | |
| 770 | /* analog joystick 1 y axis */
|
| 771 | PORT_START("JOY1_Y")
|
| 772 | PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_REVERSE
|
| 773 | |
| 774 | /* analog joystick 2 x axis */
|
| 775 | PORT_START("JOY2_X")
|
| 776 | PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_REVERSE
|
| 777 | |
| 778 | /* analog joystick 2 Y axis */
|
| 779 | PORT_START("JOY2_Y")
|
| 780 | PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE
|
| 781 | INPUT_PORTS_END
|
| 782 | |
| 783 | INPUT_PORTS_START( einstein_80col )
|
| 784 | PORT_INCLUDE(einstein)
|
| 785 | |
| 786 | /* dip switches on the 80 column card */
|
| 787 | PORT_START("80column_dips")
|
| 788 | PORT_DIPNAME(0x02, 0x00, "Startup mode")
|
| 789 | PORT_DIPSETTING(0x00, "40 column")
|
| 790 | PORT_DIPSETTING(0x02, "80 column")
|
| 791 | PORT_DIPNAME(0x04, 0x00, "50/60Hz")
|
| 792 | PORT_DIPSETTING(0x00, "50Hz")
|
| 793 | PORT_DIPSETTING(0x04, "60Hz")
|
| 794 | INPUT_PORTS_END
|
| 795 | |
| 796 | |
| 797 | /***************************************************************************
|
| 798 | MACHINE DRIVERS
|
| 799 | ***************************************************************************/
|
| 800 | |
| 801 | static const z80ctc_interface einstein_ctc_intf =
|
| 802 | {
|
| 803 | 0,
|
| 804 | 0,
|
| 805 | einstein_serial_transmit_clock,
|
| 806 | einstein_serial_receive_clock,
|
| 807 | z80ctc_trg3_w
|
| 808 | };
|
| 809 | |
| 810 | |
| 811 | static const z80pio_interface einstein_pio_intf =
|
| 812 | {
|
| 813 | DEVCB_NULL,
|
| 814 | DEVCB_NULL,
|
| 815 | DEVCB_NULL,
|
| 816 | DEVCB_DEVICE_HANDLER("centronics", centronics_data_w),
|
| 817 | DEVCB_NULL,
|
| 818 | DEVCB_DEVICE_LINE("centronics", centronics_strobe_w),
|
| 819 | DEVCB_NULL
|
| 820 | };
|
| 821 | |
| 822 | static const ay8910_interface einstein_ay_interface =
|
| 823 | {
|
| 824 | AY8910_LEGACY_OUTPUT,
|
| 825 | AY8910_DEFAULT_LOADS,
|
| 826 | DEVCB_NULL,
|
| 827 | DEVCB_MEMORY_HANDLER(IC_I001, PROGRAM, einstein_keyboard_data_read),
|
| 828 | DEVCB_MEMORY_HANDLER(IC_I001, PROGRAM, einstein_keyboard_line_write),
|
| 829 | DEVCB_NULL
|
| 830 | };
|
| 831 | |
| 832 | static const centronics_interface einstein_centronics_config =
|
| 833 | {
|
| 834 | FALSE,
|
| 835 | DEVCB_DEVICE_LINE(IC_I063, z80pio_astb_w),
|
| 836 | DEVCB_NULL,
|
| 837 | DEVCB_NULL
|
| 838 | };
|
| 839 | |
| 840 | static const mc6845_interface einstein_crtc6845_interface =
|
| 841 | {
|
| 842 | "80column",
|
| 843 | 8,
|
| 844 | NULL,
|
| 845 | einstein_6845_update_row,
|
| 846 | NULL,
|
| 847 | DEVCB_NULL,
|
| 848 | DEVCB_NULL,
|
| 849 | DEVCB_NULL,
|
| 850 | DEVCB_NULL,
|
| 851 | NULL
|
| 852 | };
|
| 853 | |
| 854 | |
| 855 | static MACHINE_DRIVER_START( einstein )
|
| 856 | /* basic machine hardware */
|
| 857 | MDRV_CPU_ADD(IC_I001, Z80, XTAL_X002 / 2)
|
| 858 | MDRV_CPU_PROGRAM_MAP(einstein_mem)
|
| 859 | MDRV_CPU_IO_MAP(einstein_io)
|
| 860 | MDRV_CPU_CONFIG(einstein_daisy_chain)
|
| 861 | |
| 862 | MDRV_DRIVER_DATA(einstein_state)
|
| 863 | |
| 864 | MDRV_MACHINE_START(einstein)
|
| 865 | MDRV_MACHINE_RESET(einstein)
|
| 866 | |
| 867 | /* this is actually clocked at the system clock 4 MHz, but this would be too fast for our
|
| 868 | driver. So we update at 50Hz and hope this is good enough. */
|
| 869 | MDRV_TIMER_ADD_PERIODIC("keyboard", einstein_keyboard_timer_callback, HZ(50))
|
| 870 | |
| 871 | MDRV_Z80PIO_ADD(IC_I063, einstein_pio_intf)
|
| 872 | |
| 873 | MDRV_Z80CTC_ADD(IC_I058, XTAL_X002 / 2, einstein_ctc_intf)
|
| 874 | /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */
|
| 875 | MDRV_TIMER_ADD_PERIODIC("ctc", einstein_ctc_trigger_callback, HZ(XTAL_X002 /4))
|
| 876 | |
| 877 | /* Einstein daisy chain support for non-Z80 devices */
|
| 878 | MDRV_DEVICE_ADD("keyboard_daisy", DEVICE_GET_INFO_NAME(einstein_keyboard_daisy), 0)
|
| 879 | MDRV_DEVICE_ADD("adc_daisy", DEVICE_GET_INFO_NAME(einstein_adc_daisy), 0)
|
| 880 | MDRV_DEVICE_ADD("fire_daisy", DEVICE_GET_INFO_NAME(einstein_fire_daisy), 0)
|
| 881 | |
| 882 | /* video hardware */
|
| 883 | MDRV_IMPORT_FROM(tms9928a)
|
| 884 | MDRV_SCREEN_MODIFY("screen")
|
| 885 | MDRV_SCREEN_REFRESH_RATE(50)
|
| 886 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 887 | |
| 888 | /* sound hardware */
|
| 889 | MDRV_SPEAKER_STANDARD_MONO("mono")
|
| 890 | MDRV_SOUND_ADD(IC_I030, AY8910, XTAL_X002 / 4)
|
| 891 | MDRV_SOUND_CONFIG(einstein_ay_interface)
|
| 892 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
|
| 893 | |
| 894 | /* printer */
|
| 895 | MDRV_CENTRONICS_ADD("centronics", einstein_centronics_config)
|
| 896 | |
| 897 | /* uart */
|
| 898 | MDRV_MSM8251_ADD(IC_I060, default_msm8251_interface)
|
| 899 | |
| 900 | MDRV_WD1770_ADD(IC_I042, default_wd17xx_interface)
|
| 901 | MACHINE_DRIVER_END
|
| 902 | |
| 903 | |
| 904 | static MACHINE_DRIVER_START( einstei2 )
|
| 905 | MDRV_IMPORT_FROM( einstein )
|
| 906 | |
| 907 | MDRV_CPU_MODIFY(IC_I001)
|
| 908 | MDRV_CPU_IO_MAP(einstein2_io)
|
| 909 | MDRV_MACHINE_RESET(einstein2)
|
| 910 | |
| 911 | /* video hardware */
|
| 912 | MDRV_DEFAULT_LAYOUT(layout_einstei2)
|
| 913 | |
| 914 | MDRV_SCREEN_ADD("80column", RASTER)
|
| 915 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 916 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 917 | MDRV_SCREEN_SIZE(640, 400)
|
| 918 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
|
| 919 | MDRV_SCREEN_REFRESH_RATE(50)
|
| 920 | |
| 921 | /* 2 additional colors for the 80 column screen */
|
| 922 | MDRV_PALETTE_LENGTH(TMS9928A_PALETTE_SIZE + 2)
|
| 923 | |
| 924 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_X002 / 4, einstein_crtc6845_interface)
|
| 925 | |
| 926 | MDRV_VIDEO_UPDATE(einstein2)
|
| 927 | MACHINE_DRIVER_END
|
| 928 | |
| 929 | |
| 930 | /***************************************************************************
|
| 931 | ROM DEFINITIONS
|
| 932 | ***************************************************************************/
|
| 933 | |
| 934 | /* There are two sockets, i023 and i024, each either a 2764 or 27128
|
| 935 | * only i023 is used by default and fitted with the 8k bios (called MOS).
|
| 936 | *
|
| 937 | * We are missing dumps of version MOS 1.1, possibly of 1.0 if it exists.
|
| 938 | */
|
| 939 | ROM_START( einstein )
|
| 940 | ROM_REGION(0x8000, "bios", 0)
|
| 941 | /* i023 */
|
| 942 | ROM_SYSTEM_BIOS(0, "mos12", "MOS 1.2")
|
| 943 | ROMX_LOAD("mos12.i023", 0, 0x2000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77), ROM_BIOS(1))
|
| 944 | ROM_SYSTEM_BIOS(1, "mos121", "MOS 1.21")
|
| 945 | ROMX_LOAD("mos121.i023", 0, 0x2000, CRC(a746eeb6) SHA1(f75aaaa777d0fd92225acba291f6bf428b341d3e), ROM_BIOS(2))
|
| 946 | ROM_RELOAD(0x2000, 0x2000)
|
| 947 | /* i024 */
|
| 948 | ROM_FILL(0x4000, 0x4000, 0xff)
|
| 949 | ROM_END
|
| 950 | |
| 951 | ROM_START( einstei2 )
|
| 952 | ROM_REGION(0x8000, "bios", 0)
|
| 953 | /* i023 */
|
| 954 | ROM_SYSTEM_BIOS(0, "mos12", "MOS 1.2")
|
| 955 | ROMX_LOAD("mos12.i023", 0, 0x2000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77), ROM_BIOS(1))
|
| 956 | ROM_SYSTEM_BIOS(1, "mos121", "MOS 1.21")
|
| 957 | ROMX_LOAD("mos121.i023", 0, 0x2000, CRC(a746eeb6) SHA1(f75aaaa777d0fd92225acba291f6bf428b341d3e), ROM_BIOS(2))
|
| 958 | ROM_RELOAD(0x2000, 0x2000)
|
| 959 | /* i024 */
|
| 960 | ROM_FILL(0x4000, 0x4000, 0xff)
|
| 961 | |
| 962 | /* character rom from 80 column card */
|
| 963 | ROM_REGION(0x800, "gfx1", 0)
|
| 964 | ROM_LOAD("charrom.rom", 0, 0x800, NO_DUMP)
|
| 965 | ROM_END
|
| 966 | |
| 967 | |
| 968 | /***************************************************************************
|
| 969 | SYSTEM CONFIG
|
| 970 | ***************************************************************************/
|
| 971 | |
| 972 | static void einstein_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
|
| 973 | {
|
| 974 | /* floppy */
|
| 975 | switch(state)
|
| 976 | {
|
| 977 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 978 | case MESS_DEVINFO_INT_COUNT: info->i = 4; break;
|
| 979 | |
| 980 | default: legacydsk_device_getinfo(devclass, state, info); break;
|
| 981 | }
|
| 982 | }
|
| 983 | |
| 984 | static SYSTEM_CONFIG_START( einstein )
|
| 985 | /* RAM is provided by 8k DRAM ICs i009, i010, i011, i012, i013, i014, i015 and i016 */
|
| 986 | CONFIG_RAM_DEFAULT(8 * 8 * 1024)
|
| 987 | CONFIG_DEVICE(einstein_floppy_getinfo)
|
| 988 | SYSTEM_CONFIG_END
|
| 989 | |
| 990 | |
| 991 | /***************************************************************************
|
| 992 | GAME DRIVERS
|
| 993 | ***************************************************************************/
|
| 994 | |
| 995 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG, COMPANY FULLNAME FLAGS */
|
| 996 | COMP( 1984, einstein, 0, 0, einstein, einstein, 0, einstein, "Tatung", "Einstein TC-01", 0 )
|
| 997 | COMP( 1984, einstei2, einstein, 0, einstei2, einstein_80col, 0, einstein, "Tatung", "Einstein TC-01 + 80 column device", 0 )
|