From b0ee1b65f9c7b34aa4fd2902f2e4a856d8fdc36d Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 13 May 2015 22:37:23 +0200 Subject: [PATCH] added tamagotchi internal layout --- src/mess/drivers/tamag1.c | 33 +++++++++++++----- src/mess/layout/tama.lay | 72 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 src/mess/layout/tama.lay diff --git a/src/mess/drivers/tamag1.c b/src/mess/drivers/tamag1.c index 569eb4caed5..ccfc175c18d 100644 --- a/src/mess/drivers/tamag1.c +++ b/src/mess/drivers/tamag1.c @@ -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 ) diff --git a/src/mess/layout/tama.lay b/src/mess/layout/tama.lay new file mode 100644 index 00000000000..e4a8c62aaab --- /dev/null +++ b/src/mess/layout/tama.lay @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +