Merge pull request #5224 from cam900/toaplan2_args

toaplan2.cpp : Updates
This commit is contained in:
R. Belmont 2019-06-13 16:40:52 -04:00 committed by GitHub
commit 7349e185f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 310 additions and 342 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@
#include "machine/bankdev.h"
#include "machine/eepromser.h"
#include "machine/gen_latch.h"
#include "machine/nmk112.h"
#include "machine/ticket.h"
#include "machine/upd4992.h"
#include "video/gp9001.h"
@ -33,7 +32,6 @@ public:
, m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu")
, m_vdp(*this, "gp9001_%u", 0U)
, m_nmk112(*this, "nmk112")
, m_oki(*this, "oki%u", 1U)
, m_eeprom(*this, "eeprom")
, m_rtc(*this, "rtc")
@ -45,8 +43,13 @@ public:
, m_hopper(*this, "hopper")
, m_dma_space(*this, "dma_space")
, m_z80_rom(*this, "audiocpu")
, m_oki_rom(*this, "oki%u", 1U)
, m_audiobank(*this, "audiobank")
, m_okibank(*this, "okibank")
, m_raizing_okibank{{*this, "raizing_okibank0_%u", 0U},
{*this, "raizing_okibank1_%u", 0U}}
, m_io_pad(*this, "PAD%u", 1U)
, m_eepromout(*this, "EEPROMOUT")
{ }
void dogyuun(machine_config &config);
@ -91,17 +94,16 @@ private:
// We encode priority with colour in the tilemaps, so need a larger palette
static constexpr unsigned T2PALETTE_LENGTH = 0x10000;
optional_shared_ptr<uint8_t> m_shared_ram; // 8 bit RAM shared between 68K and sound CPU
optional_shared_ptr<uint16_t> m_tx_videoram;
optional_shared_ptr<uint16_t> m_tx_lineselect;
optional_shared_ptr<uint16_t> m_tx_linescroll;
optional_shared_ptr<uint16_t> m_tx_gfxram;
optional_shared_ptr<uint16_t> m_mainram;
optional_shared_ptr<u8> m_shared_ram; // 8 bit RAM shared between 68K and sound CPU
optional_shared_ptr<u16> m_tx_videoram;
optional_shared_ptr<u16> m_tx_lineselect;
optional_shared_ptr<u16> m_tx_linescroll;
optional_shared_ptr<u16> m_tx_gfxram;
optional_shared_ptr<u16> m_mainram;
required_device<m68000_base_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device_array<gp9001vdp_device, 2> m_vdp;
optional_device<nmk112_device> m_nmk112;
optional_device_array<okim6295_device, 2> m_oki;
optional_device<eeprom_serial_93cxx_device> m_eeprom;
optional_device<upd4992_device> m_rtc;
@ -114,61 +116,67 @@ private:
optional_device<address_map_bank_device> m_dma_space;
optional_region_ptr<uint8_t> m_z80_rom;
optional_region_ptr<u8> m_z80_rom;
optional_region_ptr_array<u8, 2> m_oki_rom;
optional_memory_bank m_audiobank;
optional_memory_bank m_okibank;
optional_memory_bank_array<8> m_raizing_okibank[2];
int8_t m_old_p1_paddle_h; /* For Ghox */
int8_t m_old_p2_paddle_h;
uint8_t m_v25_reset_line; /* 0x20 for dogyuun/batsugun, 0x10 for vfive, 0x08 for fixeight */
uint8_t m_sndirq_line; /* IRQ4 for batrider, IRQ2 for bbakraid */
uint8_t m_z80_busreq;
uint16_t m_gfxrom_bank[8]; /* Batrider object bank */
optional_ioport_array<2> m_io_pad;
optional_ioport m_eepromout;
s8 m_old_p1_paddle_h; /* For Ghox */
s8 m_old_p2_paddle_h;
u8 m_sound_reset_bit; /* 0x20 for dogyuun/batsugun, 0x10 for vfive, 0x08 for fixeight */
u8 m_sndirq_line; /* IRQ4 for batrider, IRQ2 for bbakraid */
u8 m_z80_busreq;
u16 m_gfxrom_bank[8]; /* Batrider object bank */
bitmap_ind8 m_custom_priority_bitmap;
bitmap_ind16 m_secondary_render_bitmap;
tilemap_t *m_tx_tilemap; /* Tilemap for extra-text-layer */
DECLARE_READ16_MEMBER(video_count_r);
DECLARE_WRITE8_MEMBER(toaplan2_coin_w);
DECLARE_WRITE16_MEMBER(toaplan2_coin_word_w);
DECLARE_WRITE16_MEMBER(toaplan2_v25_coin_word_w);
DECLARE_WRITE16_MEMBER(shippumd_coin_word_w);
DECLARE_READ16_MEMBER(shared_ram_r);
DECLARE_WRITE16_MEMBER(shared_ram_w);
DECLARE_READ16_MEMBER(ghox_p1_h_analog_r);
DECLARE_READ16_MEMBER(ghox_p2_h_analog_r);
DECLARE_WRITE16_MEMBER(fixeight_subcpu_ctrl_w);
DECLARE_WRITE8_MEMBER(fixeightbl_oki_bankswitch_w);
DECLARE_WRITE8_MEMBER(raizing_z80_bankswitch_w);
DECLARE_WRITE8_MEMBER(raizing_oki_bankswitch_w);
DECLARE_READ8_MEMBER(bgaregga_E01D_r);
DECLARE_READ16_MEMBER(batrider_z80_busack_r);
DECLARE_WRITE8_MEMBER(batrider_z80_busreq_w);
DECLARE_READ16_MEMBER(batrider_z80rom_r);
DECLARE_WRITE8_MEMBER(batrider_soundlatch_w);
DECLARE_WRITE8_MEMBER(batrider_soundlatch2_w);
DECLARE_WRITE16_MEMBER(batrider_unknown_sound_w);
DECLARE_WRITE16_MEMBER(batrider_clear_sndirq_w);
DECLARE_WRITE8_MEMBER(batrider_sndirq_w);
DECLARE_WRITE8_MEMBER(batrider_clear_nmi_w);
DECLARE_READ16_MEMBER(bbakraid_eeprom_r);
DECLARE_WRITE16_MEMBER(bbakraid_eeprom_w);
DECLARE_WRITE16_MEMBER(tx_videoram_w);
DECLARE_WRITE16_MEMBER(tx_linescroll_w);
DECLARE_WRITE16_MEMBER(tx_gfxram_w);
DECLARE_WRITE16_MEMBER(batrider_tx_gfxram_w);
DECLARE_WRITE16_MEMBER(batrider_textdata_dma_w);
DECLARE_WRITE16_MEMBER(batrider_pal_text_dma_w);
DECLARE_WRITE8_MEMBER(batrider_objectbank_w);
u16 video_count_r();
void coin_w(u8 data);
void coin_sound_reset_w(u8 data);
void shippumd_coin_w(u8 data);
u8 shared_ram_r(offs_t offset);
void shared_ram_w(offs_t offset, u8 data);
u16 ghox_p1_h_analog_r();
u16 ghox_p2_h_analog_r();
void sound_reset_w(u8 data);
void fixeightbl_oki_bankswitch_w(u8 data);
void raizing_z80_bankswitch_w(u8 data);
void raizing_oki_bankswitch_w(offs_t offset, u8 data);
u8 bgaregga_E01D_r();
u16 batrider_z80_busack_r();
void batrider_z80_busreq_w(u8 data);
u16 batrider_z80rom_r(offs_t offset);
void batrider_soundlatch_w(u8 data);
void batrider_soundlatch2_w(u8 data);
void batrider_unknown_sound_w(u16 data);
void batrider_clear_sndirq_w(u16 data);
void batrider_sndirq_w(u8 data);
void batrider_clear_nmi_w(u8 data);
u16 bbakraid_eeprom_r();
void bbakraid_eeprom_w(u8 data);
void tx_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void tx_linescroll_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void tx_gfxram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void batrider_tx_gfxram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void batrider_textdata_dma_w(u16 data);
void batrider_pal_text_dma_w(u16 data);
void batrider_objectbank_w(offs_t offset, u8 data);
void batrider_bank_cb(u8 layer, u32 &code);
template<int Chip> DECLARE_WRITE8_MEMBER(oki_bankswitch_w);
DECLARE_WRITE16_MEMBER(enmadaio_oki_bank_w);
template<int Chip> void oki_bankswitch_w(u8 data);
void enmadaio_oki_bank_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void install_raizing_okibank(int chip);
TILE_GET_INFO_MEMBER(get_text_tile_info);
virtual void machine_start() override;
DECLARE_MACHINE_RESET(toaplan2);
DECLARE_MACHINE_RESET(bgaregga);
DECLARE_VIDEO_START(toaplan2);
DECLARE_MACHINE_RESET(ghox);
DECLARE_VIDEO_START(truxton2);
@ -178,21 +186,21 @@ private:
DECLARE_VIDEO_START(batrider);
// Teki Paki sound
DECLARE_READ8_MEMBER(tekipaki_cmdavailable_r);
u8 tekipaki_cmdavailable_r();
uint32_t screen_update_toaplan2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_dogyuun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_batsugun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_truxton2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_toaplan2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_dogyuun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_batsugun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_truxton2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
void cpu_space_fixeightbl_map(address_map &map);
void cpu_space_pipibibsbl_map(address_map &map);
INTERRUPT_GEN_MEMBER(bbakraid_snd_interrupt);
void create_tx_tilemap(int dx = 0, int dx_flipped = 0);
DECLARE_WRITE8_MEMBER(pwrkick_coin_w);
DECLARE_WRITE8_MEMBER(pwrkick_coin_lockout_w);
void pwrkick_coin_w(u8 data);
void pwrkick_coin_lockout_w(u8 data);
DECLARE_WRITE_LINE_MEMBER(toaplan2_reset);
@ -226,6 +234,7 @@ private:
void pipibibs_68k_mem(address_map &map);
void pipibibs_sound_z80_mem(address_map &map);
void pwrkick_68k_mem(address_map &map);
template<unsigned Chip> void raizing_oki(address_map &map);
void raizing_sound_z80_mem(address_map &map);
void shippumd_68k_mem(address_map &map);
void snowbro2_68k_mem(address_map &map);

View File

@ -35,11 +35,9 @@
TILE_GET_INFO_MEMBER(toaplan2_state::get_text_tile_info)
{
int color, tile_number, attrib;
attrib = m_tx_videoram[tile_index];
tile_number = attrib & 0x3ff;
color = attrib >> 10;
const u16 attrib = m_tx_videoram[tile_index];
const u32 tile_number = attrib & 0x3ff;
const u32 color = attrib >> 10;
SET_TILE_INFO_MEMBER(0,
tile_number,
color,
@ -92,7 +90,7 @@ VIDEO_START_MEMBER(toaplan2_state,truxton2)
VIDEO_START_CALL_MEMBER(toaplan2);
/* Create the Text tilemap for this game */
m_gfxdecode->gfx(0)->set_source(reinterpret_cast<uint8_t *>(m_tx_gfxram.target()));
m_gfxdecode->gfx(0)->set_source(reinterpret_cast<u8 *>(m_tx_gfxram.target()));
create_tx_tilemap(0x1d5, 0x16a);
}
@ -136,7 +134,7 @@ VIDEO_START_MEMBER(toaplan2_state,batrider)
m_vdp[0]->disable_sprite_buffer(); // disable buffering on this game
/* Create the Text tilemap for this game */
m_gfxdecode->gfx(0)->set_source(reinterpret_cast<uint8_t *>(m_tx_gfxram.target()));
m_gfxdecode->gfx(0)->set_source(reinterpret_cast<u8 *>(m_tx_gfxram.target()));
create_tx_tilemap(0x1d4, 0x16b);
@ -144,14 +142,14 @@ VIDEO_START_MEMBER(toaplan2_state,batrider)
save_item(NAME(m_gfxrom_bank));
}
WRITE16_MEMBER(toaplan2_state::tx_videoram_w)
void toaplan2_state::tx_videoram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_tx_videoram[offset]);
if (offset < 64*32)
m_tx_tilemap->mark_tile_dirty(offset);
}
WRITE16_MEMBER(toaplan2_state::tx_linescroll_w)
void toaplan2_state::tx_linescroll_w(offs_t offset, u16 data, u16 mem_mask)
{
/*** Line-Scroll RAM for Text Layer ***/
COMBINE_DATA(&m_tx_linescroll[offset]);
@ -159,11 +157,11 @@ WRITE16_MEMBER(toaplan2_state::tx_linescroll_w)
m_tx_tilemap->set_scrollx(offset, m_tx_linescroll[offset]);
}
WRITE16_MEMBER(toaplan2_state::tx_gfxram_w)
void toaplan2_state::tx_gfxram_w(offs_t offset, u16 data, u16 mem_mask)
{
/*** Dynamic GFX decoding for Truxton 2 / FixEight ***/
uint16_t oldword = m_tx_gfxram[offset];
const u16 oldword = m_tx_gfxram[offset];
if (oldword != data)
{
@ -172,11 +170,11 @@ WRITE16_MEMBER(toaplan2_state::tx_gfxram_w)
}
}
WRITE16_MEMBER(toaplan2_state::batrider_tx_gfxram_w)
void toaplan2_state::batrider_tx_gfxram_w(offs_t offset, u16 data, u16 mem_mask)
{
/*** Dynamic GFX decoding for Batrider / Battle Bakraid ***/
uint16_t oldword = m_tx_gfxram[offset];
const u16 oldword = m_tx_gfxram[offset];
if (oldword != data)
{
@ -185,7 +183,7 @@ WRITE16_MEMBER(toaplan2_state::batrider_tx_gfxram_w)
}
}
WRITE16_MEMBER(toaplan2_state::batrider_textdata_dma_w)
void toaplan2_state::batrider_textdata_dma_w(u16 data)
{
/*** Dynamic Text GFX decoding for Batrider ***/
/*** Only done once during start-up ***/
@ -196,7 +194,7 @@ WRITE16_MEMBER(toaplan2_state::batrider_textdata_dma_w)
}
}
WRITE16_MEMBER(toaplan2_state::batrider_pal_text_dma_w)
void toaplan2_state::batrider_pal_text_dma_w(u16 data)
{
// FIXME: In batrider and bbakraid, the text layer and palette RAM
// are probably DMA'd from main RAM by writing here at every vblank,
@ -208,7 +206,7 @@ WRITE16_MEMBER(toaplan2_state::batrider_pal_text_dma_w)
}
}
WRITE8_MEMBER(toaplan2_state::batrider_objectbank_w)
void toaplan2_state::batrider_objectbank_w(offs_t offset, u8 data)
{
data &= 0xf;
if (m_gfxrom_bank[offset] != data)
@ -224,7 +222,7 @@ void toaplan2_state::batrider_bank_cb(u8 layer, u32 &code)
}
// Dogyuun doesn't appear to require fancy mixing?
uint32_t toaplan2_state::screen_update_dogyuun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 toaplan2_state::screen_update_dogyuun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(0, cliprect);
if (m_vdp[1])
@ -238,13 +236,12 @@ uint32_t toaplan2_state::screen_update_dogyuun(screen_device &screen, bitmap_ind
m_vdp[0]->render_vdp(bitmap, cliprect);
}
return 0;
}
// renders to 2 bitmaps, and mixes output
uint32_t toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// bitmap.fill(0, cliprect);
// gp9001_custom_priority_bitmap->fill(0, cliprect);
@ -262,7 +259,6 @@ uint32_t toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_in
m_vdp[1]->render_vdp(m_secondary_render_bitmap, cliprect);
}
// key test places in batsugun
// level 2 - the two layers of clouds (will appear under background, or over ships if wrong)
// level 3 - the special effect 'layer' which should be under everything (will appear over background if wrong)
@ -276,22 +272,19 @@ uint32_t toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_in
if (m_vdp[0] && m_vdp[1])
{
uint16_t* src_vdp0; // output buffer of vdp0
uint16_t* src_vdp1; // output buffer of vdp1
for (int y=cliprect.min_y;y<=cliprect.max_y;y++)
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
src_vdp0 = &bitmap.pix16(y);
src_vdp1 = &m_secondary_render_bitmap.pix16(y);
u16* src_vdp0 = &bitmap.pix16(y);
const u16* src_vdp1 = &m_secondary_render_bitmap.pix16(y);
for (int x=cliprect.min_x;x<=cliprect.max_x;x++)
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
uint16_t GPU0_LUTaddr = src_vdp0[x];
uint16_t GPU1_LUTaddr = src_vdp1[x];
const u16 GPU0_LUTaddr = src_vdp0[x];
const u16 GPU1_LUTaddr = src_vdp1[x];
// these equations is derived from the PAL, but doesn't seem to work?
int COMPARISON = ((GPU0_LUTaddr & 0x0780) > (GPU1_LUTaddr & 0x0780));
const bool COMPARISON = ((GPU0_LUTaddr & 0x0780) > (GPU1_LUTaddr & 0x0780));
// note: GPU1_LUTaddr & 0x000f - transparency check for vdp1? (gfx are 4bpp, the low 4 bits of the lookup would be the pixel data value)
#if 0
@ -340,7 +333,7 @@ uint32_t toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_in
}
uint32_t toaplan2_state::screen_update_toaplan2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 toaplan2_state::screen_update_toaplan2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(0, cliprect);
m_custom_priority_bitmap.fill(0, cliprect);
@ -351,7 +344,7 @@ uint32_t toaplan2_state::screen_update_toaplan2(screen_device &screen, bitmap_in
/* fixeightbl and bgareggabl do not use the lineselect or linescroll tables */
uint32_t toaplan2_state::screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 toaplan2_state::screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen_update_toaplan2(screen, bitmap, cliprect);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0);
@ -359,7 +352,7 @@ uint32_t toaplan2_state::screen_update_bootleg(screen_device &screen, bitmap_ind
}
uint32_t toaplan2_state::screen_update_truxton2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 toaplan2_state::screen_update_truxton2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen_update_toaplan2(screen, bitmap, cliprect);