Previous 15994 Revisions Next

r13196 Wednesday 9th November, 2011 at 10:35:31 UTC by Barry Rodewald
amstrad: Added support for ROMbox, SSA-1 speech synth and DK'Tronics speech
synth to be used in a daisy-chain of expansion devices. [Barry Rodewald]
[src/mess/drivers]amstrad.c
[src/mess/includes]amstrad.h
[src/mess/machine]amstrad.c cpc_rom.c cpc_ssa1.c cpc_ssa1.h

src/mess/machine/cpc_ssa1.c
r13195r13196
55 *
66 */
77
8#define ADDRESS_MAP_MODERN
9
810#include "emu.h"
911#include "cpc_ssa1.h"
12#include "includes/amstrad.h"
1013
1114//**************************************************************************
1215//  DEVICE DEFINITIONS
r13195r13196
1518const device_type CPC_SSA1 = &device_creator<cpc_ssa1_device>;
1619const device_type CPC_DKSPEECH = &device_creator<cpc_dkspeech_device>;
1720
21CPC_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
1830//-------------------------------------------------
1931//  device I/O handlers
2032//-------------------------------------------------
2133
22static READ8_DEVICE_HANDLER(ssa1_r)
34READ8_MEMBER(cpc_ssa1_device::ssa1_r)
2335{
2436   UINT8 ret = 0xff;
25   cpc_ssa1_device* ssa1 = device->machine().device<cpc_ssa1_device>("exp:ssa1");
2637
27   if(ssa1->get_sby() == 0)
38   if(get_sby() == 0)
2839      ret &= ~0x80;
2940
30   if(ssa1->get_lrq() != 0)
41   if(get_lrq() != 0)
3142      ret &= ~0x40;
3243
3344   return ret;
3445}
3546
36static WRITE8_DEVICE_HANDLER(ssa1_w)
47WRITE8_MEMBER(cpc_ssa1_device::ssa1_w)
3748{
38   sp0256_ALD_w(device,0,data);
49   sp0256_ALD_w(m_sp0256_device,0,data);
3950}
4051
41static READ8_DEVICE_HANDLER(dkspeech_r)
52READ8_MEMBER(cpc_dkspeech_device::dkspeech_r)
4253{
4354   UINT8 ret = 0xff;
44   cpc_dkspeech_device* dkspeech = device->machine().device<cpc_dkspeech_device>("exp:dkspeech");
4555
4656   // SBY is not connected
4757
48   if(dkspeech->get_lrq() != 0)
58   if(get_lrq() != 0)
4959      ret &= ~0x80;
5060
5161   return ret;
5262}
5363
54static WRITE8_DEVICE_HANDLER(dkspeech_w)
64WRITE8_MEMBER(cpc_dkspeech_device::dkspeech_w)
5565{
56   sp0256_ALD_w(device,0,data & 0x3f);
66   sp0256_ALD_w(m_sp0256_device,0,data & 0x3f);
5767}
5868
5969static WRITE_LINE_DEVICE_HANDLER(ssa1_lrq_cb)
6070{
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());
6272   ssa1->set_lrq(state);
6373}
6474
6575static WRITE_LINE_DEVICE_HANDLER(ssa1_sby_cb)
6676{
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());
6878   ssa1->set_sby(state);
6979}
7080
7181static WRITE_LINE_DEVICE_HANDLER(dk_lrq_cb)
7282{
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);
7585}
7686
7787static WRITE_LINE_DEVICE_HANDLER(dk_sby_cb)
7888{
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);
8191}
8292
8393static sp0256_interface sp0256_intf =
8494{
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)
8797};
8898
8999static sp0256_interface sp0256_dk_intf =
90100{
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)
93103};
94104
95105//-------------------------------------------------
r13195r13196
102112   ROM_LOAD( "sp0256-al2.bin",   0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
103113ROM_END
104114
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.
105116ROM_START( cpc_dkspeech )
106117   ROM_REGION( 0x10000, "sp0256", 0 )
107118   ROM_LOAD( "sp0256-al2.bin",   0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
108   // TODO: Add expansion ROM
109119ROM_END
110120
111121//-------------------------------------------------
r13195r13196
127137   MCFG_SPEAKER_STANDARD_MONO("mono")
128138   MCFG_SOUND_ADD("sp0256",SP0256,XTAL_3_12MHz)
129139   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
131145MACHINE_CONFIG_END
132146
133147static MACHINE_CONFIG_FRAGMENT( cpc_dkspeech )
134148   MCFG_SPEAKER_STANDARD_MONO("mono")
135149   MCFG_SOUND_ADD("sp0256",SP0256,XTAL_4MHz)  // uses the CPC's clock from pin 50 of the expansion port
136150   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
138156MACHINE_CONFIG_END
139157
140158machine_config_constructor cpc_ssa1_device::device_mconfig_additions() const
r13195r13196
154172cpc_ssa1_device::cpc_ssa1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
155173   device_t(mconfig, CPC_SSA1, "SSA-1", tag, owner, clock),
156174   device_cpc_expansion_card_interface(mconfig, *this),
157   m_lrq(1)
175   m_lrq(1),
176   m_sp0256_device(*this,"sp0256")
158177{
159178}
160179
161180cpc_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),
163182   device_cpc_expansion_card_interface(mconfig, *this),
164   m_lrq(1)
183   m_lrq(1),
184   m_sp0256_device(*this,"sp0256")
165185{
166186}
167187
r13195r13196
177197
178198   m_rom = subregion("sp0256")->base();
179199
180   m_sp0256_device = subdevice("sp0256");
200//   m_sp0256_device = subdevice("sp0256");
181201
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));
184204}
185205
186206void cpc_dkspeech_device::device_start()
r13195r13196
191211
192212   m_rom = subregion("sp0256")->base();
193213
194   m_sp0256_device = subdevice("sp0256");
214//   m_sp0256_device = subdevice("sp0256");
195215
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));
197217}
198218
199219//-------------------------------------------------
src/mess/machine/cpc_ssa1.h
r13195r13196
4141#ifndef CPC_SSA1_H_
4242#define CPC_SSA1_H_
4343
44#define ADDRESS_MAP_MODERN
45
4446#include "emu.h"
4547#include "machine/cpcexp.h"
4648#include "sound/sp0256.h"
r13195r13196
6163   void set_sby(UINT8 state) { m_sby = state; }
6264   UINT8 get_sby() { return m_sby; }
6365
66   DECLARE_READ8_MEMBER(ssa1_r);
67   DECLARE_WRITE8_MEMBER(ssa1_w);
68
6469protected:
6570   // device-level overrides
6671   virtual void device_start();
r13195r13196
7479   UINT8 m_lrq;
7580   UINT8 m_sby;
7681
77   device_t* m_sp0256_device;
82   required_device<device_t> m_sp0256_device;
7883};
7984
8085class cpc_dkspeech_device : public device_t,
r13195r13196
9398   void set_sby(UINT8 state) { m_sby = state; }
9499   UINT8 get_sby() { return m_sby; }
95100
101   DECLARE_READ8_MEMBER(dkspeech_r);
102   DECLARE_WRITE8_MEMBER(dkspeech_w);
103
96104protected:
97105   // device-level overrides
98106   virtual void device_start();
r13195r13196
106114   UINT8 m_lrq;
107115   UINT8 m_sby;
108116
109   device_t* m_sp0256_device;
117   required_device<device_t> m_sp0256_device;
110118};
111119
112
113120// device type definition
114121extern const device_type CPC_SSA1;
115122extern const device_type CPC_DKSPEECH;
src/mess/machine/amstrad.c
r13195r13196
27602760    8,  0,  0,  0,  8,  0,  0,  0,  8,  0,  0,  0,  8,  0,  0,  0
27612761};
27622762
2763/* traverses the daisy-chain of expansion devices, looking for the specified device */
2764static 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
27632788static void amstrad_common_init(running_machine &machine)
27642789{
27652790   amstrad_state *state = machine.driver_data<amstrad_state>();
r13195r13196
28022827   space->install_write_bank(0xe000, 0xffff, "bank16");
28032828
28042829   /* Set up ROMs, if we have an expansion device connected */
2805   romexp = space->machine().device("exp:rom");
2830   romexp = get_expansion_device(machine,"rom");
28062831   if(romexp)
28072832   {
28082833      for(x=0;x<6;x++)
28092834      {
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);
28122837         if(romimage->base() != NULL)
28132838         {
28142839            state->m_Amstrad_ROM_Table[x+1] = romimage->base();
r13195r13196
28442869   device_set_irq_callback(machine.device("maincpu"), amstrad_cpu_acknowledge_int);
28452870}
28462871
2847
28482872static TIMER_CALLBACK( cb_set_resolution )
28492873{
28502874   screen_device *screen = downcast<screen_device *>(machine.device("screen"));
src/mess/machine/cpc_rom.c
r13195r13196
66
77#include "emu.h"
88#include "machine/cpc_rom.h"
9#include "includes/amstrad.h"
910
1011const device_type CPC_ROM = &device_creator<cpc_rom_device>;
1112
13#define ADDRESS_MAP_MODERN
1214
1315//**************************************************************************
1416//  DEVICE CONFIG INTERFACE
1517//**************************************************************************
1618
19CPC_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
1728// device machine config
1829static MACHINE_CONFIG_FRAGMENT( cpc_rom )
1930   MCFG_ROMSLOT_ADD("rom1")
r13195r13196
2233   MCFG_ROMSLOT_ADD("rom4")
2334   MCFG_ROMSLOT_ADD("rom5")
2435   MCFG_ROMSLOT_ADD("rom6")
36
37   // pass-through
38   MCFG_CPC_EXPANSION_SLOT_ADD("exp",sub_exp_intf,cpc_exp_cards,NULL,NULL)
39
2540MACHINE_CONFIG_END
2641
2742
r13195r13196
6378const device_type ROMSLOT = &device_creator<rom_image_device>;
6479
6580//-------------------------------------------------
66//  printer_image_device - constructor
81//  rom_image_device - constructor
6782//-------------------------------------------------
6883
6984rom_image_device::rom_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r13195r13196
7489}
7590
7691//-------------------------------------------------
77//  printer_image_device - destructor
92//  rom_image_device - destructor
7893//-------------------------------------------------
7994
8095rom_image_device::~rom_image_device()
src/mess/includes/amstrad.h
r13195r13196
1010#include "machine/upd765.h"
1111#include "video/mc6845.h"
1212#include "imagedev/snapquik.h"
13#include "machine/cpcexp.h"
14#include "machine/cpc_ssa1.h"
15#include "machine/cpc_rom.h"
16#include "machine/mface2.h"
1317
1418/****************************
1519 * Gate Array data (CPC) -
r13195r13196
160164PALETTE_INIT( amstrad_plus );         /* For CPC464+ and CPC6128+ */
161165PALETTE_INIT( aleste );               /* For aleste */
162166
167SLOT_INTERFACE_START(cpc_exp_cards)
168   SLOT_INTERFACE("ssa1", CPC_SSA1)
169   SLOT_INTERFACE("dkspeech", CPC_DKSPEECH)
170   SLOT_INTERFACE("rom", CPC_ROM)
171   SLOT_INTERFACE("multiface2", CPC_MFACE2)
172SLOT_INTERFACE_END
173
174SLOT_INTERFACE_START(cpcplus_exp_cards)
175   SLOT_INTERFACE("ssa1", CPC_SSA1)
176   SLOT_INTERFACE("dkspeech", CPC_DKSPEECH)
177   SLOT_INTERFACE("rom", CPC_ROM)
178SLOT_INTERFACE_END
179
163180#endif /* AMSTRAD_H_ */
src/mess/drivers/amstrad.c
r13195r13196
108108#include "imagedev/cartslot.h"
109109#include "imagedev/cassette.h"
110110#include "formats/tzx_cas.h"
111#include "machine/cpcexp.h"
112#include "machine/cpc_ssa1.h"
113#include "machine/cpc_rom.h"
114#include "machine/mface2.h"
115111
116112#include "machine/ram.h"
117113
r13195r13196
862858   NULL
863859};
864860
865static CPC_EXPANSION_INTERFACE(cpc_exp_intf)
861CPC_EXPANSION_INTERFACE(cpc_exp_intf)
866862{
867863   DEVCB_CPU_INPUT_LINE("maincpu", 0),
868864   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),
r13195r13196
871867   DEVCB_LINE(cpc_romen)  // /ROMEN
872868};
873869
874static SLOT_INTERFACE_START(cpc_exp_cards)
875   SLOT_INTERFACE("ssa1", CPC_SSA1)
876   SLOT_INTERFACE("dkspeech", CPC_DKSPEECH)
877   SLOT_INTERFACE("rom", CPC_ROM)
878   SLOT_INTERFACE("multiface2", CPC_MFACE2)
879SLOT_INTERFACE_END
880
881static SLOT_INTERFACE_START(cpcplus_exp_cards)
882   SLOT_INTERFACE("ssa1", CPC_SSA1)
883   SLOT_INTERFACE("dkspeech", CPC_DKSPEECH)
884   SLOT_INTERFACE("rom", CPC_ROM)
885SLOT_INTERFACE_END
886
887870static MACHINE_CONFIG_FRAGMENT( cpcplus_cartslot )
888871   MCFG_CARTSLOT_ADD("cart")
889872   MCFG_CARTSLOT_EXTENSION_LIST("cpr,bin")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team