mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
tamag1: change to a hh_ collection driver
This commit is contained in:
parent
6aab489428
commit
d1513de7cf
@ -3,16 +3,19 @@
|
||||
// thanks-to:digshadow, Segher, azya
|
||||
/*******************************************************************************
|
||||
|
||||
Bandai Tamagotchi generation 1 hardware
|
||||
Seiko Epson E0C6S46 / E0C6S48 handhelds, mostly electronic keychain toys from
|
||||
the late-1990s. The first Tamagotchi games are on this MCU.
|
||||
|
||||
Hardware notes:
|
||||
- PCB label: TMG-M1
|
||||
- Seiko Epson E0C6S46 MCU under epoxy
|
||||
- 32*16 LCD screen + 8 custom segments
|
||||
- 1-bit sound
|
||||
These were meant to stay on 24/7, so make sure to use save states if you want
|
||||
to play the games for a longer time. For the drivers that don't have an SVG
|
||||
screen, use -prescale or -nofilter to disable bilinear filtering.
|
||||
|
||||
TODO:
|
||||
- add the Mothra version that was recently dumped (has a E0C6S48)
|
||||
- add the Mothra Tamagotchi version that was recently dumped (has a E0C6S48)
|
||||
- SVGs could be more accurate? it seems they're handmade instead of a 1:1 scan
|
||||
- alienfev unmapped reads/writes, or are they harmless?
|
||||
- add LCD deflicker like hh_sm510? see venusdm for example
|
||||
- hook up LCD contrast, does any game use it? (eg. for fade-out)
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
@ -25,36 +28,33 @@ TODO:
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
// internal artwork
|
||||
#include "hh_e0c6x_lcd.lh"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class tamag1_state : public driver_device
|
||||
class hh_e0c6x_state : public driver_device
|
||||
{
|
||||
public:
|
||||
tamag1_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
hh_e0c6x_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_out_x(*this, "%u.%u", 0U, 0U)
|
||||
{ }
|
||||
|
||||
void tama(machine_config &config);
|
||||
void alienfev(machine_config &config);
|
||||
void venusdm(machine_config &config);
|
||||
|
||||
DECLARE_INPUT_CHANGED_MEMBER(input_changed);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override ATTR_COLD;
|
||||
|
||||
private:
|
||||
void lcd_segment_w(offs_t offset, u8 data) { m_out_x[offset & 0xf][offset >> 4] = data; }
|
||||
void pixel_callback(int &dx, int &dy) { int x = dx; dx = dy | (dx / 20) << 4; dy = x % 20; }
|
||||
|
||||
required_device<e0c6s46_device> m_maincpu;
|
||||
output_finder<16, 40> m_out_x;
|
||||
};
|
||||
|
||||
void tamag1_state::machine_start()
|
||||
void hh_e0c6x_state::machine_start()
|
||||
{
|
||||
m_out_x.resolve();
|
||||
}
|
||||
@ -62,51 +62,69 @@ void tamag1_state::machine_start()
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Input Ports
|
||||
|
||||
Helper Functions
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
INPUT_CHANGED_MEMBER(tamag1_state::input_changed)
|
||||
// generic input handlers
|
||||
|
||||
#define PORT_CHANGED_CB(x) \
|
||||
PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(hh_e0c6x_state::input_changed), E0C6S46_LINE_K00 + x)
|
||||
|
||||
INPUT_CHANGED_MEMBER(hh_e0c6x_state::input_changed)
|
||||
{
|
||||
// inputs are hooked up backwards here, because MCU input ports are all tied to its interrupt controller
|
||||
m_maincpu->set_input_line(param, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( tama )
|
||||
PORT_START("K0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K00)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K01)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K02)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( alienfev )
|
||||
PORT_START("K0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K00) // mode
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K01) // select
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K02) // sound
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K03) // handle
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( venusdm )
|
||||
PORT_START("K1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K10)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K11)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(tamag1_state::input_changed), E0C6S46_LINE_K12)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Machine Configs
|
||||
|
||||
Minidrivers (subclass, I/O, Inputs, Machine Config, ROM Defs)
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
void tamag1_state::tama(machine_config &config)
|
||||
/*******************************************************************************
|
||||
|
||||
Bandai Tamagotchi (Generation 1)
|
||||
* PCB label: TMG-M1
|
||||
* Seiko Epson E0C6S46 MCU under epoxy
|
||||
* 32*16 LCD screen + 8 custom segments, 1-bit sound
|
||||
|
||||
Generation 2 is on the exact same hardware
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
class tama_state : public hh_e0c6x_state
|
||||
{
|
||||
public:
|
||||
tama_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
hh_e0c6x_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void tama(machine_config &config);
|
||||
};
|
||||
|
||||
// inputs
|
||||
|
||||
static INPUT_PORTS_START( tama )
|
||||
PORT_START("K0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_CB(0)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_CB(1)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_CB(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
// config
|
||||
|
||||
void tama_state::tama(machine_config &config)
|
||||
{
|
||||
// basic machine hardware
|
||||
E0C6S46(config, m_maincpu, 32.768_kHz_XTAL);
|
||||
m_maincpu->write_r<4>().set("speaker", FUNC(speaker_sound_device::level_w)).bit(3);
|
||||
m_maincpu->write_segs().set(FUNC(tamag1_state::lcd_segment_w));
|
||||
m_maincpu->write_segs().set(FUNC(tama_state::lcd_segment_w));
|
||||
|
||||
// video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG));
|
||||
@ -114,62 +132,14 @@ void tamag1_state::tama(machine_config &config)
|
||||
screen.set_size(1119, 1080);
|
||||
screen.set_visarea_full();
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
void tamag1_state::alienfev(machine_config &config)
|
||||
{
|
||||
// basic machine hardware
|
||||
E0C6S46(config, m_maincpu, 32.768_kHz_XTAL);
|
||||
m_maincpu->write_r<4>().set("speaker", FUNC(speaker_sound_device::level_w)).bit(3);
|
||||
m_maincpu->set_osc3(1'000'000);
|
||||
|
||||
// video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
|
||||
screen.set_refresh_hz(32);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||
screen.set_size(39, 16);
|
||||
screen.set_visarea_full();
|
||||
screen.set_screen_update(m_maincpu, FUNC(e0c6s46_device::screen_update));
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
|
||||
config.set_default_layout(layout_hh_e0c6x_lcd);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
void tamag1_state::venusdm(machine_config &config)
|
||||
{
|
||||
// basic machine hardware
|
||||
E0C6S46(config, m_maincpu, 32.768_kHz_XTAL);
|
||||
m_maincpu->write_r<4>().set("speaker", FUNC(speaker_sound_device::level_w)).bit(3);
|
||||
m_maincpu->set_pixel_callback(FUNC(tamag1_state::pixel_callback));
|
||||
|
||||
// video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
|
||||
screen.set_refresh_hz(32);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||
screen.set_size(32, 20);
|
||||
screen.set_visarea_full();
|
||||
screen.set_screen_update(m_maincpu, FUNC(e0c6s46_device::screen_update));
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
ROM Definitions
|
||||
*******************************************************************************/
|
||||
// roms
|
||||
|
||||
ROM_START( tama )
|
||||
ROM_REGION( 0x3000, "maincpu", 0 )
|
||||
@ -190,11 +160,138 @@ ROM_START( tamag2 )
|
||||
ROM_LOAD( "tama.svg", 0, 139072, CRC(9468b964) SHA1(ab49471db21a00a3b3a68da39c40da69da5d7e1b) )
|
||||
ROM_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
Epoch Chibi Pachi: Alien Fever
|
||||
* Seiko Epson E0C6S46 MCU
|
||||
* 39*16 LCD screen, 1-bit sound
|
||||
|
||||
It's a Pachislot keychain game, the MCU runs on the higher-speed OSC3.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
class alienfev_state : public hh_e0c6x_state
|
||||
{
|
||||
public:
|
||||
alienfev_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
hh_e0c6x_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void alienfev(machine_config &config);
|
||||
};
|
||||
|
||||
// inputs
|
||||
|
||||
static INPUT_PORTS_START( alienfev )
|
||||
PORT_START("K0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_CB(0) PORT_NAME("Mode")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_CB(1) PORT_NAME("Select")
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CHANGED_CB(2) PORT_NAME("Sound")
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_CB(3) PORT_NAME("Handle")
|
||||
INPUT_PORTS_END
|
||||
|
||||
// config
|
||||
|
||||
void alienfev_state::alienfev(machine_config &config)
|
||||
{
|
||||
// basic machine hardware
|
||||
E0C6S46(config, m_maincpu, 32.768_kHz_XTAL);
|
||||
m_maincpu->write_r<4>().set("speaker", FUNC(speaker_sound_device::level_w)).bit(3);
|
||||
m_maincpu->set_osc3(1'000'000);
|
||||
|
||||
// video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
|
||||
screen.set_refresh_hz(32);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||
screen.set_size(39, 16);
|
||||
screen.set_visarea_full();
|
||||
screen.set_screen_update(m_maincpu, FUNC(e0c6s46_device::screen_update));
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
|
||||
|
||||
config.set_default_layout(layout_hh_e0c6x_lcd);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
// roms
|
||||
|
||||
ROM_START( alienfev )
|
||||
ROM_REGION( 0x3000, "maincpu", 0 )
|
||||
ROM_LOAD( "alienfev.bin", 0x0000, 0x3000, CRC(e561599c) SHA1(7927e198f8989861ba057150e59d1f4ad403c1d2) )
|
||||
ROM_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
Nikko Beans Collection: Venus Diet Monogatari
|
||||
* Seiko Epson E0C6S46 MCU
|
||||
* 32*20 LCD screen, 1-bit sound
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
class venusdm_state : public hh_e0c6x_state
|
||||
{
|
||||
public:
|
||||
venusdm_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
hh_e0c6x_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void venusdm(machine_config &config);
|
||||
|
||||
private:
|
||||
void pixel_callback(int &dx, int &dy) { int x = dx; dx = dy | (dx / 20) << 4; dy = x % 20; }
|
||||
};
|
||||
|
||||
// inputs
|
||||
|
||||
static INPUT_PORTS_START( venusdm )
|
||||
PORT_START("K1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_CB(4)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_CB(5)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_CB(6)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
// config
|
||||
|
||||
void venusdm_state::venusdm(machine_config &config)
|
||||
{
|
||||
// basic machine hardware
|
||||
E0C6S46(config, m_maincpu, 32.768_kHz_XTAL);
|
||||
m_maincpu->write_r<4>().set("speaker", FUNC(speaker_sound_device::level_w)).bit(3);
|
||||
m_maincpu->set_pixel_callback(FUNC(venusdm_state::pixel_callback));
|
||||
|
||||
// video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
|
||||
screen.set_refresh_hz(32);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||
screen.set_size(32, 20);
|
||||
screen.set_visarea_full();
|
||||
screen.set_screen_update(m_maincpu, FUNC(e0c6s46_device::screen_update));
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
|
||||
|
||||
config.set_default_layout(layout_hh_e0c6x_lcd);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
// roms
|
||||
|
||||
ROM_START( venusdm )
|
||||
ROM_REGION( 0x3000, "maincpu", 0 )
|
||||
ROM_LOAD( "venusdm.bin", 0x0000, 0x3000, CRC(2228b081) SHA1(22f6a2ede6259e76f1c8b9b50171c54d8a7de502) )
|
||||
@ -205,11 +302,15 @@ ROM_END
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Drivers
|
||||
|
||||
Game driver(s)
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS
|
||||
SYST( 1997, tama, 0, 0, tama, tama, tamag1_state, empty_init, "Bandai", "Tamagotchi (Gen. 1, World)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
|
||||
SYST( 1997, tamag2, 0, 0, tama, tama, tamag1_state, empty_init, "Bandai", "Tamagotchi (Gen. 2, Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
|
||||
SYST( 1997, alienfev, 0, 0, alienfev, alienfev, tamag1_state, empty_init, "Epoch", "Chibi Pachi: Alien Fever", MACHINE_SUPPORTS_SAVE )
|
||||
SYST( 1997, venusdm, 0, 0, venusdm, venusdm, tamag1_state, empty_init, "Nikko", "Beans Collection: Venus Diet Monogatari", MACHINE_SUPPORTS_SAVE )
|
||||
SYST( 1997, tama, 0, 0, tama, tama, tama_state, empty_init, "Bandai", "Tamagotchi (Gen. 1, World)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
|
||||
SYST( 1997, tamag2, 0, 0, tama, tama, tama_state, empty_init, "Bandai", "Tamagotchi (Gen. 2, Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
|
||||
|
||||
SYST( 1997, alienfev, 0, 0, alienfev, alienfev, alienfev_state, empty_init, "Epoch", "Chibi Pachi: Alien Fever", MACHINE_SUPPORTS_SAVE )
|
||||
|
||||
SYST( 1997, venusdm, 0, 0, venusdm, venusdm, venusdm_state, empty_init, "Nikko", "Beans Collection: Venus Diet Monogatari", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -32,7 +32,7 @@ TODO:
|
||||
#include "speaker.h"
|
||||
|
||||
// internal artwork
|
||||
#include "hh_ht11xx_single.lh"
|
||||
#include "hh_ht11xx_lcd.lh"
|
||||
|
||||
|
||||
namespace {
|
||||
@ -67,7 +67,7 @@ void hh_ht11xx_state::mcfg_svg_screen(machine_config &config, u16 width, u16 hei
|
||||
screen.set_size(width, height);
|
||||
screen.set_visarea_full();
|
||||
|
||||
config.set_default_layout(layout_hh_ht11xx_single);
|
||||
config.set_default_layout(layout_hh_ht11xx_lcd);
|
||||
}
|
||||
|
||||
|
||||
|
15
src/mame/layout/hh_ht11xx_lcd.lay
Normal file
15
src/mame/layout/hh_ht11xx_lcd.lay
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
license:CC0-1.0
|
||||
authors:hap
|
||||
-->
|
||||
<mamelayout version="2">
|
||||
|
||||
<element name="lcdm"><rect><color red="0.7" green="0.71" blue="0.72" /></rect></element>
|
||||
|
||||
<view name="LCD Pixel Aspect (~scr0nativexaspect~:~scr0nativeyaspect~)">
|
||||
<screen index="0"><bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" /></screen>
|
||||
<element ref="lcdm" blend="multiply"><bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" /></element>
|
||||
</view>
|
||||
|
||||
</mamelayout>
|
Loading…
Reference in New Issue
Block a user