Previous 199869 Revisions Next

r34717 Thursday 29th January, 2015 at 17:07:41 UTC by Osso
limenko.c, lordgun.c: added save state support (nw)
[src/mame/drivers]limenko.c lordgun.c
[src/mame/includes]lordgun.h

trunk/src/mame/drivers/limenko.c
r243228r243229
3434public:
3535   limenko_state(const machine_config &mconfig, device_type type, const char *tag)
3636      : driver_device(mconfig, type, tag),
37      m_maincpu(*this, "maincpu"),
38      m_oki(*this, "oki"),
39      m_qs1000(*this, "qs1000"),
40      m_gfxdecode(*this, "gfxdecode"),
41      m_palette(*this, "palette"),
3742      m_mainram(*this, "mainram"),
3843      m_fg_videoram(*this, "fg_videoram"),
3944      m_md_videoram(*this, "md_videoram"),
4045      m_bg_videoram(*this, "bg_videoram"),
4146      m_spriteram(*this, "spriteram"),
4247      m_spriteram2(*this, "spriteram2"),
43      m_videoreg(*this, "videoreg"),
44      m_maincpu(*this, "maincpu"),
45      m_oki(*this, "oki"),
46      m_gfxdecode(*this, "gfxdecode"),
47      m_palette(*this, "palette")   { }
48      m_videoreg(*this, "videoreg") { }
4849
50   required_device<cpu_device> m_maincpu;
51   optional_device<okim6295_device> m_oki;
52   optional_device<qs1000_device> m_qs1000;
53   required_device<gfxdecode_device> m_gfxdecode;
54   required_device<palette_device> m_palette;
55   
4956   required_shared_ptr<UINT32> m_mainram;
5057   required_shared_ptr<UINT32> m_fg_videoram;
5158   required_shared_ptr<UINT32> m_md_videoram;
r243228r243229
5360   required_shared_ptr<UINT32> m_spriteram;
5461   required_shared_ptr<UINT32> m_spriteram2;
5562   required_shared_ptr<UINT32> m_videoreg;
63   
5664   tilemap_t *m_bg_tilemap;
5765   tilemap_t *m_md_tilemap;
5866   tilemap_t *m_fg_tilemap;
67   
5968   int m_spriteram_bit;
6069   bitmap_ind16 m_sprites_bitmap;
6170   bitmap_ind8 m_sprites_bitmap_pri;
6271   int m_prev_sprites_count;
6372   UINT8 m_spotty_sound_cmd;
73   
6474   DECLARE_WRITE32_MEMBER(limenko_coincounter_w);
6575   DECLARE_WRITE32_MEMBER(bg_videoram_w);
6676   DECLARE_WRITE32_MEMBER(md_videoram_w);
r243228r243229
7585   DECLARE_READ32_MEMBER(legendoh_speedup_r);
7686   DECLARE_READ32_MEMBER(sb2003_speedup_r);
7787   DECLARE_READ32_MEMBER(spotty_speedup_r);
78   DECLARE_CUSTOM_INPUT_MEMBER(spriteram_bit_r);
79
8088   DECLARE_READ8_MEMBER(qs1000_p1_r);
8189   DECLARE_WRITE8_MEMBER(qs1000_p1_w);
8290   DECLARE_WRITE8_MEMBER(qs1000_p2_w);
8391   DECLARE_WRITE8_MEMBER(qs1000_p3_w);
92   
93   DECLARE_CUSTOM_INPUT_MEMBER(spriteram_bit_r);
94
8495   DECLARE_DRIVER_INIT(common);
8596   DECLARE_DRIVER_INIT(sb2003);
8697   DECLARE_DRIVER_INIT(dynabomb);
8798   DECLARE_DRIVER_INIT(legendoh);
8899   DECLARE_DRIVER_INIT(spotty);
100   
89101   TILE_GET_INFO_MEMBER(get_bg_tile_info);
90102   TILE_GET_INFO_MEMBER(get_md_tile_info);
91103   TILE_GET_INFO_MEMBER(get_fg_tile_info);
104   
92105   virtual void video_start();
93106   UINT32 screen_update_limenko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
94107   void draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int priority);
95108   void draw_sprites(UINT32 *sprites, const rectangle &cliprect, int count);
96109   void copy_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &sprites_bitmap, bitmap_ind8 &priority_bitmap, const rectangle &cliprect);
97   required_device<cpu_device> m_maincpu;
98   optional_device<okim6295_device> m_oki;
99   required_device<gfxdecode_device> m_gfxdecode;
100   required_device<palette_device> m_palette;
101110};
102111
103112/*****************************************************************************************************
r243228r243229
165174
166175WRITE32_MEMBER(limenko_state::limenko_soundlatch_w)
167176{
168   qs1000_device *qs1000 = machine().device<qs1000_device>("qs1000");
169
170177   soundlatch_byte_w(space, 0, data >> 16);
171   qs1000->set_irq(ASSERT_LINE);
178   m_qs1000->set_irq(ASSERT_LINE);
172179
173180   machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
174181}
r243228r243229
198205   // ...x .... - ?
199206   // ..x. .... - /IRQ clear
200207
201   qs1000_device *qs1000 = machine().device<qs1000_device>("qs1000");
202
203208   membank("qs1000:bank")->set_entry(data & 0x07);
204209
205210   if (!BIT(data, 5))
206      qs1000->set_irq(CLEAR_LINE);
211      m_qs1000->set_irq(CLEAR_LINE);
207212}
208213
209214/*****************************************************************************************************
r243228r243229
500505
501506   m_sprites_bitmap.allocate(384,240);
502507   m_sprites_bitmap_pri.allocate(384,240);
508   
509   save_item(NAME(m_spriteram_bit));
510   save_item(NAME(m_prev_sprites_count));
503511}
504512
505513UINT32 limenko_state::screen_update_limenko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
r243228r243229
11381146   m_maincpu->space(AS_PROGRAM).install_read_handler(0x6626c, 0x6626f, read32_delegate(FUNC(limenko_state::spotty_speedup_r), this));
11391147
11401148   m_spriteram_bit = 1;
1149   
1150   save_item(NAME(m_spotty_sound_cmd));
11411151}
11421152
1143GAME( 2000, dynabomb, 0,      limenko, sb2003, limenko_state,   dynabomb, ROT0, "Limenko", "Dynamite Bomber (Korea, Rev 1.5)",   GAME_IMPERFECT_SOUND )
1144GAME( 2000, legendoh, 0,      limenko, legendoh, limenko_state, legendoh, ROT0, "Limenko", "Legend of Heroes",                   GAME_IMPERFECT_SOUND )
1145GAME( 2003, sb2003,   0,      limenko, sb2003, limenko_state,   sb2003,   ROT0, "Limenko", "Super Bubble 2003 (World, Ver 1.0)", GAME_IMPERFECT_SOUND )
1146GAME( 2003, sb2003a,  sb2003, limenko, sb2003, limenko_state,   sb2003,   ROT0, "Limenko", "Super Bubble 2003 (Asia, Ver 1.0)",  GAME_IMPERFECT_SOUND )
1153GAME( 2000, dynabomb, 0,      limenko, sb2003, limenko_state,   dynabomb, ROT0, "Limenko", "Dynamite Bomber (Korea, Rev 1.5)",   GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
1154GAME( 2000, legendoh, 0,      limenko, legendoh, limenko_state, legendoh, ROT0, "Limenko", "Legend of Heroes",                   GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
1155GAME( 2003, sb2003,   0,      limenko, sb2003, limenko_state,   sb2003,   ROT0, "Limenko", "Super Bubble 2003 (World, Ver 1.0)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
1156GAME( 2003, sb2003a,  sb2003, limenko, sb2003, limenko_state,   sb2003,   ROT0, "Limenko", "Super Bubble 2003 (Asia, Ver 1.0)",  GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
11471157
1148// this game only use the same graphics chip used in limenko's system
1149GAME( 2001, spotty,   0,      spotty,  spotty, limenko_state,   spotty,   ROT0, "Prince Co.", "Spotty (Ver. 2.0.2)",             GAME_NO_SOUND )
1158// this game only uses the same graphics chip used in Limenko's system
1159GAME( 2001, spotty,   0,      spotty,  spotty, limenko_state,   spotty,   ROT0, "Prince Co.", "Spotty (Ver. 2.0.2)",             GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/lordgun.c
r243228r243229
4747#include "sound/ymf278b.h"
4848#include "includes/lordgun.h"
4949
50
5051/***************************************************************************
5152
5253    Memory Maps - Main
r243228r243229
5960   {
6061      case 0x00/2: // increment counter
6162      {
62         m_lordgun_protection_data++;
63         m_lordgun_protection_data &= 0x1f;
63         m_protection_data++;
64         m_protection_data &= 0x1f;
6465
6566         return;
6667      }
6768
6869      case 0xc0/2: // reset protection device
6970      {
70         m_lordgun_protection_data = 0;
71         m_protection_data = 0;
7172
7273         return;
7374      }
r243228r243229
8081   {
8182      case 0x40/2: // bitswap and xor counter
8283      {
83         UINT8 x = m_lordgun_protection_data;
84         UINT8 x = m_protection_data;
8485
85         m_lordgun_protection_data  = ((( x >> 0) | ( x >> 1)) & 1) << 4;
86         m_lordgun_protection_data |=  ((~x >> 2) & 1) << 3;
87         m_lordgun_protection_data |= (((~x >> 4) | ( x >> 0)) & 1) << 2;
88         m_lordgun_protection_data |=  (( x >> 3) & 1) << 1;
89         m_lordgun_protection_data |= (((~x >> 0) | ( x >> 2)) & 1) << 0;
86         m_protection_data  = ((( x >> 0) | ( x >> 1)) & 1) << 4;
87         m_protection_data |=  ((~x >> 2) & 1) << 3;
88         m_protection_data |= (((~x >> 4) | ( x >> 0)) & 1) << 2;
89         m_protection_data |=  (( x >> 3) & 1) << 1;
90         m_protection_data |= (((~x >> 0) | ( x >> 2)) & 1) << 0;
9091
9192         return 0;
9293      }
9394
9495      case 0x80/2: // return value if conditions are met
9596      {
96         if ((m_lordgun_protection_data & 0x11) == 0x01) return 0x10;
97         if ((m_lordgun_protection_data & 0x06) == 0x02) return 0x10;
98         if ((m_lordgun_protection_data & 0x09) == 0x08) return 0x10;
97         if ((m_protection_data & 0x11) == 0x01) return 0x10;
98         if ((m_protection_data & 0x06) == 0x02) return 0x10;
99         if ((m_protection_data & 0x09) == 0x08) return 0x10;
99100
100101         return 0;
101102      }
r243228r243229
110111   {
111112      case 0xc0/2: // reset protection device
112113      {
113         m_lordgun_protection_data = 0;
114         m_protection_data = 0;
114115
115116         return;
116117      }
r243228r243229
123124   {
124125      case 0x00/2: // de-increment counter
125126      {
126         m_lordgun_protection_data--;
127         m_lordgun_protection_data &= 0x1f;
127         m_protection_data--;
128         m_protection_data &= 0x1f;
128129
129130         return 0;
130131      }
131132
132133      case 0x40/2: // bitswap and xor counter
133134      {
134         UINT8 x = m_lordgun_protection_data;
135         UINT8 x = m_protection_data;
135136
136         m_lordgun_protection_data  = (((x >> 3) ^ (x >> 2)) & 1) << 4;
137         m_lordgun_protection_data |= (((x >> 2) ^ (x >> 1)) & 1) << 3;
138         m_lordgun_protection_data |= (((x >> 1) ^ (x >> 0)) & 1) << 2;
139         m_lordgun_protection_data |= (((x >> 4) ^ (x >> 0)) & 1) << 1;
140         m_lordgun_protection_data |= (((x >> 4) ^ (x >> 3)) & 1) << 0;
137         m_protection_data  = (((x >> 3) ^ (x >> 2)) & 1) << 4;
138         m_protection_data |= (((x >> 2) ^ (x >> 1)) & 1) << 3;
139         m_protection_data |= (((x >> 1) ^ (x >> 0)) & 1) << 2;
140         m_protection_data |= (((x >> 4) ^ (x >> 0)) & 1) << 1;
141         m_protection_data |= (((x >> 4) ^ (x >> 3)) & 1) << 0;
141142
142143         return 0;
143144      }
144145
145146      case 0x80/2: // return value if conditions are met
146147      {
147         if ((m_lordgun_protection_data & 0x11) == 0x00) return 0x20;
148         if ((m_lordgun_protection_data & 0x06) != 0x06) return 0x20;
149         if ((m_lordgun_protection_data & 0x18) == 0x00) return 0x20;
148         if ((m_protection_data & 0x11) == 0x00) return 0x20;
149         if ((m_protection_data & 0x06) != 0x06) return 0x20;
150         if ((m_protection_data & 0x18) == 0x00) return 0x20;
150151
151152         return 0;
152153      }
r243228r243229
622623
623624***************************************************************************/
624625
626void lordgun_state::machine_start()
627{
628   save_item(NAME(m_protection_data));
629   save_item(NAME(m_priority));
630   save_item(NAME(m_whitescreen));
631}
632
625633static MACHINE_CONFIG_START( lordgun, lordgun_state )
626634   MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
627635   MCFG_CPU_PROGRAM_MAP(lordgun_map)
r243228r243229
10271035
10281036***************************************************************************/
10291037
1030DRIVER_INIT_MEMBER(lordgun_state,lordgun)
1038DRIVER_INIT_MEMBER(lordgun_state, lordgun)
10311039{
1032   int i;
10331040   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
10341041   int rom_size = 0x100000;
10351042
1036   for(i = 0; i < rom_size/2; i++)
1043   for(int i = 0; i < rom_size/2; i++)
10371044   {
10381045      UINT16 x = rom[i];
10391046
r243228r243229
10421049
10431050      rom[i] = x;
10441051   }
1052   
1053   save_item(NAME(m_old));
1054   
1055   for (int i = 0; i < 2; i++)
1056   {
1057      save_item(NAME(m_gun[i].scr_x), i);
1058      save_item(NAME(m_gun[i].scr_y), i);
1059      save_item(NAME(m_gun[i].hw_x), i);
1060      save_item(NAME(m_gun[i].hw_y), i);
1061   }
10451062}
10461063
1064DRIVER_INIT_MEMBER(lordgun_state, aliencha)
1065{
1066   save_item(NAME(m_aliencha_dip_sel));
1067}
1068
10471069/***************************************************************************
10481070
10491071    Game Drivers
10501072
10511073***************************************************************************/
10521074
1053GAME( 1994, lordgun,   0,        lordgun,  lordgun,  lordgun_state, lordgun,  ROT0, "IGS", "Lord of Gun (USA)",       GAME_IMPERFECT_GRAPHICS )
1054GAME( 1994, aliencha,  0,        aliencha, aliencha, driver_device, 0,        ROT0, "IGS", "Alien Challenge (World)", 0 )
1055GAME( 1994, alienchac, aliencha, aliencha, aliencha, driver_device, 0,        ROT0, "IGS", "Alien Challenge (China)", 0 )
1075GAME( 1994, lordgun,   0,        lordgun,  lordgun,  lordgun_state, lordgun,  ROT0, "IGS", "Lord of Gun (USA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
1076GAME( 1994, aliencha,  0,        aliencha, aliencha, driver_device, 0,        ROT0, "IGS", "Alien Challenge (World)", GAME_SUPPORTS_SAVE )
1077GAME( 1994, alienchac, aliencha, aliencha, aliencha, driver_device, 0,        ROT0, "IGS", "Alien Challenge (China)", GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/lordgun.h
r243228r243229
1717public:
1818   lordgun_state(const machine_config &mconfig, device_type type, const char *tag)
1919      : driver_device(mconfig, type, tag),
20         m_priority_ram(*this, "priority_ram"),
21         m_scrollram(*this, "scrollram"),
22         m_spriteram(*this, "spriteram"),
23         m_vram(*this, "vram"),
24         m_scroll_x(*this, "scroll_x"),
25         m_scroll_y(*this, "scroll_y") ,
2620      m_maincpu(*this, "maincpu"),
2721      m_soundcpu(*this, "soundcpu"),
2822      m_oki(*this, "oki"),
r243228r243229
3024      m_gfxdecode(*this, "gfxdecode"),
3125      m_screen(*this, "screen"),
3226      m_palette(*this, "palette"),
33      m_generic_paletteram_16(*this, "paletteram") { }
27      m_generic_paletteram_16(*this, "paletteram"),
28      m_priority_ram(*this, "priority_ram"),
29      m_scrollram(*this, "scrollram"),
30      m_spriteram(*this, "spriteram"),
31      m_vram(*this, "vram"),
32      m_scroll_x(*this, "scroll_x"),
33      m_scroll_y(*this, "scroll_y") { }
3434
35   required_device<cpu_device> m_maincpu;
36   required_device<cpu_device> m_soundcpu;
37   required_device<okim6295_device> m_oki;
38   required_device<eeprom_serial_93cxx_device> m_eeprom;
39   required_device<gfxdecode_device> m_gfxdecode;
40   required_device<screen_device> m_screen;
41   required_device<palette_device> m_palette;
42   
43   required_shared_ptr<UINT16> m_generic_paletteram_16;
3544   required_shared_ptr<UINT16> m_priority_ram;
3645   required_shared_ptr<UINT16> m_scrollram;
3746   required_shared_ptr<UINT16> m_spriteram;
47   required_shared_ptr_array<UINT16, 4> m_vram;
48   required_shared_ptr_array<UINT16, 4> m_scroll_x;
49   required_shared_ptr_array<UINT16, 4> m_scroll_y;
3850
3951   UINT8 m_old;
4052   UINT8 m_aliencha_dip_sel;
4153   UINT16 m_priority;
42   required_shared_ptr_array<UINT16, 4> m_vram;
43   required_shared_ptr_array<UINT16, 4> m_scroll_x;
44   required_shared_ptr_array<UINT16, 4> m_scroll_y;
4554   int m_whitescreen;
4655   lordgun_gun_data m_gun[2];
4756   tilemap_t *m_tilemap[4];
4857   bitmap_ind16 *m_bitmaps[5];
4958
50   UINT16 m_lordgun_protection_data;
59   UINT16 m_protection_data;
5160   DECLARE_WRITE16_MEMBER(lordgun_protection_w);
5261   DECLARE_READ16_MEMBER(lordgun_protection_r);
5362   DECLARE_WRITE16_MEMBER(aliencha_protection_w);
r243228r243229
7180   DECLARE_READ8_MEMBER(aliencha_dip_r);
7281   DECLARE_WRITE8_MEMBER(aliencha_dip_w);
7382   DECLARE_WRITE8_MEMBER(lordgun_okibank_w);
83
84   DECLARE_DRIVER_INIT(aliencha);
7485   DECLARE_DRIVER_INIT(lordgun);
86
7587   TILE_GET_INFO_MEMBER(get_tile_info_0);
7688   TILE_GET_INFO_MEMBER(get_tile_info_1);
7789   TILE_GET_INFO_MEMBER(get_tile_info_2);
7890   TILE_GET_INFO_MEMBER(get_tile_info_3);
91
92   virtual void machine_start();
7993   virtual void video_start();
94
8095   UINT32 screen_update_lordgun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8196   inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
8297   inline void lordgun_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
8398   void lorddgun_calc_gun_scr(int i);
8499   void lordgun_update_gun(int i);
85100   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
86   required_device<cpu_device> m_maincpu;
87   required_device<cpu_device> m_soundcpu;
88   required_device<okim6295_device> m_oki;
89   required_device<eeprom_serial_93cxx_device> m_eeprom;
90   required_device<gfxdecode_device> m_gfxdecode;
91   required_device<screen_device> m_screen;
92   required_device<palette_device> m_palette;
93   required_shared_ptr<UINT16> m_generic_paletteram_16;
94101};
95102
96103/*----------- defined in video/lordgun.c -----------*/


Previous 199869 Revisions Next


© 1997-2024 The MAME Team