src/mess/machine/cpc_ssa1.c
| r13195 | r13196 | |
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | #define ADDRESS_MAP_MODERN |
| 9 | |
| 8 | 10 | #include "emu.h" |
| 9 | 11 | #include "cpc_ssa1.h" |
| 12 | #include "includes/amstrad.h" |
| 10 | 13 | |
| 11 | 14 | //************************************************************************** |
| 12 | 15 | // DEVICE DEFINITIONS |
| r13195 | r13196 | |
| 15 | 18 | const device_type CPC_SSA1 = &device_creator<cpc_ssa1_device>; |
| 16 | 19 | const device_type CPC_DKSPEECH = &device_creator<cpc_dkspeech_device>; |
| 17 | 20 | |
| 21 | CPC_EXPANSION_INTERFACE(sub_exp_intf) |
| 22 | { |
| 23 | DEVCB_LINE_MEMBER(cpc_expansion_slot_device,irq_w), |
| 24 | DEVCB_LINE_MEMBER(cpc_expansion_slot_device,nmi_w), |
| 25 | DEVCB_NULL, // RESET |
| 26 | DEVCB_LINE(cpc_romdis), // ROMDIS |
| 27 | DEVCB_LINE(cpc_romen) // /ROMEN |
| 28 | }; |
| 29 | |
| 18 | 30 | //------------------------------------------------- |
| 19 | 31 | // device I/O handlers |
| 20 | 32 | //------------------------------------------------- |
| 21 | 33 | |
| 22 | | static READ8_DEVICE_HANDLER(ssa1_r) |
| 34 | READ8_MEMBER(cpc_ssa1_device::ssa1_r) |
| 23 | 35 | { |
| 24 | 36 | UINT8 ret = 0xff; |
| 25 | | cpc_ssa1_device* ssa1 = device->machine().device<cpc_ssa1_device>("exp:ssa1"); |
| 26 | 37 | |
| 27 | | if(ssa1->get_sby() == 0) |
| 38 | if(get_sby() == 0) |
| 28 | 39 | ret &= ~0x80; |
| 29 | 40 | |
| 30 | | if(ssa1->get_lrq() != 0) |
| 41 | if(get_lrq() != 0) |
| 31 | 42 | ret &= ~0x40; |
| 32 | 43 | |
| 33 | 44 | return ret; |
| 34 | 45 | } |
| 35 | 46 | |
| 36 | | static WRITE8_DEVICE_HANDLER(ssa1_w) |
| 47 | WRITE8_MEMBER(cpc_ssa1_device::ssa1_w) |
| 37 | 48 | { |
| 38 | | sp0256_ALD_w(device,0,data); |
| 49 | sp0256_ALD_w(m_sp0256_device,0,data); |
| 39 | 50 | } |
| 40 | 51 | |
| 41 | | static READ8_DEVICE_HANDLER(dkspeech_r) |
| 52 | READ8_MEMBER(cpc_dkspeech_device::dkspeech_r) |
| 42 | 53 | { |
| 43 | 54 | UINT8 ret = 0xff; |
| 44 | | cpc_dkspeech_device* dkspeech = device->machine().device<cpc_dkspeech_device>("exp:dkspeech"); |
| 45 | 55 | |
| 46 | 56 | // SBY is not connected |
| 47 | 57 | |
| 48 | | if(dkspeech->get_lrq() != 0) |
| 58 | if(get_lrq() != 0) |
| 49 | 59 | ret &= ~0x80; |
| 50 | 60 | |
| 51 | 61 | return ret; |
| 52 | 62 | } |
| 53 | 63 | |
| 54 | | static WRITE8_DEVICE_HANDLER(dkspeech_w) |
| 64 | WRITE8_MEMBER(cpc_dkspeech_device::dkspeech_w) |
| 55 | 65 | { |
| 56 | | sp0256_ALD_w(device,0,data & 0x3f); |
| 66 | sp0256_ALD_w(m_sp0256_device,0,data & 0x3f); |
| 57 | 67 | } |
| 58 | 68 | |
| 59 | 69 | static WRITE_LINE_DEVICE_HANDLER(ssa1_lrq_cb) |
| 60 | 70 | { |
| 61 | | cpc_ssa1_device* ssa1 = device->machine().device<cpc_ssa1_device>("exp:ssa1"); |
| 71 | cpc_ssa1_device* ssa1 = dynamic_cast<cpc_ssa1_device*>(device->owner()); |
| 62 | 72 | ssa1->set_lrq(state); |
| 63 | 73 | } |
| 64 | 74 | |
| 65 | 75 | static WRITE_LINE_DEVICE_HANDLER(ssa1_sby_cb) |
| 66 | 76 | { |
| 67 | | cpc_ssa1_device* ssa1 = device->machine().device<cpc_ssa1_device>("exp:ssa1"); |
| 77 | cpc_ssa1_device* ssa1 = dynamic_cast<cpc_ssa1_device*>(device->owner()); |
| 68 | 78 | ssa1->set_sby(state); |
| 69 | 79 | } |
| 70 | 80 | |
| 71 | 81 | static WRITE_LINE_DEVICE_HANDLER(dk_lrq_cb) |
| 72 | 82 | { |
| 73 | | cpc_dkspeech_device* dkspeech = device->machine().device<cpc_dkspeech_device>("exp:dkspeech"); |
| 74 | | dkspeech->set_lrq(state); |
| 83 | cpc_dkspeech_device* dk = dynamic_cast<cpc_dkspeech_device*>(device->owner()); |
| 84 | dk->set_lrq(state); |
| 75 | 85 | } |
| 76 | 86 | |
| 77 | 87 | static WRITE_LINE_DEVICE_HANDLER(dk_sby_cb) |
| 78 | 88 | { |
| 79 | | cpc_dkspeech_device* dkspeech = device->machine().device<cpc_dkspeech_device>("exp:dkspeech"); |
| 80 | | dkspeech->set_sby(state); |
| 89 | cpc_dkspeech_device* dk = dynamic_cast<cpc_dkspeech_device*>(device->owner()); |
| 90 | dk->set_sby(state); |
| 81 | 91 | } |
| 82 | 92 | |
| 83 | 93 | static sp0256_interface sp0256_intf = |
| 84 | 94 | { |
| 85 | | DEVCB_LINE(ssa1_lrq_cb), |
| 86 | | DEVCB_LINE(ssa1_sby_cb) |
| 95 | DEVCB_DEVICE_LINE("sp0256",ssa1_lrq_cb), |
| 96 | DEVCB_DEVICE_LINE("sp0256",ssa1_sby_cb) |
| 87 | 97 | }; |
| 88 | 98 | |
| 89 | 99 | static sp0256_interface sp0256_dk_intf = |
| 90 | 100 | { |
| 91 | | DEVCB_LINE(dk_lrq_cb), |
| 92 | | DEVCB_LINE(dk_sby_cb) |
| 101 | DEVCB_DEVICE_LINE("sp0256",dk_lrq_cb), |
| 102 | DEVCB_DEVICE_LINE("sp0256",dk_sby_cb) |
| 93 | 103 | }; |
| 94 | 104 | |
| 95 | 105 | //------------------------------------------------- |
| r13195 | r13196 | |
| 102 | 112 | ROM_LOAD( "sp0256-al2.bin", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) |
| 103 | 113 | ROM_END |
| 104 | 114 | |
| 115 | // Available in ROM and cassette versions. For now, we'll let the user choose to load the software via ROM (using a ROM box slot device) or cassette. |
| 105 | 116 | ROM_START( cpc_dkspeech ) |
| 106 | 117 | ROM_REGION( 0x10000, "sp0256", 0 ) |
| 107 | 118 | ROM_LOAD( "sp0256-al2.bin", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) |
| 108 | | // TODO: Add expansion ROM |
| 109 | 119 | ROM_END |
| 110 | 120 | |
| 111 | 121 | //------------------------------------------------- |
| r13195 | r13196 | |
| 127 | 137 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 128 | 138 | MCFG_SOUND_ADD("sp0256",SP0256,XTAL_3_12MHz) |
| 129 | 139 | MCFG_SOUND_CONFIG(sp0256_intf) |
| 130 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 140 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 141 | |
| 142 | // pass-through |
| 143 | MCFG_CPC_EXPANSION_SLOT_ADD("exp",sub_exp_intf,cpcplus_exp_cards,NULL,NULL) |
| 144 | |
| 131 | 145 | MACHINE_CONFIG_END |
| 132 | 146 | |
| 133 | 147 | static MACHINE_CONFIG_FRAGMENT( cpc_dkspeech ) |
| 134 | 148 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 135 | 149 | MCFG_SOUND_ADD("sp0256",SP0256,XTAL_4MHz) // uses the CPC's clock from pin 50 of the expansion port |
| 136 | 150 | MCFG_SOUND_CONFIG(sp0256_dk_intf) |
| 137 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 151 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 152 | |
| 153 | // pass-through |
| 154 | MCFG_CPC_EXPANSION_SLOT_ADD("exp",sub_exp_intf,cpcplus_exp_cards,NULL,NULL) |
| 155 | |
| 138 | 156 | MACHINE_CONFIG_END |
| 139 | 157 | |
| 140 | 158 | machine_config_constructor cpc_ssa1_device::device_mconfig_additions() const |
| r13195 | r13196 | |
| 154 | 172 | cpc_ssa1_device::cpc_ssa1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 155 | 173 | device_t(mconfig, CPC_SSA1, "SSA-1", tag, owner, clock), |
| 156 | 174 | device_cpc_expansion_card_interface(mconfig, *this), |
| 157 | | m_lrq(1) |
| 175 | m_lrq(1), |
| 176 | m_sp0256_device(*this,"sp0256") |
| 158 | 177 | { |
| 159 | 178 | } |
| 160 | 179 | |
| 161 | 180 | cpc_dkspeech_device::cpc_dkspeech_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 162 | | device_t(mconfig, CPC_DKSPEECH, "DK'T Speech", tag, owner, clock), |
| 181 | device_t(mconfig, CPC_DKSPEECH, "DK'Tronics Speech Synthesiser", tag, owner, clock), |
| 163 | 182 | device_cpc_expansion_card_interface(mconfig, *this), |
| 164 | | m_lrq(1) |
| 183 | m_lrq(1), |
| 184 | m_sp0256_device(*this,"sp0256") |
| 165 | 185 | { |
| 166 | 186 | } |
| 167 | 187 | |
| r13195 | r13196 | |
| 177 | 197 | |
| 178 | 198 | m_rom = subregion("sp0256")->base(); |
| 179 | 199 | |
| 180 | | m_sp0256_device = subdevice("sp0256"); |
| 200 | // m_sp0256_device = subdevice("sp0256"); |
| 181 | 201 | |
| 182 | | space->install_legacy_readwrite_handler(*m_sp0256_device,0xfaee,0xfaee,0,0,FUNC(ssa1_r),FUNC(ssa1_w)); |
| 183 | | space->install_legacy_readwrite_handler(*m_sp0256_device,0xfbee,0xfbee,0,0,FUNC(ssa1_r),FUNC(ssa1_w)); |
| 202 | space->install_readwrite_handler(0xfaee,0xfaee,0,0,read8_delegate(FUNC(cpc_ssa1_device::ssa1_r),this),write8_delegate(FUNC(cpc_ssa1_device::ssa1_w),this)); |
| 203 | space->install_readwrite_handler(0xfbee,0xfbee,0,0,read8_delegate(FUNC(cpc_ssa1_device::ssa1_r),this),write8_delegate(FUNC(cpc_ssa1_device::ssa1_w),this)); |
| 184 | 204 | } |
| 185 | 205 | |
| 186 | 206 | void cpc_dkspeech_device::device_start() |
| r13195 | r13196 | |
| 191 | 211 | |
| 192 | 212 | m_rom = subregion("sp0256")->base(); |
| 193 | 213 | |
| 194 | | m_sp0256_device = subdevice("sp0256"); |
| 214 | // m_sp0256_device = subdevice("sp0256"); |
| 195 | 215 | |
| 196 | | space->install_legacy_readwrite_handler(*m_sp0256_device,0xfbfe,0xfbfe,0,0,FUNC(dkspeech_r),FUNC(dkspeech_w)); |
| 216 | space->install_readwrite_handler(0xfbfe,0xfbfe,0,0,read8_delegate(FUNC(cpc_dkspeech_device::dkspeech_r),this),write8_delegate(FUNC(cpc_dkspeech_device::dkspeech_w),this)); |
| 197 | 217 | } |
| 198 | 218 | |
| 199 | 219 | //------------------------------------------------- |
src/mess/machine/amstrad.c
| r13195 | r13196 | |
| 2760 | 2760 | 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0 |
| 2761 | 2761 | }; |
| 2762 | 2762 | |
| 2763 | /* traverses the daisy-chain of expansion devices, looking for the specified device */ |
| 2764 | static device_t* get_expansion_device(running_machine &machine, const char* tag) |
| 2765 | { |
| 2766 | cpc_expansion_slot_device* exp_port = machine.device<cpc_expansion_slot_device>("exp"); |
| 2767 | |
| 2768 | while(exp_port != NULL) |
| 2769 | { |
| 2770 | device_t* temp; |
| 2771 | |
| 2772 | // first, check if this expansion port has the device we want attached |
| 2773 | temp = exp_port->subdevice("rom"); |
| 2774 | if(temp != NULL) |
| 2775 | return temp; |
| 2776 | |
| 2777 | // if it's not what we're looking for, then check the expansion port on this expansion device. if it exists. |
| 2778 | temp = dynamic_cast<device_t*>(exp_port->get_card_device()); |
| 2779 | if(temp == NULL) |
| 2780 | return NULL; // no device attached |
| 2781 | exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); |
| 2782 | if(exp_port == NULL) |
| 2783 | return NULL; // we're at the end of the chain |
| 2784 | } |
| 2785 | return NULL; |
| 2786 | } |
| 2787 | |
| 2763 | 2788 | static void amstrad_common_init(running_machine &machine) |
| 2764 | 2789 | { |
| 2765 | 2790 | amstrad_state *state = machine.driver_data<amstrad_state>(); |
| r13195 | r13196 | |
| 2802 | 2827 | space->install_write_bank(0xe000, 0xffff, "bank16"); |
| 2803 | 2828 | |
| 2804 | 2829 | /* Set up ROMs, if we have an expansion device connected */ |
| 2805 | | romexp = space->machine().device("exp:rom"); |
| 2830 | romexp = get_expansion_device(machine,"rom"); |
| 2806 | 2831 | if(romexp) |
| 2807 | 2832 | { |
| 2808 | 2833 | for(x=0;x<6;x++) |
| 2809 | 2834 | { |
| 2810 | | sprintf(str,"exp:rom:rom%i",x+1); |
| 2811 | | romimage = space->machine().device<rom_image_device>(str); |
| 2835 | sprintf(str,"rom%i",x+1); |
| 2836 | romimage = romexp->subdevice<rom_image_device>(str); |
| 2812 | 2837 | if(romimage->base() != NULL) |
| 2813 | 2838 | { |
| 2814 | 2839 | state->m_Amstrad_ROM_Table[x+1] = romimage->base(); |
| r13195 | r13196 | |
| 2844 | 2869 | device_set_irq_callback(machine.device("maincpu"), amstrad_cpu_acknowledge_int); |
| 2845 | 2870 | } |
| 2846 | 2871 | |
| 2847 | | |
| 2848 | 2872 | static TIMER_CALLBACK( cb_set_resolution ) |
| 2849 | 2873 | { |
| 2850 | 2874 | screen_device *screen = downcast<screen_device *>(machine.device("screen")); |
src/mess/machine/cpc_rom.c
| r13195 | r13196 | |
| 6 | 6 | |
| 7 | 7 | #include "emu.h" |
| 8 | 8 | #include "machine/cpc_rom.h" |
| 9 | #include "includes/amstrad.h" |
| 9 | 10 | |
| 10 | 11 | const device_type CPC_ROM = &device_creator<cpc_rom_device>; |
| 11 | 12 | |
| 13 | #define ADDRESS_MAP_MODERN |
| 12 | 14 | |
| 13 | 15 | //************************************************************************** |
| 14 | 16 | // DEVICE CONFIG INTERFACE |
| 15 | 17 | //************************************************************************** |
| 16 | 18 | |
| 19 | CPC_EXPANSION_INTERFACE(sub_exp_intf) |
| 20 | { |
| 21 | DEVCB_NULL,//LINE_MEMBER(cpc_expansion_slot_device,irq_w), |
| 22 | DEVCB_NULL,//LINE_MEMBER(cpc_expansion_slot_device,nmi_w), |
| 23 | DEVCB_NULL, // RESET |
| 24 | DEVCB_LINE(cpc_romdis), // ROMDIS |
| 25 | DEVCB_LINE(cpc_romen) // /ROMEN |
| 26 | }; |
| 27 | |
| 17 | 28 | // device machine config |
| 18 | 29 | static MACHINE_CONFIG_FRAGMENT( cpc_rom ) |
| 19 | 30 | MCFG_ROMSLOT_ADD("rom1") |
| r13195 | r13196 | |
| 22 | 33 | MCFG_ROMSLOT_ADD("rom4") |
| 23 | 34 | MCFG_ROMSLOT_ADD("rom5") |
| 24 | 35 | MCFG_ROMSLOT_ADD("rom6") |
| 36 | |
| 37 | // pass-through |
| 38 | MCFG_CPC_EXPANSION_SLOT_ADD("exp",sub_exp_intf,cpc_exp_cards,NULL,NULL) |
| 39 | |
| 25 | 40 | MACHINE_CONFIG_END |
| 26 | 41 | |
| 27 | 42 | |
| r13195 | r13196 | |
| 63 | 78 | const device_type ROMSLOT = &device_creator<rom_image_device>; |
| 64 | 79 | |
| 65 | 80 | //------------------------------------------------- |
| 66 | | // printer_image_device - constructor |
| 81 | // rom_image_device - constructor |
| 67 | 82 | //------------------------------------------------- |
| 68 | 83 | |
| 69 | 84 | rom_image_device::rom_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r13195 | r13196 | |
| 74 | 89 | } |
| 75 | 90 | |
| 76 | 91 | //------------------------------------------------- |
| 77 | | // printer_image_device - destructor |
| 92 | // rom_image_device - destructor |
| 78 | 93 | //------------------------------------------------- |
| 79 | 94 | |
| 80 | 95 | rom_image_device::~rom_image_device() |