diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c index d32faba10c9..b64b2c8b7d6 100644 --- a/src/mame/drivers/tecmosys.c +++ b/src/mame/drivers/tecmosys.c @@ -309,25 +309,25 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, tecmosys_state ) AM_RANGE(0xa00000, 0xa00001) AM_WRITE(eeprom_w ) AM_RANGE(0xa80000, 0xa80005) AM_WRITEONLY AM_SHARE("a80000regs") // a80000-3 scroll? a80004 inverted ? 3 : 0 AM_RANGE(0xb00000, 0xb00005) AM_WRITEONLY AM_SHARE("b00000regs") // b00000-3 scrool?, b00004 inverted ? 3 : 0 - AM_RANGE(0xb80000, 0xb80001) AM_READWRITE(tecmosys_prot_status_r, tecmosys_prot_status_w) + AM_RANGE(0xb80000, 0xb80001) AM_READWRITE(prot_status_r, prot_status_w) AM_RANGE(0xc00000, 0xc00005) AM_WRITEONLY AM_SHARE("c00000regs") // c00000-3 scroll? c00004 inverted ? 13 : 10 AM_RANGE(0xc80000, 0xc80005) AM_WRITEONLY AM_SHARE("c80000regs") // c80000-3 scrool? c80004 inverted ? 3 : 0 AM_RANGE(0xd00000, 0xd00001) AM_READ_PORT("P1") AM_RANGE(0xd00002, 0xd00003) AM_READ_PORT("P2") AM_RANGE(0xd80000, 0xd80001) AM_READ(eeprom_r) AM_RANGE(0xe00000, 0xe00001) AM_WRITE(sound_w ) - AM_RANGE(0xe80000, 0xe80001) AM_WRITE(tecmosys_prot_data_w) + AM_RANGE(0xe80000, 0xe80001) AM_WRITE(prot_data_w) AM_RANGE(0xf00000, 0xf00001) AM_READ(sound_r) - AM_RANGE(0xf80000, 0xf80001) AM_READ(tecmosys_prot_data_r) + AM_RANGE(0xf80000, 0xf80001) AM_READ(prot_data_r) ADDRESS_MAP_END -WRITE8_MEMBER(tecmosys_state::tecmosys_z80_bank_w) +WRITE8_MEMBER(tecmosys_state::z80_bank_w) { membank("bank1")->set_entry(data); } -WRITE8_MEMBER(tecmosys_state::tecmosys_oki_bank_w) +WRITE8_MEMBER(tecmosys_state::oki_bank_w) { UINT8 upperbank = (data & 0x30) >> 4; UINT8 lowerbank = (data & 0x03) >> 0; @@ -347,8 +347,8 @@ static ADDRESS_MAP_START( io_map, AS_IO, 8, tecmosys_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ymf", ymf262_device, read, write) AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0x20, 0x20) AM_WRITE(tecmosys_oki_bank_w) - AM_RANGE(0x30, 0x30) AM_WRITE(tecmosys_z80_bank_w) + AM_RANGE(0x20, 0x20) AM_WRITE(oki_bank_w) + AM_RANGE(0x30, 0x30) AM_WRITE(z80_bank_w) AM_RANGE(0x40, 0x40) AM_READ(soundlatch_byte_r) AM_RANGE(0x50, 0x50) AM_WRITE(soundlatch2_byte_w) AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("ymz", ymz280b_device, read, write) @@ -441,6 +441,10 @@ WRITE_LINE_MEMBER(tecmosys_state::sound_irq) void tecmosys_state::machine_start() { membank("bank1")->configure_entries(0, 16, memregion("audiocpu")->base(), 0x4000); + + save_item(NAME(m_device_read_ptr)); + save_item(NAME(m_device_status)); + save_item(NAME(m_device_value)); } static MACHINE_CONFIG_START( deroon, tecmosys_state ) @@ -465,7 +469,7 @@ static MACHINE_CONFIG_START( deroon, tecmosys_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(3000)) MCFG_SCREEN_SIZE(64*8, 64*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tecmosys_state, screen_update_tecmosys) + MCFG_SCREEN_UPDATE_DRIVER(tecmosys_state, screen_update) MCFG_PALETTE_ADD("palette", 0x4000+0x800) MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) @@ -620,7 +624,7 @@ ROM_START( tkdenshoa ) ROM_LOAD( "ae500w07.ad1", 0x080000, 0x080000, CRC(3734f92c) SHA1(048555b5aa89eaf983305c439ba08d32b4a1bb80) ) ROM_END -void tecmosys_state::tecmosys_descramble() +void tecmosys_state::descramble() { UINT8 *gfxsrc = memregion( "gfx1" )->base(); size_t srcsize = memregion( "gfx1" )->bytes(); @@ -644,22 +648,22 @@ void tecmosys_state::tecmosys_descramble() DRIVER_INIT_MEMBER(tecmosys_state,deroon) { - tecmosys_descramble(); - tecmosys_prot_init(0); // machine/tecmosys.c + descramble(); + prot_init(0); // machine/tecmosys.c } DRIVER_INIT_MEMBER(tecmosys_state,tkdensho) { - tecmosys_descramble(); - tecmosys_prot_init(1); + descramble(); + prot_init(1); } DRIVER_INIT_MEMBER(tecmosys_state,tkdensha) { - tecmosys_descramble(); - tecmosys_prot_init(2); + descramble(); + prot_init(2); } -GAME( 1995, deroon, 0, deroon, deroon, tecmosys_state, deroon, ROT0, "Tecmo", "Deroon DeroDero", 0 ) -GAME( 1996, tkdensho, 0, deroon, deroon, tecmosys_state, tkdensho, ROT0, "Tecmo", "Toukidenshou - Angel Eyes (VER. 960614)", 0 ) -GAME( 1996, tkdenshoa, tkdensho, deroon, deroon, tecmosys_state, tkdensha, ROT0, "Tecmo", "Toukidenshou - Angel Eyes (VER. 960427)", 0 ) +GAME( 1995, deroon, 0, deroon, deroon, tecmosys_state, deroon, ROT0, "Tecmo", "Deroon DeroDero", GAME_SUPPORTS_SAVE ) +GAME( 1996, tkdensho, 0, deroon, deroon, tecmosys_state, tkdensho, ROT0, "Tecmo", "Toukidenshou - Angel Eyes (VER. 960614)", GAME_SUPPORTS_SAVE ) +GAME( 1996, tkdenshoa, tkdensho, deroon, deroon, tecmosys_state, tkdensha, ROT0, "Tecmo", "Toukidenshou - Angel Eyes (VER. 960427)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/tecmosys.h b/src/mame/includes/tecmosys.h index 7472d64830d..ea5b99acb42 100644 --- a/src/mame/includes/tecmosys.h +++ b/src/mame/includes/tecmosys.h @@ -10,6 +10,12 @@ class tecmosys_state : public driver_device public: tecmosys_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_eeprom(*this, "eeprom"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), m_spriteram(*this, "spriteram"), m_tilemap_paletteram16(*this, "tmap_palette"), m_bg2tilemap_ram(*this, "bg2tilemap_ram"), @@ -23,13 +29,14 @@ public: m_b00000regs(*this, "b00000regs"), m_c00000regs(*this, "c00000regs"), m_c80000regs(*this, "c80000regs"), - m_880000regs(*this, "880000regs"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_eeprom(*this, "eeprom"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_880000regs(*this, "880000regs") { } + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_eeprom; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; required_shared_ptr m_spriteram; required_shared_ptr m_tilemap_paletteram16; @@ -45,6 +52,7 @@ public: required_shared_ptr m_c00000regs; required_shared_ptr m_c80000regs; required_shared_ptr m_880000regs; + int m_spritelist; bitmap_ind16 m_sprite_bitmap; bitmap_ind16 m_tmp_tilemap_composebitmap; @@ -57,16 +65,17 @@ public: UINT8 m_device_status; const struct prot_data* m_device_data; UINT8 m_device_value; + DECLARE_READ16_MEMBER(sound_r); DECLARE_WRITE16_MEMBER(sound_w); DECLARE_WRITE16_MEMBER(unk880000_w); DECLARE_READ16_MEMBER(unk880000_r); - DECLARE_WRITE8_MEMBER(tecmosys_z80_bank_w); - DECLARE_WRITE8_MEMBER(tecmosys_oki_bank_w); - DECLARE_READ16_MEMBER(tecmosys_prot_status_r); - DECLARE_WRITE16_MEMBER(tecmosys_prot_status_w); - DECLARE_READ16_MEMBER(tecmosys_prot_data_r); - DECLARE_WRITE16_MEMBER(tecmosys_prot_data_w); + DECLARE_WRITE8_MEMBER(z80_bank_w); + DECLARE_WRITE8_MEMBER(oki_bank_w); + DECLARE_READ16_MEMBER(prot_status_r); + DECLARE_WRITE16_MEMBER(prot_status_w); + DECLARE_READ16_MEMBER(prot_data_r); + DECLARE_WRITE16_MEMBER(prot_data_w); DECLARE_WRITE16_MEMBER(bg0_tilemap_w); DECLARE_WRITE16_MEMBER(bg1_tilemap_w); DECLARE_WRITE16_MEMBER(bg2_tilemap_w); @@ -77,28 +86,25 @@ public: DECLARE_WRITE16_MEMBER(bg2_tilemap_lineram_w); DECLARE_READ16_MEMBER(eeprom_r); DECLARE_WRITE16_MEMBER(eeprom_w); + DECLARE_WRITE_LINE_MEMBER(sound_irq); + DECLARE_DRIVER_INIT(tkdensha); DECLARE_DRIVER_INIT(deroon); DECLARE_DRIVER_INIT(tkdensho); + virtual void machine_start(); + virtual void video_start(); + TILE_GET_INFO_MEMBER(get_bg0tile_info); TILE_GET_INFO_MEMBER(get_bg1tile_info); TILE_GET_INFO_MEMBER(get_bg2tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_start(); - virtual void video_start(); - UINT32 screen_update_tecmosys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void tecmosys_prot_init(int which); - void tecmosys_prot_reset(); - inline void set_color_555_tecmo(pen_t color, int rshift, int gshift, int bshift, UINT16 data); - void tecmosys_render_sprites_to_bitmap(bitmap_rgb32 &bitmap, UINT16 extrax, UINT16 extray ); - void tecmosys_tilemap_copy_to_compose(UINT16 pri); - void tecmosys_do_final_mix(bitmap_rgb32 &bitmap); - void tecmosys_descramble(); - DECLARE_WRITE_LINE_MEMBER(sound_irq); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_eeprom; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void prot_init(int which); + void prot_reset(); + inline void set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT16 data); + void render_sprites_to_bitmap(bitmap_rgb32 &bitmap, UINT16 extrax, UINT16 extray ); + void tilemap_copy_to_compose(UINT16 pri); + void do_final_mix(bitmap_rgb32 &bitmap); + void descramble(); }; diff --git a/src/mame/machine/tecmosys.c b/src/mame/machine/tecmosys.c index 6071173f45f..e5dd0d8a36d 100644 --- a/src/mame/machine/tecmosys.c +++ b/src/mame/machine/tecmosys.c @@ -103,14 +103,14 @@ static const struct prot_data tkdensha_data = }; -void tecmosys_state::tecmosys_prot_reset() +void tecmosys_state::prot_reset() { m_device_read_ptr = 0; m_device_status = DS_IDLE; m_device_value = 0xff; } -void tecmosys_state::tecmosys_prot_init(int which) +void tecmosys_state::prot_init(int which) { switch (which) { @@ -119,10 +119,10 @@ void tecmosys_state::tecmosys_prot_init(int which) case 2: m_device_data = &tkdensha_data; break; } - machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_state::tecmosys_prot_reset),this)); + machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_state::prot_reset),this)); } -READ16_MEMBER(tecmosys_state::tecmosys_prot_status_r) +READ16_MEMBER(tecmosys_state::prot_status_r) { if (ACCESSING_BITS_8_15) { @@ -134,13 +134,13 @@ READ16_MEMBER(tecmosys_state::tecmosys_prot_status_r) return 0xc0; // simulation is always ready } -WRITE16_MEMBER(tecmosys_state::tecmosys_prot_status_w) +WRITE16_MEMBER(tecmosys_state::prot_status_w) { // deroon clears the status in one place. } -READ16_MEMBER(tecmosys_state::tecmosys_prot_data_r) +READ16_MEMBER(tecmosys_state::prot_data_r) { // prot appears to be read-ready for two consecutive reads // but returns 0xff for subsequent reads. @@ -151,7 +151,7 @@ READ16_MEMBER(tecmosys_state::tecmosys_prot_data_r) } -WRITE16_MEMBER(tecmosys_state::tecmosys_prot_data_w) +WRITE16_MEMBER(tecmosys_state::prot_data_w) { // Only LSB data >>= 8; diff --git a/src/mame/video/tecmosys.c b/src/mame/video/tecmosys.c index 5cdcbab20f8..4c2414a015a 100644 --- a/src/mame/video/tecmosys.c +++ b/src/mame/video/tecmosys.c @@ -66,7 +66,7 @@ WRITE16_MEMBER(tecmosys_state::fg_tilemap_w) } -inline void tecmosys_state::set_color_555_tecmo(pen_t color, int rshift, int gshift, int bshift, UINT16 data) +inline void tecmosys_state::set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT16 data) { m_palette->set_pen_color(color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift)); } @@ -74,7 +74,7 @@ inline void tecmosys_state::set_color_555_tecmo(pen_t color, int rshift, int gsh WRITE16_MEMBER(tecmosys_state::tilemap_paletteram16_xGGGGGRRRRRBBBBB_word_w) { COMBINE_DATA(&m_tilemap_paletteram16[offset]); - set_color_555_tecmo(offset+0x4000, 5, 10, 0, m_tilemap_paletteram16[offset]); + set_color_555(offset+0x4000, 5, 10, 0, m_tilemap_paletteram16[offset]); } WRITE16_MEMBER(tecmosys_state::bg0_tilemap_lineram_w) @@ -97,7 +97,7 @@ WRITE16_MEMBER(tecmosys_state::bg2_tilemap_lineram_w) -void tecmosys_state::tecmosys_render_sprites_to_bitmap(bitmap_rgb32 &bitmap, UINT16 extrax, UINT16 extray ) +void tecmosys_state::render_sprites_to_bitmap(bitmap_rgb32 &bitmap, UINT16 extrax, UINT16 extray ) { UINT8 *gfxsrc = memregion ( "gfx1" )->base(); int i; @@ -188,7 +188,7 @@ void tecmosys_state::tecmosys_render_sprites_to_bitmap(bitmap_rgb32 &bitmap, UIN } } -void tecmosys_state::tecmosys_tilemap_copy_to_compose(UINT16 pri) +void tecmosys_state::tilemap_copy_to_compose(UINT16 pri) { int y,x; UINT16 *srcptr; @@ -205,7 +205,7 @@ void tecmosys_state::tecmosys_tilemap_copy_to_compose(UINT16 pri) } } -void tecmosys_state::tecmosys_do_final_mix(bitmap_rgb32 &bitmap) +void tecmosys_state::do_final_mix(bitmap_rgb32 &bitmap) { const pen_t *paldata = m_palette->pens(); int y,x; @@ -275,7 +275,7 @@ void tecmosys_state::tecmosys_do_final_mix(bitmap_rgb32 &bitmap) } -UINT32 tecmosys_state::screen_update_tecmosys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +UINT32 tecmosys_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { bitmap.fill(m_palette->pen(0x4000), cliprect); @@ -293,25 +293,25 @@ UINT32 tecmosys_state::screen_update_tecmosys(screen_device &screen, bitmap_rgb3 m_tmp_tilemap_renderbitmap.fill(0, cliprect); m_bg0tilemap->draw(screen, m_tmp_tilemap_renderbitmap, cliprect, 0,0); - tecmosys_tilemap_copy_to_compose(0x0000); + tilemap_copy_to_compose(0x0000); m_tmp_tilemap_renderbitmap.fill(0, cliprect); m_bg1tilemap->draw(screen, m_tmp_tilemap_renderbitmap, cliprect, 0,0); - tecmosys_tilemap_copy_to_compose(0x4000); + tilemap_copy_to_compose(0x4000); m_tmp_tilemap_renderbitmap.fill(0, cliprect); m_bg2tilemap->draw(screen, m_tmp_tilemap_renderbitmap, cliprect, 0,0); - tecmosys_tilemap_copy_to_compose(0x8000); + tilemap_copy_to_compose(0x8000); m_tmp_tilemap_renderbitmap.fill(0, cliprect); m_txt_tilemap->draw(screen, m_tmp_tilemap_renderbitmap, cliprect, 0,0); - tecmosys_tilemap_copy_to_compose(0xc000); + tilemap_copy_to_compose(0xc000); - tecmosys_do_final_mix(bitmap); + do_final_mix(bitmap); // prepare sprites for NEXT frame - causes 1 frame palette errors, but prevents sprite lag in tkdensho, which is correct? - tecmosys_render_sprites_to_bitmap(bitmap, m_880000regs[0x0], m_880000regs[0x1]); + render_sprites_to_bitmap(bitmap, m_880000regs[0x0], m_880000regs[0x1]); return 0; } @@ -339,4 +339,6 @@ void tecmosys_state::video_start() m_bg2tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tecmosys_state::get_bg2tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); m_bg2tilemap->set_transparent_pen(0); + + save_item(NAME(m_spritelist)); }