src/mess/machine/thomson.c
| r2379 | r2380 | |
| 18 | 18 | #include "audio/mea8000.h" |
| 19 | 19 | #include "devices/cartslot.h" |
| 20 | 20 | #include "machine/centroni.h" |
| 21 | #include "devices/printer.h" |
| 21 | 22 | #include "includes/serial.h" |
| 22 | 23 | #include "devices/cassette.h" |
| 23 | 24 | #include "formats/thom_cas.h" |
| r2379 | r2380 | |
| 523 | 524 | TO7_IO_RS232 |
| 524 | 525 | } to7_io_dev; |
| 525 | 526 | |
| 527 | static const device_config *printer_device(running_machine *machine) |
| 528 | { |
| 529 | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer"); |
| 530 | } |
| 526 | 531 | |
| 527 | | |
| 528 | 532 | /* test whether a parallel or a serial device is connected: both cannot |
| 529 | 533 | be exploited at the same time! |
| 530 | 534 | */ |
| 531 | | static to7_io_dev to7_io_mode( void ) |
| 535 | static to7_io_dev to7_io_mode( running_machine *machine ) |
| 532 | 536 | { |
| 533 | | if ( image_exists( image_from_devtype_and_index( IO_PRINTER, 0 ) ) ) |
| 537 | if ( printer_is_ready(printer_device(machine) ) ) |
| 534 | 538 | return TO7_IO_CENTRONICS; |
| 535 | 539 | else if ( image_exists( image_from_devtype_and_index( IO_SERIAL, THOM_SERIAL_CC90323 ) ) ) |
| 536 | | return TO7_IO_CENTRONICS; |
| 540 | return TO7_IO_RS232; |
| 537 | 541 | return TO7_IO_NONE; |
| 538 | 542 | } |
| 539 | 543 | |
| r2379 | r2380 | |
| 572 | 576 | int dsr = ( to7_io_line.input_state & SERIAL_STATE_DSR ) ? 0 : 1; |
| 573 | 577 | int rd = get_in_data_bit( to7_io_line.input_state ); |
| 574 | 578 | |
| 575 | | if ( to7_io_mode() == TO7_IO_RS232 ) |
| 579 | if ( to7_io_mode(machine) == TO7_IO_RS232 ) |
| 576 | 580 | cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1; |
| 577 | 581 | else |
| 578 | 582 | cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0; |
| 579 | 583 | |
| 580 | | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_io_mode(), cts, dsr, rd )); |
| 584 | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_io_mode(machine), cts, dsr, rd )); |
| 581 | 585 | |
| 582 | 586 | return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0); |
| 583 | 587 | } |