trunk/src/emu/bus/centronics/digiblst.c
| r0 | r31748 | |
| 1 | /* |
| 2 | * digiblst.c |
| 3 | * |
| 4 | * Created on: 23/08/2014 |
| 5 | */ |
| 6 | |
| 7 | #include "emu.h" |
| 8 | #include "sound/dac.h" |
| 9 | #include "digiblst.h" |
| 10 | |
| 11 | //************************************************************************** |
| 12 | // COVOX DEVICE |
| 13 | //************************************************************************** |
| 14 | |
| 15 | // device type definition |
| 16 | const device_type CENTRONICS_DIGIBLASTER = &device_creator<centronics_digiblaster_device>; |
| 17 | |
| 18 | static MACHINE_CONFIG_FRAGMENT( digiblst ) |
| 19 | /* sound hardware */ |
| 20 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 21 | |
| 22 | MCFG_SOUND_ADD("dac", DAC, 0) |
| 23 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 24 | MACHINE_CONFIG_END |
| 25 | |
| 26 | |
| 27 | /*************************************************************************** |
| 28 | IMPLEMENTATION |
| 29 | ***************************************************************************/ |
| 30 | //------------------------------------------------- |
| 31 | // centronics_covox_device - constructor |
| 32 | //------------------------------------------------- |
| 33 | |
| 34 | centronics_digiblaster_device::centronics_digiblaster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 35 | : device_t(mconfig, CENTRONICS_DIGIBLASTER, "Digiblaster (DIY)", tag, owner, clock, "digiblst", __FILE__), |
| 36 | device_centronics_peripheral_interface( mconfig, *this ), |
| 37 | m_dac(*this, "dac"), |
| 38 | m_data(0) |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | //------------------------------------------------- |
| 43 | // machine_config_additions - device-specific |
| 44 | // machine configurations |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | machine_config_constructor centronics_digiblaster_device::device_mconfig_additions() const |
| 48 | { |
| 49 | return MACHINE_CONFIG_NAME( digiblst ); |
| 50 | } |
| 51 | |
| 52 | void centronics_digiblaster_device::device_start() |
| 53 | { |
| 54 | save_item(NAME(m_data)); |
| 55 | } |
| 56 | |
| 57 | void centronics_digiblaster_device::update_dac() |
| 58 | { |
| 59 | if (started()) |
| 60 | m_dac->write_unsigned8(m_data); |
| 61 | } |
trunk/src/emu/bus/centronics/digiblst.h
| r0 | r31748 | |
| 1 | /* |
| 2 | * digiblst.h |
| 3 | * |
| 4 | * Digiblaster - a DIY printer port DAC for the Amstrad CPC |
| 5 | * Printed in the German magazine CPC Amstrad International issue 8-9/1991 |
| 6 | * Uses Strobe (inverted on the CPC) for the 8th bit (CPCs only have 7-bit printer ports) |
| 7 | * |
| 8 | * Code borrows from the Covox Speech Thing device. |
| 9 | * |
| 10 | * Created on: 23/08/2014 |
| 11 | */ |
| 12 | |
| 13 | #ifndef DIGIBLST_H_ |
| 14 | #define DIGIBLST_H_ |
| 15 | |
| 16 | #pragma once |
| 17 | |
| 18 | #include "ctronics.h" |
| 19 | #include "sound/dac.h" |
| 20 | |
| 21 | // ======================> centronics_covox_device |
| 22 | |
| 23 | class centronics_digiblaster_device : public device_t, |
| 24 | public device_centronics_peripheral_interface |
| 25 | { |
| 26 | public: |
| 27 | // construction/destruction |
| 28 | centronics_digiblaster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 29 | |
| 30 | // optional information overrides |
| 31 | virtual machine_config_constructor device_mconfig_additions() const; |
| 32 | |
| 33 | protected: |
| 34 | // device-level overrides |
| 35 | virtual void device_start(); |
| 36 | |
| 37 | virtual DECLARE_WRITE_LINE_MEMBER( input_data0 ) { if (state) m_data |= 0x01; else m_data &= ~0x01; update_dac(); } |
| 38 | virtual DECLARE_WRITE_LINE_MEMBER( input_data1 ) { if (state) m_data |= 0x02; else m_data &= ~0x02; update_dac(); } |
| 39 | virtual DECLARE_WRITE_LINE_MEMBER( input_data2 ) { if (state) m_data |= 0x04; else m_data &= ~0x04; update_dac(); } |
| 40 | virtual DECLARE_WRITE_LINE_MEMBER( input_data3 ) { if (state) m_data |= 0x08; else m_data &= ~0x08; update_dac(); } |
| 41 | virtual DECLARE_WRITE_LINE_MEMBER( input_data4 ) { if (state) m_data |= 0x10; else m_data &= ~0x10; update_dac(); } |
| 42 | virtual DECLARE_WRITE_LINE_MEMBER( input_data5 ) { if (state) m_data |= 0x20; else m_data &= ~0x20; update_dac(); } |
| 43 | virtual DECLARE_WRITE_LINE_MEMBER( input_data6 ) { if (state) m_data |= 0x40; else m_data &= ~0x40; update_dac(); } |
| 44 | virtual DECLARE_WRITE_LINE_MEMBER( input_strobe ) { if (state) m_data &= ~0x80; else m_data |= 0x80; update_dac(); } |
| 45 | |
| 46 | private: |
| 47 | required_device<dac_device> m_dac; |
| 48 | |
| 49 | void update_dac(); |
| 50 | |
| 51 | UINT8 m_data; |
| 52 | }; |
| 53 | |
| 54 | // device type definition |
| 55 | extern const device_type CENTRONICS_DIGIBLASTER; |
| 56 | |
| 57 | |
| 58 | #endif /* DIGIBLST_H_ */ |
trunk/src/mess/includes/amstrad.h
| r31747 | r31748 | |
| 25 | 25 | #include "machine/ram.h" |
| 26 | 26 | #include "imagedev/cassette.h" |
| 27 | 27 | #include "bus/centronics/ctronics.h" |
| 28 | #include "bus/centronics/comxpl80.h" |
| 29 | #include "bus/centronics/epson_ex800.h" |
| 30 | #include "bus/centronics/epson_lx800.h" |
| 31 | #include "bus/centronics/printer.h" |
| 32 | #include "bus/centronics/digiblst.h" |
| 28 | 33 | |
| 34 | |
| 29 | 35 | /**************************** |
| 30 | 36 | * Gate Array data (CPC) - |
| 31 | 37 | ****************************/ |
trunk/src/mess/drivers/amstrad.c
| r31747 | r31748 | |
| 830 | 830 | SLOT_INTERFACE("amdrum", CPC_AMDRUM) |
| 831 | 831 | SLOT_INTERFACE_END |
| 832 | 832 | |
| 833 | SLOT_INTERFACE_START(amstrad_printers) |
| 834 | SLOT_INTERFACE("pl80", COMX_PL80) |
| 835 | SLOT_INTERFACE("ex800", EPSON_EX800) |
| 836 | SLOT_INTERFACE("lx800", EPSON_LX800) |
| 837 | SLOT_INTERFACE("lx810l", EPSON_LX810L) |
| 838 | SLOT_INTERFACE("ap2000", EPSON_AP2000) |
| 839 | SLOT_INTERFACE("printer", CENTRONICS_PRINTER) |
| 840 | SLOT_INTERFACE("digiblst", CENTRONICS_DIGIBLASTER) |
| 841 | SLOT_INTERFACE_END |
| 842 | |
| 833 | 843 | static MACHINE_CONFIG_START( amstrad_nofdc, amstrad_state ) |
| 834 | 844 | /* Machine hardware */ |
| 835 | 845 | MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) |
| r31747 | r31748 | |
| 877 | 887 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 878 | 888 | |
| 879 | 889 | /* printer */ |
| 880 | | MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer") |
| 890 | MCFG_CENTRONICS_ADD("centronics", amstrad_printers, "printer") |
| 881 | 891 | MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amstrad_state, write_centronics_busy)) |
| 882 | 892 | |
| 883 | 893 | /* snapshot */ |