diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2014-12-20 16:07:40 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2014-12-20 16:07:40 +0100 |
commit | 86221585799dad223a7d43498a01dafc3c1c49cd (patch) | |
tree | 82c94346af12be5dd678d756821b045f4f377a10 | |
parent | 927602a8167bca79b0f664febe60e0163219d830 (diff) |
(MESS)-gamate :added bankswitched cartridges support, basic scrolling support [PeT]
-rw-r--r-- | src/mess/drivers/gamate.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/mess/drivers/gamate.c b/src/mess/drivers/gamate.c index 1495fcc5479..d3b9aad357a 100644 --- a/src/mess/drivers/gamate.c +++ b/src/mess/drivers/gamate.c @@ -19,8 +19,7 @@ public: , m_cart(*this, "cartslot") // , m_gfxdecode(*this, "gfxdecode") , m_io_joy(*this, "JOY") - , m_palette(*this, "palette") - , m_cart_rom(*this, "cart_rom") + , m_palette(*this, "palette") , m_bios(*this, "bios") { } @@ -28,6 +27,7 @@ public: DECLARE_READ8_MEMBER(protection_r); DECLARE_READ8_MEMBER(gamate_cart_protection_r); DECLARE_WRITE8_MEMBER(gamate_cart_protection_w); + DECLARE_WRITE8_MEMBER(cart_bankswitch_w); DECLARE_READ8_MEMBER(gamate_video_r); DECLARE_READ8_MEMBER(gamate_pad_r); DECLARE_WRITE8_MEMBER(gamate_video_w); @@ -49,7 +49,7 @@ private: struct { bool write; bool page2; // else page1 - UINT8 ypos, xpos/*tennis*/; + UINT8 ypos, xpos/*tennis*/; UINT8 data[2][0x100][0x20]; } bitmap; UINT8 x, y; @@ -69,7 +69,6 @@ private: // required_device<gfxdecode_device> m_gfxdecode; required_ioport m_io_joy; required_device<palette_device> m_palette; - required_shared_ptr<UINT8> m_cart_rom; required_shared_ptr<UINT8> m_bios; emu_timer *timer1; emu_timer *timer2; @@ -82,7 +81,7 @@ WRITE8_MEMBER( gamate_state::gamate_cart_protection_w ) card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0); card_protection.bit_shifter++; if (card_protection.bit_shifter>=8) { - card_protection.cartridge_byte=m_cart_rom[card_protection.address++]; + card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++]; card_protection.bit_shifter=0; } break; @@ -98,7 +97,7 @@ READ8_MEMBER( gamate_state::gamate_cart_protection_r ) card_protection.bit_shifter++; if (card_protection.bit_shifter>=8) { card_protection.bit_shifter=0; - card_protection.cartridge_byte=m_cart_rom[card_protection.address++]; + card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++]; card_protection.unprotected=true; if (!card_protection.failed) { } // now protection chip on cartridge activates cartridge chip select on cpu accesses @@ -135,6 +134,11 @@ WRITE8_MEMBER( gamate_state::gamate_video_w ) } } +WRITE8_MEMBER( gamate_state::cart_bankswitch_w ) +{ + membank("bank")->set_base(m_cart->get_rom_base()+0x4000*data); +} + READ8_MEMBER( gamate_state::gamate_video_r ) { if (offset!=6) return 0; @@ -177,9 +181,13 @@ static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state ) AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w) AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r) - AM_RANGE(0x6000, 0xdfff) AM_ROM AM_SHARE("cart_rom") + AM_RANGE(0x6000, 0x9fff) AM_ROM + AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank") + AM_RANGE(0x6000, 0x6002) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w) // AM_RANGE(0x6000, 0xdfff) AM_READWRITE(gamate_cart_r, gamate_cart_w) + AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w) + AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios") ADDRESS_MAP_END @@ -259,17 +267,15 @@ static void BlitPlane(UINT16* line, UINT8 plane1, UINT8 plane2) UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int x, y, j; - for (y=0;y<160;y++) { - for (x=0, j=0;x<160;x+=8, j++) { -// UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][j+video.bitmap.xpos/8]; -// UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][j+video.bitmap.xpos/8]; - UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)%200][j]; // kill shot, tornade - UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)%200][j]; - BlitPlane(&bitmap.pix16(y, x+4), d1, d2); - BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4); + for (y=0;y<152;y++) { + for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) { + UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f]; + UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f]; + BlitPlane(&bitmap.pix16(y, x+4), d1, d2); + BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4); } } - return 0; + return 0; } DRIVER_INIT_MEMBER(gamate_state,gamate) @@ -284,13 +290,14 @@ DRIVER_INIT_MEMBER(gamate_state,gamate) void gamate_state::machine_start() { if (m_cart->exists()) { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x9fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); // m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); + membank("bank")->set_base(m_cart->get_rom_base()+0x4000); } m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // $47 protection readback card_protection.address=0x6005-0x6001; card_protection.bit_shifter=0; - card_protection.cartridge_byte=m_cart_rom[card_protection.address++]; + card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];//m_cart_rom[card_protection.address++]; card_protection.failed=false; card_protection.unprotected=false; timer2->enable(TRUE); @@ -335,13 +342,8 @@ static MACHINE_CONFIG_START( gamate, gamate_state ) MCFG_SCREEN_ADD("screen", LCD) MCFG_SCREEN_REFRESH_RATE(60) -#ifdef SHOW_TILEMAP - MCFG_SCREEN_SIZE(256, 152+256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 152+256-1) -#else MCFG_SCREEN_SIZE(160, 152) MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 152-1) -#endif MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate) MCFG_SCREEN_PALETTE("palette") |