Previous 199869 Revisions Next

r35093 Tuesday 17th February, 2015 at 18:18:44 UTC by Osso
pirates.c: enabled save state support (nw)
[src/mame/drivers]pirates.c
[src/mame/includes]pirates.h
[src/mame/video]pirates.c

trunk/src/mame/drivers/pirates.c
r243604r243605
88- EEPROM doesn't work. I'm not sure what the program is trying to do.
99  The EEPROM handling might actually be related to the protection which
1010  makes the game hang.
11  See pirates_in1_r() for code which would work around the protection,
11  See prot_r() for code which would work around the protection,
1212  but makes the game periodically hang for a couple of seconds; therefore,
1313  for now I'm just patching out the protection check.
1414
r243604r243605
4848Inputs mapped by Stephh
4949
5050The game hanging is an interesting issue, the board owner has 2 copies of this game, one a prototype,
51on the final released version.  The roms on both boards are the same, however the prototype locks up
51one the final released version.  The roms on both boards are the same, however the prototype locks up
5252just as it does in Mame at the moment.  The final board does not.  It would appear the prototype
5353board does not have the protection hardware correctly in place
5454
r243604r243605
9494#include "includes/pirates.h"
9595
9696
97WRITE16_MEMBER(pirates_state::pirates_out_w)
97WRITE16_MEMBER(pirates_state::out_w)
9898{
9999   if (ACCESSING_BITS_0_7)
100100   {
r243604r243605
121121//  logerror("%s: IN1_r\n",machine().describe_context());
122122
123123#if 0
124   /* Pirates protection workaround. It more complicated than this... see code at
124   /* Pirates protection workaround. It's more complicated than this... see code at
125125      602e and 62a6 */
126126   /* For Genix, see 6576 for setting values and 67c2,d3b4 and dbc2 for tests. */
127127
r243604r243605
156156//  AM_RANGE(0x500000, 0x5007ff) AM_RAM
157157   AM_RANGE(0x500000, 0x5007ff) AM_WRITEONLY AM_SHARE("spriteram")
158158//  AM_RANGE(0x500800, 0x50080f) AM_WRITENOP
159   AM_RANGE(0x600000, 0x600001) AM_WRITE(pirates_out_w)
159   AM_RANGE(0x600000, 0x600001) AM_WRITE(out_w)
160160   AM_RANGE(0x700000, 0x700001) AM_WRITEONLY AM_SHARE("scroll")    // scroll reg
161161   AM_RANGE(0x800000, 0x803fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
162162   AM_RANGE(0x900000, 0x90017f) AM_RAM  // more of tilemaps ?
163   AM_RANGE(0x900180, 0x90137f) AM_RAM_WRITE(pirates_tx_tileram_w) AM_SHARE("tx_tileram")
164   AM_RANGE(0x901380, 0x902a7f) AM_RAM_WRITE(pirates_fg_tileram_w) AM_SHARE("fg_tileram")
163   AM_RANGE(0x900180, 0x90137f) AM_RAM_WRITE(tx_tileram_w) AM_SHARE("tx_tileram")
164   AM_RANGE(0x901380, 0x902a7f) AM_RAM_WRITE(fg_tileram_w) AM_SHARE("fg_tileram")
165165//  AM_RANGE(0x902580, 0x902a7f) AM_RAM  // more of tilemaps ?
166   AM_RANGE(0x902a80, 0x904187) AM_RAM_WRITE(pirates_bg_tileram_w) AM_SHARE("bg_tileram")
166   AM_RANGE(0x902a80, 0x904187) AM_RAM_WRITE(bg_tileram_w) AM_SHARE("bg_tileram")
167167//  AM_RANGE(0x903c80, 0x904187) AM_RAM  // more of tilemaps ?
168168   AM_RANGE(0xa00000, 0xa00001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
169169ADDRESS_MAP_END
r243604r243605
261261   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
262262   MCFG_SCREEN_SIZE(36*8, 32*8)
263263   MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 2*8, 30*8-1)
264   MCFG_SCREEN_UPDATE_DRIVER(pirates_state, screen_update_pirates)
264   MCFG_SCREEN_UPDATE_DRIVER(pirates_state, screen_update)
265265   MCFG_SCREEN_PALETTE("palette")
266266
267267   MCFG_PALETTE_ADD("palette", 0x2000)
r243604r243605
323323
324324/* Init */
325325
326void pirates_state::pirates_decrypt_68k()
326void pirates_state::decrypt_68k()
327327{
328328   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
329329   size_t rom_size = memregion("maincpu")->bytes();
r243604r243605
346346   }
347347}
348348
349void pirates_state::pirates_decrypt_p()
349void pirates_state::decrypt_p()
350350{
351351   int rom_size;
352352   UINT8 *rom;
r243604r243605
369369   }
370370}
371371
372void pirates_state::pirates_decrypt_s()
372void pirates_state::decrypt_s()
373373{
374374   int rom_size;
375375   UINT8 *rom;
r243604r243605
393393}
394394
395395
396void pirates_state::pirates_decrypt_oki()
396void pirates_state::decrypt_oki()
397397{
398398   int rom_size;
399399   UINT8 *rom;
r243604r243605
418418{
419419   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
420420
421   pirates_decrypt_68k();
422   pirates_decrypt_p();
423   pirates_decrypt_s();
424   pirates_decrypt_oki();
421   decrypt_68k();
422   decrypt_p();
423   decrypt_s();
424   decrypt_oki();
425425
426426   /* patch out protection check */
427427   rom[0x62c0/2] = 0x6006; // beq -> bra
r243604r243605
431431
432432DRIVER_INIT_MEMBER(pirates_state,genix)
433433{
434   pirates_decrypt_68k();
435   pirates_decrypt_p();
436   pirates_decrypt_s();
437   pirates_decrypt_oki();
434   decrypt_68k();
435   decrypt_p();
436   decrypt_s();
437   decrypt_oki();
438438
439439   /* If this value is increased then something has gone wrong and the protection failed */
440440   /* Write-protect it for now */
r243604r243605
444444
445445/* GAME */
446446
447GAME( 1994, pirates, 0, pirates, pirates, pirates_state, pirates, 0, "NIX", "Pirates", 0 )
448GAME( 1994, genix,   0, pirates, pirates, pirates_state, genix,   0, "NIX", "Genix Family", 0 )
447GAME( 1994, pirates, 0, pirates, pirates, pirates_state, pirates, 0, "NIX", "Pirates", GAME_SUPPORTS_SAVE )
448GAME( 1994, genix,   0, pirates, pirates, pirates_state, genix,   0, "NIX", "Genix Family", GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/pirates.h
r243604r243605
66public:
77   pirates_state(const machine_config &mconfig, device_type type, const char *tag)
88      : driver_device(mconfig, type, tag),
9      m_maincpu(*this, "maincpu"),
10      m_eeprom(*this, "eeprom"),
11      m_oki(*this, "oki"),
12      m_gfxdecode(*this, "gfxdecode"),
13      m_palette(*this, "palette"),
914      m_spriteram(*this, "spriteram"),
1015      m_scroll(*this, "scroll"),
1116      m_tx_tileram(*this, "tx_tileram"),
1217      m_fg_tileram(*this, "fg_tileram"),
13      m_bg_tileram(*this, "bg_tileram"),
14      m_maincpu(*this, "maincpu"),
15      m_eeprom(*this, "eeprom"),
16      m_oki(*this, "oki"),
17      m_gfxdecode(*this, "gfxdecode"),
18      m_palette(*this, "palette") { }
18      m_bg_tileram(*this, "bg_tileram") { }
1919
20   required_device<cpu_device> m_maincpu;
21   required_device<eeprom_serial_93cxx_device> m_eeprom;
22   required_device<okim6295_device> m_oki;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<palette_device> m_palette;
25
2026   required_shared_ptr<UINT16> m_spriteram;
2127   required_shared_ptr<UINT16> m_scroll;
2228   required_shared_ptr<UINT16> m_tx_tileram;
2329   required_shared_ptr<UINT16> m_fg_tileram;
2430   required_shared_ptr<UINT16> m_bg_tileram;
31
2532   tilemap_t *m_tx_tilemap;
2633   tilemap_t *m_fg_tilemap;
2734   tilemap_t *m_bg_tilemap;
28   DECLARE_WRITE16_MEMBER(pirates_out_w);
35
36   DECLARE_WRITE16_MEMBER(out_w);
37   DECLARE_WRITE16_MEMBER(tx_tileram_w);
38   DECLARE_WRITE16_MEMBER(fg_tileram_w);
39   DECLARE_WRITE16_MEMBER(bg_tileram_w);
2940   DECLARE_READ16_MEMBER(genix_prot_r);
30   DECLARE_WRITE16_MEMBER(pirates_tx_tileram_w);
31   DECLARE_WRITE16_MEMBER(pirates_fg_tileram_w);
32   DECLARE_WRITE16_MEMBER(pirates_bg_tileram_w);
41   
3342   DECLARE_CUSTOM_INPUT_MEMBER(prot_r);
43
3444   DECLARE_DRIVER_INIT(pirates);
3545   DECLARE_DRIVER_INIT(genix);
46
3647   TILE_GET_INFO_MEMBER(get_tx_tile_info);
3748   TILE_GET_INFO_MEMBER(get_fg_tile_info);
3849   TILE_GET_INFO_MEMBER(get_bg_tile_info);
50
3951   virtual void video_start();
40   UINT32 screen_update_pirates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
52
53   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4154   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
42   void pirates_decrypt_68k();
43   void pirates_decrypt_p();
44   void pirates_decrypt_s();
45   void pirates_decrypt_oki();
46   required_device<cpu_device> m_maincpu;
47   required_device<eeprom_serial_93cxx_device> m_eeprom;
48   required_device<okim6295_device> m_oki;
49   required_device<gfxdecode_device> m_gfxdecode;
50   required_device<palette_device> m_palette;
55
56   void decrypt_68k();
57   void decrypt_p();
58   void decrypt_s();
59   void decrypt_oki();
5160};
trunk/src/mame/video/pirates.c
r243604r243605
4747
4848
4949
50WRITE16_MEMBER(pirates_state::pirates_tx_tileram_w)
50WRITE16_MEMBER(pirates_state::tx_tileram_w)
5151{
5252   COMBINE_DATA(m_tx_tileram+offset);
5353   m_tx_tilemap->mark_tile_dirty(offset/2);
5454}
5555
56WRITE16_MEMBER(pirates_state::pirates_fg_tileram_w)
56WRITE16_MEMBER(pirates_state::fg_tileram_w)
5757{
5858   COMBINE_DATA(m_fg_tileram+offset);
5959   m_fg_tilemap->mark_tile_dirty(offset/2);
6060}
6161
62WRITE16_MEMBER(pirates_state::pirates_bg_tileram_w)
62WRITE16_MEMBER(pirates_state::bg_tileram_w)
6363{
6464   COMBINE_DATA(m_bg_tileram+offset);
6565   m_bg_tilemap->mark_tile_dirty(offset/2);
r243604r243605
9999   }
100100}
101101
102UINT32 pirates_state::screen_update_pirates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
102UINT32 pirates_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
103103{
104104   m_bg_tilemap->set_scrollx(0,m_scroll[0]);
105105   m_fg_tilemap->set_scrollx(0,m_scroll[0]);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team