mystston.cpp: corrected ROM labels for the myststono set [The Dumping Union]

This commit is contained in:
Ivan Vangelista 2021-12-07 18:16:04 +01:00
parent 105f67f905
commit 01c98f7cba
3 changed files with 122 additions and 131 deletions

View File

@ -22,25 +22,13 @@
#include "speaker.h"
/*************************************
*
* Clocks
*
*************************************/
#define CPU_CLOCK (MYSTSTON_MASTER_CLOCK / 8)
#define AY8910_CLOCK (MYSTSTON_MASTER_CLOCK / 8)
/*************************************
*
* Interrupt system
*
*************************************/
void mystston_state::mystston_on_scanline_interrupt()
void mystston_state::on_scanline_interrupt()
{
m_maincpu->set_input_line(0, ASSERT_LINE);
}
@ -61,7 +49,7 @@ void mystston_state::irq_clear_w(uint8_t data)
INPUT_CHANGED_MEMBER(mystston_state::coin_inserted)
{
/* coin insertion causes an NMI */
// coin insertion causes an NMI
m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
}
@ -73,19 +61,19 @@ INPUT_CHANGED_MEMBER(mystston_state::coin_inserted)
*
*************************************/
void mystston_state::mystston_ay8910_select_w(uint8_t data)
void mystston_state::ay8910_select_w(uint8_t data)
{
/* bit 5 goes to 8910 #0 BDIR pin */
// bit 5 goes to 8910 #0 BDIR pin
if (((*m_ay8910_select & 0x20) == 0x20) && ((data & 0x20) == 0x00))
{
/* bit 4 goes to the 8910 #0 BC1 pin */
// bit 4 goes to the 8910 #0 BC1 pin
m_ay8910[0]->data_address_w(*m_ay8910_select >> 4, *m_ay8910_data);
}
/* bit 7 goes to 8910 #1 BDIR pin */
// bit 7 goes to 8910 #1 BDIR pin
if (((*m_ay8910_select & 0x80) == 0x80) && ((data & 0x80) == 0x00))
{
/* bit 6 goes to the 8910 #1 BC1 pin */
// bit 6 goes to the 8910 #1 BC1 pin
m_ay8910[1]->data_address_w(*m_ay8910_select >> 6, *m_ay8910_data);
}
@ -103,17 +91,17 @@ void mystston_state::mystston_ay8910_select_w(uint8_t data)
void mystston_state::main_map(address_map &map)
{
map(0x0000, 0x077f).ram();
map(0x0780, 0x07df).ram().share("spriteram");
map(0x0780, 0x07df).ram().share(m_spriteram);
map(0x07e0, 0x0fff).ram();
map(0x1000, 0x17ff).ram().share("fg_videoram");
map(0x1800, 0x1fff).ram().share("bg_videoram");
map(0x2000, 0x2000).mirror(0x1f8f).portr("IN0").w(FUNC(mystston_state::mystston_video_control_w)).share("video_control");
map(0x1000, 0x17ff).ram().share(m_fg_videoram);
map(0x1800, 0x1fff).ram().share(m_bg_videoram);
map(0x2000, 0x2000).mirror(0x1f8f).portr("IN0").w(FUNC(mystston_state::video_control_w)).share(m_video_control);
map(0x2010, 0x2010).mirror(0x1f8f).portr("IN1").w(FUNC(mystston_state::irq_clear_w));
map(0x2020, 0x2020).mirror(0x1f8f).portr("DSW0").writeonly().share("scroll");
map(0x2030, 0x2030).mirror(0x1f8f).portr("DSW1").writeonly().share("ay8910_data");
map(0x2040, 0x2040).mirror(0x1f8f).nopr().w(FUNC(mystston_state::mystston_ay8910_select_w)).share("ay8910_select");
map(0x2020, 0x2020).mirror(0x1f8f).portr("DSW0").writeonly().share(m_scroll);
map(0x2030, 0x2030).mirror(0x1f8f).portr("DSW1").writeonly().share(m_ay8910_data);
map(0x2040, 0x2040).mirror(0x1f8f).nopr().w(FUNC(mystston_state::ay8910_select_w)).share(m_ay8910_select);
map(0x2050, 0x2050).mirror(0x1f8f).noprw();
map(0x2060, 0x207f).mirror(0x1f80).ram().share("paletteram");
map(0x2060, 0x207f).mirror(0x1f80).ram().share(m_paletteram);
map(0x4000, 0xffff).rom();
}
@ -133,8 +121,8 @@ static INPUT_PORTS_START( mystston )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mystston_state,coin_inserted, 0)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mystston_state,coin_inserted, 0)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mystston_state, coin_inserted, 0)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mystston_state, coin_inserted, 0)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
@ -156,11 +144,11 @@ static INPUT_PORTS_START( mystston )
PORT_DIPNAME(0x04, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:4" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:5" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:6" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:7" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:4" ) // Listed as "Unused"
PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:5" ) // Listed as "Unused"
PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:6" ) // Listed as "Unused"
PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:7" ) // Listed as "Unused"
PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) // Listed as "Unused"
PORT_START("DSW1")
PORT_DIPNAME(0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2")
@ -173,7 +161,7 @@ static INPUT_PORTS_START( mystston )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) )
PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) // Listed as "Unused"
PORT_DIPNAME(0x20, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
@ -183,6 +171,15 @@ static INPUT_PORTS_START( mystston )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
INPUT_PORTS_END
static INPUT_PORTS_START( myststonoi )
PORT_INCLUDE(mystston)
PORT_MODIFY("DSW0")
PORT_DIPNAME(0x01, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1")
PORT_DIPSETTING( 0x01, "2" )
PORT_DIPSETTING( 0x00, "3" )
INPUT_PORTS_END
/*************************************
@ -193,19 +190,19 @@ INPUT_PORTS_END
void mystston_state::mystston(machine_config &config)
{
/* basic machine hardware */
M6502(config, m_maincpu, CPU_CLOCK);
// basic machine hardware
M6502(config, m_maincpu, MASTER_CLOCK / 8);
m_maincpu->set_addrmap(AS_PROGRAM, &mystston_state::main_map);
/* video hardware */
mystston_video(config);
// video hardware
video(config);
/* audio hardware */
// audio hardware
SPEAKER(config, "mono").front_center();
AY8910(config, m_ay8910[0], AY8910_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.30);
AY8910(config, m_ay8910[0], MASTER_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.30);
AY8910(config, m_ay8910[1], AY8910_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.30);
AY8910(config, m_ay8910[1], MASTER_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.30);
}
@ -245,40 +242,50 @@ ROM_START( mystston )
ROM_LOAD( "ic61", 0x0000, 0x0020, CRC(e802d6cf) SHA1(233ceb9e3a91939e1925766a696bc65ab0dffa50) )
ROM_END
ROM_START( myststono )
/*
actual label format is:
--------------
| T.M. |
| MYSTERIOUS |
| STONES |
| BB00- |
| @ 1984 |
| DATA EAST |
--------------
*/
ROM_START( myststono ) // TA-0010-P1-1 + TA-0010-P2-1 PCBs
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "ms0", 0x4000, 0x2000, CRC(6dacc05f) SHA1(43054199901639516205c7ea145462d0abea8fb1) )
ROM_LOAD( "ms1", 0x6000, 0x2000, CRC(a3546df7) SHA1(89c0349885a9369406a1121cd3db28963b25f2e6) )
ROM_LOAD( "ms2", 0x8000, 0x2000, CRC(43bc6182) SHA1(dc36c10eee20009922e89d9bfdf6c2f6ffb881ce) )
ROM_LOAD( "ms3", 0xa000, 0x2000, CRC(9322222b) SHA1(25192ac9e8e66cd2bc21c66c690c57c6b9836f2d) )
ROM_LOAD( "ms4", 0xc000, 0x2000, CRC(47cefe9b) SHA1(49422b664b1322373a9cd3cb2907f8f5492faf87) )
ROM_LOAD( "ms5", 0xe000, 0x2000, CRC(b37ae12b) SHA1(55ee1193088145c85adddd377d9e5ee58aca922f) )
ROM_LOAD( "bb00.ic102", 0x4000, 0x2000, CRC(6dacc05f) SHA1(43054199901639516205c7ea145462d0abea8fb1) )
ROM_LOAD( "bw01.ic90", 0x6000, 0x2000, CRC(a3546df7) SHA1(89c0349885a9369406a1121cd3db28963b25f2e6) )
ROM_LOAD( "bw02.ic76", 0x8000, 0x2000, CRC(43bc6182) SHA1(dc36c10eee20009922e89d9bfdf6c2f6ffb881ce) )
ROM_LOAD( "bw03.ic75", 0xa000, 0x2000, CRC(9322222b) SHA1(25192ac9e8e66cd2bc21c66c690c57c6b9836f2d) )
ROM_LOAD( "bw04.ic62", 0xc000, 0x2000, CRC(47cefe9b) SHA1(49422b664b1322373a9cd3cb2907f8f5492faf87) )
ROM_LOAD( "bw05.ic61", 0xe000, 0x2000, CRC(b37ae12b) SHA1(55ee1193088145c85adddd377d9e5ee58aca922f) )
ROM_REGION( 0x0c000, "gfx1", 0 )
ROM_LOAD( "ms6", 0x00000, 0x2000, CRC(85c83806) SHA1(cdfed6c224754e8f79b154533b06b7de4a44b4d3) )
ROM_LOAD( "ms9", 0x02000, 0x2000, CRC(b146c6ab) SHA1(712c0c17780f222be5c8b09185a22e900ab23944) )
ROM_LOAD( "ms7", 0x04000, 0x2000, CRC(d025f84d) SHA1(eaaaa0bde3db850098d04a0af85993026e503fc5) )
ROM_LOAD( "ms10", 0x06000, 0x2000, CRC(d85015b5) SHA1(f4afab248dfde354650e59fadd5ab9616b04dac1) )
ROM_LOAD( "ms8", 0x08000, 0x2000, CRC(53765d89) SHA1(c8bfc311123b076dccae9f7e3b95460bf9fc843d) )
ROM_LOAD( "ms11", 0x0a000, 0x2000, CRC(919ee527) SHA1(609ee854ab3a4fdbf3404a68a4a657b85250f742) )
ROM_REGION( 0xc000, "gfx1", 0 )
ROM_LOAD( "bw06.ic105", 0x00000, 0x2000, CRC(85c83806) SHA1(cdfed6c224754e8f79b154533b06b7de4a44b4d3) )
ROM_LOAD( "bw09.ic93", 0x02000, 0x2000, CRC(b146c6ab) SHA1(712c0c17780f222be5c8b09185a22e900ab23944) )
ROM_LOAD( "bw07.ic107", 0x04000, 0x2000, CRC(d025f84d) SHA1(eaaaa0bde3db850098d04a0af85993026e503fc5) )
ROM_LOAD( "bw10.ic95", 0x06000, 0x2000, CRC(d85015b5) SHA1(f4afab248dfde354650e59fadd5ab9616b04dac1) )
ROM_LOAD( "bw08.ic109", 0x08000, 0x2000, CRC(53765d89) SHA1(c8bfc311123b076dccae9f7e3b95460bf9fc843d) )
ROM_LOAD( "bw11.ic97", 0x0a000, 0x2000, CRC(919ee527) SHA1(609ee854ab3a4fdbf3404a68a4a657b85250f742) )
ROM_REGION( 0x0c000, "gfx2", 0 )
ROM_LOAD( "ms12", 0x00000, 0x2000, CRC(72d8331d) SHA1(f0a3bc6c9d9966f169f4721c2453f7ee210f0feb) )
ROM_LOAD( "ms13", 0x02000, 0x2000, CRC(845a1f9b) SHA1(aa2eabd2a5e89e150b5d2fb3d88f91902e5ebb48) )
ROM_LOAD( "ms14", 0x04000, 0x2000, CRC(822874b0) SHA1(9376d48045bf67df91d103effd1d08bd8debad26) )
ROM_LOAD( "ms15", 0x06000, 0x2000, CRC(4594e53c) SHA1(a011a5269a9b0ca7a964181efe8413d5637c34f4) )
ROM_LOAD( "ms16", 0x08000, 0x2000, CRC(2f470b0f) SHA1(79b50a7d113fed4669361c5f6c60ec96c94344c6) )
ROM_LOAD( "ms17", 0x0a000, 0x2000, CRC(38966d1b) SHA1(89e3e54d3298cefeb35922d2292e3e7b8e995871) )
ROM_LOAD( "bw12.ic15", 0x00000, 0x2000, CRC(72d8331d) SHA1(f0a3bc6c9d9966f169f4721c2453f7ee210f0feb) )
ROM_LOAD( "bw13.ic20", 0x02000, 0x2000, CRC(845a1f9b) SHA1(aa2eabd2a5e89e150b5d2fb3d88f91902e5ebb48) )
ROM_LOAD( "bw14.ic24", 0x04000, 0x2000, CRC(822874b0) SHA1(9376d48045bf67df91d103effd1d08bd8debad26) )
ROM_LOAD( "bw15.ic29", 0x06000, 0x2000, CRC(4594e53c) SHA1(a011a5269a9b0ca7a964181efe8413d5637c34f4) )
ROM_LOAD( "bw16.ic34", 0x08000, 0x2000, CRC(2f470b0f) SHA1(79b50a7d113fed4669361c5f6c60ec96c94344c6) )
ROM_LOAD( "bw17.ic38", 0x0a000, 0x2000, CRC(38966d1b) SHA1(89e3e54d3298cefeb35922d2292e3e7b8e995871) )
ROM_REGION( 0x0020, "proms", 0 )
ROM_LOAD( "ic61", 0x0000, 0x0020, CRC(e802d6cf) SHA1(233ceb9e3a91939e1925766a696bc65ab0dffa50) )
ROM_LOAD( "hlo.ic61", 0x0000, 0x0020, CRC(e802d6cf) SHA1(233ceb9e3a91939e1925766a696bc65ab0dffa50) )
ROM_END
// looks like Itisa made a (very) minor mod to the ROMs when producing the PCBs
ROM_START( myststonoi )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "14.bin", 0x4000, 0x2000, CRC(78bf2a58) SHA1(92e61041acad3293a103d957507b091321eed8f1) ) // 2 bytes changed in here
ROM_LOAD( "14.bin", 0x4000, 0x2000, CRC(78bf2a58) SHA1(92e61041acad3293a103d957507b091321eed8f1) ) // 2 bytes changed in here (values for the lives' dip-switch)
ROM_LOAD( "13.bin", 0x6000, 0x2000, CRC(a3546df7) SHA1(89c0349885a9369406a1121cd3db28963b25f2e6) )
ROM_LOAD( "12.bin", 0x8000, 0x2000, CRC(43bc6182) SHA1(dc36c10eee20009922e89d9bfdf6c2f6ffb881ce) )
ROM_LOAD( "11.bin", 0xa000, 0x2000, CRC(9322222b) SHA1(25192ac9e8e66cd2bc21c66c690c57c6b9836f2d) )
@ -318,6 +325,6 @@ ROM_END
*
*************************************/
GAME( 1984, mystston, 0, mystston, mystston, mystston_state, empty_init, ROT270, "Technos Japan", "Mysterious Stones - Dr. John's Adventure", MACHINE_SUPPORTS_SAVE )
GAME( 1984, myststono, mystston, mystston, mystston, mystston_state, empty_init, ROT270, "Technos Japan", "Mysterious Stones - Dr. Kick in Adventure", MACHINE_SUPPORTS_SAVE )
GAME( 1984, myststonoi, mystston, mystston, mystston, mystston_state, empty_init, ROT270, "Technos Japan", "Mysterious Stones - Dr. Kick in Adventure (Itisa PCB)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, mystston, 0, mystston, mystston, mystston_state, empty_init, ROT270, "Technos Japan", "Mysterious Stones - Dr. John's Adventure", MACHINE_SUPPORTS_SAVE )
GAME( 1984, myststono, mystston, mystston, mystston, mystston_state, empty_init, ROT270, "Technos Japan", "Mysterious Stones - Dr. Kick in Adventure", MACHINE_SUPPORTS_SAVE )
GAME( 1984, myststonoi, mystston, mystston, myststonoi, mystston_state, empty_init, ROT270, "Technos Japan", "Mysterious Stones - Dr. Kick in Adventure (Itisa PCB)", MACHINE_SUPPORTS_SAVE )

View File

@ -14,9 +14,6 @@
#include "tilemap.h"
#define MYSTSTON_MASTER_CLOCK (XTAL(12'000'000))
class mystston_state : public driver_device
{
public:
@ -25,12 +22,14 @@ public:
m_ay8910(*this, "ay%u", 1U),
m_ay8910_data(*this, "ay8910_data"),
m_ay8910_select(*this, "ay8910_select"),
m_dsw1(*this, "DSW1"),
m_bg_videoram(*this, "bg_videoram"),
m_fg_videoram(*this, "fg_videoram"),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_scroll(*this, "scroll"),
m_video_control(*this, "video_control") ,
m_video_control(*this, "video_control"),
m_color_prom(*this, "proms"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
@ -45,13 +44,15 @@ protected:
virtual void video_reset() override;
private:
static constexpr XTAL MASTER_CLOCK = XTAL(12'000'000);
/* machine state */
// machine state
required_device_array<ay8910_device, 2> m_ay8910;
required_shared_ptr<uint8_t> m_ay8910_data;
required_shared_ptr<uint8_t> m_ay8910_select;
required_ioport m_dsw1;
/* video state */
// video state
tilemap_t *m_fg_tilemap;
tilemap_t *m_bg_tilemap;
emu_timer *m_interrupt_timer;
@ -61,20 +62,22 @@ private:
required_shared_ptr<uint8_t> m_paletteram;
required_shared_ptr<uint8_t> m_scroll;
required_shared_ptr<uint8_t> m_video_control;
required_region_ptr<uint8_t> m_color_prom;
void irq_clear_w(uint8_t data);
void mystston_ay8910_select_w(uint8_t data);
void mystston_video_control_w(uint8_t data);
void ay8910_select_w(uint8_t data);
void video_control_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update_mystston(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_callback);
void set_palette();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip);
void mystston_on_scanline_interrupt();
void on_scanline_interrupt();
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
void mystston_video(machine_config &config);
void video(machine_config &config);
void main_map(address_map &map);
};

View File

@ -26,8 +26,8 @@
*
*************************************/
// HMC20
// set_raw(XTAL(12'000'000)/2, 384, 0, 256, 272, 8, 248)
#define PIXEL_CLOCK (XTAL(12'000'000) / 2)
// set_raw(MASTER_CLOCK / 2, 384, 0, 256, 272, 8, 248)
#define PIXEL_CLOCK (MASTER_CLOCK / 2)
#define HTOTAL (384)
#define HBEND (0)
#define HBSTART (256)
@ -52,13 +52,13 @@ TIMER_CALLBACK_MEMBER(mystston_state::interrupt_callback)
{
int scanline = param;
mystston_on_scanline_interrupt();
on_scanline_interrupt();
scanline = scanline + 16;
if (scanline >= VTOTAL)
scanline = FIRST_INT_VPOS;
/* the vertical synch chain is clocked by H256 -- this is probably not important, but oh well */
// the vertical synch chain is clocked by H256 -- this is probably not important, but oh well
m_interrupt_timer->adjust(m_screen->time_until_pos(scanline - 1, INT_HPOS), scanline);
}
@ -72,46 +72,41 @@ TIMER_CALLBACK_MEMBER(mystston_state::interrupt_callback)
void mystston_state::set_palette()
{
int i;
static const int resistances_rg[3] = { 4700, 3300, 1500 };
static const int resistances_b [2] = { 3300, 1500 };
double weights_rg[3], weights_b[2];
uint8_t *color_prom = memregion("proms")->base();
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 4700,
2, resistances_b, weights_b, 0, 4700,
0, nullptr, nullptr, 0, 0);
for (i = 0; i < 0x40; i++)
for (int i = 0; i < 0x40; i++)
{
uint8_t data;
int r, g, b;
int bit0, bit1, bit2;
/* first half is dynamic, second half is from the PROM */
// first half is dynamic, second half is from the PROM
if (i & 0x20)
data = color_prom[i & 0x1f];
data = m_color_prom[i & 0x1f];
else
data = m_paletteram[i];
/* red component */
bit0 = (data >> 0) & 0x01;
bit1 = (data >> 1) & 0x01;
bit2 = (data >> 2) & 0x01;
r = combine_weights(weights_rg, bit0, bit1, bit2);
// red component
int bit0 = (data >> 0) & 0x01;
int bit1 = (data >> 1) & 0x01;
int bit2 = (data >> 2) & 0x01;
int r = combine_weights(weights_rg, bit0, bit1, bit2);
/* green component */
// green component
bit0 = (data >> 3) & 0x01;
bit1 = (data >> 4) & 0x01;
bit2 = (data >> 5) & 0x01;
g = combine_weights(weights_rg, bit0, bit1, bit2);
int g = combine_weights(weights_rg, bit0, bit1, bit2);
/* blue component */
// blue component
bit0 = (data >> 6) & 0x01;
bit1 = (data >> 7) & 0x01;
b = combine_weights(weights_b, bit0, bit1);
int b = combine_weights(weights_b, bit0, bit1);
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
@ -125,20 +120,20 @@ void mystston_state::set_palette()
*
*************************************/
void mystston_state::mystston_video_control_w(uint8_t data)
void mystston_state::video_control_w(uint8_t data)
{
*m_video_control = data;
/* D0-D1 - foreground text color */
/* D2 - background page select */
/* D3 - unused */
// D0-D1 - foreground text color
// D2 - background page select
// D3 - unused
/* D4-D5 - coin counters in flipped order */
// D4-D5 - coin counters in flipped order
machine().bookkeeping().coin_counter_w(0, data & 0x20);
machine().bookkeeping().coin_counter_w(1, data & 0x10);
/* D6 - unused */
/* D7 - screen flip */
// D6 - unused
// D7 - screen flip
}
@ -177,9 +172,7 @@ TILE_GET_INFO_MEMBER(mystston_state::get_fg_tile_info)
void mystston_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip)
{
int offs;
for (offs = 0; offs < 0x60; offs += 4)
for (int offs = 0; offs < 0x60; offs += 4)
{
int attr = m_spriteram[offs];
@ -200,7 +193,7 @@ void mystston_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
flipy = !flipy;
}
gfx->transpen(bitmap,cliprect, code, color, flipx, flipy, x, y, 0);
gfx->transpen(bitmap,cliprect, code, color, flipx, flipy, x, y, 0);
}
}
}
@ -220,8 +213,8 @@ void mystston_state::video_start()
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mystston_state::get_fg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X, 8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
/* create the interrupt timer */
m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mystston_state::interrupt_callback),this));
// create the interrupt timer
m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mystston_state::interrupt_callback), this));
}
@ -245,9 +238,9 @@ void mystston_state::video_reset()
*
*************************************/
uint32_t mystston_state::screen_update_mystston(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t mystston_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int flip = (*m_video_control & 0x80) ^ ((ioport("DSW1")->read() & 0x20) << 2);
int flip = (*m_video_control & 0x80) ^ ((m_dsw1->read() & 0x20) << 2);
set_palette();
@ -270,18 +263,6 @@ uint32_t mystston_state::screen_update_mystston(screen_device &screen, bitmap_in
*
*************************************/
static const gfx_layout charlayout =
{
8,8,
RGN_FRAC(1,3),
3,
{ RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8
};
static const gfx_layout spritelayout =
{
16,16,
@ -297,7 +278,7 @@ static const gfx_layout spritelayout =
static GFXDECODE_START( gfx_mystston )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 4*8, 4 )
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x3_planar, 4*8, 4 )
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 2*8, 1 )
GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0*8, 2 )
GFXDECODE_END
@ -310,13 +291,13 @@ GFXDECODE_END
*
*************************************/
void mystston_state::mystston_video(machine_config &config)
void mystston_state::video(machine_config &config)
{
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mystston);
PALETTE(config, m_palette).set_entries(0x40);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
m_screen->set_screen_update(FUNC(mystston_state::screen_update_mystston));
m_screen->set_palette("palette");
m_screen->set_screen_update(FUNC(mystston_state::screen_update));
m_screen->set_palette(m_palette);
}