Previous 199869 Revisions Next

r40662 Thursday 10th September, 2015 at 11:53:20 UTC by Barry Rodewald
al520ex: added preliminary Magic Sound expansion (not working) [Barry Rodewald]
[scripts/src]bus.lua
[src/emu/bus/cpc]cpcexp.h magicsound.c* magicsound.h*
[src/mess/drivers]amstrad.c
[src/mess/includes]amstrad.h
[src/mess/machine]amstrad.c

trunk/scripts/src/bus.lua
r249173r249174
21852185      MAME_DIR .. "src/emu/bus/cpc/hd20.h",
21862186      MAME_DIR .. "src/emu/bus/cpc/ddi1.c",
21872187      MAME_DIR .. "src/emu/bus/cpc/ddi1.h",
2188      MAME_DIR .. "src/emu/bus/cpc/magicsound.c",
2189      MAME_DIR .. "src/emu/bus/cpc/magicsound.h",
21882190   }
21892191end
21902192
trunk/src/emu/bus/cpc/cpcexp.h
r249173r249174
3131 *   RAMDIS  45  46  CURSOR
3232 *    L.PEN  47  48  _EXP
3333 *      GND  49  50  CLOCK
34 *
35 *  Aleste 520EX expansion port is 62-pin.  Same as the CPC above, except that pin 40 is not connected, plus the following:
36 * 
37 *    MAP14  A26  B26  MAP15
38 *    MAP16  A27  B27  MAP17
39 *    MAP18  A28  B28  MAPBLK
40 *    _INTA  A29  B29  _DISP
41 *     Agnd  A30  B30  _CPU
42 *     Aucc  A31  B31  HIGH
43 *
3444 */
3545
3646#pragma once
trunk/src/emu/bus/cpc/magicsound.c
r0r249174
1// license:BSD-3-Clause
2// copyright-holders:Barry Rodewald
3/*
4 * magicsound.c
5 *
6 *  Magic Sound Board for the Aleste 520EX
7 *
8 */
9 
10#include "emu.h"
11#include "magicsound.h"
12#include "includes/amstrad.h"
13
14
15//**************************************************************************
16//  DEVICE DEFINITIONS
17//**************************************************************************
18
19const device_type AL_MAGICSOUND = &device_creator<al_magicsound_device>;
20
21
22static MACHINE_CONFIG_FRAGMENT( al_magicsound )
23   MCFG_DEVICE_ADD( "dmac", AM9517A, XTAL_4MHz )  // CLK from expansion port
24   // According to the schematics, the TC pin (EOP on western chips) is connected to NMI on the expansion port.
25   // NMIs seem to occur too quickly when this is active, so either EOP is not triggered at the correct time, or
26   // the K1810WT37 is different to the i8237/AM9517A
27   //MCFG_I8237_OUT_EOP_CB(DEVWRITELINE("^", cpc_expansion_slot_device, nmi_w)) // MCFG_DEVCB_INVERT
28   MCFG_I8237_OUT_HREQ_CB(DEVWRITELINE("dmac", am9517a_device, hack_w))
29   MCFG_I8237_IN_MEMR_CB(READ8(al_magicsound_device,dma_read_byte))
30   MCFG_I8237_OUT_IOW_0_CB(WRITE8(al_magicsound_device,dma_write_byte))
31   MCFG_I8237_OUT_IOW_1_CB(WRITE8(al_magicsound_device,dma_write_byte))
32   MCFG_I8237_OUT_IOW_2_CB(WRITE8(al_magicsound_device,dma_write_byte))
33   MCFG_I8237_OUT_IOW_3_CB(WRITE8(al_magicsound_device,dma_write_byte))
34   MCFG_I8237_OUT_DACK_0_CB(WRITELINE(al_magicsound_device, dack0_w))
35   MCFG_I8237_OUT_DACK_1_CB(WRITELINE(al_magicsound_device, dack1_w))
36   MCFG_I8237_OUT_DACK_2_CB(WRITELINE(al_magicsound_device, dack2_w))
37   MCFG_I8237_OUT_DACK_3_CB(WRITELINE(al_magicsound_device, dack3_w))
38
39   // Timing does not seem to be correct.
40   // According to the schematics, the clock is from the clock pin on the expansion port (4MHz), and
41   // passes through an inverter to each CLK pin on both timers.  This seems to be too fast.
42   // Timer outputs to SAM0/1/2/3 are sample clocks for each sound channel, D/A0 is the low bit of the channel select.
43   MCFG_DEVICE_ADD("timer1", PIT8254, 0)
44   MCFG_PIT8253_CLK0(XTAL_4MHz)
45   MCFG_PIT8253_OUT0_HANDLER(WRITELINE(al_magicsound_device,sam0_w))
46   MCFG_PIT8253_CLK1(XTAL_4MHz)
47   MCFG_PIT8253_OUT1_HANDLER(WRITELINE(al_magicsound_device,sam1_w))
48   MCFG_PIT8253_CLK2(XTAL_4MHz)
49   MCFG_PIT8253_OUT2_HANDLER(WRITELINE(al_magicsound_device,sam2_w))
50
51   MCFG_DEVICE_ADD("timer2", PIT8254, 0)
52   MCFG_PIT8253_CLK0(XTAL_4MHz)
53   MCFG_PIT8253_OUT0_HANDLER(WRITELINE(al_magicsound_device,sam3_w))
54   MCFG_PIT8253_CLK1(XTAL_4MHz)
55   MCFG_PIT8253_OUT1_HANDLER(WRITELINE(al_magicsound_device,da0_w))
56   MCFG_PIT8253_CLK2(XTAL_4MHz)
57
58   MCFG_SPEAKER_STANDARD_MONO("mono")
59   MCFG_DAC_ADD("dac1")   
60   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
61   // no pass-through(?)
62MACHINE_CONFIG_END
63
64machine_config_constructor al_magicsound_device::device_mconfig_additions() const
65{
66   return MACHINE_CONFIG_NAME( al_magicsound );
67}
68
69//**************************************************************************
70//  LIVE DEVICE
71//**************************************************************************
72
73al_magicsound_device::al_magicsound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
74   device_t(mconfig, AL_MAGICSOUND, "Magic Sound Board", tag, owner, clock, "al_magicsound", __FILE__),
75   device_cpc_expansion_card_interface(mconfig, *this),
76   m_dac1(*this,"dac1"),
77   m_dmac(*this,"dmac"),
78   m_timer1(*this,"timer1"),
79   m_timer2(*this,"timer2")
80{
81}
82
83//-------------------------------------------------
84//  device_start - device-specific startup
85//-------------------------------------------------
86
87void al_magicsound_device::device_start()
88{
89   device_t* cpu = machine().device("maincpu");
90   address_space& space = cpu->memory().space(AS_IO);
91   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
92
93   space.install_readwrite_handler(0xf8d0,0xf8df,0,0,read8_delegate(FUNC(al_magicsound_device::dmac_r),this),write8_delegate(FUNC(al_magicsound_device::dmac_w),this));
94   space.install_write_handler(0xf9d0,0xf9df,0,0,write8_delegate(FUNC(al_magicsound_device::timer_w),this));
95   space.install_write_handler(0xfad0,0xfadf,0,0,write8_delegate(FUNC(al_magicsound_device::volume_w),this));
96   space.install_write_handler(0xfbd0,0xfbdf,0,0,write8_delegate(FUNC(al_magicsound_device::mapper_w),this));
97   
98   m_ramptr = machine().device<ram_device>(":" RAM_TAG);
99   
100   for(int x=0;x<4;x++)
101   {
102      save_item(NAME(m_output[x]),x);
103   }
104}
105
106//-------------------------------------------------
107//  device_reset - device-specific reset
108//-------------------------------------------------
109
110void al_magicsound_device::device_reset()
111{
112   m_current_channel = -1;
113   m_current_output = 0;
114   set_timer_gate(false);
115}
116
117READ8_MEMBER(al_magicsound_device::dmac_r)
118{
119   return m_dmac->read(space,offset);
120}
121
122WRITE8_MEMBER(al_magicsound_device::dmac_w)
123{
124   m_dmac->write(space,offset,data);
125}
126
127WRITE8_MEMBER(al_magicsound_device::timer_w)
128{
129   // can both PITs be selected at the same time?
130   if(offset & 0x08)
131      m_timer1->write(space,offset & 0x03,data);
132   if(offset & 0x04)
133      m_timer2->write(space,offset & 0x03,data);
134}
135
136WRITE8_MEMBER(al_magicsound_device::volume_w)
137{
138   m_volume[offset & 0x03] = data & 0x3f;
139}
140
141WRITE8_MEMBER(al_magicsound_device::mapper_w)
142{
143   UINT8 channel = (offset & 0x0c) >> 2;
144   UINT8 page = offset & 0x03;
145   m_page[channel][page] = (~(data) & 0x3f) * 0x4000;
146   set_timer_gate(true);
147}
148
149WRITE_LINE_MEMBER(al_magicsound_device::da0_w)
150{
151   m_dac1->write_unsigned8(m_output[m_current_output++]);
152   if(m_current_output > 3)
153      m_current_output = 0;
154}
155
156WRITE_LINE_MEMBER(al_magicsound_device::dack0_w) { m_dack[0] = state; }
157WRITE_LINE_MEMBER(al_magicsound_device::dack1_w) { m_dack[1] = state; }
158WRITE_LINE_MEMBER(al_magicsound_device::dack2_w) { m_dack[2] = state; }
159WRITE_LINE_MEMBER(al_magicsound_device::dack3_w) { m_dack[3] = state; }
160
161WRITE_LINE_MEMBER(al_magicsound_device::sam0_w) { m_current_channel = 0; if(m_dack[0] && state) m_dmac->dreq0_w(1); }
162WRITE_LINE_MEMBER(al_magicsound_device::sam1_w) { m_current_channel = 1; if(m_dack[1] && state) m_dmac->dreq1_w(1); }
163WRITE_LINE_MEMBER(al_magicsound_device::sam2_w) { m_current_channel = 2; if(m_dack[2] && state) m_dmac->dreq2_w(1); }
164WRITE_LINE_MEMBER(al_magicsound_device::sam3_w) { m_current_channel = 3; if(m_dack[3] && state) m_dmac->dreq3_w(1); }
165
166READ8_MEMBER(al_magicsound_device::dma_read_byte)
167{
168   UINT8 ret = 0xff;
169   UINT8 page = (offset & 0xc000) >> 14;
170   
171   if(m_current_channel != -1)
172      ret = m_ramptr->read(m_page[m_current_channel][page] + (offset & 0x3fff));
173   return ret;
174}
175
176WRITE8_MEMBER(al_magicsound_device::dma_write_byte)
177{
178   m_output[m_current_channel] = data;
179}
180
181void al_magicsound_device::set_timer_gate(bool state)
182{
183   m_timer1->write_gate0(state);
184   m_timer1->write_gate1(state);
185   m_timer1->write_gate2(state);
186   m_timer2->write_gate0(state);
187   m_timer2->write_gate1(state);
188   m_timer2->write_gate2(state);
189}
190
trunk/src/emu/bus/cpc/magicsound.h
r0r249174
1// license:BSD-3-Clause
2// copyright-holders:Barry Rodewald
3/*
4 * magicsound.h
5 *
6 *  Magic Sound Board for the Aleste 520EX
7 *
8 *  DMA-based 4-channel sound board
9 * 
10 *  1x K1810WT37 DMA controller (i8237/AM9517A)
11 *  2x K1810WT54 programmable timers  (i8254)
12 *  1x K1118PA1 DAC  (MC10318)
13 *
14 *  I/O Ports:
15 *  FxDx: selects the board
16 *  F8Dx: DMA controller (R/w)
17 *  F9Dx: PIT timers (A2 active for channels 0-2, A3 active for channels 3-5) (W/O)
18 *  FADx: Volume control (A1-A0 = channel) (W/O, 6-bit)
19 *  FBDx: Mapper (A1-A0 = mapper page number, A3-A2 = channel, D5-D0 = inverted page number) (W/O)
20 *
21 *  Further info available here:  http://cpcwiki.eu/index.php/Magic_Sound_Board
22 *
23 */
24
25#ifndef MAGICSOUND_H_
26#define MAGICSOUND_H_
27
28#include "emu.h"
29#include "cpcexp.h"
30#include "sound/dmadac.h"
31#include "sound/dac.h"
32#include "machine/am9517a.h"
33#include "machine/pit8253.h"
34#include "machine/ram.h"
35
36class al_magicsound_device  : public device_t,
37                     public device_cpc_expansion_card_interface
38{
39public:
40   // construction/destruction
41   al_magicsound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
42
43   // optional information overrides
44   virtual machine_config_constructor device_mconfig_additions() const;
45
46   DECLARE_READ8_MEMBER(dmac_r);
47   DECLARE_WRITE8_MEMBER(dmac_w);
48   DECLARE_WRITE8_MEMBER(timer_w);
49   DECLARE_WRITE8_MEMBER(volume_w);
50   DECLARE_WRITE8_MEMBER(mapper_w);
51   DECLARE_WRITE_LINE_MEMBER(da0_w);
52   DECLARE_READ8_MEMBER(dma_read_byte);
53   DECLARE_WRITE8_MEMBER(dma_write_byte);
54   DECLARE_WRITE_LINE_MEMBER(dack0_w);
55   DECLARE_WRITE_LINE_MEMBER(dack1_w);
56   DECLARE_WRITE_LINE_MEMBER(dack2_w);
57   DECLARE_WRITE_LINE_MEMBER(dack3_w);
58   DECLARE_WRITE_LINE_MEMBER(sam0_w);
59   DECLARE_WRITE_LINE_MEMBER(sam1_w);
60   DECLARE_WRITE_LINE_MEMBER(sam2_w);
61   DECLARE_WRITE_LINE_MEMBER(sam3_w);
62
63protected:
64   // device-level overrides
65   virtual void device_start();
66   virtual void device_reset();
67
68private:
69   cpc_expansion_slot_device *m_slot;
70
71   required_device<dac_device> m_dac1;
72   required_device<am9517a_device> m_dmac;
73   required_device<pit8254_device> m_timer1;
74   required_device<pit8254_device> m_timer2;
75   
76   void set_timer_gate(bool state);
77   
78   UINT8 m_volume[4];
79   UINT32 m_page[4][4];
80   UINT8 m_output[4];
81   bool m_dack[4];
82   INT8 m_current_channel;
83   ram_device* m_ramptr;
84   UINT8 m_current_output;
85};
86
87// device type definition
88extern const device_type AL_MAGICSOUND;
89
90
91#endif /* MAGICSOUND_H_ */
trunk/src/mess/drivers/amstrad.c
r249173r249174
846846   SLOT_INTERFACE("hd20", CPC_HD20)
847847SLOT_INTERFACE_END
848848
849SLOT_INTERFACE_START(aleste_exp_cards)
850   SLOT_INTERFACE("ssa1", CPC_SSA1)
851   SLOT_INTERFACE("dkspeech", CPC_DKSPEECH)
852   SLOT_INTERFACE("rom", CPC_ROM)
853   SLOT_INTERFACE("multiface2", CPC_MFACE2)
854   SLOT_INTERFACE("pds", CPC_PDS)
855   SLOT_INTERFACE("rs232", CPC_RS232)
856   SLOT_INTERFACE("amsrs232", CPC_RS232_AMS)
857   SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
858   SLOT_INTERFACE("amdrum", CPC_AMDRUM)
859   SLOT_INTERFACE("playcity", CPC_PLAYCITY)
860   SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
861   SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
862   SLOT_INTERFACE("hd20", CPC_HD20)
863   SLOT_INTERFACE("magicsound", AL_MAGICSOUND)
864SLOT_INTERFACE_END
865
849866SLOT_INTERFACE_START(amstrad_centronics_devices)
850867   SLOT_INTERFACE("pl80", COMX_PL80)
851868   SLOT_INTERFACE("ex800", EPSON_EX800)
r249173r249174
11281145   MCFG_DEVICE_REMOVE("upd765")
11291146   MCFG_I8272A_ADD("upd765", true)
11301147
1148   MCFG_DEVICE_REMOVE("exp")
1149   MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0)
1150   MCFG_DEVICE_SLOT_INTERFACE(aleste_exp_cards, NULL, false)
1151   MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0))
1152   MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI))
1153   MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis))  // ROMDIS
1154   MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select))
1155
11311156   MCFG_FLOPPY_DRIVE_ADD("upd765:0", aleste_floppies, "35dd", amstrad_state::aleste_floppy_formats)
11321157   MCFG_FLOPPY_DRIVE_ADD("upd765:1", aleste_floppies, "35dd", amstrad_state::aleste_floppy_formats)
11331158
trunk/src/mess/includes/amstrad.h
r249173r249174
2929#include "bus/cpc/smartwatch.h"
3030#include "bus/cpc/brunword4.h"
3131#include "bus/cpc/hd20.h"
32#include "bus/cpc/magicsound.h"
3233#include "machine/ram.h"
3334#include "imagedev/cassette.h"
3435#include "bus/centronics/ctronics.h"
trunk/src/mess/machine/amstrad.c
r249173r249174
16941694WRITE8_MEMBER(amstrad_state::aleste_msx_mapper)
16951695{
16961696   int page = (offset & 0x0300) >> 8;
1697   int ramptr = (data & 0x1f) * 0x4000;
1698   int rampage = data & 0x1f;
1697   int ramptr = (data & 0x3f) * 0x4000;
1698   int rampage = data & 0x3f;
16991699   int function = (data & 0xc0) >> 6;
17001700   UINT8 *ram = m_ram->pointer();
17011701


Previous 199869 Revisions Next


© 1997-2024 The MAME Team