nmk/nmk16.cpp: upgraded interrupts trigger system based on PROM contents (#12562)

* nmk/nmk16.cpp: upgraded interrupts trigger system based on PROM contents
* added info about screen resolutions and timings
* merged powerins.cpp into nmk16.cpp driver to make use the new interrupt system
* nmk16 prom timing fixes
* fixed interrupts config for `powerinsb` and `powerinsc`
This commit is contained in:
Sergio G. 2024-07-27 03:10:47 +02:00 committed by GitHub
parent cb354265c1
commit aaae6d6954
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1508 additions and 1354 deletions

View File

@ -34916,6 +34916,13 @@ mustangs // UPL-90058 (c) 1990 UPL + Seoul Trading
nouryoku // (c) 1995 Tecmo
nouryokup // (c) 1995 Tecmo
popspops // (c) 1999
powerins // (c) 1993 Atlus (USA)
powerinsa // (c) 1993 Atlus (bootleg of USA version)
powerinsb // (c) 1993 Atlus (bootleg of USA version)
powerinsc // (c) 1993 Atlus (bootleg of USA version)
powerinsj // (c) 1993 Atlus (Japan)
powerinspj // prototype (Japan)
powerinspu // prototype (USA)
raphero // (c) 1994 NMK
rapheroa // (c) 1994 Media Trading Corp
redfoxwp2 // (c) 1998 (China)
@ -34968,15 +34975,6 @@ sluster2 // NMK
sweethrt // NMK
trocana // NTC / NMK
@source:nmk/powerins.cpp
powerins // (c) 1993 Atlus (USA)
powerinsa // (c) 1993 Atlus (bootleg of USA version)
powerinsb // (c) 1993 Atlus (bootleg of USA version)
powerinsc // (c) 1993 Atlus (bootleg of USA version)
powerinsj // (c) 1993 Atlus (Japan)
powerinspj // prototype (Japan)
powerinspu // prototype (USA)
@source:nmk/quizdna.cpp
gakupara // (c) 1991 NMK
gekiretu // (c) 1992 Face

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@ public:
m_tilemap_rom(*this, "tilerom"),
m_audiobank(*this, "audiobank"),
m_okibank(*this, "okibank%u", 1U),
m_vtiming_prom(*this, "vtiming"),
m_dsw_io(*this, "DSW%u", 1U),
m_in_io(*this, "IN%u", 0U),
m_sprdma_base(0x8000)
@ -77,6 +78,13 @@ public:
void mustangb3(machine_config &config);
void twinactn(machine_config &config);
void vandykeb(machine_config &config);
void powerins(machine_config &config);
void powerinsj(machine_config &config);
void powerinspu(machine_config &config);
void powerinspj(machine_config &config);
void powerinsa(machine_config &config);
void powerinsb(machine_config &config);
void powerinsc(machine_config &config);
void init_nmk();
void init_tharrier();
@ -87,10 +95,15 @@ public:
void init_banked_audiocpu();
void init_gunnailb();
void init_bjtwin();
void init_powerinsa();
void init_acrobatmbl();
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
TIMER_DEVICE_CALLBACK_MEMBER(nmk16_scanline);
TIMER_DEVICE_CALLBACK_MEMBER(nmk16_hacky_scanline);
u32 screen_update_macross(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void txvideoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
@ -98,7 +111,12 @@ protected:
void vandyke_flipscreen_w(u8 data);
void tilebank_w(u8 data);
void macross2_sound_bank_w(u8 data);
void macross2_sound_reset_w(u16 data);
void macross2_audiobank_w(u8 data);
void ssmissin_okibank_w(u8 data);
void powerinsa_okibank_w(u8 data);
template<unsigned Chip> void tharrier_okibank_w(u8 data);
u8 powerins_bootleg_fake_ym2203_r();
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
@ -120,6 +138,7 @@ protected:
optional_region_ptr<u16> m_tilemap_rom;
optional_memory_bank m_audiobank;
optional_memory_bank_array<2> m_okibank;
optional_memory_region m_vtiming_prom;
optional_ioport_array<2> m_dsw_io;
optional_ioport_array<3> m_in_io;
@ -138,15 +157,13 @@ protected:
u8 m_scroll[2][4]{};
u16 m_vscroll[4]{};
int m_prot_count = 0;
u8 m_interrupt_trigger;
void mainram_strange_w(offs_t offset, u16 data/*, u16 mem_mask = ~0*/);
u16 mainram_swapped_r(offs_t offset);
void mainram_swapped_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void ssmissin_soundbank_w(u8 data);
void tharrier_mcu_control_w(u16 data);
u16 tharrier_mcu_r(offs_t offset, u16 mem_mask = ~0);
void macross2_sound_reset_w(u16 data);
template<unsigned Chip> void tharrier_oki_bankswitch_w(u8 data);
u16 vandykeb_r();
u16 tdragonb_prot_r();
template<unsigned Layer> void bgvideoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
@ -161,27 +178,34 @@ protected:
void nmk004_x0016_w(u16 data);
void nmk004_bioship_x0016_w(u16 data);
void set_interrupt_timing(machine_config &config);
void set_hacky_interrupt_timing(machine_config &config);
void set_hacky_screen_lowres(machine_config &config);
void set_hacky_screen_hires(machine_config &config);
void set_screen_lowres(machine_config &config);
void set_screen_midres(machine_config &config);
void set_screen_hires(machine_config &config);
TILEMAP_MAPPER_MEMBER(tilemap_scan_pages);
template<unsigned Layer, unsigned Gfx> TILE_GET_INFO_MEMBER(common_get_bg_tile_info);
TILE_GET_INFO_MEMBER(common_get_tx_tile_info);
TILE_GET_INFO_MEMBER(bioship_get_bg_tile_info);
TILE_GET_INFO_MEMBER(bjtwin_get_bg_tile_info);
TILE_GET_INFO_MEMBER(powerins_get_bg_tile_info);
DECLARE_VIDEO_START(macross);
DECLARE_VIDEO_START(bioship);
DECLARE_VIDEO_START(strahl);
DECLARE_VIDEO_START(macross2);
DECLARE_VIDEO_START(gunnail);
DECLARE_VIDEO_START(bjtwin);
DECLARE_VIDEO_START(powerins);
void get_colour_4bit(u32 &colour, u32 &pri_mask);
void get_colour_5bit(u32 &colour, u32 &pri_mask);
void get_colour_6bit(u32 &colour, u32 &pri_mask);
void get_sprite_flip(u16 attr, int &flipx, int &flipy, int &code);
void get_flip_extcode_powerins(u16 attr, int &flipx, int &flipy, int &code);
u32 screen_update_tharrier(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_strahl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_bjtwin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_vblank_powerins_bootleg(int state);
TIMER_CALLBACK_MEMBER(dma_callback);
TIMER_DEVICE_CALLBACK_MEMBER(manybloc_scanline);
void video_init();
@ -216,6 +240,11 @@ protected:
void mustangb3_sound_map(address_map &map);
void oki1_map(address_map &map);
void oki2_map(address_map &map);
void powerins_map(address_map &map);
void powerins_sound_map(address_map &map);
void powerins_bootleg_audio_io_map(address_map &map);
void powerinsa_map(address_map &map);
void powerinsa_oki_map(address_map &map);
void raphero_map(address_map &map);
void raphero_sound_mem_map(address_map &map);
void ssmissin_map(address_map &map);

View File

@ -65,6 +65,15 @@ TILE_GET_INFO_MEMBER(nmk16_state::bjtwin_get_bg_tile_info)
0);
}
TILE_GET_INFO_MEMBER(nmk16_state::powerins_get_bg_tile_info)
{
const u16 code = m_bgvideoram[0][tile_index];
tileinfo.set(1,
(code & 0x07ff) | (m_bgbank << 11),
((code & 0xf000) >> 12) | ((code & 0x0800) >> 7),
0);
}
/***************************************************************************
@ -164,6 +173,36 @@ VIDEO_START_MEMBER(nmk16_state, bjtwin)
m_bg_tilemap[0]->set_scrolldx(28+64, 28+64);
}
/***************************************************************************
[ Tiles Format VRAM 0]
Offset:
0.w fedc ---- ---- ---- Color Low Bits
---- b--- ---- ---- Color High Bit
---- -a98 7654 3210 Code (Banked)
[ Tiles Format VRAM 1]
Offset:
0.w fedc ---- ---- ---- Color
---- ba98 7654 3210 Code
***************************************************************************/
VIDEO_START_MEMBER(nmk16_state, powerins)
{
m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(nmk16_state::powerins_get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(nmk16_state::tilemap_scan_pages)), 16, 16, 256, 32);
m_bg_tilemap[1] = nullptr;
m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(nmk16_state::common_get_tx_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 64, 32);
m_tx_tilemap->set_transparent_pen(15);
video_init();
// 320x224 screen, leftmost 32 pixels have to be retrieved from the other side of the tilemap (!)
m_bg_tilemap[0]->set_scrolldx(60+32, 60+32);
m_tx_tilemap->set_scrolldx(60+32, 60+32);
}
void nmk16_state::mustang_scroll_w(u16 data)
{
// osd_printf_debug("mustang %04x %04x %04x\n",offset,data,mem_mask);
@ -295,6 +334,12 @@ void nmk16_state::get_colour_5bit(u32 &colour, u32 &pri_mask)
pri_mask |= GFX_PMASK_2; // under foreground
}
void nmk16_state::get_colour_6bit(u32 &colour, u32 &pri_mask)
{
colour &= 0x3f;
pri_mask |= GFX_PMASK_2; // under foreground
}
// manybloc uses extra flip bits on the sprites, but these break other games
void nmk16_state::get_sprite_flip(u16 attr, int &flipx, int &flipy, int &code)
@ -303,6 +348,12 @@ void nmk16_state::get_sprite_flip(u16 attr, int &flipx, int &flipy, int &code)
flipx = (attr & 0x100) >> 8;
}
void nmk16_state::get_flip_extcode_powerins(u16 attr, int &flipx, int &flipy, int &code)
{
flipx = (attr & 0x1000) >> 12;
code = (code & 0x7fff) | ((attr & 0x100) << 7);
}
void nmk16_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u16 *src)
{
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(2), src, 0x1000 / 2);
@ -403,6 +454,17 @@ u32 nmk16_state::screen_update_bjtwin(screen_device &screen, bitmap_ind16 &bitma
return 0;
}
void nmk16_state::screen_vblank_powerins_bootleg(int state)
{
if (state)
{
m_maincpu->set_input_line(4, HOLD_LINE);
// bootlegs don't have DMA?
memcpy(m_spriteram_old2.get(),m_spriteram_old.get(), 0x1000);
memcpy(m_spriteram_old.get(), m_mainram + m_sprdma_base / 2, 0x1000);
}
}
/***************************************************************************

File diff suppressed because it is too large Load Diff