src/mess/drivers/sord.c
| r4268 | r4269 | |
| 23 | 23 | #include "sound/sn76496.h" |
| 24 | 24 | #include "cpu/z80/z80.h" |
| 25 | 25 | #include "cpu/z80/z80daisy.h" |
| 26 | | #include "machine/centroni.h" |
| 27 | | #include "devices/printer.h" |
| 26 | #include "machine/ctronics.h" |
| 28 | 27 | #include "machine/z80ctc.h" |
| 29 | 28 | #include "machine/z80sio.h" |
| 30 | 29 | #include "machine/8255ppi.h" |
| r4268 | r4269 | |
| 340 | 339 | |
| 341 | 340 | static READ8_HANDLER(sord_sys_r) |
| 342 | 341 | { |
| 343 | | unsigned char data; |
| 344 | | int printer_handshake; |
| 342 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 343 | UINT8 data = 0; |
| 345 | 344 | |
| 346 | | data = 0; |
| 347 | | |
| 348 | 345 | /* cassette read */ |
| 349 | 346 | if (cassette_input(cassette_device_image(space->machine)) >=0) |
| 350 | 347 | data |=(1<<0); |
| 351 | 348 | |
| 352 | | printer_handshake = centronics_read_handshake(space->machine, 0); |
| 349 | data |= centronics_busy_r(printer) << 1; |
| 353 | 350 | |
| 354 | | /* if printer is not online, it is busy */ |
| 355 | | if ((printer_handshake & CENTRONICS_ONLINE)!=0) |
| 356 | | { |
| 357 | | data|=(1<<1); |
| 358 | | } |
| 359 | | |
| 360 | 351 | /* bit 7 must be 0 for saving and loading to work */ |
| 361 | 352 | |
| 362 | 353 | logerror("sys read: %02x\n",data); |
| r4268 | r4269 | |
| 374 | 365 | |
| 375 | 366 | static WRITE8_HANDLER(sord_sys_w) |
| 376 | 367 | { |
| 377 | | int handshake; |
| 368 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 378 | 369 | |
| 379 | | handshake = 0; |
| 380 | | if (data & (1<<0)) |
| 381 | | { |
| 382 | | handshake = CENTRONICS_STROBE; |
| 383 | | } |
| 384 | | |
| 385 | 370 | /* cassette remote */ |
| 386 | 371 | cassette_change_state( |
| 387 | 372 | cassette_device_image(space->machine), |
| r4268 | r4269 | |
| 391 | 376 | /* cassette data */ |
| 392 | 377 | cassette_output(cassette_device_image(space->machine), (data & (1<<0)) ? -1.0 : 1.0); |
| 393 | 378 | |
| 394 | | /* assumption: select is tied low */ |
| 395 | | centronics_write_handshake(space->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 396 | | centronics_write_handshake(space->machine, 0, handshake, CENTRONICS_STROBE); |
| 379 | centronics_strobe_w(printer, BIT(data, 0)); |
| 397 | 380 | |
| 398 | 381 | logerror("sys write: %02x\n",data); |
| 399 | 382 | } |
| 400 | 383 | |
| 401 | | static WRITE8_HANDLER(sord_printer_w) |
| 402 | | { |
| 403 | | // logerror("centronics w: %02x\n",data); |
| 404 | | centronics_write_data(space->machine, 0,data); |
| 405 | | } |
| 406 | 384 | |
| 407 | 385 | static ADDRESS_MAP_START( sord_m5_io , ADDRESS_SPACE_IO, 8) |
| 408 | 386 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| r4268 | r4269 | |
| 411 | 389 | AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w) |
| 412 | 390 | AM_RANGE(0x20, 0x2f) AM_WRITE( sn76496_0_w) |
| 413 | 391 | AM_RANGE(0x30, 0x3f) AM_READ(sord_keyboard_r) |
| 414 | | AM_RANGE(0x40, 0x40) AM_WRITE( sord_printer_w) |
| 392 | AM_RANGE(0x40, 0x40) AM_DEVWRITE(CENTRONICS, "centronics", centronics_data_w) |
| 415 | 393 | AM_RANGE(0x50, 0x50) AM_READWRITE(sord_sys_r, sord_sys_w) |
| 416 | 394 | ADDRESS_MAP_END |
| 417 | 395 | |
| r4268 | r4269 | |
| 422 | 400 | AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w) |
| 423 | 401 | AM_RANGE(0x20, 0x2f) AM_WRITE( sn76496_0_w) |
| 424 | 402 | AM_RANGE(0x30, 0x3f) AM_READ(sord_keyboard_r) |
| 425 | | AM_RANGE(0x40, 0x40) AM_WRITE( sord_printer_w) |
| 403 | AM_RANGE(0x40, 0x40) AM_DEVWRITE(CENTRONICS, "centronics", centronics_data_w) |
| 426 | 404 | AM_RANGE(0x50, 0x50) AM_READWRITE(sord_sys_r, sord_sys_w) |
| 427 | 405 | AM_RANGE(0x70, 0x73) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w) |
| 428 | 406 | ADDRESS_MAP_END |
| 429 | 407 | |
| 430 | 408 | |
| 431 | 409 | |
| 432 | | static const CENTRONICS_CONFIG sordm5_cent_config[1] = |
| 433 | | { |
| 434 | | { |
| 435 | | PRINTER_CENTRONICS, |
| 436 | | NULL |
| 437 | | }, |
| 438 | | }; |
| 439 | | |
| 440 | 410 | static void sordm5_video_interrupt_callback(running_machine *machine, int state) |
| 441 | 411 | { |
| 442 | 412 | if (state) |
| r4268 | r4269 | |
| 466 | 436 | |
| 467 | 437 | /* should be done in a special callback to work properly! */ |
| 468 | 438 | memory_set_bankptr(machine, 1, memory_region(machine, "user1")); |
| 469 | | |
| 470 | | centronics_config(machine, 0, sordm5_cent_config); |
| 471 | | /* assumption: select is tied low */ |
| 472 | | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 473 | 439 | } |
| 474 | 440 | |
| 475 | | /* 2008-05 FP: |
| 441 | /* 2008-05 FP: |
| 476 | 442 | Small note about natural keyboard: currently |
| 477 | 443 | - "Reset" is mapped to 'Esc' |
| 478 | 444 | - "Func" is mapped to 'F1' |
| r4268 | r4269 | |
| 644 | 610 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 645 | 611 | |
| 646 | 612 | /* printer */ |
| 647 | | MDRV_PRINTER_ADD("printer") |
| 613 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 648 | 614 | |
| 649 | 615 | MDRV_CASSETTE_ADD( "cassette", sordm5_cassette_config ) |
| 650 | | |
| 616 | |
| 651 | 617 | /* cartridge */ |
| 652 | 618 | MDRV_CARTSLOT_ADD("cart") |
| 653 | 619 | MDRV_CARTSLOT_EXTENSION_LIST("rom") |
| r4268 | r4269 | |
| 667 | 633 | |
| 668 | 634 | MDRV_QUANTUM_TIME(HZ(1200)) |
| 669 | 635 | MDRV_MACHINE_RESET( sord_m5_fd5 ) |
| 670 | | |
| 636 | |
| 671 | 637 | MDRV_NEC765A_ADD("nec765", sord_fd5_nec765_interface) |
| 672 | 638 | MACHINE_DRIVER_END |
| 673 | 639 | |