trunk/src/mess/machine/a2arcadebd.c
r0 | r18095 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2arcadeboard.c |
| 4 | |
| 5 | Implementation of the Third Millenium Engineering Arcade Board |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "machine/a2arcadebd.h" |
| 11 | |
| 12 | |
| 13 | /*************************************************************************** |
| 14 | PARAMETERS |
| 15 | ***************************************************************************/ |
| 16 | |
| 17 | #define TMS_TAG "arcbd_tms" |
| 18 | #define AY_TAG "arcbd_ay" |
| 19 | #define SCREEN_TAG "screen" |
| 20 | |
| 21 | //************************************************************************** |
| 22 | // GLOBAL VARIABLES |
| 23 | //************************************************************************** |
| 24 | |
| 25 | const device_type A2BUS_ARCADEBOARD = &device_creator<a2bus_arcboard_device>; |
| 26 | |
| 27 | static const ay8910_interface arcadeboard_ay8910_interface = |
| 28 | { |
| 29 | AY8910_LEGACY_OUTPUT, |
| 30 | AY8910_DEFAULT_LOADS, |
| 31 | DEVCB_NULL |
| 32 | }; |
| 33 | |
| 34 | static TMS9928A_INTERFACE(arcadeboard_tms9918a_interface) |
| 35 | { |
| 36 | SCREEN_TAG, |
| 37 | 0x4000, // 16k of VRAM |
| 38 | DEVCB_NULL // VBL interrupt |
| 39 | }; |
| 40 | |
| 41 | MACHINE_CONFIG_FRAGMENT( arcadeboard ) |
| 42 | MCFG_TMS9928A_ADD( TMS_TAG, TMS9918A, arcadeboard_tms9918a_interface ) |
| 43 | MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) |
| 44 | MCFG_SCREEN_UPDATE_DEVICE( TMS_TAG, tms9918a_device, screen_update ) |
| 45 | |
| 46 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 47 | MCFG_SOUND_ADD(AY_TAG, AY8910, 1022727) |
| 48 | MCFG_SOUND_CONFIG(arcadeboard_ay8910_interface) |
| 49 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 50 | MACHINE_CONFIG_END |
| 51 | |
| 52 | //------------------------------------------------- |
| 53 | // machine_config_additions - device-specific |
| 54 | // machine configurations |
| 55 | //------------------------------------------------- |
| 56 | |
| 57 | machine_config_constructor a2bus_arcboard_device::device_mconfig_additions() const |
| 58 | { |
| 59 | return MACHINE_CONFIG_NAME( arcadeboard ); |
| 60 | } |
| 61 | |
| 62 | //************************************************************************** |
| 63 | // LIVE DEVICE |
| 64 | //************************************************************************** |
| 65 | |
| 66 | a2bus_arcboard_device::a2bus_arcboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 67 | device_t(mconfig, A2BUS_ARCADEBOARD, "Third Millenium Engineering Arcade Board", tag, owner, clock), |
| 68 | device_a2bus_card_interface(mconfig, *this), |
| 69 | m_tms(*this, TMS_TAG), |
| 70 | m_ay(*this, AY_TAG) |
| 71 | { |
| 72 | m_shortname = "a2arcbd"; |
| 73 | } |
| 74 | |
| 75 | a2bus_arcboard_device::a2bus_arcboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 76 | device_t(mconfig, type, name, tag, owner, clock), |
| 77 | device_a2bus_card_interface(mconfig, *this), |
| 78 | m_tms(*this, TMS_TAG), |
| 79 | m_ay(*this, AY_TAG) |
| 80 | { |
| 81 | m_shortname = "a2arcbd"; |
| 82 | } |
| 83 | |
| 84 | //------------------------------------------------- |
| 85 | // device_start - device-specific startup |
| 86 | //------------------------------------------------- |
| 87 | |
| 88 | void a2bus_arcboard_device::device_start() |
| 89 | { |
| 90 | // set_a2bus_device makes m_slot valid |
| 91 | set_a2bus_device(); |
| 92 | } |
| 93 | |
| 94 | void a2bus_arcboard_device::device_reset() |
| 95 | { |
| 96 | } |
| 97 | |
| 98 | /* |
| 99 | C0nx map: |
| 100 | 0 - TMS read vram |
| 101 | 1 - TMS read status |
| 102 | 2 - TMS write vram |
| 103 | 3 - TMS write register |
| 104 | 5 - AY register select |
| 105 | 6 - AY data |
| 106 | */ |
| 107 | |
| 108 | UINT8 a2bus_arcboard_device::read_c0nx(address_space &space, UINT8 offset) |
| 109 | { |
| 110 | switch (offset) |
| 111 | { |
| 112 | case 0: |
| 113 | return m_tms->vram_read(space, 0); |
| 114 | |
| 115 | case 1: |
| 116 | return m_tms->register_read(space, 0); |
| 117 | |
| 118 | case 6: |
| 119 | return ay8910_r(m_ay, space, 0); |
| 120 | } |
| 121 | |
| 122 | return 0xff; |
| 123 | } |
| 124 | |
| 125 | void a2bus_arcboard_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 126 | { |
| 127 | switch (offset) |
| 128 | { |
| 129 | case 2: |
| 130 | m_tms->vram_write(space, 0, data); |
| 131 | break; |
| 132 | |
| 133 | case 3: |
| 134 | m_tms->register_write(space, 0, data); |
| 135 | break; |
| 136 | |
| 137 | case 5: |
| 138 | ay8910_address_w(m_ay, space, 0, data); |
| 139 | break; |
| 140 | |
| 141 | case 6: |
| 142 | ay8910_data_w(m_ay, space, 0, data); |
| 143 | break; |
| 144 | } |
| 145 | } |
trunk/src/mess/machine/a2arcadebd.h
r0 | r18095 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2arcadebd.h |
| 4 | |
| 5 | Third Millenium Engineering Arcade Board |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef __A2BUS_ARCADEBOARD__ |
| 10 | #define __A2BUS_ARCADEBOARD__ |
| 11 | |
| 12 | #include "emu.h" |
| 13 | #include "machine/a2bus.h" |
| 14 | #include "video/tms9928a.h" |
| 15 | #include "sound/ay8910.h" |
| 16 | |
| 17 | //************************************************************************** |
| 18 | // TYPE DEFINITIONS |
| 19 | //************************************************************************** |
| 20 | |
| 21 | class a2bus_arcboard_device: |
| 22 | public device_t, |
| 23 | public device_a2bus_card_interface |
| 24 | { |
| 25 | public: |
| 26 | // construction/destruction |
| 27 | a2bus_arcboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 28 | a2bus_arcboard_device(const machine_config &mconfig, device_type type, const char *name, 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 | virtual void device_start(); |
| 35 | virtual void device_reset(); |
| 36 | |
| 37 | // overrides of standard a2bus slot functions |
| 38 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 39 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 40 | |
| 41 | required_device<tms9918a_device> m_tms; |
| 42 | required_device<device_t> m_ay; |
| 43 | |
| 44 | private: |
| 45 | }; |
| 46 | |
| 47 | // device type definition |
| 48 | extern const device_type A2BUS_ARCADEBOARD; |
| 49 | |
| 50 | #endif /* __A2BUS_ARCADEBOARD__ */ |
| 51 | |