hotblock.c, ironhors.c: added save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-03-06 18:33:26 +01:00
parent 6000d9f9fb
commit 77c98e46a6
4 changed files with 87 additions and 82 deletions

View File

@ -50,10 +50,14 @@ class hotblock_state : public driver_device
public:
hotblock_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_vram(*this, "vram"),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette") { }
m_palette(*this, "palette"),
m_vram(*this, "vram") { }
/* devices */
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
/* memory pointers */
required_shared_ptr<UINT8> m_vram;
@ -63,21 +67,21 @@ public:
/* memory */
UINT8 m_pal[0x10000];
DECLARE_READ8_MEMBER(hotblock_video_read);
DECLARE_READ8_MEMBER(hotblock_port4_r);
DECLARE_WRITE8_MEMBER(hotblock_port4_w);
DECLARE_WRITE8_MEMBER(hotblock_port0_w);
DECLARE_WRITE8_MEMBER(hotblock_video_write);
DECLARE_READ8_MEMBER(video_read);
DECLARE_READ8_MEMBER(port4_r);
DECLARE_WRITE8_MEMBER(port4_w);
DECLARE_WRITE8_MEMBER(port0_w);
DECLARE_WRITE8_MEMBER(video_write);
virtual void video_start();
UINT32 screen_update_hotblock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(hotblocks_irq);
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
};
READ8_MEMBER(hotblock_state::hotblock_video_read)
READ8_MEMBER(hotblock_state::video_read)
{
/* right?, anything else?? */
if (m_port0 & 0x20) // port 0 = a8 e8 -- palette
@ -91,14 +95,14 @@ READ8_MEMBER(hotblock_state::hotblock_video_read)
}
/* port 4 is some kind of eeprom / storage .. used to store the scores */
READ8_MEMBER(hotblock_state::hotblock_port4_r)
READ8_MEMBER(hotblock_state::port4_r)
{
// osd_printf_debug("port4_r\n");
return 0x00;
}
WRITE8_MEMBER(hotblock_state::hotblock_port4_w)
WRITE8_MEMBER(hotblock_state::port4_w)
{
// osd_printf_debug("port4_w: pc = %06x : data %04x\n", space.device().safe_pc(), data);
// popmessage("port4_w: pc = %06x : data %04x", space.device().safe_pc(), data);
@ -108,14 +112,14 @@ WRITE8_MEMBER(hotblock_state::hotblock_port4_w)
WRITE8_MEMBER(hotblock_state::hotblock_port0_w)
WRITE8_MEMBER(hotblock_state::port0_w)
{
// popmessage("port4_w: pc = %06x : data %04x", space.device().safe_pc(), data);
m_port0 = data;
}
WRITE8_MEMBER(hotblock_state::hotblock_video_write)
WRITE8_MEMBER(hotblock_state::video_write)
{
/* right?, anything else?? */
if (m_port0 & 0x20) // port 0 = a8 e8 -- palette
@ -130,13 +134,13 @@ WRITE8_MEMBER(hotblock_state::hotblock_video_write)
static ADDRESS_MAP_START( hotblock_map, AS_PROGRAM, 8, hotblock_state )
AM_RANGE(0x00000, 0x0ffff) AM_RAM
AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(hotblock_video_read, hotblock_video_write) AM_SHARE("vram")
AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(video_read, video_write) AM_SHARE("vram")
AM_RANGE(0x20000, 0xfffff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( hotblock_io, AS_IO, 8, hotblock_state )
AM_RANGE(0x0000, 0x0000) AM_WRITE(hotblock_port0_w)
AM_RANGE(0x0004, 0x0004) AM_READWRITE(hotblock_port4_r, hotblock_port4_w)
AM_RANGE(0x0000, 0x0000) AM_WRITE(port0_w)
AM_RANGE(0x0004, 0x0004) AM_READWRITE(port4_r, port4_w)
AM_RANGE(0x8000, 0x8001) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
AM_RANGE(0x8001, 0x8001) AM_DEVREAD("aysnd", ay8910_device, data_r)
ADDRESS_MAP_END
@ -146,9 +150,11 @@ ADDRESS_MAP_END
void hotblock_state::video_start()
{
save_item(NAME(m_pal));
save_item(NAME(m_port0));
save_item(NAME(m_port4)); //stored but not read for now
}
UINT32 hotblock_state::screen_update_hotblock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 hotblock_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int y, x, count;
int i;
@ -200,18 +206,13 @@ static INPUT_PORTS_START( hotblock )
INPUT_PORTS_END
INTERRUPT_GEN_MEMBER(hotblock_state::hotblocks_irq)/* right? */
{
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
static MACHINE_CONFIG_START( hotblock, hotblock_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", I8088, 10000000)
MCFG_CPU_PROGRAM_MAP(hotblock_map)
MCFG_CPU_IO_MAP(hotblock_io)
MCFG_CPU_VBLANK_INT_DRIVER("screen", hotblock_state, hotblocks_irq)
MCFG_CPU_VBLANK_INT_DRIVER("screen", hotblock_state, nmi_line_pulse) /* right? */
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@ -219,7 +220,7 @@ static MACHINE_CONFIG_START( hotblock, hotblock_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(1024,1024)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1)
MCFG_SCREEN_UPDATE_DRIVER(hotblock_state, screen_update_hotblock)
MCFG_SCREEN_UPDATE_DRIVER(hotblock_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 256)
@ -240,4 +241,4 @@ ROM_START( hotblock )
ROM_LOAD( "hotblk6.ic5", 0x080000, 0x080000, CRC(3176d231) SHA1(ac22fd0e9820c6714f51a3d8315eb5d43ef91eeb) )
ROM_END
GAME( 1993, hotblock, 0, hotblock, hotblock, driver_device, 0, ROT0, "NIX?", "Hot Blocks - Tetrix II", 0 )
GAME( 1993, hotblock, 0, hotblock, hotblock, driver_device, 0, ROT0, "NIX?", "Hot Blocks - Tetrix II", GAME_SUPPORTS_SAVE )

View File

@ -20,7 +20,7 @@
*
*************************************/
TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::ironhors_irq)
TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::irq)
{
int scanline = param;
@ -36,12 +36,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::ironhors_irq)
}
}
WRITE8_MEMBER(ironhors_state::ironhors_sh_irqtrigger_w)
WRITE8_MEMBER(ironhors_state::sh_irqtrigger_w)
{
m_soundcpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
}
WRITE8_MEMBER(ironhors_state::ironhors_filter_w)
WRITE8_MEMBER(ironhors_state::filter_w)
{
discrete_device *m_disc_ih = machine().device<discrete_device>("disc_ih");
m_disc_ih->write(space, NODE_11, (data & 0x04) >> 2);
@ -57,24 +57,24 @@ WRITE8_MEMBER(ironhors_state::ironhors_filter_w)
static ADDRESS_MAP_START( master_map, AS_PROGRAM, 8, ironhors_state )
AM_RANGE(0x0000, 0x0002) AM_RAM
AM_RANGE(0x0003, 0x0003) AM_RAM_WRITE(ironhors_charbank_w)
AM_RANGE(0x0003, 0x0003) AM_RAM_WRITE(charbank_w)
AM_RANGE(0x0004, 0x0004) AM_RAM AM_SHARE("int_enable")
AM_RANGE(0x0005, 0x001f) AM_RAM
AM_RANGE(0x0020, 0x003f) AM_RAM AM_SHARE("scroll")
AM_RANGE(0x0040, 0x005f) AM_RAM
AM_RANGE(0x0060, 0x00df) AM_RAM
AM_RANGE(0x0800, 0x0800) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0x0900, 0x0900) AM_READ_PORT("DSW3") AM_WRITE(ironhors_sh_irqtrigger_w)
AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("DSW2") AM_WRITE(ironhors_palettebank_w)
AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("DSW1") AM_WRITE(ironhors_flipscreen_w)
AM_RANGE(0x0900, 0x0900) AM_READ_PORT("DSW3") AM_WRITE(sh_irqtrigger_w)
AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("DSW2") AM_WRITE(palettebank_w)
AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("DSW1") AM_WRITE(flipscreen_w)
AM_RANGE(0x0b01, 0x0b01) AM_READ_PORT("P2")
AM_RANGE(0x0b02, 0x0b02) AM_READ_PORT("P1")
AM_RANGE(0x0b03, 0x0b03) AM_READ_PORT("SYSTEM")
AM_RANGE(0x1800, 0x1800) AM_WRITENOP // ???
AM_RANGE(0x1a00, 0x1a01) AM_WRITENOP // ???
AM_RANGE(0x1c00, 0x1dff) AM_WRITENOP // ???
AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(ironhors_colorram_w) AM_SHARE("colorram")
AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(ironhors_videoram_w) AM_SHARE("videoram")
AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x2800, 0x2fff) AM_RAM
AM_RANGE(0x3000, 0x30ff) AM_RAM AM_SHARE("spriteram2")
AM_RANGE(0x3100, 0x37ff) AM_RAM
@ -103,23 +103,23 @@ static ADDRESS_MAP_START( farwest_master_map, AS_PROGRAM, 8, ironhors_state )
AM_RANGE(0x0040, 0x005f) AM_RAM
AM_RANGE(0x0060, 0x00ff) AM_RAM
AM_RANGE(0x0800, 0x0800) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0x0900, 0x0900) /*AM_READ_PORT("DSW3") */AM_WRITE(ironhors_sh_irqtrigger_w)
AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("DSW2") //AM_WRITE(ironhors_palettebank_w)
AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("DSW1") AM_WRITE(ironhors_flipscreen_w)
AM_RANGE(0x0b01, 0x0b01) AM_READ_PORT("DSW2") //AM_WRITE(ironhors_palettebank_w)
AM_RANGE(0x0900, 0x0900) /*AM_READ_PORT("DSW3") */AM_WRITE(sh_irqtrigger_w)
AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("DSW2") //AM_WRITE(palettebank_w)
AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("DSW1") AM_WRITE(flipscreen_w)
AM_RANGE(0x0b01, 0x0b01) AM_READ_PORT("DSW2") //AM_WRITE(palettebank_w)
AM_RANGE(0x0b02, 0x0b02) AM_READ_PORT("P1")
AM_RANGE(0x0b03, 0x0b03) AM_READ_PORT("SYSTEM")
AM_RANGE(0x1800, 0x1800) AM_WRITE(ironhors_sh_irqtrigger_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(sh_irqtrigger_w)
AM_RANGE(0x1a00, 0x1a00) AM_RAM AM_SHARE("int_enable")
AM_RANGE(0x1a01, 0x1a01) AM_RAM_WRITE(ironhors_charbank_w)
AM_RANGE(0x1a02, 0x1a02) AM_WRITE(ironhors_palettebank_w)
AM_RANGE(0x1a01, 0x1a01) AM_RAM_WRITE(charbank_w)
AM_RANGE(0x1a02, 0x1a02) AM_WRITE(palettebank_w)
AM_RANGE(0x0000, 0x1bff) AM_ROM
// AM_RANGE(0x1c00, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(ironhors_colorram_w) AM_SHARE("colorram")
AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(ironhors_videoram_w) AM_SHARE("videoram")
AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x2800, 0x2fff) AM_RAM
AM_RANGE(0x1c00, 0x1dff) AM_RAM AM_SHARE("spriteram2")
AM_RANGE(0x3000, 0x38ff) AM_RAM
@ -359,7 +359,7 @@ static MACHINE_CONFIG_START( ironhors, ironhors_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6809,18432000/6) /* 3.072 MHz??? mod by Shingo Suzuki 1999/10/15 */
MCFG_CPU_PROGRAM_MAP(master_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ironhors_state, ironhors_irq, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ironhors_state, irq, "screen", 0, 1)
MCFG_CPU_ADD("soundcpu",Z80,18432000/6) /* 3.072 MHz */
MCFG_CPU_PROGRAM_MAP(slave_map)
@ -372,7 +372,7 @@ static MACHINE_CONFIG_START( ironhors, ironhors_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(ironhors_state, screen_update_ironhors)
MCFG_SCREEN_UPDATE_DRIVER(ironhors_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", ironhors)
@ -384,7 +384,7 @@ static MACHINE_CONFIG_START( ironhors, ironhors_state )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ym2203", YM2203, 18432000/6)
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(ironhors_state, ironhors_filter_w))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(ironhors_state, filter_w))
MCFG_SOUND_ROUTE_EX(0, "disc_ih", 1.0, 0)
MCFG_SOUND_ROUTE_EX(1, "disc_ih", 1.0, 1)
@ -436,7 +436,7 @@ static MACHINE_CONFIG_DERIVED( farwest, ironhors )
MCFG_SOUND_MODIFY("ym2203")
MCFG_AY8910_PORT_B_READ_CB(READ8(ironhors_state, farwest_soundlatch_r))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(ironhors_state, ironhors_filter_w))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(ironhors_state, filter_w))
MACHINE_CONFIG_END
@ -525,6 +525,6 @@ ROM_END
*
*************************************/
GAME( 1986, ironhors, 0, ironhors, ironhors, driver_device, 0, ROT0, "Konami", "Iron Horse", 0 )
GAME( 1986, dairesya, ironhors, ironhors, dairesya, driver_device, 0, ROT0, "Konami (Kawakusu license)", "Dai Ressya Goutou (Japan)", 0 )
GAME( 1986, farwest, ironhors, farwest, ironhors, driver_device, 0, ROT0, "bootleg?", "Far West", GAME_NOT_WORKING )
GAME( 1986, ironhors, 0, ironhors, ironhors, driver_device, 0, ROT0, "Konami", "Iron Horse", GAME_SUPPORTS_SAVE )
GAME( 1986, dairesya, ironhors, ironhors, dairesya, driver_device, 0, ROT0, "Konami (Kawakusu license)", "Dai Ressya Goutou (Japan)", GAME_SUPPORTS_SAVE )
GAME( 1986, farwest, ironhors, farwest, ironhors, driver_device, 0, ROT0, "bootleg?", "Far West", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )

View File

@ -9,16 +9,22 @@ class ironhors_state : public driver_device
public:
ironhors_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_interrupt_enable(*this, "int_enable"),
m_scroll(*this, "scroll"),
m_colorram(*this, "colorram"),
m_videoram(*this, "videoram"),
m_spriteram2(*this, "spriteram2"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_spriteram(*this, "spriteram") { }
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
/* memory pointers */
required_shared_ptr<UINT8> m_interrupt_enable;
@ -34,31 +40,29 @@ public:
int m_charbank;
int m_spriterambank;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
DECLARE_WRITE8_MEMBER(ironhors_sh_irqtrigger_w);
DECLARE_WRITE8_MEMBER(ironhors_videoram_w);
DECLARE_WRITE8_MEMBER(ironhors_colorram_w);
DECLARE_WRITE8_MEMBER(ironhors_charbank_w);
DECLARE_WRITE8_MEMBER(ironhors_palettebank_w);
DECLARE_WRITE8_MEMBER(ironhors_flipscreen_w);
DECLARE_WRITE8_MEMBER(ironhors_filter_w);
DECLARE_WRITE8_MEMBER(sh_irqtrigger_w);
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(colorram_w);
DECLARE_WRITE8_MEMBER(charbank_w);
DECLARE_WRITE8_MEMBER(palettebank_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_WRITE8_MEMBER(filter_w);
DECLARE_READ8_MEMBER(farwest_soundlatch_r);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(farwest_get_bg_tile_info);
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
DECLARE_PALETTE_INIT(ironhors);
DECLARE_VIDEO_START(farwest);
UINT32 screen_update_ironhors(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_farwest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(ironhors_irq);
TIMER_DEVICE_CALLBACK_MEMBER(farwest_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void farwest_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
TIMER_DEVICE_CALLBACK_MEMBER(irq);
TIMER_DEVICE_CALLBACK_MEMBER(farwest_irq);
};

View File

@ -1,6 +1,6 @@
/***************************************************************************
video.c
ironhors.c
Functions to emulate the video hardware of the machine.
@ -76,19 +76,19 @@ PALETTE_INIT_MEMBER(ironhors_state, ironhors)
}
}
WRITE8_MEMBER(ironhors_state::ironhors_videoram_w)
WRITE8_MEMBER(ironhors_state::videoram_w)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(ironhors_state::ironhors_colorram_w)
WRITE8_MEMBER(ironhors_state::colorram_w)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(ironhors_state::ironhors_charbank_w)
WRITE8_MEMBER(ironhors_state::charbank_w)
{
if (m_charbank != (data & 0x03))
{
@ -101,7 +101,7 @@ WRITE8_MEMBER(ironhors_state::ironhors_charbank_w)
/* other bits unknown */
}
WRITE8_MEMBER(ironhors_state::ironhors_palettebank_w)
WRITE8_MEMBER(ironhors_state::palettebank_w)
{
if (m_palettebank != (data & 0x07))
{
@ -115,10 +115,10 @@ WRITE8_MEMBER(ironhors_state::ironhors_palettebank_w)
/* bit 6 unknown - set after game over */
if (data & 0x88)
popmessage("ironhors_palettebank_w %02x",data);
popmessage("palettebank_w %02x",data);
}
WRITE8_MEMBER(ironhors_state::ironhors_flipscreen_w)
WRITE8_MEMBER(ironhors_state::flipscreen_w)
{
if (flip_screen() != (~data & 0x08))
{
@ -230,7 +230,7 @@ void ironhors_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre
}
}
UINT32 ironhors_state::screen_update_ironhors(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 ironhors_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int row;