src/mess/machine/mtx.c
| r4312 | r4313 | |
| 7 | 7 | **************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | | /* Core includes */ |
| 11 | 10 | #include "driver.h" |
| 12 | 11 | #include "includes/mtx.h" |
| 13 | | |
| 14 | | /* Components */ |
| 15 | 12 | #include "cpu/z80/z80.h" |
| 16 | 13 | #include "machine/z80ctc.h" |
| 17 | 14 | #include "machine/z80dart.h" |
| 18 | 15 | #include "video/tms9928a.h" |
| 19 | | |
| 20 | | /* Devices */ |
| 21 | | #include "devices/printer.h" |
| 16 | #include "machine/ctronics.h" |
| 22 | 17 | #include "devices/snapquik.h" |
| 23 | 18 | |
| 24 | 19 | |
| 25 | | #define MTX_PRT_BUSY 1 |
| 26 | | #define MTX_PRT_NOERROR 2 |
| 27 | | #define MTX_PRT_EMPTY 4 |
| 28 | | #define MTX_PRT_SELECTED 8 |
| 29 | 20 | |
| 30 | | |
| 31 | | |
| 32 | 21 | /************************************* |
| 33 | 22 | * |
| 34 | 23 | * Global variables |
| r4312 | r4313 | |
| 37 | 26 | |
| 38 | 27 | static UINT8 key_sense; |
| 39 | 28 | |
| 40 | | static char mtx_prt_strobe = 0; |
| 41 | | static char mtx_prt_data = 0; |
| 42 | 29 | |
| 43 | 30 | |
| 44 | | |
| 45 | 31 | /************************************* |
| 46 | 32 | * |
| 47 | 33 | * TMS9929A video chip |
| r4312 | r4313 | |
| 126 | 112 | * |
| 127 | 113 | *************************************/ |
| 128 | 114 | |
| 129 | | static const device_config *mtx_printer_image(running_machine *machine) |
| 130 | | { |
| 131 | | return devtag_get_device(machine, PRINTER, "printer"); |
| 132 | | } |
| 133 | | |
| 134 | 115 | READ8_HANDLER( mtx_strobe_r ) |
| 135 | 116 | { |
| 136 | | if (mtx_prt_strobe == 0) |
| 137 | | printer_output(mtx_printer_image(space->machine), mtx_prt_data); |
| 117 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 138 | 118 | |
| 139 | | mtx_prt_strobe = 1; |
| 119 | /* set STROBE low */ |
| 120 | centronics_strobe_w(printer, FALSE); |
| 140 | 121 | |
| 141 | | return 0; |
| 122 | return 0xff; |
| 142 | 123 | } |
| 143 | 124 | |
| 144 | 125 | |
| 145 | 126 | READ8_HANDLER( mtx_prt_r ) |
| 146 | 127 | { |
| 147 | | mtx_prt_strobe = 0; |
| 128 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 129 | UINT8 result = 0; |
| 148 | 130 | |
| 149 | | return MTX_PRT_NOERROR | (printer_is_ready(mtx_printer_image(space->machine)) |
| 150 | | ? MTX_PRT_SELECTED : 0); |
| 151 | | } |
| 131 | /* reset STROBE to high */ |
| 132 | centronics_strobe_w(printer, TRUE); |
| 152 | 133 | |
| 153 | | WRITE8_HANDLER( mtx_prt_w ) |
| 154 | | { |
| 155 | | mtx_prt_data = data; |
| 134 | /* fill in centronics printer status */ |
| 135 | result |= centronics_busy_r(printer) << 0; |
| 136 | result |= centronics_fault_r(printer) << 1; |
| 137 | result |= !centronics_pe_r(printer) << 2; |
| 138 | result |= centronics_vcc_r(printer) << 3; |
| 139 | |
| 140 | return result; |
| 156 | 141 | } |
| 157 | 142 | |
| 158 | 143 | |
| 159 | 144 | |
| 145 | |
| 160 | 146 | /************************************* |
| 161 | 147 | * |
| 162 | 148 | * Keyboard |
src/mess/drivers/mtx.c
| r4312 | r4313 | |
| 16 | 16 | **************************************************************************/ |
| 17 | 17 | |
| 18 | 18 | |
| 19 | | /* Core includes */ |
| 20 | 19 | #include "driver.h" |
| 21 | 20 | #include "includes/mtx.h" |
| 22 | | |
| 23 | | /* Components */ |
| 24 | 21 | #include "cpu/z80/z80.h" |
| 25 | 22 | #include "cpu/z80/z80daisy.h" |
| 26 | 23 | #include "machine/z80ctc.h" |
| 27 | 24 | #include "video/tms9928a.h" |
| 28 | 25 | #include "sound/sn76496.h" |
| 29 | | |
| 30 | | /* Devices */ |
| 31 | | #include "devices/printer.h" |
| 26 | #include "machine/ctronics.h" |
| 32 | 27 | #include "devices/snapquik.h" |
| 33 | 28 | |
| 34 | 29 | |
| r4312 | r4313 | |
| 64 | 59 | AM_RANGE(0x01, 0x01) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w) |
| 65 | 60 | AM_RANGE(0x02, 0x02) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w) |
| 66 | 61 | AM_RANGE(0x03, 0x03) AM_READWRITE(mtx_cst_r, mtx_cst_w) |
| 67 | | AM_RANGE(0x04, 0x04) AM_READWRITE(mtx_prt_r, mtx_prt_w) |
| 62 | AM_RANGE(0x04, 0x04) AM_READ(mtx_prt_r) AM_DEVWRITE(CENTRONICS, "centronics", centronics_data_w) |
| 68 | 63 | AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w) |
| 69 | 64 | AM_RANGE(0x06, 0x06) AM_READ(mtx_key_hi_r) |
| 70 | 65 | AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "sn76489a", sn76496_w) |
| r4312 | r4313 | |
| 273 | 268 | MDRV_TIMER_ADD_PERIODIC("z80ctc_c1c2", ctc_c1_c2_tick, HZ(4000000/13)) |
| 274 | 269 | |
| 275 | 270 | /* printer */ |
| 276 | | MDRV_PRINTER_ADD("printer") |
| 271 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 277 | 272 | |
| 278 | 273 | /* snapshot */ |
| 279 | 274 | MDRV_SNAPSHOT_ADD(mtx, "mtb", 0.5) |