summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2014-05-15 05:28:02 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2014-05-15 05:28:02 +0000
commitcd941da1657929e60dce840c05d71a786b379b65 (patch)
treebc505f7aa4e6759db8d7216e4dac5ecfc6c619b8 /src/emu
parent5b22660639682358a801ad2072845cdb518d7d62 (diff)
Gaelco CG-1V/GAE1: converted to use inline configs. nw.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/sound/gaelco.c22
-rw-r--r--src/emu/sound/gaelco.h41
2 files changed, 29 insertions, 34 deletions
diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c
index d2aa0f7ef66..6e073b91c9a 100644
--- a/src/emu/sound/gaelco.c
+++ b/src/emu/sound/gaelco.c
@@ -58,7 +58,8 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char
: device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock, "gaelco_gae1", __FILE__),
device_sound_interface(mconfig, *this),
m_stream(NULL),
- m_snd_data(NULL)
+ m_snd_data(NULL),
+ m_data_tag(NULL)
{
}
@@ -66,7 +67,8 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_typ
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_sound_interface(mconfig, *this),
m_stream(NULL),
- m_snd_data(NULL)
+ m_snd_data(NULL),
+ m_data_tag(NULL)
{
}
@@ -236,21 +238,15 @@ WRITE16_MEMBER( gaelco_gae1_device::gaelcosnd_w )
void gaelco_gae1_device::device_start()
{
- int j, vol;
- const gaelcosnd_interface *intf = (const gaelcosnd_interface *)static_config();
-
- /* copy rom banks */
- for (j = 0; j < 4; j++){
- m_banks[j] = intf->banks[j];
- }
m_stream = stream_alloc(0, 2, 8000);
- m_snd_data = (UINT8 *)machine().root_device().memregion(intf->gfxregion)->base();
+
+ m_snd_data = (UINT8 *)machine().root_device().memregion(m_data_tag)->base();
if (m_snd_data == NULL)
m_snd_data = *region();
/* init volume table */
- for (vol = 0; vol < GAELCO_VOLUME_LEVELS; vol++){
- for (j = -128; j <= 127; j++){
+ for (int vol = 0; vol < GAELCO_VOLUME_LEVELS; vol++){
+ for (int j = -128; j <= 127; j++){
m_volume_table[vol][(j ^ 0x80) & 0xff] = (vol*j*256)/(GAELCO_VOLUME_LEVELS - 1);
}
}
@@ -268,8 +264,6 @@ void gaelco_gae1_device::device_stop()
}
-
-
/*============================================================================
Gaelco CG-1V sound device
============================================================================*/
diff --git a/src/emu/sound/gaelco.h b/src/emu/sound/gaelco.h
index fdb3a984685..c1cf64ed6d7 100644
--- a/src/emu/sound/gaelco.h
+++ b/src/emu/sound/gaelco.h
@@ -1,7 +1,7 @@
#pragma once
-#ifndef __GALELCO_H__
-#define __GALELCO_H__
+#ifndef __GAELCO_SND_H__
+#define __GAELCO_SND_H__
#define GAELCO_NUM_CHANNELS 0x07
#define GAELCO_VOLUME_LEVELS 0x10
@@ -11,14 +11,12 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_GAELCO_GAE1_ADD(_tag, _clock) \
- MCFG_DEVICE_ADD(_tag, GAELCO_GAE1, _clock)
-#define MCFG_GAELCO_GAE1_REPLACE(_tag, _clock) \
- MCFG_DEVICE_REPLACE(_tag, GAELCO_GAE1, _clock)
-#define MCFG_GAELCO_CG1V_ADD(_tag, _clock) \
- MCFG_DEVICE_ADD(_tag, GAELCO_CG1V, _clock)
-#define MCFG_GAELCO_CG1V_REPLACE(_tag, _clock) \
- MCFG_DEVICE_REPLACE(_tag, GAELCO_CG1V, _clock)
+#define MCFG_GAELCO_SND_DATA(_tag) \
+ gaelco_gae1_device::set_snd_data_tag(*device, _tag);
+
+#define MCFG_GAELCO_BANKS(_offs1, _offs2, _offs3, _offs4) \
+ gaelco_gae1_device::set_bank_offsets(*device, _offs1, _offs2, _offs3, _offs4);
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -34,15 +32,6 @@ struct gaelco_sound_channel
};
-// ======================> External interface
-
-struct gaelcosnd_interface
-{
- const char *gfxregion; /* shared gfx region name */
- int banks[4]; /* start of each ROM bank */
-};
-
-
// ======================> gaelco_gae1_device
class gaelco_gae1_device : public device_t,
@@ -53,6 +42,16 @@ public:
gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
~gaelco_gae1_device() { }
+ static void set_snd_data_tag(device_t &device, const char *tag) { downcast<gaelco_gae1_device &>(device).m_data_tag = tag; }
+ static void set_bank_offsets(device_t &device, int offs1, int offs2, int offs3, int offs4)
+ {
+ gaelco_gae1_device &dev = downcast<gaelco_gae1_device &>(device);
+ dev.m_banks[0] = offs1;
+ dev.m_banks[1] = offs2;
+ dev.m_banks[2] = offs3;
+ dev.m_banks[3] = offs4;
+ }
+
protected:
// device-level overrides
virtual void device_start();
@@ -71,6 +70,8 @@ private:
int m_banks[4]; /* start of each ROM bank */
gaelco_sound_channel m_channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */
+ const char *m_data_tag;
+
UINT16 m_sndregs[0x38];
// Table for converting from 8 to 16 bits with volume control
@@ -92,4 +93,4 @@ public:
extern const device_type GAELCO_CG1V;
-#endif /* __GALELCO_H__ */
+#endif /* __GAELCO_SND_H__ */
(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); required_device<cpu_device> m_maincpu; required_device<cpu_device> m_mcu; required_device<scn2674_device> m_crtc; required_device<pic8259_device> m_pic2; }; class pcd_video_device : public pcdx_video_device { public: pcd_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual void map(address_map &map) override; DECLARE_WRITE8_MEMBER(vram_sw_w); DECLARE_READ8_MEMBER(vram_r); DECLARE_WRITE8_MEMBER(vram_w); protected: void device_start() override; void device_reset() override; virtual const tiny_rom_entry *device_rom_region() const override; virtual void device_add_mconfig(machine_config &config) override; virtual ioport_constructor device_input_ports() const override; private: required_ioport m_mouse_btn; required_ioport m_mouse_x; required_ioport m_mouse_y; std::vector<uint8_t> m_vram; std::vector<uint8_t> m_charram; uint8_t m_vram_sw, m_t1, m_p2; struct { int phase; int x; int y; int prev_x; int prev_y; int xa; int xb; int ya; int yb; } m_mouse; DECLARE_READ_LINE_MEMBER(t1_r); DECLARE_READ8_MEMBER(p1_r); DECLARE_WRITE8_MEMBER(p2_w); TIMER_DEVICE_CALLBACK_MEMBER(mouse_timer); SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); }; class pcx_video_device : public pcdx_video_device, public device_serial_interface { public: pcx_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); template <class Object> devcb_base &set_txd_handler(Object &&cb) { return m_txd_handler.set_callback(std::forward<Object>(cb)); } virtual void map(address_map &map) override; DECLARE_READ8_MEMBER(term_r); DECLARE_WRITE8_MEMBER(term_w); DECLARE_READ8_MEMBER(term_mcu_r); DECLARE_WRITE8_MEMBER(term_mcu_w); DECLARE_READ8_MEMBER(vram_r); DECLARE_WRITE8_MEMBER(vram_w); DECLARE_READ8_MEMBER(vram_latch_r); DECLARE_WRITE8_MEMBER(vram_latch_w); DECLARE_READ8_MEMBER(unk_r); DECLARE_WRITE8_MEMBER(p1_w); void pcx_vid_io(address_map &map); void pcx_vid_map(address_map &map); void pcx_vram(address_map &map); protected: void device_start() override; void device_reset() override; virtual const tiny_rom_entry *device_rom_region() const override; virtual void device_add_mconfig(machine_config &config) override; void tra_callback() override; void rcv_complete() override; private: std::vector<uint8_t> m_vram; required_region_ptr<uint8_t> m_charrom; devcb_write_line m_txd_handler; uint8_t m_term_key, m_term_char, m_term_stat, m_vram_latch_r[2], m_vram_latch_w[2], m_p1; DECLARE_READ8_MEMBER(rx_callback); DECLARE_WRITE8_MEMBER(tx_callback); SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); }; DECLARE_DEVICE_TYPE(PCD_VIDEO, pcd_video_device) DECLARE_DEVICE_TYPE(PCX_VIDEO, pcx_video_device) #endif // MAME_VIDEO_PCD_H