Previous 199869 Revisions Next

r33983 Saturday 20th December, 2014 at 15:07:40 UTC by Miodrag Milanović
(MESS)-gamate :added bankswitched cartridges support, basic scrolling support [PeT]
[src/mess/drivers]gamate.c

trunk/src/mess/drivers/gamate.c
r242494r242495
1919      , m_cart(*this, "cartslot")
2020//      , m_gfxdecode(*this, "gfxdecode")
2121      , m_io_joy(*this, "JOY")
22      ,   m_palette(*this, "palette")
23      , m_cart_rom(*this, "cart_rom")
22      , m_palette(*this, "palette")
2423      , m_bios(*this, "bios")
2524   { }
2625
r242494r242495
2827   DECLARE_READ8_MEMBER(protection_r);
2928   DECLARE_READ8_MEMBER(gamate_cart_protection_r);
3029   DECLARE_WRITE8_MEMBER(gamate_cart_protection_w);
30   DECLARE_WRITE8_MEMBER(cart_bankswitch_w);
3131   DECLARE_READ8_MEMBER(gamate_video_r);
3232   DECLARE_READ8_MEMBER(gamate_pad_r);
3333   DECLARE_WRITE8_MEMBER(gamate_video_w);
r242494r242495
4949     struct {
5050       bool write;
5151       bool page2; // else page1
52         UINT8 ypos, xpos/*tennis*/;
52   UINT8 ypos, xpos/*tennis*/;
5353       UINT8 data[2][0x100][0x20];
5454     } bitmap;
5555     UINT8 x, y;
r242494r242495
6969//   required_device<gfxdecode_device> m_gfxdecode;
7070   required_ioport m_io_joy;
7171   required_device<palette_device> m_palette;
72   required_shared_ptr<UINT8> m_cart_rom;
7372   required_shared_ptr<UINT8> m_bios;
7473   emu_timer *timer1;
7574   emu_timer *timer2;
r242494r242495
8281      card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0);
8382      card_protection.bit_shifter++;
8483      if (card_protection.bit_shifter>=8) {
85         card_protection.cartridge_byte=m_cart_rom[card_protection.address++];
84         card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];
8685         card_protection.bit_shifter=0;
8786      }
8887      break;
r242494r242495
9897      card_protection.bit_shifter++;
9998      if (card_protection.bit_shifter>=8) {
10099         card_protection.bit_shifter=0;
101         card_protection.cartridge_byte=m_cart_rom[card_protection.address++];
100         card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];
102101         card_protection.unprotected=true;
103102         if (!card_protection.failed) {
104103         } // now protection chip on cartridge activates cartridge chip select on cpu accesses
r242494r242495
135134  }
136135}
137136
137WRITE8_MEMBER( gamate_state::cart_bankswitch_w )
138{
139   membank("bank")->set_base(m_cart->get_rom_base()+0x4000*data);
140}
141
138142READ8_MEMBER( gamate_state::gamate_video_r )
139143{
140144   if (offset!=6) return 0;
r242494r242495
177181  AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
178182  AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
179183
180  AM_RANGE(0x6000, 0xdfff) AM_ROM AM_SHARE("cart_rom")
184  AM_RANGE(0x6000, 0x9fff) AM_ROM
185  AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
186
181187   AM_RANGE(0x6000, 0x6002) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w)
182188//   AM_RANGE(0x6000, 0xdfff) AM_READWRITE(gamate_cart_r, gamate_cart_w)
189   AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w)
190
183191  AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
184192ADDRESS_MAP_END
185193
r242494r242495
259267UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
260268{
261269  int x, y, j;
262  for (y=0;y<160;y++) {
263    for (x=0, j=0;x<160;x+=8, j++) {
264//      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][j+video.bitmap.xpos/8];
265//      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][j+video.bitmap.xpos/8];
266      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)%200][j]; // kill shot, tornade
267      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)%200][j];
268         BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
269         BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
270  for (y=0;y<152;y++) {
271    for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
272      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
273      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
274      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
275      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
270276    }
271277  }
272   return 0;
278  return 0;
273279}
274280
275281DRIVER_INIT_MEMBER(gamate_state,gamate)
r242494r242495
284290void gamate_state::machine_start()
285291{
286292   if (m_cart->exists()) {
287      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart));
293      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x9fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart));
288294//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
295      membank("bank")->set_base(m_cart->get_rom_base()+0x4000);
289296   }
290297   m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // $47 protection readback
291298   card_protection.address=0x6005-0x6001;
292299   card_protection.bit_shifter=0;
293   card_protection.cartridge_byte=m_cart_rom[card_protection.address++];
300   card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];//m_cart_rom[card_protection.address++];
294301   card_protection.failed=false;
295302   card_protection.unprotected=false;
296303   timer2->enable(TRUE);
r242494r242495
335342
336343   MCFG_SCREEN_ADD("screen", LCD)
337344   MCFG_SCREEN_REFRESH_RATE(60)
338#ifdef SHOW_TILEMAP
339   MCFG_SCREEN_SIZE(256, 152+256)
340   MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 152+256-1)
341#else
342345   MCFG_SCREEN_SIZE(160, 152)
343346   MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 152-1)
344#endif
345347   MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate)
346348   MCFG_SCREEN_PALETTE("palette")
347349


Previous 199869 Revisions Next


© 1997-2024 The MAME Team