src/mess/machine/vtech1.c
| r4246 | r4247 | |
| 50 | 50 | #include "video/m6847.h" |
| 51 | 51 | #include "includes/vtech1.h" |
| 52 | 52 | #include "devices/cassette.h" |
| 53 | | #include "devices/printer.h" |
| 53 | #include "machine/ctronics.h" |
| 54 | 54 | #include "cpu/z80/z80.h" |
| 55 | 55 | #include "sound/speaker.h" |
| 56 | 56 | |
| r4246 | r4247 | |
| 483 | 483 | static int cassette_bit = 0; |
| 484 | 484 | int row, data = 0xff; |
| 485 | 485 | double level; |
| 486 | | static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", |
| 486 | static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", |
| 487 | 487 | "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" }; |
| 488 | 488 | |
| 489 | 489 | /* scan keyboard rows */ |
| 490 | | for (row = 0; row < 8; row++) |
| 490 | for (row = 0; row < 8; row++) |
| 491 | 491 | { |
| 492 | 492 | if (!(offset & (1 << row))) |
| 493 | 493 | data &= input_port_read(space->machine, keynames[row]); |
| r4246 | r4247 | |
| 543 | 543 | Printer Handling |
| 544 | 544 | ******************************************************************************/ |
| 545 | 545 | |
| 546 | | static const device_config *printer_device(running_machine *machine) |
| 547 | | { |
| 548 | | return devtag_get_device(machine, PRINTER, "printer"); |
| 549 | | } |
| 550 | | |
| 551 | 546 | /* |
| 552 | 547 | The VZ200/300 printer interface uses I/O port address OE Hex for the ASCII |
| 553 | 548 | character code data and strobe output, and address OOH for the busy/ready-bar |
| 554 | 549 | status input (bit 0). |
| 555 | 550 | */ |
| 556 | 551 | |
| 557 | | READ8_HANDLER(vtech1_printer_r) |
| 552 | READ8_HANDLER( vtech1_printer_r ) |
| 558 | 553 | { |
| 559 | | int data = 0xff; |
| 554 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 555 | UINT8 result = 0xff; |
| 560 | 556 | |
| 561 | | if (printer_is_ready(printer_device(space->machine))) |
| 562 | | data &= ~0x01; |
| 557 | result &= ~(!centronics_busy_r(printer)); |
| 563 | 558 | |
| 564 | | return data; |
| 559 | return result; |
| 565 | 560 | } |
| 566 | 561 | |
| 567 | | WRITE8_HANDLER(vtech1_printer_w) |
| 562 | WRITE8_HANDLER( vtech1_strobe_w ) |
| 568 | 563 | { |
| 569 | | static int prn_data; |
| 570 | | |
| 571 | | switch (offset) { |
| 572 | | case 0x0d: /* strobe data to printer */ |
| 573 | | printer_output(printer_device(space->machine), prn_data); |
| 574 | | break; |
| 575 | | case 0x0e: /* load output latch */ |
| 576 | | prn_data = data; |
| 577 | | break; |
| 578 | | default: |
| 579 | | logerror("vtech1_printer_w $%02x, unknown offset %02x\n", data, offset); |
| 580 | | } |
| 564 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 565 | centronics_strobe_w(printer, FALSE); |
| 581 | 566 | } |
| 582 | 567 | |
| 583 | 568 | |
src/mess/drivers/vtech1.c
| r4246 | r4247 | |
| 112 | 112 | #include "devices/cartslot.h" |
| 113 | 113 | #include "devices/snapquik.h" |
| 114 | 114 | #include "devices/cassette.h" |
| 115 | | #include "devices/printer.h" |
| 115 | #include "machine/ctronics.h" |
| 116 | 116 | #include "devices/z80bin.h" |
| 117 | 117 | #include "formats/vt_cas.h" |
| 118 | 118 | |
| r4246 | r4247 | |
| 153 | 153 | |
| 154 | 154 | static ADDRESS_MAP_START(vtech1_io, ADDRESS_SPACE_IO, 8) |
| 155 | 155 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 156 | | AM_RANGE(0x00, 0x0f) AM_READWRITE(vtech1_printer_r, vtech1_printer_w) |
| 156 | AM_RANGE(0x00, 0x00) AM_READ(vtech1_printer_r) |
| 157 | AM_RANGE(0x0d, 0x0d) AM_WRITE(vtech1_strobe_w) |
| 158 | AM_RANGE(0x0e, 0x0e) AM_DEVWRITE(CENTRONICS, "centronics", centronics_data_w) |
| 157 | 159 | AM_RANGE(0x10, 0x1f) AM_READWRITE(vtech1_fdc_r, vtech1_fdc_w) |
| 158 | 160 | AM_RANGE(0x20, 0x2f) AM_READ(vtech1_joystick_r) |
| 159 | 161 | AM_RANGE(0x30, 0x3f) AM_READWRITE(vtech1_serial_r, vtech1_serial_w) |
| r4246 | r4247 | |
| 309 | 311 | CASSETTE_PLAY |
| 310 | 312 | }; |
| 311 | 313 | |
| 314 | |
| 312 | 315 | static MACHINE_DRIVER_START(laser110) |
| 313 | 316 | /* basic machine hardware */ |
| 314 | 317 | MDRV_CPU_ADD("main", Z80, VTECH1_CLK) /* 3.57950 MHz */ |
| r4246 | r4247 | |
| 336 | 339 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 337 | 340 | |
| 338 | 341 | /* printer */ |
| 339 | | MDRV_PRINTER_ADD("printer") |
| 342 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 340 | 343 | |
| 341 | 344 | /* snapshot/quickload */ |
| 342 | 345 | MDRV_SNAPSHOT_ADD(vtech1, "vz", 1.5) |
| 343 | 346 | MDRV_Z80BIN_QUICKLOAD_ADD(vtech1, 1.5) |
| 344 | 347 | |
| 345 | 348 | MDRV_CASSETTE_ADD( "cassette", laser_cassette_config ) |
| 346 | | |
| 349 | |
| 347 | 350 | /* cartridge */ |
| 348 | 351 | MDRV_CARTSLOT_ADD("cart") |
| 349 | 352 | MDRV_CARTSLOT_EXTENSION_LIST("rom") |