From e00e52e972fdbf1723f240569044303b9452bf75 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 5 Apr 2022 18:00:10 +0200 Subject: - buggychl.cpp, himesiki.cpp, surpratk.cpp: finders and other small cleanups - discrete.cpp, mac.cpp: initialized some variables which were causing problems - centiped.cpp: added 82s153 dump for bullsdrt [chaneman] --- scripts/target/mame/arcade.lua | 6 - src/devices/sound/discrete.cpp | 2 +- src/mame/drivers/buggychl.cpp | 603 +++++++++++++++++++++++++++++++---------- src/mame/drivers/centiped.cpp | 22 ++ src/mame/drivers/himesiki.cpp | 291 ++++++++++++++++---- src/mame/drivers/pc8001.cpp | 2 + src/mame/drivers/surpratk.cpp | 203 +++++++++++--- src/mame/drivers/tasman.cpp | 2 +- src/mame/includes/buggychl.h | 114 -------- src/mame/includes/galaxian.h | 2 + src/mame/includes/himesiki.h | 72 ----- src/mame/includes/mac.h | 2 +- src/mame/includes/pc8001.h | 2 +- src/mame/includes/surpratk.h | 63 ----- src/mame/machine/mac.cpp | 3 + src/mame/video/buggychl.cpp | 234 ---------------- src/mame/video/himesiki.cpp | 133 --------- src/mame/video/surpratk.cpp | 79 ------ 18 files changed, 902 insertions(+), 933 deletions(-) delete mode 100644 src/mame/includes/buggychl.h delete mode 100644 src/mame/includes/himesiki.h delete mode 100644 src/mame/includes/surpratk.h delete mode 100644 src/mame/video/buggychl.cpp delete mode 100644 src/mame/video/himesiki.cpp delete mode 100644 src/mame/video/surpratk.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 052ba217e41..edff2785d78 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -2617,8 +2617,6 @@ files { MAME_DIR .. "src/mame/includes/spy.h", MAME_DIR .. "src/mame/video/spy.cpp", MAME_DIR .. "src/mame/drivers/surpratk.cpp", - MAME_DIR .. "src/mame/includes/surpratk.h", - MAME_DIR .. "src/mame/video/surpratk.cpp", MAME_DIR .. "src/mame/drivers/tasman.cpp", MAME_DIR .. "src/mame/drivers/tgtpanic.cpp", MAME_DIR .. "src/mame/drivers/thunderx.cpp", @@ -3076,8 +3074,6 @@ files { MAME_DIR .. "src/mame/includes/crgolf.h", MAME_DIR .. "src/mame/video/crgolf.cpp", MAME_DIR .. "src/mame/drivers/himesiki.cpp", - MAME_DIR .. "src/mame/includes/himesiki.h", - MAME_DIR .. "src/mame/video/himesiki.cpp", MAME_DIR .. "src/mame/drivers/suprgolf.cpp", } @@ -3990,12 +3986,10 @@ files { MAME_DIR .. "src/mame/machine/bublbobl.cpp", MAME_DIR .. "src/mame/video/bublbobl.cpp", MAME_DIR .. "src/mame/drivers/buggychl.cpp", - MAME_DIR .. "src/mame/includes/buggychl.h", MAME_DIR .. "src/mame/machine/taito68705interface.cpp", MAME_DIR .. "src/mame/machine/taito68705interface.h", MAME_DIR .. "src/mame/machine/taitosjsec.cpp", MAME_DIR .. "src/mame/machine/taitosjsec.h", - MAME_DIR .. "src/mame/video/buggychl.cpp", MAME_DIR .. "src/mame/drivers/capr1.cpp", MAME_DIR .. "src/mame/drivers/caprcyc.cpp", MAME_DIR .. "src/mame/drivers/cchance.cpp", diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp index 47e517af633..0ad9f34562a 100644 --- a/src/devices/sound/discrete.cpp +++ b/src/devices/sound/discrete.cpp @@ -353,7 +353,7 @@ discrete_base_node::discrete_base_node() : m_input_intf(nullptr), m_output_intf(nullptr) { - m_output[0] = 0.0; + std::fill(std::begin(m_output), std::end(m_output), 0.0); } diff --git a/src/mame/drivers/buggychl.cpp b/src/mame/drivers/buggychl.cpp index fb94fd73eab..0c390756441 100644 --- a/src/mame/drivers/buggychl.cpp +++ b/src/mame/drivers/buggychl.cpp @@ -87,32 +87,367 @@ QB output = "1/2CLK" = 12mhz QC output = "CLK" = 6mhz "1/2phi" = 24M / 3 = 8mhz -The z80B main cpu is clocked by (depending on a jumper) either "1/2CLK"/2 OR "1/2PHI"/2, so either 6mhz or 4mhz. +The z80B main CPU is clocked by (depending on a jumper) either "1/2CLK"/2 OR "1/2PHI"/2, so either 6mhz or 4mhz. Schematics show the jumper set to the 6mhz setting. ***************************************************************************/ #include "emu.h" -#include "includes/buggychl.h" -#include "cpu/z80/z80.h" +#include "machine/taito68705interface.h" + #include "cpu/m6805/m6805.h" +#include "cpu/z80/z80.h" +#include "machine/gen_latch.h" +#include "machine/input_merger.h" #include "machine/watchdog.h" +#include "sound/ay8910.h" +#include "sound/msm5232.h" +#include "sound/ta7630.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" #include "buggychl.lh" +namespace { + +class buggychl_state : public driver_device +{ +public: + buggychl_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_charram(*this, "charram"), + m_videoram(*this, "videoram"), + m_spriteram(*this, "spriteram"), + m_scrollv(*this, "scrollv"), + m_scrollh(*this, "scrollh"), + m_mainbank(*this, "mainbank"), + m_sprite_zoom_table(*this, "sprite_zoom_table"), + m_audiocpu(*this, "audiocpu"), + m_maincpu(*this, "maincpu"), + m_bmcu(*this, "bmcu"), + m_ta7630(*this, "ta7630"), + m_msm(*this, "msm"), + m_ay(*this, "ay%u", 1U), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_soundnmi(*this, "soundnmi"), + m_soundlatch(*this, "soundlatch%u", 1U), + m_pedal_input(*this, "PEDAL"), + m_led(*this, "led%u", 0U) + { } + + void buggychl(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(pedal_in_r); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_charram; + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + required_shared_ptr m_scrollv; + required_shared_ptr m_scrollh; + required_memory_bank m_mainbank; + required_region_ptr m_sprite_zoom_table; + + // devices + required_device m_audiocpu; + required_device m_maincpu; + required_device m_bmcu; + required_device m_ta7630; + required_device m_msm; + required_device_array m_ay; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_soundnmi; + required_device_array m_soundlatch; + required_ioport m_pedal_input; + + output_finder<1> m_led; + + // video-related + bitmap_ind16 m_tmp_bitmap[2]; + uint16_t m_sl_bank; + uint8_t m_bg_clip_on; + uint8_t m_sky_on; + uint8_t m_sprite_color_base; + int32_t m_bg_scrollx; + bool m_sound_irq_enable; + uint8_t m_sprite_lookup[0x2000]; + + void bankswitch_w(uint8_t data); + void sound_enable_w(uint8_t data); + uint8_t mcu_status_r(); + uint8_t sound_status_main_r(); + uint8_t sound_status_sound_r(); + void chargen_w(offs_t offset, uint8_t data); + void sprite_lookup_bank_w(uint8_t data); + void sprite_lookup_w(offs_t offset, uint8_t data); + void ctrl_w(uint8_t data); + void bg_scrollx_w(uint8_t data); + template void ta7630_volbal_ay_w(uint8_t data); + template void port_b_w(uint8_t data); + void ta7630_volbal_msm_w(uint8_t data); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sky(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_bg(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +void buggychl_state::palette(palette_device &palette) const +{ + // arbitrary blue shading for the sky, estimation + for (int i = 0; i < 128; i++) + palette.set_pen_color(i + 128, rgb_t(0, 240 - i, 255)); +} + +void buggychl_state::video_start() +{ + m_screen->register_screen_bitmap(m_tmp_bitmap[0]); + m_screen->register_screen_bitmap(m_tmp_bitmap[1]); + + save_item(NAME(m_tmp_bitmap[0])); + save_item(NAME(m_tmp_bitmap[1])); + + m_gfxdecode->gfx(0)->set_source(m_charram); +} + +void buggychl_state::chargen_w(offs_t offset, uint8_t data) +{ + if (m_charram[offset] != data) + { + m_charram[offset] = data; + m_gfxdecode->gfx(0)->mark_dirty((offset / 8) & 0xff); + } +} + +void buggychl_state::sprite_lookup_bank_w(uint8_t data) +{ + m_sl_bank = (data & 0x10) << 8; +} + +void buggychl_state::sprite_lookup_w(offs_t offset, uint8_t data) +{ + m_sprite_lookup[offset + m_sl_bank] = data; +} + +void buggychl_state::ctrl_w(uint8_t data) +{ +/* + bit7 = lamp + bit6 = lockout + bit4 = OJMODE + bit3 = SKY OFF + bit2 = /SN3OFF + bit1 = HINV + bit0 = VINV +*/ + + flip_screen_y_set(data & 0x01); + flip_screen_x_set(data & 0x02); + + m_bg_clip_on = data & 0x04; + m_sky_on = data & 0x08; + + m_sprite_color_base = (data & 0x10) ? 1 * 16 : 3 * 16; + + machine().bookkeeping().coin_lockout_global_w((~data & 0x40) >> 6); + m_led[0] = BIT(~data, 7); +} + +void buggychl_state::bg_scrollx_w(uint8_t data) +{ + m_bg_scrollx = -(data - 0x12); +} + + +void buggychl_state::draw_sky(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(y, x) = 128 + x / 2; +} + + +void buggychl_state::draw_bg(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // prevent wraparound + rectangle clip = cliprect; + + // enable clipping if on (title screen disables this to cover all of the area) + if (m_bg_clip_on) + { + if (flip_screen_x()) clip.min_x += 8 * 8; + else clip.max_x -= 8 * 8; + } + + for (int offs = 0; offs < 0x400; offs++) + { + int code = m_videoram[0x400 + offs]; + + int sx = offs % 32; + int sy = offs / 32; + + if (flip_screen_x()) + sx = 31 - sx; + if (flip_screen_y()) + sy = 31 - sy; + + m_gfxdecode->gfx(0)->opaque(m_tmp_bitmap[0], m_tmp_bitmap[0].cliprect(), + code, + 2, + flip_screen_x(), flip_screen_y(), + 8 * sx, 8 * sy); + } + + int scroll[256]; + + // first copy to a temp bitmap doing column scroll + for (int offs = 0; offs < 256; offs++) + scroll[offs] = -m_scrollv[offs / 8]; + + copyscrollbitmap(m_tmp_bitmap[1], m_tmp_bitmap[0], 1, &m_bg_scrollx, 256, scroll, m_tmp_bitmap[1].cliprect()); + + // then copy to the screen doing row scroll + for (int offs = 0; offs < 256; offs++) + scroll[offs] = -m_scrollh[offs]; + + copyscrollbitmap_trans(bitmap, m_tmp_bitmap[1], 256, scroll, 0, nullptr, clip, 32); +} + + +void buggychl_state::draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 0; offs < 0x400; offs++) + { + int sx = offs % 32; + int sy = offs / 32; + int flipx = flip_screen_x(); + int flipy = flip_screen_y(); + + int code = m_videoram[offs]; + + if (flipx) + sx = 31 - sx; + if (flipy) + sy = 31 - sy; + + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, + code, + 0, + flipx, flipy, + 8 * sx, 8 * sy, + 0); + } +} + + +void buggychl_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + g_profiler.start(PROFILER_USER1); + + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + int sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); + int sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); + int flipy = m_spriteram[offs + 1] & 0x40; + int zoom = m_spriteram[offs + 1] & 0x3f; + uint8_t const *const zoomy_rom = &m_sprite_zoom_table[zoom << 6]; + uint8_t const *const zoomx_rom = &m_sprite_zoom_table[0x2000 + (zoom << 3)]; + + uint8_t const *const lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); + + for (int y = 0; y < 64; y++) + { + int dy = flip_screen_y() ? (255 - sy - y) : (sy + y); + + if ((dy & ~0xff) == 0) + { + int charline = zoomy_rom[y] & 0x07; + int base_pos = zoomy_rom[y] & 0x38; + if (flipy) + base_pos ^= 0x38; + + int px = 0; + for (int ch = 0; ch < 4; ch++) + { + int pos = base_pos + 2 * ch; + int code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); + int realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; + code += (realflipy ? (charline ^ 7) : charline); + uint8_t const *const pendata = m_gfxdecode->gfx(1)->get_data(code); + + for (int x = 0; x < 16; x++) + { + int col = pendata[x]; + if (col) + { + int dx = flip_screen_x() ? (255 - sx - px) : (sx + px); + if ((dx & ~0xff) == 0) + bitmap.pix(dy, dx) = m_sprite_color_base + col; + } + + // the following line is almost certainly wrong + if (zoomx_rom[7 - (2 * ch + x / 8)] & (1 << (x & 7))) + px++; + } + } + } + } + } + + g_profiler.stop(); +} + + +uint32_t buggychl_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if (m_sky_on) + draw_sky(bitmap, cliprect); + else + bitmap.fill(0x20, cliprect); // stage 3 disables sky, wants background pen to be blue + + draw_bg(bitmap, cliprect); + + draw_sprites(bitmap, cliprect); + + draw_fg(bitmap, cliprect); + + return 0; +} + + +// machine + void buggychl_state::bankswitch_w(uint8_t data) { - membank("bank1")->set_entry(data & 0x07); // shall we check if data&7 < # banks? + m_mainbank->set_entry(data & 0x07); // shall we check if data & 7 < # banks? } void buggychl_state::sound_enable_w(uint8_t data) { // does this really only control the sound irq 'timer' enable state, rather than the entire sound system? // this would be more in line with the (admittedly incorrect) schematic... - //logerror("Sound_enable_w written with data of %02x\n", data); + // logerror("Sound_enable_w written with data of %02x\n", data); machine().sound().system_mute(!BIT(data, 0)); } @@ -125,26 +460,26 @@ uint8_t buggychl_state::mcu_status_r() ((CLEAR_LINE != m_bmcu->mcu_semaphore_r()) ? 0x02 : 0x00); } -// the schematics show that the two sound semaphore latch bits are actually flipped backwards when read by the sound cpu -// vs when read by the main cpu. -// Given the other schematic errors, and the fact that the sound board schematic is for the wrong pcb, is this even correct? -// It isn't even obvious if the maincpu or sound cpu read the semaphores at all, ever. -// a cpu write to soundlatch sets ic12.2 so /Q is low, so cpu bit 1 and sound bit 0 read as clear -// a sound write to soundlatch2 clears ic12.1 so /Q is high, so cpu bit 0 and sound bit 1 read as set -// a cpu read of soundlatch2 sets ic12.1 so /Q is low, so cpu bit 0 and sound bit 1 read as clear -// a sound read of soundlatch clears ic12.2 so /Q is high, so cpu bit 1 and sound bit 0 read as set +// the schematics show that the two sound semaphore latch bits are actually flipped backwards when read by the sound CPU +// vs when read by the main CPU. +// Given the other schematic errors, and the fact that the sound board schematic is for the wrong PCB, is this even correct? +// It isn't even obvious if the main CPU or sound CPU read the semaphores at all, ever. +// a CPU write to soundlatch[0] sets ic12.2 so /Q is low, so CPU bit 1 and sound bit 0 read as clear +// a sound write to soundlatch[1] clears ic12.1 so /Q is high, so CPU bit 0 and sound bit 1 read as set +// a CPU read of soundlatch[1] sets ic12.1 so /Q is low, so CPU bit 0 and sound bit 1 read as clear +// a sound read of soundlatch[0] clears ic12.2 so /Q is high, so CPU bit 1 and sound bit 0 read as set // ic12.1 is set and ic12.2 is cleared by /SRESET uint8_t buggychl_state::sound_status_main_r() { - return (m_soundlatch2->pending_r() ? 1 : 0) | (m_soundlatch->pending_r() ? 0 : 2); + return (m_soundlatch[1]->pending_r() ? 1 : 0) | (m_soundlatch[0]->pending_r() ? 0 : 2); } uint8_t buggychl_state::sound_status_sound_r() { - return (m_soundlatch2->pending_r() ? 2 : 0) | (m_soundlatch->pending_r() ? 0 : 1); + return (m_soundlatch[1]->pending_r() ? 2 : 0) | (m_soundlatch[0]->pending_r() ? 0 : 1); } -/* Main cpu address map ( * = used within this section; x = don't care ) +/* Main CPU address map ( * = used within this section; x = don't care ) | | | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 * * R 74LS139 @ ic53 @@ -197,64 +532,64 @@ uint8_t buggychl_state::sound_status_sound_r() 1 1 1 0 ? ? ? ? ? ? ? ? ? ? ? ? ? (unknown, cut off on schematic) 1 1 1 1 ? ? ? ? ? ? ? ? ? ? ? ? ? (unknown, cut off on schematic) */ -void buggychl_state::buggychl_map(address_map &map) +void buggychl_state::main_map(address_map &map) { - map(0x0000, 0x3fff).rom(); /* A22-04 (23) */ - map(0x4000, 0x7fff).rom(); /* A22-05 (22) */ - map(0x8000, 0x87ff).ram(); /* 6116 SRAM (36) */ - map(0x8800, 0x8fff).ram(); /* 6116 SRAM (35) */ - map(0x9000, 0x9fff).w(FUNC(buggychl_state::buggychl_sprite_lookup_w)); - map(0xa000, 0xbfff).bankr("bank1").w(FUNC(buggychl_state::buggychl_chargen_w)).share("charram"); - map(0xc800, 0xcfff).ram().share("videoram"); + map(0x0000, 0x3fff).rom(); // A22-04 (23) + map(0x4000, 0x7fff).rom(); // A22-05 (22) + map(0x8000, 0x87ff).ram(); // 6116 SRAM (36) + map(0x8800, 0x8fff).ram(); // 6116 SRAM (35) + map(0x9000, 0x9fff).w(FUNC(buggychl_state::sprite_lookup_w)); + map(0xa000, 0xbfff).bankr(m_mainbank).w(FUNC(buggychl_state::chargen_w)).share(m_charram); + map(0xc800, 0xcfff).ram().share(m_videoram); map(0xd000, 0xd000).nopw(); // ??? - map(0xd100, 0xd100).mirror(0x00ff).w(FUNC(buggychl_state::buggychl_ctrl_w)); + map(0xd100, 0xd100).mirror(0x00ff).w(FUNC(buggychl_state::ctrl_w)); map(0xd200, 0xd200).mirror(0x00ff).w(FUNC(buggychl_state::bankswitch_w)); map(0xd300, 0xd300).mirror(0x00f8).w("watchdog", FUNC(watchdog_timer_device::reset_w)); // d301 = flp stuff, unused? // d302 = mcu reset latched d0 - map(0xd303, 0xd303).mirror(0x00f8).w(FUNC(buggychl_state::buggychl_sprite_lookup_bank_w)); + map(0xd303, 0xd303).mirror(0x00f8).w(FUNC(buggychl_state::sprite_lookup_bank_w)); map(0xd304, 0xd307).nopw(); // d304-d307 is SCCON, which seems to be for a bezel mounted 7seg score/time display like Grand Champion has map(0xd400, 0xd400).mirror(0x00fc).rw(m_bmcu, FUNC(taito68705_mcu_device::data_r), FUNC(taito68705_mcu_device::data_w)); map(0xd401, 0xd401).mirror(0x00fc).r(FUNC(buggychl_state::mcu_status_r)); - map(0xd500, 0xd57f).writeonly().share("spriteram"); + map(0xd500, 0xd57f).writeonly().share(m_spriteram); map(0xd600, 0xd600).mirror(0x00e4).portr("DSW1"); map(0xd601, 0xd601).mirror(0x00e4).portr("DSW2"); map(0xd602, 0xd602).mirror(0x00e4).portr("DSW3"); - map(0xd603, 0xd603).mirror(0x00e4).portr("IN0"); /* player inputs */ + map(0xd603, 0xd603).mirror(0x00e4).portr("IN0"); // player inputs map(0xd608, 0xd608).mirror(0x00e4).portr("WHEEL"); - map(0xd609, 0xd609).mirror(0x00e4).portr("IN1"); /* coin + accelerator */ + map(0xd609, 0xd609).mirror(0x00e4).portr("IN1"); // coin + accelerator // map(0xd60a, 0xd60a).mirror(0x00e4); // other inputs, not used? // map(0xd60b, 0xd60b).mirror(0x00e4); // other inputs, not used? - map(0xd610, 0xd610).mirror(0x00e4).r(m_soundlatch2, FUNC(generic_latch_8_device::read)).w(m_soundlatch, FUNC(generic_latch_8_device::write)); + map(0xd610, 0xd610).mirror(0x00e4).r(m_soundlatch[1], FUNC(generic_latch_8_device::read)).w(m_soundlatch[0], FUNC(generic_latch_8_device::write)); map(0xd611, 0xd611).mirror(0x00e4).r(FUNC(buggychl_state::sound_status_main_r)); // map(0xd613, 0xd613).mirror(0x00e4).w(FUNC(buggychl_state::sound_reset_w)); - map(0xd618, 0xd618).mirror(0x00e7).nopw(); /* accelerator clear; TODO: should we emulate the proper quadrature counter here? */ + map(0xd618, 0xd618).mirror(0x00e7).nopw(); // accelerator clear; TODO: should we emulate the proper quadrature counter here? map(0xd700, 0xd7ff).w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0xd820, 0xd83f).ram(); // TODO - map(0xd840, 0xd85f).writeonly().share("scrollv"); - map(0xdb00, 0xdbff).writeonly().share("scrollh"); - map(0xdc04, 0xdc04).nopw(); /* should be fg scroll */ - map(0xdc06, 0xdc06).w(FUNC(buggychl_state::buggychl_bg_scrollx_w)); + map(0xd840, 0xd85f).writeonly().share(m_scrollv); + map(0xdb00, 0xdbff).writeonly().share(m_scrollh); + map(0xdc04, 0xdc04).nopw(); // should be fg scroll + map(0xdc06, 0xdc06).w(FUNC(buggychl_state::bg_scrollx_w)); } -/* The schematics for buggy challenge has the wrong sound board schematic attached to it. - (The schematic is for an unknown taito game, possibly never released.) - The final buggy challenge sound board is more similar to Fairyland Story sound +/* The schematics for Buggy Challenge have the wrong sound board schematic attached to it. + (The schematic is for an unknown Taito game, possibly never released.) + The final Buggy Challenge sound board is more similar to Fairyland Story sound hardware, except it has two YM2149 chips instead of one, and much less ROM space. */ void buggychl_state::sound_map(address_map &map) { map(0x0000, 0x3fff).rom(); map(0x4000, 0x47ff).ram(); - map(0x4800, 0x4801).w(m_ay1, FUNC(ay8910_device::address_data_w)); - map(0x4802, 0x4803).w(m_ay2, FUNC(ay8910_device::address_data_w)); + map(0x4800, 0x4801).w(m_ay[0], FUNC(ay8910_device::address_data_w)); + map(0x4802, 0x4803).w(m_ay[1], FUNC(ay8910_device::address_data_w)); map(0x4810, 0x481d).w(m_msm, FUNC(msm5232_device::write)); - map(0x4820, 0x4820).w(FUNC(buggychl_state::ta7630_volbal_msm_w)); /* VOL/BAL for the 7630 on the MSM5232 output */ - map(0x4830, 0x4830).ram(); /* TRBL/BASS for the 7630 on the MSM5232 output */ - map(0x5000, 0x5000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(m_soundlatch2, FUNC(generic_latch_8_device::write)); + map(0x4820, 0x4820).w(FUNC(buggychl_state::ta7630_volbal_msm_w)); // VOL/BAL for the 7630 on the MSM5232 output + map(0x4830, 0x4830).ram(); // TRBL/BASS for the 7630 on the MSM5232 output + map(0x5000, 0x5000).r(m_soundlatch[0], FUNC(generic_latch_8_device::read)).w(m_soundlatch[1], FUNC(generic_latch_8_device::write)); map(0x5001, 0x5001).r(FUNC(buggychl_state::sound_status_sound_r)).w(m_soundnmi, FUNC(input_merger_device::in_set<1>)); map(0x5002, 0x5002).w(m_soundnmi, FUNC(input_merger_device::in_clear<1>)); map(0x5003, 0x5003).w(FUNC(buggychl_state::sound_enable_w)); // unclear what this actually controls - map(0xe000, 0xefff).rom(); /* space for diagnostics ROM */ + map(0xe000, 0xefff).rom(); // space for diagnostics ROM } /* Here is the memory maps from the 'wrong' sound schematic @@ -290,28 +625,28 @@ Sound Master CPU (SMCPU) 0 1 1 1 0 0 1 x x x x x x x x x W OPEN BUS 0 1 1 1 0 1 0 x x x x x x x x x W Main VR Control voltage DAC 0 1 1 1 0 1 1 x x x x x x x x x W OPEN BUS - 0 1 1 1 1 0 0 x x x x x x x x x W CHA Level (selectively gate the 4 dac bits for 2x 4bit r2r dac, one on d7-4, one d3-0, for front right) - 0 1 1 1 1 0 1 x x x x x x x x x W CHB Level (selectively gate the 4 dac bits for 2x 4bit r2r dac, one on d7-4, one d3-0, for rear right) - 0 1 1 1 1 1 0 x x x x x x x x x W CHC Level (selectively gate the 4 dac bits for 2x 4bit r2r dac, one on d7-4, one d3-0, for front left) - 0 1 1 1 1 1 1 x x x x x x x x x W CHD Level (selectively gate the 4 dac bits for 2x 4bit r2r dac, one on d7-4, one d3-0, for rear left) + 0 1 1 1 1 0 0 x x x x x x x x x W CHA Level (selectively gate the 4 DAC bits for 2x 4bit r2r DAC, one on d7-4, one d3-0, for front right) + 0 1 1 1 1 0 1 x x x x x x x x x W CHB Level (selectively gate the 4 DAC bits for 2x 4bit r2r DAC, one on d7-4, one d3-0, for rear right) + 0 1 1 1 1 1 0 x x x x x x x x x W CHC Level (selectively gate the 4 DAC bits for 2x 4bit r2r DAC, one on d7-4, one d3-0, for front left) + 0 1 1 1 1 1 1 x x x x x x x x x W CHD Level (selectively gate the 4 DAC bits for 2x 4bit r2r DAC, one on d7-4, one d3-0, for rear left) 1 0 0 x x x x x x x x x x * * * SM-8 /CS (inject ?4? SM waitstates cycles) 1 0 0 x x x x x x x x x x 0 0 x W OPEN BUS 1 0 0 x x x x x x x x x x 0 1 0 W AY #1 @ic42 Address write 1 0 0 x x x x x x x x x x 0 1 1 W AY #1 @ic42 Data write - AY #1 IOB7-4 connect to an r2r dac+opamp controlling ay1 TA7630P Treble - AY #1 IOB3-0 connect to an r2r dac+opamp controlling ay1 TA7630P Bass - AY #1 IOA7-4 connect to an r2r dac+opamp controlling ay1 TA7630P Volume - AY #1 IOA3-0 connect to an r2r dac+opamp controlling ay1 TA7630P Balance + AY #1 IOB7-4 connect to an r2r DAC+opamp controlling ay1 TA7630P Treble + AY #1 IOB3-0 connect to an r2r DAC+opamp controlling ay1 TA7630P Bass + AY #1 IOA7-4 connect to an r2r DAC+opamp controlling ay1 TA7630P Volume + AY #1 IOA3-0 connect to an r2r DAC+opamp controlling ay1 TA7630P Balance 1 0 0 x x x x x x x x x x 1 0 0 W AY #2 @ic41 Address write 1 0 0 x x x x x x x x x x 1 0 1 W AY #2 @ic41 Data write - AY #2 IOB7-4 connect to an r2r dac+opamp controlling ay2 TA7630P Treble - AY #2 IOB3-0 connect to an r2r dac+opamp controlling ay2 TA7630P Bass - AY #2 IOA7-4 connect to an r2r dac+opamp controlling ay2 TA7630P Volume - AY #2 IOA3-0 connect to an r2r dac+opamp controlling ay2 TA7630P Balance + AY #2 IOB7-4 connect to an r2r DAC+opamp controlling ay2 TA7630P Treble + AY #2 IOB3-0 connect to an r2r DAC+opamp controlling ay2 TA7630P Bass + AY #2 IOA7-4 connect to an r2r DAC+opamp controlling ay2 TA7630P Volume + AY #2 IOA3-0 connect to an r2r DAC+opamp controlling ay2 TA7630P Balance 1 0 0 x x x x x x x x x x 1 1 x W OPEN BUS - 1 0 1 * * * * * * * * * * * * * RW SM-A /CS (read or write to slave cpu address space 0000-1fff; slave cpu is held in waitstate during this) + 1 0 1 * * * * * * * * * * * * * RW SM-A /CS (read or write to slave CPU address space 0000-1fff; slave CPU is held in waitstate during this) 1 1 0 x x * * * * * * * * * * * RW SRAM (ic3) - 1 1 1 x x x x x x x x x x x x x OPEN BUS (diag rom may map here?) + 1 1 1 x x x x x x x x x x x x x OPEN BUS (diag ROM may map here?) */ /******************************************************************************/ @@ -325,7 +660,7 @@ CUSTOM_INPUT_MEMBER( buggychl_state::pedal_in_r ) static INPUT_PORTS_START( buggychl ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, "Game Over Bonus" ) PORT_DIPLOCATION("SW1:1,2") /* Arks/Flags/Fuel */ + PORT_DIPNAME( 0x03, 0x03, "Game Over Bonus" ) PORT_DIPLOCATION("SW1:1,2") // Arks/Flags/Fuel PORT_DIPSETTING( 0x03, "2000/1000/50" ) PORT_DIPSETTING( 0x02, "1000/500/30" ) PORT_DIPSETTING( 0x01, "500/200/10" ) @@ -334,15 +669,15 @@ static INPUT_PORTS_START( buggychl ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5") - PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) /* 1300 units of fuel */ - PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) /* 1200 units of fuel */ - PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) /* 1100 units of fuel */ - PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) /* 1000 units of fuel */ + PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) // 1300 units of fuel + PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) // 1200 units of fuel + PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) // 1100 units of fuel + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) // 1000 units of fuel PORT_SERVICE_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) /* Only listed as OFF in the manual */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // Only listed as OFF in the manual PORT_START("DSW2") PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3,4") @@ -384,11 +719,11 @@ static INPUT_PORTS_START( buggychl ) PORT_DIPNAME( 0x01, 0x01, "Start button needed" ) PORT_DIPLOCATION("SW3:1") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" ) /* Only listed as OFF in the manual */ + PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" ) // Only listed as OFF in the manual PORT_DIPNAME( 0x04, 0x04, "Fuel loss (Cheat)") PORT_DIPLOCATION("SW3:3") PORT_DIPSETTING( 0x04, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x00, "Crash only" ) - PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" ) /* Only listed as OFF in the manual */ + PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" ) // Only listed as OFF in the manual PORT_DIPNAME( 0x10, 0x10, "Coinage Display" ) PORT_DIPLOCATION("SW3:5") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) @@ -406,7 +741,7 @@ static INPUT_PORTS_START( buggychl ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_TOGGLE PORT_NAME("P1 Gear Shift") /* shift */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_TOGGLE PORT_NAME("P1 Gear Shift") PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Test Button") PORT_CODE(KEYCODE_F1) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -420,9 +755,9 @@ static INPUT_PORTS_START( buggychl ) PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(buggychl_state, pedal_in_r) PORT_START("PEDAL") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_NAME("P1 Pedal") PORT_SENSITIVITY(100) PORT_KEYDELTA(15) /* accelerator */ + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_NAME("P1 Pedal") PORT_SENSITIVITY(100) PORT_KEYDELTA(15) // accelerator - PORT_START("WHEEL") /* wheel */ + PORT_START("WHEEL") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_REVERSE INPUT_PORTS_END @@ -452,9 +787,9 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_buggychl ) - GFXDECODE_ENTRY( nullptr, 0, charlayout, 0, 8 ) /* decoded at runtime */ - /* sprites are drawn pixel by pixel by draw_sprites() */ - GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0, 8 ) + GFXDECODE_ENTRY( nullptr, 0, charlayout, 0, 8 ) // decoded at runtime + // sprites are drawn pixel by pixel by draw_sprites() + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 8 ) GFXDECODE_END @@ -463,33 +798,25 @@ void buggychl_state::ta7630_volbal_msm_w(uint8_t data) m_ta7630->set_device_volume(m_msm, data >> 4); } -void buggychl_state::ta7630_volbal_ay1_w(uint8_t data) -{ - /* VOL/BAL for the 7630 on this 8910 output */ - m_ta7630->set_device_volume(m_ay1, data >> 4); -} - -void buggychl_state::port_b_0_w(uint8_t data) +template +void buggychl_state::ta7630_volbal_ay_w(uint8_t data) { - /* TRBL/BASS for the 7630 on this 8910 output */ + // VOL/BAL for the 7630 on this 8910 output + m_ta7630->set_device_volume(m_ay[Which], data >> 4); } -void buggychl_state::ta7630_volbal_ay2_w(uint8_t data) +template +void buggychl_state::port_b_w(uint8_t data) { - /* VOL/BAL for the 7630 on this 8910 output */ - m_ta7630->set_device_volume(m_ay2, data >> 4); + // TRBL/BASS for the 7630 on this 8910 output } -void buggychl_state::port_b_1_w(uint8_t data) -{ - /* TRBL/BASS for the 7630 on this 8910 output */ -} void buggychl_state::machine_start() { uint8_t *ROM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x2000); + m_mainbank->configure_entries(0, 6, &ROM[0x10000], 0x2000); save_item(NAME(m_sprite_lookup)); save_item(NAME(m_sl_bank)); @@ -512,65 +839,65 @@ void buggychl_state::machine_reset() void buggychl_state::buggychl(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 48_MHz_XTAL/8); /* 6 MHz according to schematics, though it can be jumpered for 4MHz as well */ - m_maincpu->set_addrmap(AS_PROGRAM, &buggychl_state::buggychl_map); + // basic machine hardware + Z80(config, m_maincpu, 48_MHz_XTAL / 8); // 6 MHz according to schematics, though it can be jumpered for 4MHz as well + m_maincpu->set_addrmap(AS_PROGRAM, &buggychl_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(buggychl_state::irq0_line_hold)); - Z80(config, m_audiocpu, 8_MHz_XTAL/2); /* 4 MHz according to schematics */ + Z80(config, m_audiocpu, 8_MHz_XTAL / 2); // 4 MHz according to schematics m_audiocpu->set_addrmap(AS_PROGRAM, &buggychl_state::sound_map); - m_audiocpu->set_periodic_int(FUNC(buggychl_state::irq0_line_hold), attotime::from_hz(8_MHz_XTAL/2/2/256/64)); // timer irq - //TIMER(config, "soundirq").configure_periodic(m_audiocpu, FUNC(buggychl_state::irq0_line_hold), 8_MHz_XTAL/2/2/256/64); + m_audiocpu->set_periodic_int(FUNC(buggychl_state::irq0_line_hold), attotime::from_hz(8_MHz_XTAL / 2 / 2 / 256 / 64)); // timer IRQ + //TIMER(config, "soundirq").configure_periodic(m_audiocpu, FUNC(buggychl_state::irq0_line_hold), 8_MHz_XTAL / 2 / 2 / 256 / 64); // The schematics (which are at least partly for the wrong sound board) show a configurable timer with rates of - // 61.035Hz (8_MHz_XTAL/2/2/256/128) - // or 122.0Hz (8_MHz_XTAL/2/2/256/64) + // 61.035Hz (8_MHz_XTAL / 2 / 2 / 256 / 128) + // or 122.0Hz (8_MHz_XTAL / 2 / 2 / 256 / 64) // similar to flstory.cpp and other Taito MSM5232 based games. - // The real sound pcb probably lacks the latch for this configurable timer, but does have a jumper which likely has a similar function. - // The game code implies the timer int is enable/disabled by one of the "sound_enable_w" bits? + // The real sound PCB probably lacks the latch for this configurable timer, but does have a jumper which likely has a similar function. + // The game code implies the timer int is enabled/disabled by one of the "sound_enable_w" bits? // TODO: actually hook this up? - /* audiocpu nmi is caused by (main->sound semaphore)&&(sound_nmi_enabled), identical to bubble bobble. */ + // audiocpu NMI is caused by (main->sound semaphore)&&(sound_nmi_enabled), identical to Bubble Bobble. - TAITO68705_MCU(config, m_bmcu, 48_MHz_XTAL/8/2); /* CPUspeed/2 MHz according to schematics, so 3MHz if cpu is jumpered for 6MHz */ + TAITO68705_MCU(config, m_bmcu, 48_MHz_XTAL / 8 / 2); // CPUspeed/2 MHz according to schematics, so 3MHz if CPU is jumpered for 6MHz WATCHDOG_TIMER(config, "watchdog").set_vblank_count("screen", 128); // typical Taito 74ls392 - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); // derived from ladyfrog.cpp, causes glitches? // m_screen->set_raw(8_MHz_XTAL, 510, 0, 256, 262, 2*8, 30*8); // pixel clock appears to run at 8 MHz - m_screen->set_screen_update(FUNC(buggychl_state::screen_update_buggychl)); + m_screen->set_screen_update(FUNC(buggychl_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_buggychl); - PALETTE(config, m_palette, FUNC(buggychl_state::buggychl_palette)).set_format(palette_device::xRGB_444, 128 + 128); + PALETTE(config, m_palette, FUNC(buggychl_state::palette)).set_format(palette_device::xRGB_444, 128 + 128); m_palette->set_endianness(ENDIANNESS_BIG); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>)); - GENERIC_LATCH_8(config, m_soundlatch2); + GENERIC_LATCH_8(config, m_soundlatch[0]).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>)); + GENERIC_LATCH_8(config, m_soundlatch[1]); INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI); TA7630(config, m_ta7630); - YM2149(config, m_ay1, 8_MHz_XTAL/4); - m_ay1->port_a_write_callback().set(FUNC(buggychl_state::ta7630_volbal_ay1_w)); - m_ay1->port_b_write_callback().set(FUNC(buggychl_state::port_b_0_w)); - m_ay1->add_route(ALL_OUTPUTS, "mono", 0.50); + YM2149(config, m_ay[0], 8_MHz_XTAL / 4); + m_ay[0]->port_a_write_callback().set(FUNC(buggychl_state::ta7630_volbal_ay_w<0>)); + m_ay[0]->port_b_write_callback().set(FUNC(buggychl_state::port_b_w<0>)); + m_ay[0]->add_route(ALL_OUTPUTS, "mono", 0.50); - YM2149(config, m_ay2, 8_MHz_XTAL/4); - m_ay2->port_a_write_callback().set(FUNC(buggychl_state::ta7630_volbal_ay2_w)); - m_ay2->port_b_write_callback().set(FUNC(buggychl_state::port_b_1_w)); - m_ay2->add_route(ALL_OUTPUTS, "mono", 0.50); + YM2149(config, m_ay[1], 8_MHz_XTAL / 4); + m_ay[1]->port_a_write_callback().set(FUNC(buggychl_state::ta7630_volbal_ay_w<1>)); + m_ay[1]->port_b_write_callback().set(FUNC(buggychl_state::port_b_w<1>)); + m_ay[1]->add_route(ALL_OUTPUTS, "mono", 0.50); - MSM5232(config, m_msm, 8_MHz_XTAL/4); - m_msm->set_capacitors(0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6); /* default 0.39 uF capacitors (not verified) */ + MSM5232(config, m_msm, 8_MHz_XTAL / 4); + m_msm->set_capacitors(0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6); // default 0.39 uF capacitors (not verified) m_msm->add_route(0, "mono", 1.0); // pin 28 2'-1 m_msm->add_route(1, "mono", 1.0); // pin 29 4'-1 m_msm->add_route(2, "mono", 1.0); // pin 30 8'-1 @@ -594,17 +921,17 @@ ROM_START( buggychl ) ROM_REGION( 0x1c000, "maincpu", 0 ) ROM_LOAD( "a22-04-2.23", 0x00000, 0x4000, CRC(16445a6a) SHA1(5ce7b0b1aeb3b6cd400965467f913558f39c251f) ) ROM_LOAD( "a22-05-2.22", 0x04000, 0x4000, CRC(d57430b2) SHA1(3e5b8c21a342d8e26c12a78535748073bc5b8742) ) - ROM_LOAD( "a22-01.3", 0x10000, 0x4000, CRC(af3b7554) SHA1(fd4f5a6cf9253f64c7e86d566802a02baae3b379) ) /* banked */ - ROM_LOAD( "a22-02.2", 0x14000, 0x4000, CRC(b8a645fb) SHA1(614a0656dee0cfa1d7e16ec1e0138a423ecaf18b) ) /* banked */ - ROM_LOAD( "a22-03.1", 0x18000, 0x4000, CRC(5f45d469) SHA1(3a1b9ab2d57c06bfffb1271583944c90d3f6b5a2) ) /* banked */ + ROM_LOAD( "a22-01.3", 0x10000, 0x4000, CRC(af3b7554) SHA1(fd4f5a6cf9253f64c7e86d566802a02baae3b379) ) // banked + ROM_LOAD( "a22-02.2", 0x14000, 0x4000, CRC(b8a645fb) SHA1(614a0656dee0cfa1d7e16ec1e0138a423ecaf18b) ) // banked + ROM_LOAD( "a22-03.1", 0x18000, 0x4000, CRC(5f45d469) SHA1(3a1b9ab2d57c06bfffb1271583944c90d3f6b5a2) ) // banked - ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound Z80 */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 ROM_LOAD( "a22-24.28", 0x00000, 0x4000, CRC(1e7f841f) SHA1(2dc0787b08d32acb78291b689c02dbb83d04d08c) ) - ROM_REGION( 0x0800, "bmcu:mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "bmcu:mcu", 0 ) ROM_LOAD( "a22-19.31", 0x00000, 0x0800, CRC(06a71df0) SHA1(28183e6769e1471e7f28dc2a9f5b54e14b7ef339) ) - ROM_REGION( 0x20000, "gfx1", 0 ) /* sprites */ + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "a22-06.111", 0x00000, 0x4000, CRC(1df91b17) SHA1(440d33bf984042fb4eac8f17bb385992ccdc6113) ) ROM_LOAD( "a22-07.110", 0x04000, 0x4000, CRC(2f0ab9b7) SHA1(07b98e23d12da834d522e29fe7891503dc258b05) ) ROM_LOAD( "a22-08.109", 0x08000, 0x4000, CRC(49cb2134) SHA1(f9998617c097b90be7257ba6fc1e46ff9e1f8916) ) @@ -614,27 +941,27 @@ ROM_START( buggychl ) ROM_LOAD( "a22-12.105", 0x18000, 0x4000, CRC(8b365b24) SHA1(a306c1f6fe1f5563602ab424f1b4f6ac17d1e47d) ) ROM_LOAD( "a22-13.104", 0x1c000, 0x4000, CRC(2c6d68fe) SHA1(9e1a0e44ae2b9986d0ebff49a0fd4df3e8a7f4e7) ) - ROM_REGION( 0x4000, "gfx2", 0 ) /* sprite zoom tables */ - ROM_LOAD( "a22-14.59", 0x0000, 0x2000, CRC(a450b3ef) SHA1(42646bfaed19ea01ffe06996bb6c2fd6c70076d6) ) /* vertical */ - ROM_LOAD( "a22-15.115", 0x2000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) /* horizontal */ - ROM_LOAD( "a22-16.116", 0x3000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) /* horizontal */ + ROM_REGION( 0x4000, "sprite_zoom_table", 0 ) + ROM_LOAD( "a22-14.59", 0x0000, 0x2000, CRC(a450b3ef) SHA1(42646bfaed19ea01ffe06996bb6c2fd6c70076d6) ) // vertical + ROM_LOAD( "a22-15.115", 0x2000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) // horizontal + ROM_LOAD( "a22-16.116", 0x3000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) // horizontal ROM_END ROM_START( buggychlt ) ROM_REGION( 0x1c000, "maincpu", 0 ) ROM_LOAD( "bu04.bin", 0x00000, 0x4000, CRC(f90ab854) SHA1(d4536c98be35de3d888548e2de15f8435ca4f08c) ) ROM_LOAD( "bu05.bin", 0x04000, 0x4000, CRC(543d0949) SHA1(b7b0b0319f5376e7cfcfd0e8a4fa6fea566e0206) ) - ROM_LOAD( "a22-01.3", 0x10000, 0x4000, CRC(af3b7554) SHA1(fd4f5a6cf9253f64c7e86d566802a02baae3b379) ) /* banked */ - ROM_LOAD( "a22-02.2", 0x14000, 0x4000, CRC(b8a645fb) SHA1(614a0656dee0cfa1d7e16ec1e0138a423ecaf18b) ) /* banked */ - ROM_LOAD( "a22-03.1", 0x18000, 0x4000, CRC(5f45d469) SHA1(3a1b9ab2d57c06bfffb1271583944c90d3f6b5a2) ) /* banked */ + ROM_LOAD( "a22-01.3", 0x10000, 0x4000, CRC(af3b7554) SHA1(fd4f5a6cf9253f64c7e86d566802a02baae3b379) ) // banked + ROM_LOAD( "a22-02.2", 0x14000, 0x4000, CRC(b8a645fb) SHA1(614a0656dee0cfa1d7e16ec1e0138a423ecaf18b) ) // banked + ROM_LOAD( "a22-03.1", 0x18000, 0x4000, CRC(5f45d469) SHA1(3a1b9ab2d57c06bfffb1271583944c90d3f6b5a2) ) // banked - ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound Z80 */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 ROM_LOAD( "a22-24.28", 0x00000, 0x4000, CRC(1e7f841f) SHA1(2dc0787b08d32acb78291b689c02dbb83d04d08c) ) - ROM_REGION( 0x0800, "bmcu:mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "bmcu:mcu", 0 ) ROM_LOAD( "a22-19.31", 0x00000, 0x0800, CRC(06a71df0) SHA1(28183e6769e1471e7f28dc2a9f5b54e14b7ef339) ) - ROM_REGION( 0x20000, "gfx1", 0 ) /* sprites */ + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "a22-06.111", 0x00000, 0x4000, CRC(1df91b17) SHA1(440d33bf984042fb4eac8f17bb385992ccdc6113) ) ROM_LOAD( "a22-07.110", 0x04000, 0x4000, CRC(2f0ab9b7) SHA1(07b98e23d12da834d522e29fe7891503dc258b05) ) ROM_LOAD( "a22-08.109", 0x08000, 0x4000, CRC(49cb2134) SHA1(f9998617c097b90be7257ba6fc1e46ff9e1f8916) ) @@ -644,12 +971,14 @@ ROM_START( buggychlt ) ROM_LOAD( "a22-12.105", 0x18000, 0x4000, CRC(8b365b24) SHA1(a306c1f6fe1f5563602ab424f1b4f6ac17d1e47d) ) ROM_LOAD( "a22-13.104", 0x1c000, 0x4000, CRC(2c6d68fe) SHA1(9e1a0e44ae2b9986d0ebff49a0fd4df3e8a7f4e7) ) - ROM_REGION( 0x4000, "gfx2", 0 ) /* sprite zoom tables */ - ROM_LOAD( "a22-14.59", 0x0000, 0x2000, CRC(a450b3ef) SHA1(42646bfaed19ea01ffe06996bb6c2fd6c70076d6) ) /* vertical */ - ROM_LOAD( "a22-15.115", 0x2000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) /* horizontal */ - ROM_LOAD( "a22-16.116", 0x3000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) /* horizontal */ + ROM_REGION( 0x4000, "sprite_zoom_table", 0 ) + ROM_LOAD( "a22-14.59", 0x0000, 0x2000, CRC(a450b3ef) SHA1(42646bfaed19ea01ffe06996bb6c2fd6c70076d6) ) // vertical + ROM_LOAD( "a22-15.115", 0x2000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) // horizontal + ROM_LOAD( "a22-16.116", 0x3000, 0x1000, CRC(337a0c14) SHA1(2aa6814f74497c5c55bf7098d7f6f5508845e36c) ) // horizontal ROM_END +} // anonymous namespace + GAMEL( 1984, buggychl, 0, buggychl, buggychl, buggychl_state, empty_init, ROT270, "Taito Corporation", "Buggy Challenge", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE, layout_buggychl ) GAMEL( 1984, buggychlt, buggychl, buggychl, buggychl, buggychl_state, empty_init, ROT270, "Taito Corporation (Tecfri license)", "Buggy Challenge (Tecfri)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE, layout_buggychl ) diff --git a/src/mame/drivers/centiped.cpp b/src/mame/drivers/centiped.cpp index af742873ef4..4486d972846 100644 --- a/src/mame/drivers/centiped.cpp +++ b/src/mame/drivers/centiped.cpp @@ -2303,6 +2303,25 @@ ROM_START( warlords ) ROM_END +/* +This is a conversion daughterboard for Atari Centipede PCBs. +The Bullseye Darts PCB is screened (C) 1984 CVS Technology. +PROM and PAL data recovered by mark shostak - 09 Feb 2003. + +The PCB utilizes a MAB2650A CPU; SN76496N DAC for sound; Century 109 +40-pin custom chip for protection, one 2114 (1024x4) SRAM and +one 8-pin dip that has been rendered unidentifiable. + +Two jumper wires have been run to the Centipede PCB. The red wire +runs from the 'audio' designation on the Bullseye Darts PCB (TP.A) +to both C65 and R81. The second jumper wire, blue, is run from +TP.B to the 'negative' side of R12. + +The board has two barnicles as follows: +1) 2650 pin 22 to N82SS153 pin 4 +2) 2114 pin 10 to N82SS153 pin 14 +*/ + ROM_START( bullsdrt ) ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "27128.bin", 0x0000, 0x1000, CRC(2729f585) SHA1(6ffbfa5b62c497c3932ab71d0e3f407cae99cb59) ) @@ -2316,6 +2335,9 @@ ROM_START( bullsdrt ) ROM_REGION( 0x0200, "proms", 0 ) /* unknown */ ROM_LOAD( "82s147.bin", 0x0000, 0x0200, CRC(d841b7e0) SHA1(aab32645a613cd027aed98437db24704763cc147) ) + + ROM_REGION( 0xeb, "plds", 0 ) + ROM_LOAD( "82s153.bin", 0x00, 0xeb, CRC(ff7e0ced) SHA1(b11dcb1937e01c23a3fad1d8c3cf0d969a80a122) ) ROM_END diff --git a/src/mame/drivers/himesiki.cpp b/src/mame/drivers/himesiki.cpp index 9b25a268663..d7584e43d9e 100644 --- a/src/mame/drivers/himesiki.cpp +++ b/src/mame/drivers/himesiki.cpp @@ -3,7 +3,7 @@ /***************************************************************************** Himeshikibu (C) 1989 Hi-Soft -Android (C) 198? Nasco +Android (C) 1987? Nasco Driver by Uki @@ -92,30 +92,210 @@ A 12.000MHz */ #include "emu.h" -#include "includes/himesiki.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/i8255.h" #include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class himesiki_state : public driver_device +{ +public: + himesiki_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_bg_ram(*this, "bg_ram"), + m_spriteram_p103a(*this, "sprram_p103a"), + m_spriteram(*this, "spriteram"), + m_mainbank(*this, "mainbank"), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "sub"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") + { } + + void himesiki(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_bg_ram; + required_shared_ptr m_spriteram_p103a; + required_shared_ptr m_spriteram; + required_memory_bank m_mainbank; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_scrollx[2]{}; + uint8_t m_scrolly = 0; + uint8_t m_flipscreen = 0; + + // devices + required_device m_maincpu; + required_device m_subcpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + void rombank_w(uint8_t data); + void sound_w(uint8_t data); + void bg_ram_w(offs_t offset, uint8_t data); + void scrollx_w(offs_t offset, uint8_t data); + void scrolly_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_io_map(address_map &map); + void sound_io_map(address_map &map); + void main_prg_map(address_map &map); + void sound_prg_map(address_map &map); +}; -#define MCLK XTAL(12'000'000) // this is on the video board -#define CLK2 XTAL(8'000'000) // near the CPUs +// video + +TILE_GET_INFO_MEMBER(himesiki_state::get_bg_tile_info) +{ + int code = m_bg_ram[tile_index * 2] + m_bg_ram[tile_index * 2 + 1] * 0x100; + int col = code >> 12; + + code &= 0xfff; + + tileinfo.set(0, code, col, 0); +} -void himesiki_state::himesiki_rombank_w(uint8_t data) +void himesiki_state::video_start() { - membank("bank1")->set_entry(((data & 0x0c) >> 2)); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(himesiki_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); +} + +void himesiki_state::bg_ram_w(offs_t offset, uint8_t data) +{ + m_bg_ram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset / 2); +} + +void himesiki_state::scrollx_w(offs_t offset, uint8_t data) +{ + m_scrollx[offset] = data; +} + +void himesiki_state::scrolly_w(uint8_t data) +{ + m_scrolly = data; +} - m_flipscreen = (data & 0x10)>>4; +void himesiki_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // these sprites are from the ET-P103A board (himesiki only) + for (int offs = 0x00; offs < 0x60; offs += 4) + { + int attr = m_spriteram_p103a[offs + 1]; + int code = m_spriteram_p103a[offs + 0] | (attr & 3) << 8; + int x = m_spriteram_p103a[offs + 3] | (attr & 8) << 5; + int y = m_spriteram_p103a[offs + 2]; + + int col = (attr & 0xf0) >> 4; + int fx = attr & 4; + int fy = 0; + + if (x > 0x1e0) + x -= 0x200; + + if (m_flipscreen) + { + y = (y - 31) & 0xff; + x = 224 - x; + fx ^= 4; + fy = 1; + } + else + { + y = 257 - y; + if (y > 0xc0) + y -= 0x100; + } + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, code, col, fx, fy, x, y, 15); + } + + // 0xc0 - 0xff unused + for (int offs = 0; offs < 0x100; offs += 4) + { + // not sure about this, but you sometimes get a garbage sprite in the corner otherwise. + if ((m_spriteram[offs + 0] == 0x00) && + (m_spriteram[offs + 1] == 0x00) && + (m_spriteram[offs + 2] == 0x00) && + (m_spriteram[offs + 3] == 0x00)) + continue; + + int attr = m_spriteram[offs + 1]; + int code = m_spriteram[offs + 0] | (attr & 7) << 8; + int x = m_spriteram[offs + 3] | (attr & 8) << 5; + int y = m_spriteram[offs + 2]; + + int col = (attr & 0xf0) >> 4; + int f = 0; + + if (x > 0x1e0) + x -= 0x200; + + if (m_flipscreen) + { + y = (y - 15) & 0xff; + x = 240 - x; + f = 1; + } + else + y = 257 - y; + + y &= 0xff; + if (y > 0xf0) + y -= 0x100; + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, col, f, f, x, y, 15); + } +} + +uint32_t himesiki_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x = -(m_scrollx[0] << 8 | m_scrollx[1]) & 0x1ff; + m_bg_tilemap->set_scrolldx(x, x); + m_bg_tilemap->set_scrolldy(-m_scrolly, -m_scrolly - 64); + + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + draw_sprites(bitmap, cliprect); + + return 0; +} + + +// machine + +void himesiki_state::rombank_w(uint8_t data) +{ + m_mainbank->set_entry(((data & 0x0c) >> 2)); + + m_flipscreen = (data & 0x10) >> 4; flip_screen_set(m_flipscreen); if (data & 0xe3) logerror("p06_w %02x\n", data); } -void himesiki_state::himesiki_sound_w(uint8_t data) +void himesiki_state::sound_w(uint8_t data) { m_soundlatch->write(data); m_subcpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); @@ -123,37 +303,37 @@ void himesiki_state::himesiki_sound_w(uint8_t data) /****************************************************************************/ -void himesiki_state::himesiki_prm0(address_map &map) +void himesiki_state::main_prg_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x9fff).ram(); - map(0xa000, 0xa0ff).ram().share("spriteram"); - map(0xa100, 0xa7ff).ram().share("sprram_p103a"); // not on Android + map(0xa000, 0xa0ff).ram().share(m_spriteram); + map(0xa100, 0xa7ff).ram().share(m_spriteram_p103a); // not on Android map(0xa800, 0xafff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); - map(0xb000, 0xbfff).ram().w(FUNC(himesiki_state::himesiki_bg_ram_w)).share("bg_ram"); - map(0xc000, 0xffff).bankr("bank1"); + map(0xb000, 0xbfff).ram().w(FUNC(himesiki_state::bg_ram_w)).share(m_bg_ram); + map(0xc000, 0xffff).bankr(m_mainbank); } -void himesiki_state::himesiki_iom0(address_map &map) +void himesiki_state::main_io_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x03).rw("ppi8255_0", FUNC(i8255_device::read), FUNC(i8255_device::write)); // inputs map(0x04, 0x07).rw("ppi8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write)); // dips + rombank - map(0x08, 0x08).w(FUNC(himesiki_state::himesiki_scrolly_w)); - map(0x09, 0x0a).w(FUNC(himesiki_state::himesiki_scrollx_w)); - map(0x0b, 0x0b).w(FUNC(himesiki_state::himesiki_sound_w)); + map(0x08, 0x08).w(FUNC(himesiki_state::scrolly_w)); + map(0x09, 0x0a).w(FUNC(himesiki_state::scrollx_w)); + map(0x0b, 0x0b).w(FUNC(himesiki_state::sound_w)); } -void himesiki_state::himesiki_prm1(address_map &map) +void himesiki_state::sound_prg_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0xf800, 0xffff).ram(); } -void himesiki_state::himesiki_iom1(address_map &map) +void himesiki_state::sound_io_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x01).rw("ym2203", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); @@ -375,29 +555,17 @@ static const gfx_layout layout_p103a = 32*32*4 }; -static const gfx_layout layout_spr = -{ - 16,16, - RGN_FRAC(1,1), - 4, - { 0,1,2,3 }, - { 4,0,12,8,20,16,28,24,36,32,44,40,52,48,60,56 }, - { STEP16(0,64) }, - 16*16*4 -}; static GFXDECODE_START( gfx_himesiki ) - GFXDECODE_ENTRY( "bgtiles", 0, gfx_8x8x4_packed_lsb, 0x000, 16 ) - GFXDECODE_ENTRY( "sprites", 0, layout_spr, 0x200, 16 ) - GFXDECODE_ENTRY( "spr_p103a", 0, layout_p103a, 0x200, 16 ) + GFXDECODE_ENTRY( "bgtiles", 0, gfx_8x8x4_packed_lsb, 0x000, 16 ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 0x200, 16 ) + GFXDECODE_ENTRY( "spr_p103a", 0, layout_p103a, 0x200, 16 ) GFXDECODE_END void himesiki_state::machine_start() { - uint8_t *ROM = memregion("banks")->base(); - - membank("bank1")->configure_entries(0, 4, ROM, 0x4000); + m_mainbank->configure_entries(0, 4, memregion("banks")->base(), 0x4000); save_item(NAME(m_scrollx)); @@ -417,15 +585,18 @@ void himesiki_state::machine_reset() void himesiki_state::himesiki(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, CLK2); /* it's a 6.000 MHz rated part, but near the 8 Mhz XTAL?? - Android skips lots of frames at 6, crashes at 4 */ - m_maincpu->set_addrmap(AS_PROGRAM, &himesiki_state::himesiki_prm0); - m_maincpu->set_addrmap(AS_IO, &himesiki_state::himesiki_iom0); + [[maybe_unused]] constexpr XTAL MCLK = XTAL(12'000'000); // this is on the video board + constexpr XTAL CLK2 = XTAL(8'000'000); // near the CPUs + + // basic machine hardware + Z80(config, m_maincpu, CLK2); // it's a 6.000 MHz rated part, but near the 8 Mhz XTAL?? - Android skips lots of frames at 6, crashes at 4 + m_maincpu->set_addrmap(AS_PROGRAM, &himesiki_state::main_prg_map); + m_maincpu->set_addrmap(AS_IO, &himesiki_state::main_io_map); m_maincpu->set_vblank_int("screen", FUNC(himesiki_state::irq0_line_hold)); - Z80(config, m_subcpu, CLK2/2); /* 4.000 MHz (4Mhz rated part, near the 8 Mhz XTAL) */ - m_subcpu->set_addrmap(AS_PROGRAM, &himesiki_state::himesiki_prm1); - m_subcpu->set_addrmap(AS_IO, &himesiki_state::himesiki_iom1); + Z80(config, m_subcpu, CLK2 / 2); // 4.000 MHz (4Mhz rated part, near the 8 Mhz XTAL) + m_subcpu->set_addrmap(AS_PROGRAM, &himesiki_state::sound_prg_map); + m_subcpu->set_addrmap(AS_IO, &himesiki_state::sound_io_map); i8255_device &ppi0(I8255A(config, "ppi8255_0")); ppi0.in_pa_callback().set_ioport("1P"); @@ -435,26 +606,26 @@ void himesiki_state::himesiki(machine_config &config) i8255_device &ppi1(I8255A(config, "ppi8255_1")); ppi1.in_pa_callback().set_ioport("DSW1"); ppi1.in_pb_callback().set_ioport("DSW2"); - ppi1.out_pc_callback().set(FUNC(himesiki_state::himesiki_rombank_w)); + ppi1.out_pc_callback().set(FUNC(himesiki_state::rombank_w)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 0*8, 24*8-1); - screen.set_screen_update(FUNC(himesiki_state::screen_update_himesiki)); + screen.set_screen_update(FUNC(himesiki_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_himesiki); PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xRGB_555, 1024); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); - ym2203_device &ym2203(YM2203(config, "ym2203", CLK2/4)); // ?? + ym2203_device &ym2203(YM2203(config, "ym2203", CLK2 / 4)); // ?? ym2203.irq_handler().set_inputline("sub", 0); ym2203.add_route(0, "mono", 0.10); ym2203.add_route(1, "mono", 0.10); @@ -466,7 +637,7 @@ void himesiki_state::himesiki(machine_config &config) /****************************************************************************/ ROM_START( himesiki ) - ROM_REGION( 0x08000, "maincpu", 0 ) /* z80 */ + ROM_REGION( 0x08000, "maincpu", 0 ) // z80 ROM_LOAD( "1.1k", 0x00000, 0x08000, CRC(fb4604b3) SHA1(e8155bbafb881125e1bf9a04808d6a6546887e90) ) ROM_REGION( 0x10000, "banks", 0 ) @@ -474,21 +645,21 @@ ROM_START( himesiki ) ROM_CONTINUE( 0x08000, 0x04000) // 1j is unpopulated on this game - ROM_REGION( 0x010000, "sub", 0 ) /* z80 */ + ROM_REGION( 0x08000, "sub", 0 ) // z80 ROM_LOAD( "5.6n", 0x00000, 0x08000, CRC(b1214ac7) SHA1(ee5459c28d9c3c2eb3467261716b1259ec486534) ) - ROM_REGION( 0x020000, "bgtiles", 0 ) /* bg */ + ROM_REGION( 0x020000, "bgtiles", 0 ) ROM_LOAD( "3.5f", 0x000000, 0x010000, CRC(73843e60) SHA1(0d8a397d8798e15f3fa7bf7a83e4c2ee44f6fa86) ) ROM_LOAD( "4.5d", 0x010000, 0x010000, CRC(443a3164) SHA1(08aa002214251a870581a01d775f497dd390957c) ) - ROM_REGION( 0x040000, "sprites", 0 ) /* sprites */ + ROM_REGION( 0x040000, "sprites", 0 ) ROM_LOAD16_BYTE( "13.9e", 0x000000, 0x010000, CRC(43102682) SHA1(0d4bde8bece0cbc6c06071aa8ad210a0636d862f) ) ROM_LOAD16_BYTE( "12.9c", 0x000001, 0x010000, CRC(19c8f9f4) SHA1(b14c8a6b94fd474be375e7a6a03d7f4517da2247) ) ROM_LOAD16_BYTE( "15.8e", 0x020000, 0x010000, CRC(2630d394) SHA1(b2e9e836b1f053fce3212912c53d3cdca3372439) ) ROM_LOAD16_BYTE( "14.8c", 0x020001, 0x010000, CRC(8103a207) SHA1(0dde8a0aaf2618d9c1589f35841db210439d0388) ) - ROM_REGION( 0x060000, "spr_p103a", 0 ) /* sprites */ + ROM_REGION( 0x060000, "spr_p103a", 0 ) ROM_LOAD16_BYTE( "6.1a", 0x000000, 0x010000, CRC(14989c22) SHA1(fe0c31df10237294ea8ef0ab8965ba5bb25113a2) ) ROM_LOAD16_BYTE( "7.1c", 0x000001, 0x010000, CRC(cec56e16) SHA1(836ff413301044313fdf7af5d304c145137b898a) ) ROM_LOAD16_BYTE( "8.2a", 0x020000, 0x010000, CRC(44ba127e) SHA1(d756b6c3075d75287f9c8be662c1eab02f4245a3) ) @@ -506,11 +677,11 @@ ROM_START( androidpo ) ROM_REGION( 0x10000, "banks", 0 ) ROM_LOAD( "mitsubishi__ad-3__m5l27256k.toppcb.g1", 0x00000, 0x04000, CRC(6cf5f48a) SHA1(b9b4e5e7bace0e8d98fbc9f4ad91bc56ef42099e) ) - ROM_CONTINUE( 0x08000, 0x04000) - ROM_LOAD( "mitsubishi__ad2__m5l27256k.toppcb.j1", 0x04000, 0x04000, CRC(e41426be) SHA1(e7e06ef3ff5160bb7d870e148ba2799da52cf24c) ) - ROM_CONTINUE( 0x0c000, 0x04000) + ROM_CONTINUE( 0x08000, 0x04000) + ROM_LOAD( "mitsubishi__ad2__m5l27256k.toppcb.j1", 0x04000, 0x04000, CRC(e41426be) SHA1(e7e06ef3ff5160bb7d870e148ba2799da52cf24c) ) + ROM_CONTINUE( 0x0c000, 0x04000) - ROM_REGION( 0x18000, "sub", 0 ) + ROM_REGION( 0x08000, "sub", 0 ) ROM_LOAD( "mitsubishi__ad-4__m5l27256k.toppcb.n6", 0x00000, 0x08000, CRC(13c38fe4) SHA1(34a35fa057159a5c83892a88b8c908faa39d5cb3) ) ROM_REGION( 0x10000, "bgtiles", 0 ) @@ -518,7 +689,7 @@ ROM_START( androidpo ) ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD16_BYTE( "mitsubishi__ad-6__m5l27512k.botpcb.def9", 0x00000, 0x10000, CRC(5e42984e) SHA1(2a928960c740dfb94589e011cce093bed2fd7685) ) - ROM_LOAD16_BYTE( "mitsubishi__ad-7__m5l27512k.botpcb.bc9", 0x00001, 0x10000, CRC(611ff400) SHA1(1a9aed33d0e3f063811f92b9fee3ecbff0e965bf) ) + ROM_LOAD16_BYTE( "mitsubishi__ad-7__m5l27512k.botpcb.bc9", 0x00001, 0x10000, CRC(611ff400) SHA1(1a9aed33d0e3f063811f92b9fee3ecbff0e965bf) ) ROM_REGION( 0x2000, "plds", 0 ) ROM_LOAD( "ricoh_7a2_19__epl10p8bp_japan_i.f1.jed", 0x0000, 0x0473, CRC(c5e51ea2) SHA1(3e35a30935f562227f0afa32a6be6eb33f9a8372) ) @@ -534,9 +705,9 @@ ROM_START( androidp ) ROM_REGION( 0x10000, "banks", 0 ) ROM_LOAD( "andr3.bin", 0x00000, 0x04000, CRC(112d5123) SHA1(653109eae7b58d9dcb8892ea9aca17427f14c145) ) - ROM_CONTINUE( 0x08000, 0x04000) + ROM_CONTINUE( 0x08000, 0x04000) - ROM_REGION( 0x18000, "sub", 0 ) + ROM_REGION( 0x08000, "sub", 0 ) ROM_LOAD( "andr4.bin", 0x00000, 0x08000, CRC(65f5e98b) SHA1(69f979d653695413a1c503c402d4bf5ffcfb6e5d) ) ROM_REGION( 0x10000, "bgtiles", 0 ) @@ -553,6 +724,8 @@ ROM_START( androidp ) // + 2 undumped PLDs (?) ROM_END +} // anonymous namespace + GAME( 1989, himesiki, 0, himesiki, himesiki, himesiki_state, empty_init, ROT90, "Hi-Soft", "Himeshikibu (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pc8001.cpp b/src/mame/drivers/pc8001.cpp index 07c7ef6e2a7..2249d19b853 100644 --- a/src/mame/drivers/pc8001.cpp +++ b/src/mame/drivers/pc8001.cpp @@ -644,6 +644,8 @@ uint8_t pc8001_base_state::dma_mem_r(offs_t offset) void pc8001_base_state::machine_start() { + m_screen_reverse = false; + save_item(NAME(m_width80)); save_item(NAME(m_color)); save_item(NAME(m_screen_reverse)); diff --git a/src/mame/drivers/surpratk.cpp b/src/mame/drivers/surpratk.cpp index e93db52a150..ce6c7b263ee 100644 --- a/src/mame/drivers/surpratk.cpp +++ b/src/mame/drivers/surpratk.cpp @@ -11,15 +11,151 @@ ***************************************************************************/ #include "emu.h" -#include "includes/surpratk.h" + #include "includes/konamipt.h" +#include "video/k052109.h" +#include "video/k053244_k053245.h" +#include "video/k053251.h" +#include "video/konami_helper.h" +#include "cpu/m6809/konami.h" // for the callback and the FIRQ IRQ definition +#include "machine/bankdev.h" #include "machine/watchdog.h" #include "sound/ymopm.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" -void surpratk_state::surpratk_videobank_w(uint8_t data) +namespace { + +class surpratk_state : public driver_device +{ +public: + surpratk_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_bank0000(*this, "bank0000"), + m_k052109(*this, "k052109"), + m_k053244(*this, "k053244"), + m_k053251(*this, "k053251"), + m_palette(*this, "palette"), + m_mainbank(*this, "mainbank") + { } + + void surpratk(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + // video-related + uint8_t m_layer_colorbase[3]{}; + uint8_t m_sprite_colorbase = 0; + int m_layerpri[3]{}; + + // devices + required_device m_maincpu; + required_device m_bank0000; + required_device m_k052109; + required_device m_k053244; + required_device m_k053251; + required_device m_palette; + + required_memory_bank m_mainbank; + + void videobank_w(uint8_t data); + void _5fc0_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + K05324X_CB_MEMBER(sprite_callback); + K052109_CB_MEMBER(tile_callback); + void banking_callback(uint8_t data); + void bank0000_map(address_map &map); + void main_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Callbacks for the K052109 + +***************************************************************************/ + +K052109_CB_MEMBER(surpratk_state::tile_callback) +{ + *flags = (*color & 0x80) ? TILE_FLIPX : 0; + *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); + *color = m_layer_colorbase[layer] + ((*color & 0x60) >> 5); +} + +/*************************************************************************** + + Callbacks for the K053245 + +***************************************************************************/ + +K05324X_CB_MEMBER(surpratk_state::sprite_callback) +{ + int pri = 0x20 | ((*color & 0x60) >> 2); + if (pri <= m_layerpri[2]) + *priority = 0; + else if (pri > m_layerpri[2] && pri <= m_layerpri[1]) + *priority = 0xf0; + else if (pri > m_layerpri[1] && pri <= m_layerpri[0]) + *priority = 0xf0 | 0xcc; + else + *priority = 0xf0 | 0xcc | 0xaa; + + *color = m_sprite_colorbase + (*color & 0x1f); +} + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +uint32_t surpratk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int bg_colorbase = m_k053251->get_palette_index(k053251_device::CI0); + m_sprite_colorbase = m_k053251->get_palette_index(k053251_device::CI1); + m_layer_colorbase[0] = m_k053251->get_palette_index(k053251_device::CI2); + m_layer_colorbase[1] = m_k053251->get_palette_index(k053251_device::CI4); + m_layer_colorbase[2] = m_k053251->get_palette_index(k053251_device::CI3); + + m_k052109->tilemap_update(); + + int layer[3]; + + layer[0] = 0; + m_layerpri[0] = m_k053251->get_priority(k053251_device::CI2); + layer[1] = 1; + m_layerpri[1] = m_k053251->get_priority(k053251_device::CI4); + layer[2] = 2; + m_layerpri[2] = m_k053251->get_priority(k053251_device::CI3); + + konami_sortlayers3(layer, m_layerpri); + + screen.priority().fill(0, cliprect); + bitmap.fill(16 * bg_colorbase, cliprect); + m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[0], 0, 1); + m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2); + m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4); + + m_k053244->sprites_draw(bitmap, cliprect, screen.priority()); + return 0; +} + + +// machine + +void surpratk_state::videobank_w(uint8_t data) { if (data & 0xf8) logerror("%s: videobank = %02x\n", machine().describe_context(), data); @@ -33,10 +169,10 @@ void surpratk_state::surpratk_videobank_w(uint8_t data) m_bank0000->set_bank(BIT(data, 0)); } -void surpratk_state::surpratk_5fc0_w(uint8_t data) +void surpratk_state::_5fc0_w(uint8_t data) { if ((data & 0xf4) != 0x10) - logerror("%04x: 3fc0 = %02x\n",m_maincpu->pc(),data); + logerror("%04x: 3fc0 = %02x\n", m_maincpu->pc(), data); // bit 0/1 = coin counters machine().bookkeeping().coin_counter_w(0, data & 0x01); @@ -51,11 +187,11 @@ void surpratk_state::surpratk_5fc0_w(uint8_t data) /********************************************/ -void surpratk_state::surpratk_map(address_map &map) +void surpratk_state::main_map(address_map &map) { map(0x0000, 0x07ff).m(m_bank0000, FUNC(address_map_bank_device::amap8)); map(0x0800, 0x1fff).ram(); - map(0x2000, 0x3fff).bankr("bank1"); /* banked ROM */ + map(0x2000, 0x3fff).bankr(m_mainbank); map(0x4000, 0x7fff).rw(m_k052109, FUNC(k052109_device::read), FUNC(k052109_device::write)); map(0x5f8c, 0x5f8c).portr("P1"); map(0x5f8d, 0x5f8d).portr("P2"); @@ -64,9 +200,9 @@ void surpratk_state::surpratk_map(address_map &map) map(0x5f90, 0x5f90).portr("DSW2"); map(0x5fa0, 0x5faf).rw(m_k053244, FUNC(k05324x_device::k053244_r), FUNC(k05324x_device::k053244_w)); map(0x5fb0, 0x5fbf).w(m_k053251, FUNC(k053251_device::write)); - map(0x5fc0, 0x5fc0).r("watchdog", FUNC(watchdog_timer_device::reset_r)).w(FUNC(surpratk_state::surpratk_5fc0_w)); + map(0x5fc0, 0x5fc0).r("watchdog", FUNC(watchdog_timer_device::reset_r)).w(FUNC(surpratk_state::_5fc0_w)); + map(0x5fc4, 0x5fc4).w(FUNC(surpratk_state::videobank_w)); map(0x5fd0, 0x5fd1).w("ymsnd", FUNC(ym2151_device::write)); - map(0x5fc4, 0x5fc4).w(FUNC(surpratk_state::surpratk_videobank_w)); map(0x8000, 0xffff).rom().region("maincpu", 0x38000); } @@ -134,8 +270,8 @@ INPUT_PORTS_END void surpratk_state::machine_start() { - membank("bank1")->configure_entries(0, 32, memregion("maincpu")->base(), 0x2000); - membank("bank1")->set_entry(0); + m_mainbank->configure_entries(0, 32, memregion("maincpu")->base(), 0x2000); + m_mainbank->set_entry(0); save_item(NAME(m_sprite_colorbase)); save_item(NAME(m_layer_colorbase)); @@ -158,27 +294,27 @@ void surpratk_state::machine_reset() void surpratk_state::banking_callback(uint8_t data) { // logerror("%s: setlines %02x\n", machine().describe_context(), data); - membank("bank1")->set_entry(data & 0x1f); + m_mainbank->set_entry(data & 0x1f); } void surpratk_state::surpratk(machine_config &config) { - /* basic machine hardware */ - KONAMI(config, m_maincpu, XTAL(24'000'000)/2/4); /* 053248, the clock input is 12MHz, and internal CPU divider of 4 */ - m_maincpu->set_addrmap(AS_PROGRAM, &surpratk_state::surpratk_map); + // basic machine hardware + KONAMI(config, m_maincpu, XTAL(24'000'000) / 2 / 4); // 053248, the clock input is 12MHz, and internal CPU divider of 4 + m_maincpu->set_addrmap(AS_PROGRAM, &surpratk_state::main_map); m_maincpu->line().set(FUNC(surpratk_state::banking_callback)); ADDRESS_MAP_BANK(config, "bank0000").set_map(&surpratk_state::bank0000_map).set_options(ENDIANNESS_BIG, 8, 13, 0x800); WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(12*8, (64-12)*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(surpratk_state::screen_update_surpratk)); + screen.set_screen_update(FUNC(surpratk_state::screen_update)); screen.set_palette(m_palette); PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048); @@ -196,7 +332,7 @@ void surpratk_state::surpratk(machine_config &config) K053251(config, m_k053251, 0); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -216,47 +352,50 @@ void surpratk_state::surpratk(machine_config &config) ROM_START( suratk ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms */ + ROM_REGION( 0x40000, "maincpu", 0 ) // code + banked roms ROM_LOAD( "911j01.f5", 0x00000, 0x20000, CRC(1e647881) SHA1(241e421d5599ebd9fcfb8be9c48dfd3b4c671958) ) ROM_LOAD( "911k02.h5", 0x20000, 0x20000, CRC(ef10e7b6) SHA1(0b41a929c0c579d688653a8d90dd6b40db12cfb3) ) - ROM_REGION( 0x080000, "k052109", 0 ) /* tiles */ + ROM_REGION( 0x080000, "k052109", 0 ) // tiles ROM_LOAD32_WORD( "911d05.bin", 0x000000, 0x040000, CRC(308d2319) SHA1(521d2a72fecb094e2c2f23b535f0b527886b4d3a) ) ROM_LOAD32_WORD( "911d06.bin", 0x000002, 0x040000, CRC(91cc9b32) SHA1(e05b7bbff30f24fe6f009560410f5e90bb118692) ) - ROM_REGION( 0x080000, "k053244", 0 ) /* graphics */ - ROM_LOAD32_WORD( "911d03.bin", 0x000000, 0x040000, CRC(e34ff182) SHA1(075ca7a91c843bdac7da21ddfcd43f7a043a09b6) ) /* sprites */ - ROM_LOAD32_WORD( "911d04.bin", 0x000002, 0x040000, CRC(20700bd2) SHA1(a2fa4a3ee28c1542cdd798907a9ece249aadff0a) ) /* sprites */ + ROM_REGION( 0x080000, "k053244", 0 ) // sprites + ROM_LOAD32_WORD( "911d03.bin", 0x000000, 0x040000, CRC(e34ff182) SHA1(075ca7a91c843bdac7da21ddfcd43f7a043a09b6) ) + ROM_LOAD32_WORD( "911d04.bin", 0x000002, 0x040000, CRC(20700bd2) SHA1(a2fa4a3ee28c1542cdd798907a9ece249aadff0a) ) ROM_END ROM_START( suratka ) - ROM_REGION( 0x48000, "maincpu", 0 ) /* code + banked roms */ + ROM_REGION( 0x48000, "maincpu", 0 ) // code + banked roms ROM_LOAD( "911j01.f5", 0x00000, 0x20000, CRC(1e647881) SHA1(241e421d5599ebd9fcfb8be9c48dfd3b4c671958) ) ROM_LOAD( "911l02.h5", 0x20000, 0x20000, CRC(11db8288) SHA1(09fe187855172ebf0c57f561cce7f41e47f53114) ) - ROM_REGION( 0x080000, "k052109", 0 ) /* tiles */ + ROM_REGION( 0x080000, "k052109", 0 ) // tiles ROM_LOAD32_WORD( "911d05.bin", 0x000000, 0x040000, CRC(308d2319) SHA1(521d2a72fecb094e2c2f23b535f0b527886b4d3a) ) ROM_LOAD32_WORD( "911d06.bin", 0x000002, 0x040000, CRC(91cc9b32) SHA1(e05b7bbff30f24fe6f009560410f5e90bb118692) ) - ROM_REGION( 0x080000, "k053244", 0 ) /* graphics */ - ROM_LOAD32_WORD( "911d03.bin", 0x000000, 0x040000, CRC(e34ff182) SHA1(075ca7a91c843bdac7da21ddfcd43f7a043a09b6) ) /* sprites */ - ROM_LOAD32_WORD( "911d04.bin", 0x000002, 0x040000, CRC(20700bd2) SHA1(a2fa4a3ee28c1542cdd798907a9ece249aadff0a) ) /* sprites */ + ROM_REGION( 0x080000, "k053244", 0 ) // sprites + ROM_LOAD32_WORD( "911d03.bin", 0x000000, 0x040000, CRC(e34ff182) SHA1(075ca7a91c843bdac7da21ddfcd43f7a043a09b6) ) + ROM_LOAD32_WORD( "911d04.bin", 0x000002, 0x040000, CRC(20700bd2) SHA1(a2fa4a3ee28c1542cdd798907a9ece249aadff0a) ) ROM_END ROM_START( suratkj ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* code + banked roms + palette RAM */ + ROM_REGION( 0x40000, "maincpu", 0 ) // code + banked roms ROM_LOAD( "911m01.f5", 0x00000, 0x20000, CRC(ee5b2cc8) SHA1(4b05f7ba4e804a3bccb41fe9d3258cbcfe5324aa) ) ROM_LOAD( "911m02.h5", 0x20000, 0x20000, CRC(5d4148a8) SHA1(4fa5947db777b4c742775d588dea38758812a916) ) - ROM_REGION( 0x080000, "k052109", 0 ) /* tiles */ + ROM_REGION( 0x080000, "k052109", 0 ) // tiles ROM_LOAD32_WORD( "911d05.bin", 0x000000, 0x040000, CRC(308d2319) SHA1(521d2a72fecb094e2c2f23b535f0b527886b4d3a) ) ROM_LOAD32_WORD( "911d06.bin", 0x000002, 0x040000, CRC(91cc9b32) SHA1(e05b7bbff30f24fe6f009560410f5e90bb118692) ) - ROM_REGION( 0x080000, "k053244", 0 ) /* graphics */ - ROM_LOAD32_WORD( "911d03.bin", 0x000000, 0x040000, CRC(e34ff182) SHA1(075ca7a91c843bdac7da21ddfcd43f7a043a09b6) ) /* sprites */ - ROM_LOAD32_WORD( "911d04.bin", 0x000002, 0x040000, CRC(20700bd2) SHA1(a2fa4a3ee28c1542cdd798907a9ece249aadff0a) ) /* sprites */ + ROM_REGION( 0x080000, "k053244", 0 ) // sprites + ROM_LOAD32_WORD( "911d03.bin", 0x000000, 0x040000, CRC(e34ff182) SHA1(075ca7a91c843bdac7da21ddfcd43f7a043a09b6) ) + ROM_LOAD32_WORD( "911d04.bin", 0x000002, 0x040000, CRC(20700bd2) SHA1(a2fa4a3ee28c1542cdd798907a9ece249aadff0a) ) ROM_END +} // anonymous namespace + + /*************************************************************************** Game driver(s) diff --git a/src/mame/drivers/tasman.cpp b/src/mame/drivers/tasman.cpp index 34362931356..e5319b787e4 100644 --- a/src/mame/drivers/tasman.cpp +++ b/src/mame/drivers/tasman.cpp @@ -893,4 +893,4 @@ GAME( 199?, dragsphr, 0, kongambl, kongambl, kongambl_state, empty_i GAME( 199?, ivorytsk, 0, kongambl, kongambl, kongambl_state, empty_init, ROT0, "Konami", "Ivory Tusk", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 199?, vikingt, 0, kongambl, kongambl, kongambl_state, empty_init, ROT0, "Konami", "Viking Treasure", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 1997, thequest, 0, kongambl, kongambl, kongambl_state, empty_init, ROT0, "Konami", "The Quest (NSW, Australia)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 199?, horses4c, 0, kongambl, kongambl, kongambl_state, empty_init, ROT0, "Konami", "Horses 4 Courses (NSW, Australia)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2000, horses4c, 0, kongambl, kongambl, kongambl_state, empty_init, ROT0, "Konami", "Horses For Courses (NSW, Australia)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/includes/buggychl.h b/src/mame/includes/buggychl.h deleted file mode 100644 index 15b5e5febcb..00000000000 --- a/src/mame/includes/buggychl.h +++ /dev/null @@ -1,114 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi, Nicola Salmoria -/* - buggychl -*/ -#ifndef MAME_INCLUDES_BUGGYCHL_H -#define MAME_INCLUDES_BUGGYCHL_H - -#pragma once - -#include "machine/taito68705interface.h" -#include "machine/input_merger.h" -#include "machine/gen_latch.h" -#include "sound/msm5232.h" -#include "sound/ta7630.h" -#include "sound/ay8910.h" -#include "emupal.h" -#include "screen.h" - -class buggychl_state : public driver_device -{ -public: - buggychl_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_charram(*this, "charram"), - m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram"), - m_scrollv(*this, "scrollv"), - m_scrollh(*this, "scrollh"), - m_audiocpu(*this, "audiocpu"), - m_maincpu(*this, "maincpu"), - m_bmcu(*this, "bmcu"), - m_ta7630(*this, "ta7630"), - m_msm(*this, "msm"), - m_ay1(*this, "ay1"), - m_ay2(*this, "ay2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundnmi(*this, "soundnmi"), - m_soundlatch(*this, "soundlatch"), - m_soundlatch2(*this, "soundlatch2"), - m_pedal_input(*this, "PEDAL"), - m_led(*this, "led%u", 0U) - { } - - /* memory pointers */ - required_shared_ptr m_charram; - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram; - required_shared_ptr m_scrollv; - required_shared_ptr m_scrollh; - - /* devices */ - required_device m_audiocpu; - required_device m_maincpu; - required_device m_bmcu; - required_device m_ta7630; - required_device m_msm; - required_device m_ay1; - required_device m_ay2; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_soundnmi; - required_device m_soundlatch; - required_device m_soundlatch2; - required_ioport m_pedal_input; - - output_finder<1> m_led; - - void bankswitch_w(uint8_t data); - void sound_enable_w(uint8_t data); - uint8_t mcu_status_r(); - uint8_t sound_status_main_r(); - uint8_t sound_status_sound_r(); - void buggychl_chargen_w(offs_t offset, uint8_t data); - void buggychl_sprite_lookup_bank_w(uint8_t data); - void buggychl_sprite_lookup_w(offs_t offset, uint8_t data); - void buggychl_ctrl_w(uint8_t data); - void buggychl_bg_scrollx_w(uint8_t data); - void ta7630_volbal_ay1_w(uint8_t data); - void port_b_0_w(uint8_t data); - void ta7630_volbal_ay2_w(uint8_t data); - void port_b_1_w(uint8_t data); - void ta7630_volbal_msm_w(uint8_t data); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - void buggychl_palette(palette_device &palette) const; - uint32_t screen_update_buggychl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_CUSTOM_INPUT_MEMBER( pedal_in_r ); - - void buggychl(machine_config &config); - void buggychl_map(address_map &map); - void sound_map(address_map &map); -private: - void draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_bg( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - /* video-related */ - bitmap_ind16 m_tmp_bitmap1; - bitmap_ind16 m_tmp_bitmap2; - int m_sl_bank; - int m_bg_clip_on; - int m_sky_on; - int m_sprite_color_base; - int m_bg_scrollx; - bool m_sound_irq_enable; - uint8_t m_sprite_lookup[0x2000]; -}; - -#endif // MAME_INCLUDES_BUGGYCHL_H diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index 0b5c73e5006..e986578c226 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -314,6 +314,7 @@ public: void astroamb(machine_config &config); void mimonkey(machine_config &config); void mimonscr(machine_config &config); + void galartic(machine_config &config); template CUSTOM_INPUT_MEMBER(ckongg_coinage_r); template DECLARE_READ_LINE_MEMBER(ckongs_coinage_r); @@ -351,6 +352,7 @@ protected: void frogger_sound_portmap(address_map &map); void froggeram_map(address_map &map); void froggermc_map(address_map &map); + void galartic_map(address_map &map); void galaxian_map(address_map &map); void galaxian_map_base(address_map &map); void galaxian_map_discrete(address_map &map); diff --git a/src/mame/includes/himesiki.h b/src/mame/includes/himesiki.h deleted file mode 100644 index 40844635370..00000000000 --- a/src/mame/includes/himesiki.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Uki - -/************************************************************************* - - Himeshikibu - -*************************************************************************/ -#ifndef MAME_INCLUDES_HIMESIKI_H -#define MAME_INCLUDES_HIMESIKI_H - -#pragma once - -#include "machine/gen_latch.h" -#include "emupal.h" -#include "tilemap.h" - -class himesiki_state : public driver_device -{ -public: - himesiki_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_bg_ram(*this, "bg_ram"), - m_spriteram_p103a(*this, "sprram_p103a"), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") - { } - - void himesiki(machine_config &config); - -private: - // memory pointers - required_shared_ptr m_bg_ram; - required_shared_ptr m_spriteram_p103a; - required_shared_ptr m_spriteram; - - // video-related - tilemap_t *m_bg_tilemap = nullptr; - int m_scrollx[2]{}; - int m_scrolly = 0; - - int m_flipscreen = 0; - - // devices - required_device m_maincpu; - required_device m_subcpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - void himesiki_rombank_w(uint8_t data); - void himesiki_sound_w(uint8_t data); - void himesiki_bg_ram_w(offs_t offset, uint8_t data); - void himesiki_scrollx_w(offs_t offset, uint8_t data); - void himesiki_scrolly_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update_himesiki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void himesiki_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void himesiki_iom0(address_map &map); - void himesiki_iom1(address_map &map); - void himesiki_prm0(address_map &map); - void himesiki_prm1(address_map &map); -}; - -#endif // MAME_INCLUDES_HIMESIKI_H diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h index b1d6bf3b984..ddacee4be80 100644 --- a/src/mame/includes/mac.h +++ b/src/mame/includes/mac.h @@ -258,7 +258,7 @@ private: optional_shared_ptr m_vram64; // interrupts - int m_scc_interrupt, m_via_interrupt, m_via2_interrupt, m_scsi_interrupt, m_asc_interrupt, m_last_taken_interrupt; + int m_scc_interrupt, m_via_interrupt, m_via2_interrupt, m_scsi_interrupt, m_last_taken_interrupt; // defined in machine/mac.c void v8_resize(); diff --git a/src/mame/includes/pc8001.h b/src/mame/includes/pc8001.h index 50abd3e02b4..cd5aa3f0adb 100644 --- a/src/mame/includes/pc8001.h +++ b/src/mame/includes/pc8001.h @@ -62,7 +62,7 @@ protected: uint8_t dma_mem_r(offs_t offset); private: - bool m_screen_reverse = false; + bool m_screen_reverse; bool m_screen_is_24KHz; /* video state */ diff --git a/src/mame/includes/surpratk.h b/src/mame/includes/surpratk.h deleted file mode 100644 index a00bb65871f..00000000000 --- a/src/mame/includes/surpratk.h +++ /dev/null @@ -1,63 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/************************************************************************* - - Surprise Attack - -*************************************************************************/ -#ifndef MAME_INCLUDES_SURPRATK_H -#define MAME_INCLUDES_SURPRATK_H - -#pragma once - -#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ -#include "machine/bankdev.h" -#include "video/k052109.h" -#include "video/k053244_k053245.h" -#include "video/k053251.h" -#include "video/konami_helper.h" -#include "emupal.h" - -class surpratk_state : public driver_device -{ -public: - surpratk_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_bank0000(*this, "bank0000"), - m_k052109(*this, "k052109"), - m_k053244(*this, "k053244"), - m_k053251(*this, "k053251"), - m_palette(*this, "palette") - { } - - void surpratk(machine_config &config); - -private: - /* video-related */ - int m_layer_colorbase[3]{}; - int m_sprite_colorbase = 0; - int m_layerpri[3]{}; - - /* devices */ - required_device m_maincpu; - required_device m_bank0000; - required_device m_k052109; - required_device m_k053244; - required_device m_k053251; - required_device m_palette; - - void surpratk_videobank_w(uint8_t data); - void surpratk_5fc0_w(uint8_t data); - virtual void machine_start() override; - virtual void machine_reset() override; - uint32_t screen_update_surpratk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - K05324X_CB_MEMBER(sprite_callback); - K052109_CB_MEMBER(tile_callback); - void banking_callback(uint8_t data); - void bank0000_map(address_map &map); - void surpratk_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SURPRATK_H diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp index 6e0421e293f..24d129f8ce3 100644 --- a/src/mame/machine/mac.cpp +++ b/src/mame/machine/mac.cpp @@ -1195,6 +1195,9 @@ void mac_state::mac_driver_init(model_t model) m_overlay = 1; m_scsi_interrupt = 0; m_model = model; + m_scc_interrupt = 0; + m_via_interrupt = 0; + m_via2_interrupt = 0; m_rom_size = memregion("bootrom")->bytes(); m_rom_ptr = reinterpret_cast(memregion("bootrom")->base()); diff --git a/src/mame/video/buggychl.cpp b/src/mame/video/buggychl.cpp deleted file mode 100644 index 7ac9ed42437..00000000000 --- a/src/mame/video/buggychl.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi, Nicola Salmoria -#include "emu.h" -#include "includes/buggychl.h" - - -void buggychl_state::buggychl_palette(palette_device &palette) const -{ - // arbitrary blue shading for the sky, estimation - for (int i = 0; i < 128; i++) - palette.set_pen_color(i + 128, rgb_t(0, 240 - i, 255)); -} - -void buggychl_state::video_start() -{ - m_screen->register_screen_bitmap(m_tmp_bitmap1); - m_screen->register_screen_bitmap(m_tmp_bitmap2); - - save_item(NAME(m_tmp_bitmap1)); - save_item(NAME(m_tmp_bitmap2)); - - m_gfxdecode->gfx(0)->set_source(m_charram); -} - - - -void buggychl_state::buggychl_chargen_w(offs_t offset, uint8_t data) -{ - if (m_charram[offset] != data) - { - m_charram[offset] = data; - m_gfxdecode->gfx(0)->mark_dirty((offset / 8) & 0xff); - } -} - -void buggychl_state::buggychl_sprite_lookup_bank_w(uint8_t data) -{ - m_sl_bank = (data & 0x10) << 8; -} - -void buggychl_state::buggychl_sprite_lookup_w(offs_t offset, uint8_t data) -{ - m_sprite_lookup[offset + m_sl_bank] = data; -} - -void buggychl_state::buggychl_ctrl_w(uint8_t data) -{ -/* - bit7 = lamp - bit6 = lockout - bit4 = OJMODE - bit3 = SKY OFF - bit2 = /SN3OFF - bit1 = HINV - bit0 = VINV -*/ - - flip_screen_y_set(data & 0x01); - flip_screen_x_set(data & 0x02); - - m_bg_clip_on = data & 0x04; - m_sky_on = data & 0x08; - - m_sprite_color_base = (data & 0x10) ? 1 * 16 : 3 * 16; - - machine().bookkeeping().coin_lockout_global_w((~data & 0x40) >> 6); - m_led[0] = BIT(~data, 7); -} - -void buggychl_state::buggychl_bg_scrollx_w(uint8_t data) -{ - m_bg_scrollx = -(data - 0x12); -} - - -void buggychl_state::draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - for (int y = 0; y < 256; y++) - for (int x = 0; x < 256; x++) - bitmap.pix(y, x) = 128 + x / 2; -} - - -void buggychl_state::draw_bg( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int offs; - int scroll[256]; - - /* prevent wraparound */ - rectangle clip = cliprect; - // enable clipping if on (title screen disable this to cover all of the area) - if(m_bg_clip_on) - { - if (flip_screen_x()) clip.min_x += 8*8; - else clip.max_x -= 8*8; - } - - for (offs = 0; offs < 0x400; offs++) - { - int code = m_videoram[0x400 + offs]; - - int sx = offs % 32; - int sy = offs / 32; - - if (flip_screen_x()) - sx = 31 - sx; - if (flip_screen_y()) - sy = 31 - sy; - - m_gfxdecode->gfx(0)->opaque(m_tmp_bitmap1,m_tmp_bitmap1.cliprect(), - code, - 2, - flip_screen_x(),flip_screen_y(), - 8*sx,8*sy); - } - - /* first copy to a temp bitmap doing column scroll */ - for (offs = 0; offs < 256; offs++) - scroll[offs] = -m_scrollv[offs / 8]; - - copyscrollbitmap(m_tmp_bitmap2, m_tmp_bitmap1, 1, &m_bg_scrollx, 256, scroll, m_tmp_bitmap2.cliprect()); - - /* then copy to the screen doing row scroll */ - for (offs = 0; offs < 256; offs++) - scroll[offs] = -m_scrollh[offs]; - - copyscrollbitmap_trans(bitmap, m_tmp_bitmap2, 256, scroll, 0, nullptr, clip, 32); -} - - -void buggychl_state::draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int offs; - - for (offs = 0; offs < 0x400; offs++) - { - int sx = offs % 32; - int sy = offs / 32; - int flipx = flip_screen_x(); - int flipy = flip_screen_y(); - - int code = m_videoram[offs]; - - if (flipx) - sx = 31 - sx; - if (flipy) - sy = 31 - sy; - - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, - code, - 0, - flipx,flipy, - 8*sx,8*sy, - 0); - } -} - - -void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - g_profiler.start(PROFILER_USER1); - - uint8_t const *const gfx = memregion("gfx2")->base(); - for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) - { - int sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); - int sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); - int flipy = m_spriteram[offs + 1] & 0x40; - int zoom = m_spriteram[offs + 1] & 0x3f; - uint8_t const *const zoomy_rom = gfx + (zoom << 6); - uint8_t const *const zoomx_rom = gfx + 0x2000 + (zoom << 3); - - uint8_t const *const lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - - for (int y = 0; y < 64; y++) - { - int dy = flip_screen_y() ? (255 - sy - y) : (sy + y); - - if ((dy & ~0xff) == 0) - { - int charline, base_pos; - - charline = zoomy_rom[y] & 0x07; - base_pos = zoomy_rom[y] & 0x38; - if (flipy) - base_pos ^= 0x38; - - int px = 0; - for (int ch = 0; ch < 4; ch++) - { - int pos = base_pos + 2 * ch; - int code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); - int realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; - code += (realflipy ? (charline ^ 7) : charline); - uint8_t const *const pendata = m_gfxdecode->gfx(1)->get_data(code); - - for (int x = 0; x < 16; x++) - { - int col = pendata[x]; - if (col) - { - int dx = flip_screen_x() ? (255 - sx - px) : (sx + px); - if ((dx & ~0xff) == 0) - bitmap.pix(dy, dx) = m_sprite_color_base + col; - } - - /* the following line is almost certainly wrong */ - if (zoomx_rom[7 - (2 * ch + x / 8)] & (1 << (x & 7))) - px++; - } - } - } - } - } - - g_profiler.stop(); -} - - -uint32_t buggychl_state::screen_update_buggychl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if (m_sky_on) - draw_sky(bitmap, cliprect); - else - bitmap.fill(0x20, cliprect); // stage 3 disables sky, wants background pen to be blue - - draw_bg(bitmap, cliprect); - - draw_sprites(bitmap, cliprect); - - draw_fg(bitmap, cliprect); - - return 0; -} diff --git a/src/mame/video/himesiki.cpp b/src/mame/video/himesiki.cpp deleted file mode 100644 index b4e6bcd614e..00000000000 --- a/src/mame/video/himesiki.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Uki -/****************************************************************************** - -Himeshikibu (C) 1989 Hi-Soft - -Video hardware - driver by Uki - -******************************************************************************/ - -#include "emu.h" -#include "includes/himesiki.h" - -TILE_GET_INFO_MEMBER(himesiki_state::get_bg_tile_info) -{ - int code = m_bg_ram[tile_index * 2] + m_bg_ram[tile_index * 2 + 1] * 0x100 ; - int col = code >> 12; - - code &= 0xfff; - - tileinfo.set(0, code, col, 0); -} - -void himesiki_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(himesiki_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); -} - -void himesiki_state::himesiki_bg_ram_w(offs_t offset, uint8_t data) -{ - m_bg_ram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset / 2); -} - -void himesiki_state::himesiki_scrollx_w(offs_t offset, uint8_t data) -{ - m_scrollx[offset] = data; -} - -void himesiki_state::himesiki_scrolly_w(uint8_t data) -{ - m_scrolly = data; -} - -void himesiki_state::himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - uint8_t *spriteram; - int offs; - - // these sprites are from the ET-P103A board (himesiki only) - spriteram = m_spriteram_p103a; - for (offs = 0x00; offs < 0x60; offs += 4) - { - int attr = spriteram[offs + 1]; - int code = spriteram[offs + 0] | (attr & 3) << 8; - int x = spriteram[offs + 3] | (attr & 8) << 5; - int y = spriteram[offs + 2]; - - int col = (attr & 0xf0) >> 4; - int fx = attr & 4; - int fy = 0; - - if (x > 0x1e0) - x -= 0x200; - - if (m_flipscreen) - { - y = (y - 31) & 0xff; - x = 224 - x; - fx ^= 4; - fy = 1; - } - else - { - y = 257 - y; - if (y > 0xc0) - y -= 0x100; - } - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, col, fx, fy, x, y, 15); - } - - // 0xc0 - 0xff unused - spriteram = m_spriteram; - for (offs = 0; offs < 0x100; offs += 4) - { - // not sure about this, but you sometimes get a garbage sprite in the corner otherwise. - if ((spriteram[offs + 0] == 0x00) && - (spriteram[offs + 1] == 0x00) && - (spriteram[offs + 2] == 0x00) && - (spriteram[offs + 3] == 0x00)) - continue; - - int attr = spriteram[offs + 1]; - int code = spriteram[offs + 0] | (attr & 7) << 8; - int x = spriteram[offs + 3] | (attr & 8) << 5; - int y = spriteram[offs + 2]; - - int col = (attr & 0xf0) >> 4; - int f = 0; - - if (x > 0x1e0) - x -= 0x200; - - if (m_flipscreen) - { - y = (y - 15) &0xff; - x = 240 - x; - f = 1; - } - else - y = 257 - y; - - y &= 0xff; - if (y > 0xf0) - y -= 0x100; - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, col, f, f, x, y, 15); - } -} - -uint32_t himesiki_state::screen_update_himesiki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x = -(m_scrollx[0] << 8 | m_scrollx[1]) & 0x1ff; - m_bg_tilemap->set_scrolldx(x, x); - m_bg_tilemap->set_scrolldy(-m_scrolly, -m_scrolly-64); - - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - himesiki_draw_sprites(bitmap, cliprect); - - return 0; -} diff --git a/src/mame/video/surpratk.cpp b/src/mame/video/surpratk.cpp deleted file mode 100644 index d5ecc5b088f..00000000000 --- a/src/mame/video/surpratk.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria - -#include "emu.h" -#include "includes/surpratk.h" -#include "screen.h" - - -/*************************************************************************** - - Callbacks for the K052109 - -***************************************************************************/ - -K052109_CB_MEMBER(surpratk_state::tile_callback) -{ - *flags = (*color & 0x80) ? TILE_FLIPX : 0; - *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); - *color = m_layer_colorbase[layer] + ((*color & 0x60) >> 5); -} - -/*************************************************************************** - - Callbacks for the K053245 - -***************************************************************************/ - -K05324X_CB_MEMBER(surpratk_state::sprite_callback) -{ - int pri = 0x20 | ((*color & 0x60) >> 2); - if (pri <= m_layerpri[2]) - *priority = 0; - else if (pri > m_layerpri[2] && pri <= m_layerpri[1]) - *priority = 0xf0; - else if (pri > m_layerpri[1] && pri <= m_layerpri[0]) - *priority = 0xf0 | 0xcc; - else - *priority = 0xf0 | 0xcc | 0xaa; - - *color = m_sprite_colorbase + (*color & 0x1f); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -uint32_t surpratk_state::screen_update_surpratk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int layer[3], bg_colorbase; - - bg_colorbase = m_k053251->get_palette_index(k053251_device::CI0); - m_sprite_colorbase = m_k053251->get_palette_index(k053251_device::CI1); - m_layer_colorbase[0] = m_k053251->get_palette_index(k053251_device::CI2); - m_layer_colorbase[1] = m_k053251->get_palette_index(k053251_device::CI4); - m_layer_colorbase[2] = m_k053251->get_palette_index(k053251_device::CI3); - - m_k052109->tilemap_update(); - - layer[0] = 0; - m_layerpri[0] = m_k053251->get_priority(k053251_device::CI2); - layer[1] = 1; - m_layerpri[1] = m_k053251->get_priority(k053251_device::CI4); - layer[2] = 2; - m_layerpri[2] = m_k053251->get_priority(k053251_device::CI3); - - konami_sortlayers3(layer, m_layerpri); - - screen.priority().fill(0, cliprect); - bitmap.fill(16 * bg_colorbase, cliprect); - m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[0], 0, 1); - m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2); - m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4); - - m_k053244->sprites_draw(bitmap, cliprect, screen.priority()); - return 0; -} -- cgit v1.2.3