added tamagotchi internal layout

This commit is contained in:
hap 2015-05-13 22:37:23 +02:00
parent 8923ae9911
commit b0ee1b65f9
2 changed files with 97 additions and 8 deletions

View File

@ -3,8 +3,8 @@
/***************************************************************************
Bandai Tamagotchi generation 1 hardware
** SKELETON Driver - feel free to add notes here, but driver itself is WIP
* PCB label TMG-M1
* Seiko Epson E0C6S46 MCU under epoxy
***************************************************************************/
@ -12,6 +12,8 @@
#include "cpu/e0c6200/e0c6s46.h"
#include "sound/speaker.h"
#include "tama.lh"
class tamag1_state : public driver_device
{
@ -39,7 +41,7 @@ public:
static E0C6S46_PIXEL_UPDATE_CB(tama_pixel_update)
{
// 16 COM(common) pins, 40 SEG(segment) pins from MCU,
// 32x16 LCD screen and 2 rows of indicators
// 32x16 LCD screen:
static const int seg2x[0x28] =
{
0, 1, 2, 3, 4, 5, 6, 7,
@ -48,16 +50,31 @@ static E0C6S46_PIXEL_UPDATE_CB(tama_pixel_update)
27,26,25,24,36,23,22,21,
20,19,18,17,16,37,38,39
};
int y = com, x = seg2x[seg];
if (cliprect.contains(x, y))
bitmap.pix16(y, x) = state;
// 2 rows of indicators:
// above screen: 0:meal, 1:lamp, 2:play, 3:medicine
// under screen: 4:bath, 5:scales, 6:shout, 7:attention
// they are on pin SEG08(x=35) + COM00-03, pin SEG28(x=36) + COM12-15
if (x == 35 && y < 4)
output_set_lamp_value(y, state);
else if (x == 36 && y >= 12)
output_set_lamp_value(y-8, state);
// output for svg2lay
char buf[0x10];
sprintf(buf, "%d.%d", y, x);
output_set_value(buf, state);
}
PALETTE_INIT_MEMBER(tamag1_state, tama)
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
palette.set_pen_color(0, rgb_t(0xf0, 0xf2, 0xff)); // background
palette.set_pen_color(1, rgb_t(0x3c, 0x38, 0x38)); // lcd pixel
}
@ -105,7 +122,7 @@ static MACHINE_CONFIG_START( tama, tamag1_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(40, 16)
MCFG_SCREEN_VISIBLE_AREA(0, 32-1, 0, 16-1)
// MCFG_DEFAULT_LAYOUT(layout_tama)
MCFG_DEFAULT_LAYOUT(layout_tama)
MCFG_SCREEN_UPDATE_DEVICE("maincpu", e0c6s46_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
@ -133,4 +150,4 @@ ROM_START( tama )
ROM_END
CONS( 1997, tama, 0, 0, tama, tama, driver_device, 0, "Bandai", "Tamagotchi (USA)", GAME_NOT_WORKING )
CONS( 1997, tama, 0, 0, tama, tama, driver_device, 0, "Bandai", "Tamagotchi (USA)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )

72
src/mess/layout/tama.lay Normal file
View File

@ -0,0 +1,72 @@
<?xml version="1.0"?>
<mamelayout version="2">
<!-- define elements -->
<element name="static_yellow"><rect><color red="0.91" green="0.9" blue="0.78" /></rect></element>
<element name="ind0" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="FOOD"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="FOOD"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind1" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="LAMP"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="LAMP"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind2" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="PLAY"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="PLAY"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind3" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="MEDS"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="MEDS"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind4" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="BATH"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="BATH"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind5" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="STATS"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="STATS"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind6" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="SHOUT"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="SHOUT"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<element name="ind7" defstate="0">
<rect><color red="0.91" green="0.9" blue="0.78" /></rect>
<text state="0" string="ATTN"><color red="0.87" green="0.86" blue="0.74" /></text>
<text state="1" string="ATTN"><color red="0.22" green="0.2" blue="0.2" /></text>
</element>
<!-- build screen -->
<view name="Internal Layout">
<bounds left="0" top="0" right="32" bottom="26" />
<screen index="0">
<bounds x="0" y="5" width="32" height="16" />
</screen>
<bezel element="static_yellow"><bounds x="0" y="0" width="32" height="4" /></bezel>
<bezel element="static_yellow"><bounds x="0" y="22" width="32" height="4" /></bezel>
<bezel name="lamp0" element="ind0"><bounds x="0" y="1" width="8" height="2" /></bezel>
<bezel name="lamp1" element="ind1"><bounds x="8" y="1" width="8" height="2" /></bezel>
<bezel name="lamp2" element="ind2"><bounds x="16" y="1" width="8" height="2" /></bezel>
<bezel name="lamp3" element="ind3"><bounds x="24" y="1" width="8" height="2" /></bezel>
<bezel name="lamp4" element="ind4"><bounds x="0" y="23" width="8" height="2" /></bezel>
<bezel name="lamp5" element="ind5"><bounds x="8" y="23" width="8" height="2" /></bezel>
<bezel name="lamp6" element="ind6"><bounds x="16" y="23" width="8" height="2" /></bezel>
<bezel name="lamp7" element="ind7"><bounds x="24" y="23" width="8" height="2" /></bezel>
</view>
</mamelayout>