mirror of
https://github.com/holub/mame
synced 2025-05-04 21:43:05 +03:00
(MESS) gmaster.c: Switched to use simple speaker sound device. (nw)
This commit is contained in:
parent
cb8457a4d8
commit
39eda23169
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -5933,7 +5933,6 @@ src/mess/audio/dave.c svneol=native#text/plain
|
||||
src/mess/audio/dave.h svneol=native#text/plain
|
||||
src/mess/audio/gb.c svneol=native#text/plain
|
||||
src/mess/audio/gb.h svneol=native#text/plain
|
||||
src/mess/audio/gmaster.c svneol=native#text/plain
|
||||
src/mess/audio/lynx.c svneol=native#text/plain
|
||||
src/mess/audio/lynx.h svneol=native#text/plain
|
||||
src/mess/audio/mac.c svneol=native#text/plain
|
||||
@ -6554,7 +6553,6 @@ src/mess/includes/gamepock.h svneol=native#text/plain
|
||||
src/mess/includes/gb.h svneol=native#text/plain
|
||||
src/mess/includes/gba.h svneol=native#text/plain
|
||||
src/mess/includes/genpc.h svneol=native#text/plain
|
||||
src/mess/includes/gmaster.h svneol=native#text/plain
|
||||
src/mess/includes/gp32.h svneol=native#text/plain
|
||||
src/mess/includes/hec2hrp.h svneol=native#text/plain
|
||||
src/mess/includes/hp48.h svneol=native#text/plain
|
||||
|
@ -1,104 +0,0 @@
|
||||
/***************************************************************************
|
||||
PeT mess@utanet.at march 2002
|
||||
***************************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include "emu.h"
|
||||
#include "cpu/upd7810/upd7810.h"
|
||||
#include "includes/gmaster.h"
|
||||
|
||||
struct gmaster_sound
|
||||
{
|
||||
/*bool*/int level;
|
||||
sound_stream *mixer_channel;
|
||||
};
|
||||
|
||||
|
||||
static gmaster_sound *get_token(device_t *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->type() == GMASTER);
|
||||
return (gmaster_sound *) downcast<gmaster_sound_device *>(device)->token();
|
||||
}
|
||||
|
||||
|
||||
int gmaster_io_callback(device_t *device, int ioline, int state)
|
||||
{ /* comes across with cpu device - need to use sound device */
|
||||
gmaster_sound *token = get_token(device->machine().device("custom"));
|
||||
|
||||
switch (ioline)
|
||||
{
|
||||
case UPD7810_TO:
|
||||
token->mixer_channel->update();
|
||||
token->level = state;
|
||||
break;
|
||||
default:
|
||||
logerror("io changed %d %.2x\n",ioline, state);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
/* Sound handler update */
|
||||
/************************************/
|
||||
static STREAM_UPDATE( gmaster_update )
|
||||
{
|
||||
int i;
|
||||
gmaster_sound *token = get_token(device);
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
for (i = 0; i < samples; i++, buffer++)
|
||||
{
|
||||
*buffer = token->level ? 0x4000 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************/
|
||||
/* Sound handler start */
|
||||
/************************************/
|
||||
|
||||
static DEVICE_START( gmaster_sound )
|
||||
{
|
||||
gmaster_sound *token = get_token(device);
|
||||
token->mixer_channel = device->machine().sound().stream_alloc(*device, 0, 1, device->machine().sample_rate(), 0, gmaster_update);
|
||||
}
|
||||
|
||||
const device_type GMASTER = &device_creator<gmaster_sound_device>;
|
||||
|
||||
gmaster_sound_device::gmaster_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, GMASTER, "Game Master Custom", tag, owner, clock),
|
||||
device_sound_interface(mconfig, *this)
|
||||
{
|
||||
m_token = global_alloc_clear(gmaster_sound);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void gmaster_sound_device::device_config_complete()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void gmaster_sound_device::device_start()
|
||||
{
|
||||
DEVICE_START_NAME( gmaster_sound )(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void gmaster_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
// should never get here
|
||||
fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
|
||||
}
|
@ -5,8 +5,48 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/upd7810/upd7810.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "sound/speaker.h"
|
||||
#include "rendlay.h"
|
||||
#include "includes/gmaster.h"
|
||||
|
||||
|
||||
struct GMASTER_VIDEO
|
||||
{
|
||||
UINT8 data[8];
|
||||
int index;
|
||||
int x, y;
|
||||
/*bool*/int mode; // true read does not increase address
|
||||
/*bool*/int delayed;
|
||||
UINT8 pixels[8][64/*>=62 sure*/];
|
||||
};
|
||||
|
||||
struct GMASTER_MACHINE
|
||||
{
|
||||
UINT8 ports[5];
|
||||
};
|
||||
|
||||
|
||||
class gmaster_state : public driver_device
|
||||
{
|
||||
public:
|
||||
gmaster_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_speaker(*this, "speaker")
|
||||
{ }
|
||||
|
||||
GMASTER_VIDEO m_video;
|
||||
GMASTER_MACHINE m_gmachine;
|
||||
DECLARE_READ8_MEMBER(gmaster_io_r);
|
||||
DECLARE_WRITE8_MEMBER(gmaster_io_w);
|
||||
DECLARE_READ8_MEMBER(gmaster_port_r);
|
||||
DECLARE_WRITE8_MEMBER(gmaster_port_w);
|
||||
DECLARE_DRIVER_INIT(gmaster);
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(gmaster_interrupt);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
};
|
||||
|
||||
|
||||
READ8_MEMBER(gmaster_state::gmaster_io_r)
|
||||
@ -120,7 +160,7 @@ WRITE8_MEMBER(gmaster_state::gmaster_port_w)
|
||||
{
|
||||
case UPD7810_PORTC:
|
||||
m_video.y = BLITTER_Y;
|
||||
gmaster_io_callback(this, UPD7810_TO, ( data & 0x10 ) ? 1 : 0 );
|
||||
speaker_level_w( m_speaker, ( data & 0x10 ) ? 1 : 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -211,11 +251,11 @@ INTERRUPT_GEN_MEMBER(gmaster_state::gmaster_interrupt)
|
||||
static const UPD7810_CONFIG config = {
|
||||
// TYPE_78C10, // 78c11 in handheld
|
||||
TYPE_7810, // temporarily until 7810 core fixes synchronized
|
||||
gmaster_io_callback
|
||||
NULL
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( gmaster, gmaster_state )
|
||||
MCFG_CPU_ADD("maincpu", UPD7810, XTAL_12MHz/2/*?*/)
|
||||
MCFG_CPU_ADD("maincpu", UPD7810, XTAL_12MHz/2/*?*/) // upd78c11 in the unit
|
||||
MCFG_CPU_PROGRAM_MAP(gmaster_mem)
|
||||
MCFG_CPU_IO_MAP( gmaster_io)
|
||||
MCFG_CPU_CONFIG( config )
|
||||
@ -231,7 +271,7 @@ static MACHINE_CONFIG_START( gmaster, gmaster_state )
|
||||
MCFG_DEFAULT_LAYOUT(layout_lcd)
|
||||
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_SOUND_ADD("custom", GMASTER, 0)
|
||||
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
|
||||
MCFG_SOUND_ROUTE(0, "mono", 0.50)
|
||||
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
|
@ -1,69 +0,0 @@
|
||||
#ifndef __GMASTER_H__
|
||||
#define __GMASTER_H__
|
||||
|
||||
struct GMASTER_VIDEO
|
||||
{
|
||||
UINT8 data[8];
|
||||
int index;
|
||||
int x, y;
|
||||
/*bool*/int mode; // true read does not increase address
|
||||
/*bool*/int delayed;
|
||||
UINT8 pixels[8][64/*>=62 sure*/];
|
||||
};
|
||||
|
||||
struct GMASTER_MACHINE
|
||||
{
|
||||
UINT8 ports[5];
|
||||
};
|
||||
|
||||
|
||||
class gmaster_state : public driver_device
|
||||
{
|
||||
public:
|
||||
gmaster_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu") { }
|
||||
|
||||
GMASTER_VIDEO m_video;
|
||||
GMASTER_MACHINE m_gmachine;
|
||||
DECLARE_READ8_MEMBER(gmaster_io_r);
|
||||
DECLARE_WRITE8_MEMBER(gmaster_io_w);
|
||||
DECLARE_READ8_MEMBER(gmaster_port_r);
|
||||
DECLARE_WRITE8_MEMBER(gmaster_port_w);
|
||||
DECLARE_DRIVER_INIT(gmaster);
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(gmaster_interrupt);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in audio/gmaster.c -----------*/
|
||||
|
||||
class gmaster_sound_device : public device_t,
|
||||
public device_sound_interface
|
||||
{
|
||||
public:
|
||||
gmaster_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~gmaster_sound_device() { global_free(m_token); }
|
||||
|
||||
// access to legacy token
|
||||
void *token() const { assert(m_token != NULL); return m_token; }
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
private:
|
||||
// internal state
|
||||
void *m_token;
|
||||
};
|
||||
|
||||
extern const device_type GMASTER;
|
||||
|
||||
|
||||
int gmaster_io_callback(device_t *device, int ioline, int state);
|
||||
|
||||
#endif /* __GMASTER_H__ */
|
@ -1182,7 +1182,6 @@ $(MESSOBJ)/grundy.a: \
|
||||
|
||||
$(MESSOBJ)/hartung.a: \
|
||||
$(MESS_DRIVERS)/gmaster.o \
|
||||
$(MESS_AUDIO)/gmaster.o \
|
||||
|
||||
$(MESSOBJ)/heathkit.a: \
|
||||
$(MESS_DRIVERS)/et3400.o \
|
||||
|
Loading…
Reference in New Issue
Block a user