diff options
| author | 2025-06-29 23:41:52 +0200 | |
|---|---|---|
| committer | 2025-06-29 23:42:04 +0200 | |
| commit | e42f68174d15984a0371d8e51f67c5a73149793f (patch) | |
| tree | f69cbbe54c4459335c06c55edfbf24fee76ef840 | |
| parent | b62e63dfacd8014f87a7618668388cffb6005c0a (diff) | |
k052109: add nmi and firq timers (copy paste to/from k051960) [hap, Jim Westfall]
| -rw-r--r-- | src/mame/konami/aliens.cpp | 2 | ||||
| -rw-r--r-- | src/mame/konami/bottom9.cpp | 2 | ||||
| -rw-r--r-- | src/mame/konami/crimfght.cpp | 2 | ||||
| -rw-r--r-- | src/mame/konami/gradius3.cpp | 2 | ||||
| -rw-r--r-- | src/mame/konami/k051960.cpp | 84 | ||||
| -rw-r--r-- | src/mame/konami/k051960.h | 11 | ||||
| -rw-r--r-- | src/mame/konami/k052109.cpp | 121 | ||||
| -rw-r--r-- | src/mame/konami/k052109.h | 15 | ||||
| -rw-r--r-- | src/mame/konami/k053246_k053247_k055673.cpp | 4 | ||||
| -rw-r--r-- | src/mame/konami/konmedal.cpp | 66 | ||||
| -rw-r--r-- | src/mame/konami/spy.cpp | 12 | ||||
| -rw-r--r-- | src/mame/konami/thunderx.cpp | 1 | ||||
| -rw-r--r-- | src/mame/konami/tmnt.cpp | 8 | ||||
| -rw-r--r-- | src/mame/konami/tmnt2.cpp | 2 | ||||
| -rw-r--r-- | src/mame/konami/vendetta.cpp | 5 | ||||
| -rw-r--r-- | src/mame/konami/xmen.cpp | 2 |
16 files changed, 167 insertions, 172 deletions
diff --git a/src/mame/konami/aliens.cpp b/src/mame/konami/aliens.cpp index 31ec52883ec..ce78b0ec387 100644 --- a/src/mame/konami/aliens.cpp +++ b/src/mame/konami/aliens.cpp @@ -315,7 +315,7 @@ void aliens_state::aliens(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette("palette"); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(aliens_state::tile_callback)); K051960(config, m_k051960, 24_MHz_XTAL); diff --git a/src/mame/konami/bottom9.cpp b/src/mame/konami/bottom9.cpp index fe4bc5354a4..9f5dc2716cf 100644 --- a/src/mame/konami/bottom9.cpp +++ b/src/mame/konami/bottom9.cpp @@ -157,7 +157,7 @@ uint32_t bottom9_state::screen_update(screen_device &screen, bitmap_ind16 &bitma m_k052109->tilemap_update(); // note: FIX layer is not used - bitmap.fill(m_layer_colorbase[1], cliprect); + bitmap.fill(m_layer_colorbase[1] * 16, cliprect); screen.priority().fill(0, cliprect); if (m_video_enable) diff --git a/src/mame/konami/crimfght.cpp b/src/mame/konami/crimfght.cpp index c1bd85448a6..a8962d1bfde 100644 --- a/src/mame/konami/crimfght.cpp +++ b/src/mame/konami/crimfght.cpp @@ -454,7 +454,7 @@ void crimfght_state::crimfght(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(crimfght_state::tile_callback)); K051960(config, m_k051960, 24_MHz_XTAL); diff --git a/src/mame/konami/gradius3.cpp b/src/mame/konami/gradius3.cpp index df276f8bbc0..3477b7c62bc 100644 --- a/src/mame/konami/gradius3.cpp +++ b/src/mame/konami/gradius3.cpp @@ -490,7 +490,7 @@ void gradius3_state::gradius3(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette("palette"); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(gradius3_state::tile_callback)); m_k052109->set_char_ram(true); diff --git a/src/mame/konami/k051960.cpp b/src/mame/konami/k051960.cpp index 2d76ce3ca98..1acd2f45ec1 100644 --- a/src/mame/konami/k051960.cpp +++ b/src/mame/konami/k051960.cpp @@ -141,15 +141,15 @@ k051960_device::k051960_device(const machine_config &mconfig, const char *tag, d , device_gfx_interface(mconfig, *this, gfxinfo) , device_video_interface(mconfig, *this) , m_sprite_rom(*this, DEVICE_SELF) - , m_scanline_timer(nullptr) , m_k051960_cb(*this) , m_shadow_config_cb(*this) , m_irq_handler(*this) , m_firq_handler(*this) , m_nmi_handler(*this) + , m_firq_scanline(nullptr) + , m_nmi_scanline(nullptr) , m_romoffset(0) , m_control(0) - , m_nmi_count(0) , m_shadow_config(0) { } @@ -190,12 +190,24 @@ void k051960_device::device_start() if (!palette().device().started()) throw device_missing_dependencies(); + // and register a callback for vblank state + screen().register_vblank_callback(vblank_state_delegate(&k051960_device::vblank_callback, this)); + // bind callbacks m_k051960_cb.resolve(); - // allocate scanline timer and start at first scanline - m_scanline_timer = timer_alloc(FUNC(k051960_device::scanline_callback), this); - m_scanline_timer->adjust(screen().time_until_pos(0), 0); + // allocate scanline timers and start at first scanline + if (!m_firq_handler.isunset()) + { + m_firq_scanline = timer_alloc(FUNC(k051960_device::firq_scanline), this); + m_firq_scanline->adjust(screen().time_until_pos(0), 0); + } + + if (!m_nmi_handler.isunset()) + { + m_nmi_scanline = timer_alloc(FUNC(k051960_device::nmi_scanline), this); + m_nmi_scanline->adjust(screen().time_until_pos(0), 0); + } m_sprites_busy = timer_alloc(timer_expired_delegate()); @@ -211,7 +223,6 @@ void k051960_device::device_start() // register for save states save_item(NAME(m_romoffset)); save_item(NAME(m_control)); - save_item(NAME(m_nmi_count)); save_item(NAME(m_shadow_config)); save_item(NAME(m_spriterombank)); save_item(NAME(m_ram)); @@ -235,44 +246,47 @@ void k051960_device::device_reset() DEVICE HANDLERS *****************************************************************************/ -TIMER_CALLBACK_MEMBER(k051960_device::scanline_callback) +void k051960_device::vblank_callback(screen_device &screen, bool state) { - int scanline = param; + if (!state) + return; - // NMI every 32 scanlines (not on 16V) - if ((++m_nmi_count & 3) == 3 && BIT(m_control, 2)) - m_nmi_handler(ASSERT_LINE); + // vblank interrupt + if (BIT(m_control, 0)) + m_irq_handler(ASSERT_LINE); - // FIRQ is when? - - // vblank - if (scanline == 240) + // do the sprite dma, unless sprite processing was disabled + if (!BIT(m_control, 4)) { - if (BIT(m_control, 0)) - m_irq_handler(ASSERT_LINE); - - // do the sprite dma, unless sprite processing was disabled - if (!BIT(m_control, 4)) - { - memcpy(m_buffer, m_ram, sizeof(m_buffer)); + memcpy(m_buffer, m_ram, sizeof(m_buffer)); - // count number of active sprites in the buffer - int active = 0; - for (int i = 0; i < sizeof(m_buffer); i += 8) - active += BIT(m_buffer[i], 7); + // count number of active sprites in the buffer + int active = 0; + for (int i = 0; i < sizeof(m_buffer); i += 8) + active += BIT(m_buffer[i], 7); - // 32 clocks per active sprite, around 18 clocks per inactive sprite - const u32 ticks = (active * 32) + (128 - active) * 18; - m_sprites_busy->adjust(attotime::from_ticks(ticks * 4, clock())); - } + // 32 clocks per active sprite, around 18 clocks per inactive sprite + const u32 ticks = (active * 32) + (128 - active) * 18; + m_sprites_busy->adjust(attotime::from_ticks(ticks * 4, clock())); } +} + +TIMER_CALLBACK_MEMBER(k051960_device::firq_scanline) +{ + // FIRQ every other scanline + if (BIT(m_control, 1)) + m_firq_handler(ASSERT_LINE); - // wait for next line - scanline += 8; - if (scanline >= screen().height()) - scanline = 0; + m_firq_scanline->adjust(screen().time_until_pos(screen().vpos() + 2)); +} + +TIMER_CALLBACK_MEMBER(k051960_device::nmi_scanline) +{ + // NMI every 32 scanlines (not on 16V) + if (BIT(m_control, 2)) + m_nmi_handler(ASSERT_LINE); - m_scanline_timer->adjust(screen().time_until_pos(scanline), scanline); + m_nmi_scanline->adjust(screen().time_until_pos(screen().vpos() + 32)); } u8 k051960_device::k051960_fetchromdata(offs_t offset) diff --git a/src/mame/konami/k051960.h b/src/mame/konami/k051960.h index 1ea93733cdb..5db963bd851 100644 --- a/src/mame/konami/k051960.h +++ b/src/mame/konami/k051960.h @@ -75,8 +75,6 @@ private: required_region_ptr<u8> m_sprite_rom; - emu_timer *m_scanline_timer; - sprite_delegate m_k051960_cb; devcb_write_line m_shadow_config_cb; @@ -84,15 +82,20 @@ private: devcb_write_line m_firq_handler; devcb_write_line m_nmi_handler; + emu_timer *m_firq_scanline; + emu_timer *m_nmi_scanline; + u8 m_spriterombank[3]; u8 m_romoffset; u8 m_control; - u8 m_nmi_count; emu_timer *m_sprites_busy; u8 m_shadow_config; u8 k051960_fetchromdata(offs_t offset); - TIMER_CALLBACK_MEMBER(scanline_callback); + + void vblank_callback(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(firq_scanline); + TIMER_CALLBACK_MEMBER(nmi_scanline); }; DECLARE_DEVICE_TYPE(K051960, k051960_device) diff --git a/src/mame/konami/k052109.cpp b/src/mame/konami/k052109.cpp index 543e3f38d8e..794d3dd752f 100644 --- a/src/mame/konami/k052109.cpp +++ b/src/mame/konami/k052109.cpp @@ -95,13 +95,15 @@ address lines), and then reading it from the 051962. ---xx--- layer B row scroll --x----- layer B column scroll suratk sets this register to 0x70 during the second boss to produce a rotating star field, - using X and Y scroll at the same time. In MAME, the corners don't scroll, or is that normal? - It only modifies Y scroll 0x23-0x32 (no columns after that), or maybe bit 6 has a meaning. + using X and Y scroll at the same time. In MAME, the corners don't scroll, but on the PCB, + the effect definitely applies there (at least seen under the 2nd N of P2 INSERT COIN). The + game only modifies Y scroll 0x23-0x32, no columns after that. Maybe bit 6 has a meaning? glfgreat sets it to 0x30 when showing the leader board mariorou sets it to 0x36 when ingame, while actually does per-row scroll for layer A and per-column scroll for layer B. -1d00 : bits 0 & 1 might enable NMI and FIRQ, not sure - : bit 2 = IRQ enable +1d00 : bit 0 = NMI enable/acknowledge + : bit 1 = FIRQ enable/acknowledge + : bit 2 = IRQ enable/acknowledge 1d80 : ROM bank selector bits 0-3 = bank 0 bits 4-7 = bank 1 1e00 : ROM membank selector for ROM testing 1e80 : bit 0 = flip screen (applies to tilemaps only, not sprites) @@ -190,27 +192,20 @@ k052109_device::k052109_device(const machine_config &mconfig, const char *tag, d m_tileflip_enable(0), m_has_extra_video_ram(0), m_rmrd_line(0), - m_irq_enabled(0), + m_irq_control(0), m_romsubbank(0), m_scrollctrl(0), m_char_rom(*this, DEVICE_SELF), m_k052109_cb(*this), m_irq_handler(*this), m_firq_handler(*this), - m_nmi_handler(*this) + m_nmi_handler(*this), + m_firq_scanline(nullptr), + m_nmi_scanline(nullptr) { } -void k052109_device::set_char_ram(bool ram) -{ - if (ram) - set_info(gfxinfo_ram); - else - set_info(gfxinfo); -} - - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -220,23 +215,37 @@ void k052109_device::device_start() // assumes it can make an address mask with m_char_rom.length() - 1 assert(!m_char_rom.found() || !(m_char_rom.length() & (m_char_rom.length() - 1))); - if (has_screen()) - { - // make sure our screen is started - if (!screen().started()) - throw device_missing_dependencies(); + // make sure our screen is started + if (!screen().started()) + throw device_missing_dependencies(); + if (!palette().device().started()) + throw device_missing_dependencies(); - // and register a callback for vblank state - screen().register_vblank_callback(vblank_state_delegate(&k052109_device::vblank_callback, this)); - } + // and register a callback for vblank state + screen().register_vblank_callback(vblank_state_delegate(&k052109_device::vblank_callback, this)); // resolve delegates m_k052109_cb.resolve(); + // allocate scanline timers and start at first scanline + if (!m_firq_handler.isunset()) + { + m_firq_scanline = timer_alloc(FUNC(k052109_device::firq_scanline), this); + m_firq_scanline->adjust(screen().time_until_pos(0), 0); + } + + if (!m_nmi_handler.isunset()) + { + m_nmi_scanline = timer_alloc(FUNC(k052109_device::nmi_scanline), this); + m_nmi_scanline->adjust(screen().time_until_pos(0), 0); + } + decode_gfx(); gfx(0)->set_colors(palette().entries() / gfx(0)->depth()); m_ram = make_unique_clear<uint8_t[]>(0x6000); + memset(m_charrombank, 0, sizeof(m_charrombank)); + memset(m_charrombank_2, 0, sizeof(m_charrombank_2)); m_colorram_F = &m_ram[0x0000]; m_colorram_A = &m_ram[0x0800]; @@ -266,7 +275,7 @@ void k052109_device::device_start() save_item(NAME(m_charrombank_2)); save_item(NAME(m_has_extra_video_ram)); save_item(NAME(m_rmrd_line)); - save_item(NAME(m_irq_enabled)); + save_item(NAME(m_irq_control)); save_item(NAME(m_romsubbank)); save_item(NAME(m_scrollctrl)); save_item(NAME(m_addrmap)); @@ -279,12 +288,11 @@ void k052109_device::device_start() void k052109_device::device_reset() { m_rmrd_line = CLEAR_LINE; - m_irq_enabled = 0; - m_romsubbank = 0; - m_scrollctrl = 0; - m_addrmap = 0; m_has_extra_video_ram = 0; + for (offs_t offset = 0x1c00; offset <= 0x1f00; offset += 0x80) + write(offset, 0); + for (int i = 0; i < 4; i++) { m_charrombank[i] = 0; @@ -292,25 +300,34 @@ void k052109_device::device_reset() } } -//------------------------------------------------- -// device_post_load - device-specific postload -//------------------------------------------------- - -void k052109_device::device_post_load() -{ - tileflip_reset(); -} - /***************************************************************************** DEVICE HANDLERS *****************************************************************************/ void k052109_device::vblank_callback(screen_device &screen, bool state) { - if (state && m_irq_enabled) + if (state && BIT(m_irq_control, 2)) m_irq_handler(ASSERT_LINE); } +TIMER_CALLBACK_MEMBER(k052109_device::firq_scanline) +{ + // FIRQ every other scanline + if (BIT(m_irq_control, 1)) + m_firq_handler(ASSERT_LINE); + + m_firq_scanline->adjust(screen().time_until_pos(screen().vpos() + 2)); +} + +TIMER_CALLBACK_MEMBER(k052109_device::nmi_scanline) +{ + // NMI every 32 scanlines (not on 16V) + if (BIT(m_irq_control, 0)) + m_nmi_handler(ASSERT_LINE); + + m_nmi_scanline->adjust(screen().time_until_pos(screen().vpos() + 32)); +} + u8 k052109_device::read(offs_t offset) { if (m_rmrd_line == CLEAR_LINE) @@ -334,7 +351,7 @@ u8 k052109_device::read(offs_t offset) } else /* Punk Shot and TMNT read from 0000-1fff, Aliens from 2000-3fff */ { - assert (m_char_rom.found()); + assert(m_char_rom.found()); int code = (offset & 0x1fff) >> 5; int color = m_romsubbank; @@ -393,11 +410,17 @@ void k052109_device::write(offs_t offset, u8 data) else if (offset == 0x1d00) { //logerror("%s: 052109 register 1d00 = %02x\n", machine().describe_context(), data); - /* bit 2 = irq enable */ - /* the custom chip can also generate NMI and FIRQ, for use with a 6809 */ - m_irq_enabled = data & 0x04; - if (!m_irq_enabled) + // clear interrupts + if (BIT(~data & m_irq_control, 0)) + m_nmi_handler(CLEAR_LINE); + + if (BIT(~data & m_irq_control, 1)) + m_firq_handler(CLEAR_LINE); + + if (BIT(~data & m_irq_control, 2)) m_irq_handler(CLEAR_LINE); + + m_irq_control = data; } else if (offset == 0x1d80) { @@ -415,7 +438,7 @@ void k052109_device::write(offs_t offset, u8 data) for (int i = 0; i < 0x1800; i++) { - int bank = (m_ram[i]&0x0c) >> 2; + int bank = (m_ram[i] & 0x0c) >> 2; if ((bank == 0 && (dirty & 1)) || (bank == 1 && (dirty & 2))) { m_tilemap[(i & 0x1800) >> 11]->mark_tile_dirty(i & 0x7ff); @@ -486,16 +509,6 @@ void k052109_device::write(offs_t offset, u8 data) } } -void k052109_device::set_rmrd_line(int state) -{ - m_rmrd_line = state; -} - -int k052109_device::get_rmrd_line() -{ - return m_rmrd_line; -} - void k052109_device::tilemap_update() { diff --git a/src/mame/konami/k052109.h b/src/mame/konami/k052109.h index 0baa1771940..951da65a4c8 100644 --- a/src/mame/konami/k052109.h +++ b/src/mame/konami/k052109.h @@ -44,14 +44,14 @@ public: */ template <typename... T> void set_tile_callback(T &&... args) { m_k052109_cb.set(std::forward<T>(args)...); } - void set_char_ram(bool ram); + void set_char_ram(bool ram) { set_info(ram ? gfxinfo_ram : gfxinfo); } // public interface u8 read(offs_t offset); void write(offs_t offset, u8 data); - void set_rmrd_line(int state); - int get_rmrd_line(); + void set_rmrd_line(int state) { m_rmrd_line = state; } + int get_rmrd_line() { return m_rmrd_line; } void tilemap_update(); void tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, uint32_t flags = 0, uint8_t priority = 0, uint8_t priority_mask = 0xff); void mark_tilemap_dirty(uint8_t tmap_num); @@ -60,7 +60,7 @@ protected: // device-level overrides virtual void device_start() override ATTR_COLD; virtual void device_reset() override ATTR_COLD; - virtual void device_post_load() override; + virtual void device_post_load() override { tileflip_reset(); } private: // internal state @@ -81,7 +81,7 @@ private: uint8_t m_charrombank_2[4]; uint8_t m_has_extra_video_ram; int32_t m_rmrd_line; - uint8_t m_irq_enabled; + uint8_t m_irq_control; uint8_t m_romsubbank, m_scrollctrl, m_addrmap; optional_region_ptr<uint8_t> m_char_rom; @@ -92,6 +92,9 @@ private: devcb_write_line m_firq_handler; devcb_write_line m_nmi_handler; + emu_timer *m_firq_scanline; + emu_timer *m_nmi_scanline; + TILE_GET_INFO_MEMBER(get_tile_info0); TILE_GET_INFO_MEMBER(get_tile_info1); TILE_GET_INFO_MEMBER(get_tile_info2); @@ -100,6 +103,8 @@ private: void tileflip_reset(); void vblank_callback(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(firq_scanline); + TIMER_CALLBACK_MEMBER(nmi_scanline); }; DECLARE_DEVICE_TYPE(K052109, k052109_device) diff --git a/src/mame/konami/k053246_k053247_k055673.cpp b/src/mame/konami/k053246_k053247_k055673.cpp index 758ae959f8c..d2671b94b20 100644 --- a/src/mame/konami/k053246_k053247_k055673.cpp +++ b/src/mame/konami/k053246_k053247_k055673.cpp @@ -532,10 +532,10 @@ void k053247_device::zdrawgfxzoom32GP( const int x_off = (src_base_x + x * src_stride_x) >> FP; const int y_off = (src_base_y + y * src_stride_y) >> FP; const u8 pal_idx = src_base[(x_off + y_off * 16) ^ flip_mask]; - if (!pal_idx || (drawmode & 0b01 && pal_idx >= shdpen) || ozbuf_ptr[x + y * GX_ZBUFW] < z8) continue; + if (!pal_idx || (drawmode & 3 && pal_idx >= shdpen) || ozbuf_ptr[x + y * GX_ZBUFW] < z8) continue; ozbuf_ptr[x + y * GX_ZBUFW] = z8; - if ((drawmode & 0b10) == 0) // solid sprite + if (!BIT(drawmode, 1)) // solid sprite { dst_ptr[x + y * dst_pitch] = pal_base[pal_idx]; } diff --git a/src/mame/konami/konmedal.cpp b/src/mame/konami/konmedal.cpp index 1896ab72934..9beae74be52 100644 --- a/src/mame/konami/konmedal.cpp +++ b/src/mame/konami/konmedal.cpp @@ -53,13 +53,16 @@ Konami PWB 402218 boards Notes and TODOs: - Priorities not understood and wrong in places of GX-based games, apparently controlled by PROM - - X/Y scroll effects not 100% handled by current K052109(TMNT tilemaps) emulation. - Mario Roulette issues currently "resolved" using hack. - Chusenoh keypad hardware is completely unknown. It's presumed to hook up via the i8251. ***************************************************************************/ #include "emu.h" + +#include "k054156_k054157_k056832.h" +#include "k052109.h" +#include "konami_helper.h" + #include "cpu/z80/z80.h" #include "machine/clock.h" #include "machine/i8251.h" @@ -71,9 +74,7 @@ Konami PWB 402218 boards #include "sound/okim6295.h" #include "sound/upd7759.h" #include "sound/ymz280b.h" -#include "k054156_k054157_k056832.h" -#include "k052109.h" -#include "konami_helper.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -155,10 +156,7 @@ private: void k056832_b_w(offs_t offset, uint8_t data) { m_k056832->b_w(offset ^ 1, data); } K052109_CB_MEMBER(shuriboy_tile_callback); - TIMER_DEVICE_CALLBACK_MEMBER(shuri_scanline); void shuri_bank_w(uint8_t data); - uint8_t shuri_irq_r(); - void shuri_irq_w(uint8_t data); void ddboy_main(address_map &map) ATTR_COLD; void chusenoh_main(address_map &map) ATTR_COLD; @@ -183,7 +181,6 @@ private: u8 m_control = 0; u8 m_control2 = 0; - u8 m_shuri_irq = 0; int m_ccu_int_time = 0; int m_ccu_int_time_count = 0; int m_avac = 0; @@ -555,7 +552,6 @@ void konmedal_state::shuriboy_main(address_map &map) m_scc_map[0](0x9800, 0x98ff).mirror(0x0700).m("k051649", FUNC(k051649_device::scc_map)); map(0xa000, 0xbfff).bankr("bank1"); map(0xc000, 0xffff).rw(m_k052109, FUNC(k052109_device::read), FUNC(k052109_device::write)); - map(0xdd00, 0xdd00).rw(FUNC(konmedal_state::shuri_irq_r), FUNC(konmedal_state::shuri_irq_w)); } static INPUT_PORTS_START( konmedal ) @@ -901,7 +897,6 @@ void konmedal_state::machine_start_common() m_lamps.resolve(); save_item(NAME(m_control)); save_item(NAME(m_control2)); - save_item(NAME(m_shuri_irq)); save_item(NAME(m_ccu_int_time)); save_item(NAME(m_ccu_int_time_count)); } @@ -924,7 +919,6 @@ void konmedal_state::machine_reset() { m_control = 0; m_control2 = 0; - m_shuri_irq = 0; m_ccu_int_time_count = 0; m_ccu_int_time = 31; m_avac = 0; @@ -1092,41 +1086,7 @@ K052109_CB_MEMBER(konmedal_state::shuriboy_tile_callback) void konmedal_state::shuri_bank_w(uint8_t data) { m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); - membank("bank1")->set_entry(data&0x3); -} - -uint8_t konmedal_state::shuri_irq_r() -{ - return m_shuri_irq; -} - -void konmedal_state::shuri_irq_w(uint8_t data) -{ - if ((m_shuri_irq & 0x4) && !(data & 0x4)) - { - m_maincpu->set_input_line(0, CLEAR_LINE); - } - else if ((m_shuri_irq & 0x1) && !(data & 0x1)) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - } - - m_shuri_irq = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(konmedal_state::shuri_scanline) -{ - int scanline = param; - - if ((scanline == 240) && (m_shuri_irq & 0x4)) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - } - - if ((scanline == 255) && (m_shuri_irq & 0x1)) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } + membank("bank1")->set_entry(data & 0x3); } void konmedal_state::shuriboy(machine_config &config) @@ -1134,7 +1094,6 @@ void konmedal_state::shuriboy(machine_config &config) /* basic machine hardware */ Z80(config, m_maincpu, 24_MHz_XTAL / 4); // divisor unknown m_maincpu->set_addrmap(AS_PROGRAM, &konmedal_state::shuriboy_main); - TIMER(config, "scantimer").configure_scanline(FUNC(konmedal_state::shuri_scanline), "screen", 0, 1); NVRAM(config, m_nvram, nvram_device::DEFAULT_ALL_0); m_nvram->set_custom_handler(FUNC(konmedal_state::shuriboy_nvram_init)); @@ -1152,8 +1111,10 @@ void konmedal_state::shuriboy(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(konmedal_state::shuriboy_tile_callback)); + m_k052109->irq_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_k052109->nmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); MCFG_MACHINE_START_OVERRIDE(konmedal_state, shuriboy) @@ -1181,11 +1142,14 @@ void konmedal_state::tsupenta(machine_config &config) { shuriboy(config); m_nvram->set_custom_handler(FUNC(konmedal_state::tsupenta_nvram_init)); + + // no NMI routine + m_k052109->nmi_handler().remove(); } void konmedal_state::tsururin(machine_config &config) { - shuriboy(config); + tsupenta(config); NVRAM(config.replace(), m_nvram, nvram_device::DEFAULT_ALL_0); } @@ -1484,7 +1448,7 @@ ROM_END // Konami PWB 451847A and PWB 452093A boards (TMNT tilemaps) -GAME( 1990, tsururin, 0, tsururin, tsururin, konmedal_state, mario_init, ROT0, "Konami", "Tsururin Kun", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING) // resets after start up test. Seems to be an IRQ problem +GAME( 1990, tsururin, 0, tsururin, tsururin, konmedal_state, mario_init, ROT0, "Konami", "Tsururin Kun", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING) GAME( 1991, slimekun, 0, tsupenta, slimekun, konmedal_state, mario_init, ROT0, "Konami", "Slime Kun", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING) GAME( 1991, mariorou, 0, mariorou, mario, konmedal_state, mario_init, ROT0, "Konami", "Mario Roulette", MACHINE_SUPPORTS_SAVE) GAME( 1991, tsupenta, 0, tsupenta, tsupenta, konmedal_state, mario_init, ROT0, "Konami", "Tsurikko Penta", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/konami/spy.cpp b/src/mame/konami/spy.cpp index e6f2dcca840..32f79fc70da 100644 --- a/src/mame/konami/spy.cpp +++ b/src/mame/konami/spy.cpp @@ -90,6 +90,8 @@ private: bool m_video_enable = false; int32_t m_old_3f90 = -1; + static constexpr int m_layer_colorbase[3] = { 768 / 16, 0 / 16, 256 / 16 }; + void bankswitch_w(uint8_t data); void spy_3f90_w(uint8_t data); void sh_irqtrigger_w(uint8_t data); @@ -115,11 +117,9 @@ private: K052109_CB_MEMBER(spy_state::tile_callback) { - static const int layer_colorbase[] = { 768 / 16, 0 / 16, 256 / 16 }; - *flags = (*color & 0x20) ? TILE_FLIPX : 0; *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); - *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); } @@ -155,15 +155,15 @@ uint32_t spy_state::screen_update_spy(screen_device &screen, bitmap_ind16 &bitma screen.priority().fill(0, cliprect); - if (!m_video_enable) - bitmap.fill(768, cliprect); // ? - else + if (m_video_enable) { m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0); } + else + bitmap.fill(m_layer_colorbase[0] * 16, cliprect); return 0; } diff --git a/src/mame/konami/thunderx.cpp b/src/mame/konami/thunderx.cpp index 032a11f3df1..82d3fba0dab 100644 --- a/src/mame/konami/thunderx.cpp +++ b/src/mame/konami/thunderx.cpp @@ -192,6 +192,7 @@ K052109_CB_MEMBER(scontra_state::gbusters_tile_callback) *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); } + /*************************************************************************** Callbacks for the K051960 diff --git a/src/mame/konami/tmnt.cpp b/src/mame/konami/tmnt.cpp index b6e30d932d7..c50be26cdc9 100644 --- a/src/mame/konami/tmnt.cpp +++ b/src/mame/konami/tmnt.cpp @@ -288,8 +288,6 @@ void tmnt_state::tmnt_decode_sample() ***************************************************************************/ -// Missing in Action - K052109_CB_MEMBER(tmnt_state::mia_tile_callback) { *flags = (*color & 0x04) ? TILE_FLIPX : 0; @@ -850,7 +848,7 @@ void tmnt_state::cuebrick(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(tmnt_state::cuebrick_tile_callback)); K051960(config, m_k051960, 24_MHz_XTAL); @@ -895,7 +893,7 @@ void tmnt_state::mia(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(tmnt_state::mia_tile_callback)); K051960(config, m_k051960, 24_MHz_XTAL); @@ -957,7 +955,7 @@ void tmnt_state::tmnt(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(tmnt_state::tmnt_tile_callback)); K051960(config, m_k051960, 24_MHz_XTAL); diff --git a/src/mame/konami/tmnt2.cpp b/src/mame/konami/tmnt2.cpp index 3d985d5a531..473219624b3 100644 --- a/src/mame/konami/tmnt2.cpp +++ b/src/mame/konami/tmnt2.cpp @@ -2788,7 +2788,7 @@ void sunsetbl_state::sunsetbl(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); - m_k052109->set_screen(nullptr); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(sunsetbl_state::ssbl_tile_callback)); K053245(config, m_k053245, 24_MHz_XTAL); diff --git a/src/mame/konami/vendetta.cpp b/src/mame/konami/vendetta.cpp index 98281634cd5..5f94073e227 100644 --- a/src/mame/konami/vendetta.cpp +++ b/src/mame/konami/vendetta.cpp @@ -632,6 +632,7 @@ void vendetta_state::vendetta(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette(m_palette); + m_k052109->set_screen("screen"); m_k052109->set_tile_callback(FUNC(vendetta_state::vendetta_tile_callback)); K053246(config, m_k053246, 24_MHz_XTAL); @@ -666,12 +667,8 @@ void vendetta_state::esckids(machine_config &config) subdevice<screen_device>("screen")->set_visarea(2*8, 38*8-1, 2*8, 30*8-1); config.device_remove("k054000"); - config.device_remove("k052109"); - K052109(config, m_k052109, 0); - m_k052109->set_palette(m_palette); m_k052109->set_tile_callback(FUNC(vendetta_state::esckids_tile_callback)); - m_k053246->set_config(NORMAL_PLANE_ORDER, 5, 6); K053252(config, "k053252", 24_MHz_XTAL / 4).set_offsets(0, 8); diff --git a/src/mame/konami/xmen.cpp b/src/mame/konami/xmen.cpp index 1555b82f0a5..7a210c821bf 100644 --- a/src/mame/konami/xmen.cpp +++ b/src/mame/konami/xmen.cpp @@ -699,7 +699,7 @@ void xmen_state::base(machine_config &config) K052109(config, m_k052109, 24_MHz_XTAL); m_k052109->set_palette("palette"); - m_k052109->set_screen(nullptr); + m_k052109->set_screen(m_screen); m_k052109->set_tile_callback(FUNC(xmen_state::tile_callback)); K053246(config, m_k053246, 24_MHz_XTAL); |
