From 194142e5f6322261e4f176442bd2833d77f7ff3b Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 13 Nov 2020 13:48:12 +0100 Subject: Fixed drivers itech32, jangou, konamigs and konamigx broken by b8c3388 --- src/mame/drivers/itech32.cpp | 27 +++++++----- src/mame/drivers/jangou.cpp | 1 + src/mame/drivers/konamigs.cpp | 18 ++++---- src/mame/includes/itech32.h | 18 +++++--- src/mame/includes/konamigx.h | 4 +- src/mame/video/k053246_k053247_k055673.h | 2 +- src/mame/video/k053936.cpp | 76 +++++++++++++++++++++++++++++++- src/mame/video/k053936.h | 2 +- 8 files changed, 117 insertions(+), 31 deletions(-) diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp index 52d7f8a0236..1a807c16771 100644 --- a/src/mame/drivers/itech32.cpp +++ b/src/mame/drivers/itech32.cpp @@ -632,13 +632,13 @@ u16 drivedge_state::gas_r() u16 itech32_state::wcbowl_prot_result_r() { - return m_nvram[0x111d/2]; + return m_nvram16[0x111d/2]; } u8 itech32_state::itech020_prot_result_r() { - u32 result = ((u32 *)m_nvram.target())[m_itech020_prot_address >> 2]; + u32 result = ((u32 *)m_nvram32.target())[m_itech020_prot_address >> 2]; result >>= (~m_itech020_prot_address & 3) * 8; return result & 0xff; } @@ -850,7 +850,7 @@ u32 drivedge_state::tms2_speedup_r(address_space &space) void itech32_state::nvram_init(nvram_device &nvram, void *base, size_t length) { // if nvram is the main RAM, don't overwrite exception vectors - int start = (base == m_nvram) ? 0x80 : 0x00; + int start = (!m_main_ram32) && (base == m_nvram32 || base == m_nvram16) ? 0x80 : 0x00; for (int i = start; i < length; i++) ((u8 *)base)[i] = machine().rand(); } @@ -860,7 +860,7 @@ void drivedge_state::nvram_init(nvram_device &nvram, void *base, size_t length) itech32_state::nvram_init(nvram, base, length); // due to accessing uninitialized RAM, we need this hack - ((u32 *)m_nvram.target())[0x2ce4/4] = 0x0000001e; + m_nvram32[0x2ce4/4] = 0x0000001e; } /************************************* @@ -882,7 +882,7 @@ void itech32_state::timekill_map(address_map &map) map(0x068000, 0x068003).w(FUNC(itech32_state::timekill_colorbc_w)); map(0x070000, 0x070001).nopw(); /* noisy */ map(0x078001, 0x078001).w(FUNC(itech32_state::sound_data_w)); - map(0x080000, 0x08007f).rw(FUNC(itech32_state::video_r), FUNC(itech32_state::video_w)).share("video"); + map(0x080000, 0x08007f).rw(FUNC(itech32_state::video_r), FUNC(itech32_state::video_w)); map(0x0a0000, 0x0a0001).w(FUNC(itech32_state::int1_ack_w)); map(0x0c0000, 0x0c7fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x100000, 0x17ffff).rom().region("user1", 0); @@ -902,7 +902,7 @@ void itech32_state::bloodstm_map(address_map &map) map(0x380001, 0x380001).w(FUNC(itech32_state::color_w<1>)); map(0x400000, 0x400001).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); map(0x480001, 0x480001).w(FUNC(itech32_state::sound_data_w)); - map(0x500000, 0x5000ff).rw(FUNC(itech32_state::bloodstm_video_r), FUNC(itech32_state::bloodstm_video_w)).share("video"); + map(0x500000, 0x5000ff).rw(FUNC(itech32_state::bloodstm_video_r), FUNC(itech32_state::bloodstm_video_w)); map(0x580000, 0x59ffff).ram().w(FUNC(itech32_state::bloodstm_paletteram_w)).share("palette"); map(0x700001, 0x700001).w(FUNC(itech32_state::bloodstm_plane_w)); map(0x780000, 0x780001).portr("EXTRA"); @@ -971,12 +971,12 @@ map(0x000c00, 0x007fff).mirror(0x40000).rw(FUNC(itech32_state::test2_r), FUNC(it map(0x180001, 0x180001).w(FUNC(drivedge_state::color_w<0>)); map(0x1a0000, 0x1bffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette"); map(0x1c0000, 0x1c0003).nopw(); - map(0x1e0000, 0x1e0113).rw(FUNC(drivedge_state::bloodstm_video_r), FUNC(drivedge_state::bloodstm_video_w)).share("video"); + map(0x1e0000, 0x1e0113).rw(FUNC(drivedge_state::bloodstm_video_r), FUNC(drivedge_state::bloodstm_video_w)); map(0x1e4000, 0x1e4003).w(FUNC(drivedge_state::tms_reset_assert_w)); map(0x1ec000, 0x1ec003).w(FUNC(drivedge_state::tms_reset_clear_w)); map(0x200000, 0x200003).portr("200000"); - map(0x280000, 0x280fff).ram().w(FUNC(drivedge_state::tms1_68k_ram_w)).share("tms1_ram"); - map(0x300000, 0x300fff).ram().w(FUNC(drivedge_state::tms2_68k_ram_w)).share("tms2_ram"); + map(0x280000, 0x280fff).ram().lr32(NAME([this](offs_t offset) { return m_tms1_ram[offset]; })).w(FUNC(drivedge_state::tms1_68k_ram_w)); + map(0x300000, 0x300fff).ram().lr32(NAME([this](offs_t offset) { return m_tms2_ram[offset]; })).w(FUNC(drivedge_state::tms2_68k_ram_w)); map(0x380000, 0x380003).nopw(); // .w("watchdog", FUNC(watchdog_timer_device::reset16_w)); map(0x600000, 0x607fff).rom().region("user1", 0); } @@ -1008,7 +1008,7 @@ void itech32_state::itech020_map(address_map &map) map(0x380003, 0x380003).w(FUNC(itech32_state::color_w<0>)); map(0x400000, 0x400003).w("watchdog", FUNC(watchdog_timer_device::reset32_w)); map(0x480001, 0x480001).w(FUNC(itech32_state::sound_data_w)); - map(0x500000, 0x5000ff).rw(FUNC(itech32_state::bloodstm_video_r), FUNC(itech32_state::bloodstm_video_w)).share("video"); + map(0x500000, 0x5000ff).rw(FUNC(itech32_state::bloodstm_video_r), FUNC(itech32_state::bloodstm_video_w)); map(0x578000, 0x57ffff).nopr(); /* touched by protection */ map(0x580000, 0x59ffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette"); map(0x600000, 0x603fff).ram().share("nvram"); @@ -4629,7 +4629,12 @@ ROM_END void itech32_state::init_program_rom() { - memcpy(m_nvram, m_main_rom, 0x80); + if(m_main_ram32) + memcpy(m_main_ram32, m_main_rom32, 0x80); + else if(m_nvram16) + memcpy(m_nvram16, m_main_rom16, 0x80); + else + memcpy(m_nvram32, m_main_rom32, 0x80); } diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 7888971b5a2..3cb350b349d 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -1060,6 +1060,7 @@ void jangou_state::luckygrl(machine_config &config) maincpu.set_addrmap(AS_IO, &jangou_state::cntrygrl_cpu0_io); maincpu.set_addrmap(AS_OPCODES, &jangou_state::decrypted_opcodes_map); maincpu.set_decrypted_tag(":decrypted_opcodes"); + maincpu.set_size(0x5000); maincpu.set_vblank_int("screen", FUNC(jangou_state::irq0_line_hold)); } diff --git a/src/mame/drivers/konamigs.cpp b/src/mame/drivers/konamigs.cpp index f006d55d4e7..7a8c7e678f4 100644 --- a/src/mame/drivers/konamigs.cpp +++ b/src/mame/drivers/konamigs.cpp @@ -59,8 +59,8 @@ public: , m_rtc_r(*this, "RTCR") , m_rtc_w(*this, "RTCW") , m_dipsw_r(*this, "DSW") - , m_vram(*this, "vram") - , m_gpuregs(*this, "gpu_regs") + , m_vram(*this, "vram", 0x800000, ENDIANNESS_LITTLE) + , m_gpuregs(*this, "gpu_regs", 0x800, ENDIANNESS_LITTLE) , m_ymzram(*this, "ymz_ram") , m_screen(*this, "screen") , m_hopper(*this, "hopper") @@ -77,8 +77,8 @@ protected: required_ioport m_rtc_r; required_ioport m_rtc_w; required_ioport m_dipsw_r; - required_shared_ptr m_vram; - required_shared_ptr m_gpuregs; + memory_share_creator m_vram; + memory_share_creator m_gpuregs; required_shared_ptr m_ymzram; required_device m_screen; optional_device m_hopper; @@ -760,7 +760,7 @@ void gsan_state::main_map_common(address_map &map) { map(0x00000000, 0x0000ffff).rom().region("maincpu", 0); map(0x0c000000, 0x0c3fffff).ram().share("main_ram"); - map(0x10000000, 0x100007ff).rw(FUNC(gsan_state::gpu_r), FUNC(gsan_state::gpu_w)).share("gpu_regs"); + map(0x10000000, 0x100007ff).rw(FUNC(gsan_state::gpu_r), FUNC(gsan_state::gpu_w)); // misc I/O map(0x14000800, 0x14000807).rw(FUNC(gsan_state::cf_regs_r), FUNC(gsan_state::cf_regs_w)); map(0x14000c00, 0x14000c03).rw(FUNC(gsan_state::cf_data_r), FUNC(gsan_state::cf_data_w)); @@ -776,8 +776,8 @@ void gsan_state::main_map_common(address_map &map) void gsan_state::main_map(address_map &map) { main_map_common(map); - map(0x08000000, 0x087fffff).rw(FUNC(gsan_state::vram_r), FUNC(gsan_state::vram_w)).share("vram"); - map(0x18800000, 0x18ffffff).rw(FUNC(gsan_state::ymzram_r), FUNC(gsan_state::ymzram_w)).share("ymz_ram"); + map(0x08000000, 0x087fffff).rw(FUNC(gsan_state::vram_r), FUNC(gsan_state::vram_w)); + map(0x18800000, 0x18ffffff).rw(FUNC(gsan_state::ymzram_r), FUNC(gsan_state::ymzram_w)); } void gsan_state::main_port(address_map &map) @@ -797,8 +797,8 @@ void gsan_state::ymz280b_map(address_map &map) void gsan_state::main_map_medal(address_map &map) { main_map_common(map); - map(0x08000000, 0x083fffff).rw(FUNC(gsan_state::vram_r), FUNC(gsan_state::vram_w)).share("vram"); - map(0x18800000, 0x18bfffff).rw(FUNC(gsan_state::ymzram_r), FUNC(gsan_state::ymzram_w)).share("ymz_ram"); + map(0x08000000, 0x083fffff).rw(FUNC(gsan_state::vram_r), FUNC(gsan_state::vram_w)); + map(0x18800000, 0x18bfffff).rw(FUNC(gsan_state::ymzram_r), FUNC(gsan_state::ymzram_w)); } void gsan_state::main_port_medal(address_map &map) diff --git a/src/mame/includes/itech32.h b/src/mame/includes/itech32.h index 07fabcfebaa..f1c33ba6ee7 100644 --- a/src/mame/includes/itech32.h +++ b/src/mame/includes/itech32.h @@ -42,9 +42,12 @@ public: m_timekeeper(*this, "m48t02"), m_soundlatch(*this, "soundlatch"), m_soundlatch2(*this, "soundlatch2"), - m_nvram(*this, "nvram"), - m_video(*this, "video"), - m_main_rom(*this, "maincpu"), + m_nvram16(*this, "nvram"), + m_nvram32(*this, "nvram"), + m_main_ram32(*this, "main_ram"), + m_video(*this, "video", 0x200, ENDIANNESS_BIG), + m_main_rom16(*this, "user1"), + m_main_rom32(*this, "user1"), m_grom(*this, "gfx1"), m_soundbank(*this, "soundbank") { } @@ -88,9 +91,12 @@ protected: required_device m_soundlatch; optional_device m_soundlatch2; - optional_shared_ptr m_nvram; - optional_shared_ptr m_video; - optional_region_ptr m_main_rom; + optional_shared_ptr m_nvram16; + optional_shared_ptr m_nvram32; + optional_shared_ptr m_main_ram32; + memory_share_creator m_video; + optional_region_ptr m_main_rom16; + optional_region_ptr m_main_rom32; required_region_ptr m_grom; required_memory_bank m_soundbank; diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h index 9a7f6f7031d..47bed7e1d74 100644 --- a/src/mame/includes/konamigx.h +++ b/src/mame/includes/konamigx.h @@ -212,8 +212,8 @@ protected: optional_shared_ptr m_workram; optional_shared_ptr m_psacram; optional_shared_ptr m_subpaletteram32; - optional_shared_ptr m_k053936_0_ctrl; - optional_shared_ptr m_k053936_0_linectrl; + optional_shared_ptr m_k053936_0_ctrl; + optional_shared_ptr m_k053936_0_linectrl; optional_shared_ptr m_k053936_0_ctrl_16; optional_shared_ptr m_k053936_0_linectrl_16; optional_shared_ptr m_generic_paletteram_32; diff --git a/src/mame/video/k053246_k053247_k055673.h b/src/mame/video/k053246_k053247_k055673.h index d293806244b..e9d97608c7c 100644 --- a/src/mame/video/k053246_k053247_k055673.h +++ b/src/mame/video/k053246_k053247_k055673.h @@ -40,7 +40,7 @@ Callback procedures for non-standard shadows: #define GX_ZBUFSIZE 0x600000 #else #define GX_ZBUFW 576 - #define GX_ZBUFH 224 + #define GX_ZBUFH 256 #define GX_ZPAGESIZE (GX_ZBUFW*GX_ZBUFH) #define GX_ZBUFSIZE ((GX_ZBUFW*GX_ZBUFH)*2) #endif diff --git a/src/mame/video/k053936.cpp b/src/mame/video/k053936.cpp index a86814041c2..c9900430b53 100644 --- a/src/mame/video/k053936.cpp +++ b/src/mame/video/k053936.cpp @@ -767,8 +767,82 @@ static void K053936GP_zoom_draw(running_machine &machine, } } +static void K053936GP_zoom_draw(running_machine &machine, + int chip, uint32_t *ctrl1, uint32_t *linectrl1, + bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tmap, + int tilebpp, int blend, int alpha, int pixeldouble_output, palette_device &palette) +{ + uint16_t *lineaddr; + + // Horrible but that's what the code previously did, only hidden + uint16_t *ctrl = (uint16_t *)ctrl1; + uint16_t *linectrl = (uint16_t *)linectrl1; + + rectangle my_clip; + uint32_t startx, starty; + int incxx, incxy, incyx, incyy, y, maxy, clip; + + bitmap_ind16 &src_bitmap = tmap->pixmap(); + rectangle &src_cliprect = K053936_cliprect[chip]; + clip = K053936_clip_enabled[chip]; + + if (ctrl[0x07] & 0x0040) /* "super" mode */ + { + my_clip.min_x = cliprect.min_x; + my_clip.max_x = cliprect.max_x; + y = cliprect.min_y; + maxy = cliprect.max_y; + + while (y <= maxy) + { + lineaddr = linectrl + ( ((y - K053936_offset[chip][1]) & 0x1ff) << 2); + my_clip.min_y = my_clip.max_y = y; + + startx = (int16_t)(lineaddr[0] + ctrl[0x00]) << 8; + starty = (int16_t)(lineaddr[1] + ctrl[0x01]) << 8; + incxx = (int16_t)(lineaddr[2]); + incxy = (int16_t)(lineaddr[3]); + + if (ctrl[0x06] & 0x8000) incxx <<= 8; + if (ctrl[0x06] & 0x0080) incxy <<= 8; + + startx -= K053936_offset[chip][0] * incxx; + starty -= K053936_offset[chip][0] * incxy; + + K053936GP_copyroz32clip(machine, + bitmap, src_bitmap, my_clip, src_cliprect, + startx<<5, starty<<5, incxx<<5, incxy<<5, 0, 0, + tilebpp, blend, alpha, clip, pixeldouble_output, palette); + y++; + } + } + else /* "simple" mode */ + { + startx = (int16_t)(ctrl[0x00]) << 8; + starty = (int16_t)(ctrl[0x01]) << 8; + incyx = (int16_t)(ctrl[0x02]); + incyy = (int16_t)(ctrl[0x03]); + incxx = (int16_t)(ctrl[0x04]); + incxy = (int16_t)(ctrl[0x05]); + + if (ctrl[0x06] & 0x4000) { incyx <<= 8; incyy <<= 8; } + if (ctrl[0x06] & 0x0040) { incxx <<= 8; incxy <<= 8; } + + startx -= K053936_offset[chip][1] * incyx; + starty -= K053936_offset[chip][1] * incyy; + + startx -= K053936_offset[chip][0] * incxx; + starty -= K053936_offset[chip][0] * incxy; + + K053936GP_copyroz32clip(machine, + bitmap, src_bitmap, cliprect, src_cliprect, + startx<<5, starty<<5, incxx<<5, incxy<<5, incyx<<5, incyy<<5, + tilebpp, blend, alpha, clip, pixeldouble_output, palette); + } +} + void K053936GP_0_zoom_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, - tilemap_t *tmap, int tilebpp, int blend, int alpha, int pixeldouble_output, uint16_t* temp_m_k053936_0_ctrl_16, uint16_t* temp_m_k053936_0_linectrl_16,uint16_t* temp_m_k053936_0_ctrl, uint16_t* temp_m_k053936_0_linectrl, palette_device &palette) + tilemap_t *tmap, int tilebpp, int blend, int alpha, int pixeldouble_output, uint16_t* temp_m_k053936_0_ctrl_16, uint16_t* temp_m_k053936_0_linectrl_16,uint32_t* temp_m_k053936_0_ctrl, uint32_t* temp_m_k053936_0_linectrl, palette_device &palette) { if (temp_m_k053936_0_ctrl_16) { diff --git a/src/mame/video/k053936.h b/src/mame/video/k053936.h index 8d0d62f3e25..75894c2bf95 100644 --- a/src/mame/video/k053936.h +++ b/src/mame/video/k053936.h @@ -17,7 +17,7 @@ void K053936_set_offset(int chip, int xoffs, int yoffs); void K053936GP_set_offset(int chip, int xoffs, int yoffs); void K053936GP_clip_enable(int chip, int status); void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy); -void K053936GP_0_zoom_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tmap, int tilebpp, int blend, int alpha, int pixeldouble_output, uint16_t* temp_m_k053936_0_ctrl_16, uint16_t* temp_m_k053936_0_linectrl_16, uint16_t* temp_m_k053936_0_ctrl, uint16_t* temp_m_k053936_0_linectrl, palette_device &palette); +void K053936GP_0_zoom_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tmap, int tilebpp, int blend, int alpha, int pixeldouble_output, uint16_t* temp_m_k053936_0_ctrl_16, uint16_t* temp_m_k053936_0_linectrl_16, uint32_t* temp_m_k053936_0_ctrl, uint32_t* temp_m_k053936_0_linectrl, palette_device &palette); class k053936_device : public device_t -- cgit v1.2.3