diff --git a/src/mame/atari/eprom.cpp b/src/mame/atari/eprom.cpp index 135a58a8130..6478fbc5d2c 100644 --- a/src/mame/atari/eprom.cpp +++ b/src/mame/atari/eprom.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders: Aaron Giles + /*************************************************************************** Atari Escape hardware @@ -26,14 +27,488 @@ #include "emu.h" -#include "eprom.h" + +#include "atarijsa.h" +#include "atarimo.h" + #include "cpu/m68000/m68000.h" #include "machine/eeprompar.h" +#include "machine/adc0808.h" +#include "machine/timer.h" #include "machine/watchdog.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" +namespace { + +class eprom_state : public driver_device +{ +public: + eprom_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_playfield_tilemap(*this, "playfield"), + m_alpha_tilemap(*this, "alpha"), + m_mob(*this, "mob"), + m_jsa(*this, "jsa"), + m_shared_ram(*this, "shared_ram"), + m_adc(*this, "adc"), + m_extra(*this, "extra"), + m_palette(*this, "palette"), + m_paletteram(*this, "paletteram") + { } + + void guts(machine_config &config); + void eprom(machine_config &config); + void klaxp(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_playfield_tilemap; + required_device m_alpha_tilemap; + required_device m_mob; + required_device m_jsa; + required_shared_ptr m_shared_ram; + optional_device m_adc; + optional_device m_extra; + required_device m_palette; + required_shared_ptr m_paletteram; + uint8_t m_screen_intensity = 0U; + uint8_t m_video_disable = 0U; + static const atari_motion_objects_config s_mob_config; + static const atari_motion_objects_config s_guts_mob_config; + + void video_int_ack_w(uint16_t data); + TIMER_DEVICE_CALLBACK_MEMBER(scanline_update); + uint8_t adc_r(offs_t offset); + void eprom_latch_w(uint8_t data); + template void sync_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + TILE_GET_INFO_MEMBER(get_alpha_tile_info); + TILE_GET_INFO_MEMBER(get_playfield_tile_info); + TILE_GET_INFO_MEMBER(guts_get_playfield_tile_info); + uint32_t screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void update_palette(); + void extra_map(address_map &map); + void guts_map(address_map &map); + void main_map(address_map &map); +}; + + +// video + +/************************************* + * + * Palette + * + *************************************/ + +void eprom_state::update_palette() +{ + for (int color = 0; color < 0x800; ++color) + { + uint16_t const data = m_paletteram[color]; + + /* FIXME this is only a very crude approximation of the palette output. + * The circuit involves a dozen transistors and probably has an output + * which is quite different from this. + * This is, however, good enough to match the video and description + * of MAMETesters bug #02677. + */ + int i = (((data >> 12) & 15) + 1) * (4 - m_screen_intensity); + if (i < 0) + i = 0; + + int const r = ((data >> 8) & 15) * i / 4; + int const g = ((data >> 4) & 15) * i / 4; + int const b = ((data >> 0) & 15) * i / 4; + + m_palette->set_pen_color(color, r, g, b); + } +} + + + +/************************************* + * + * Tilemap callbacks + * + *************************************/ + +TILE_GET_INFO_MEMBER(eprom_state::get_alpha_tile_info) +{ + uint16_t const data = m_alpha_tilemap->basemem_read(tile_index); + int const code = data & 0x3ff; + int const color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20); + int const opaque = data & 0x8000; + tileinfo.set(1, code, color, opaque ? TILE_FORCE_LAYER0 : 0); +} + + +TILE_GET_INFO_MEMBER(eprom_state::get_playfield_tile_info) +{ + uint16_t const data1 = m_playfield_tilemap->basemem_read(tile_index); + uint16_t const data2 = m_playfield_tilemap->extmem_read(tile_index) >> 8; + int const code = data1 & 0x7fff; + int const color = 0x10 + (data2 & 0x0f); + tileinfo.set(0, code, color, (data1 >> 15) & 1); +} + + +TILE_GET_INFO_MEMBER(eprom_state::guts_get_playfield_tile_info) +{ + uint16_t const data1 = m_playfield_tilemap->basemem_read(tile_index); + uint16_t const data2 = m_playfield_tilemap->extmem_read(tile_index) >> 8; + int const code = data1 & 0x7fff; + int const color = 0x10 + (data2 & 0x0f); + tileinfo.set(2, code, color, (data1 >> 15) & 1); +} + + + +/************************************* + * + * Video system start + * + *************************************/ + +const atari_motion_objects_config eprom_state::s_mob_config = +{ + 0, // index to which gfx system + 1, // number of motion object banks + 1, // are the entries linked? + 0, // are the entries split? + 1, // render in reverse order? + 0, // render in swapped X/Y order? + 0, // does the neighbor bit affect the next object? + 8, // pixels per SLIP entry (0 for no-slip) + 0, // pixel offset for SLIPs + 0, // maximum number of links to visit/scanline (0=all) + + 0x100, // base palette entry + 0x100, // maximum number of colors + 0, // transparent pen index + + {{ 0x03ff,0,0,0 }}, // mask for the link + {{ 0,0x7fff,0,0 }}, // mask for the code index + {{ 0,0,0x000f,0 }}, // mask for the color + {{ 0,0,0xff80,0 }}, // mask for the X position + {{ 0,0,0,0xff80 }}, // mask for the Y position + {{ 0,0,0,0x0070 }}, // mask for the width, in tiles + {{ 0,0,0,0x0007 }}, // mask for the height, in tiles + {{ 0,0,0,0x0008 }}, // mask for the horizontal flip + {{ 0 }}, // mask for the vertical flip + {{ 0,0,0x0070,0 }}, // mask for the priority + {{ 0 }}, // mask for the neighbor + {{ 0 }}, // mask for absolute coordinates + + {{ 0 }}, // mask for the special value + 0 // resulting value to indicate "special" +}; + +void eprom_state::video_start() +{ + // save states + save_item(NAME(m_screen_intensity)); + save_item(NAME(m_video_disable)); + + m_screen_intensity = 0; + m_video_disable = 0; +} + + +const atari_motion_objects_config eprom_state::s_guts_mob_config = +{ + 0, // index to which gfx system + 1, // number of motion object banks + 1, // are the entries linked? + 0, // are the entries split? + 0, // render in reverse order? + 0, // render in swapped X/Y order? + 0, // does the neighbor bit affect the next object? + 8, // pixels per SLIP entry (0 for no-slip) + 0, // pixel offset for SLIPs + 0, // maximum number of links to visit/scanline (0=all) + + 0x100, // base palette entry + 0x100, // maximum number of colors + 0, // transparent pen index + + {{ 0x03ff,0,0,0 }}, // mask for the link + {{ 0,0x7fff,0,0 }}, // mask for the code index + {{ 0,0,0x000f,0 }}, // mask for the color + {{ 0,0,0xff80,0 }}, // mask for the X position + {{ 0,0,0,0xff80 }}, // mask for the Y position + {{ 0,0,0,0x0070 }}, // mask for the width, in tiles + {{ 0,0,0,0x000f }}, // mask for the height, in tiles + {{ 0,0x8000,0,0 }}, // mask for the horizontal flip + {{ 0 }}, // mask for the vertical flip + {{ 0,0,0x0070,0 }}, // mask for the priority + {{ 0 }}, // mask for the neighbor + {{ 0 }}, // mask for absolute coordinates + + {{ 0 }}, // mask for the special value + 0 // resulting value to indicate "special" +}; + + +/************************************* + * + * Periodic scanline updater + * + *************************************/ + +TIMER_DEVICE_CALLBACK_MEMBER(eprom_state::scanline_update) +{ + // update the playfield + if (param == 0) + { + int const xscroll = (m_alpha_tilemap->basemem_read(0x780) >> 7) & 0x1ff; + int const yscroll = (m_alpha_tilemap->basemem_read(0x781) >> 7) & 0x1ff; + m_playfield_tilemap->set_scrollx(0, xscroll); + m_playfield_tilemap->set_scrolly(0, yscroll); + m_mob->set_scroll(xscroll, yscroll); + } +} + + + +/************************************* + * + * Main refresh + * + *************************************/ + +uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if (m_video_disable) + { + bitmap.fill(m_palette->black_pen(), cliprect); + return 0; + } + + update_palette(); + + // start drawing + m_mob->draw_async(cliprect); + + // draw the playfield + m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw and merge the MO + bitmap_ind16 &mobitmap = m_mob->bitmap(); + for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) + for (int y = rect->top(); y <= rect->bottom(); y++) + { + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + for (int x = rect->left(); x <= rect->right(); x++) + if (mo[x] != 0xffff) + { + /* verified from the GALs on the real PCB; equations follow + * + * --- FORCEMC0 forces 3 bits of the MO color to 0 under some conditions + * FORCEMC0=!PFX3*PFX4*PFX5*!MPR0 + * +!PFX3*PFX5*!MPR1 + * +!PFX3*PFX4*!MPR0*!MPR1 + * + * --- SHADE selects an alternate color bank for the playfield + * !SHADE=!MPX0 + * +MPX1 + * +MPX2 + * +MPX3 + * +!MPX4*!MPX5*!MPX6*!MPX7 + * +FORCEMC0 + * + * --- PF/M is 1 if playfield has priority, or 0 if MOs have priority + * !PF/M=MPR0*MPR1 + * +PFX3 + * +!PFX4*MPR1 + * +!PFX5*MPR1 + * +!PFX5*MPR0 + * +!PFX4*!PFX5*!MPR0*!MPR1 + * + * --- M7 is passed as the upper MO bit to the GPC ASIC + * M7=MPX0*!MPX1*!MPX2*!MPX3 + * + * --- CL10-9 are outputs from the GPC, specifying which layer to render + * CL10 = 1 if pf + * CL9 = 1 if mo + * + * --- CRA10 is the 0x200 bit of the color RAM index; it comes directly from the GPC + * CRA10 = CL10 + * + * --- CRA9 is the 0x100 bit of the color RAM index; is comes directly from the GPC + * or if the SHADE flag is set, it affects the playfield color bank + * CRA9 = SHADE*CL10 + * +CL9 + * + * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected + */ + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 4) & 3; + + // upper bit of MO priority signals special rendering and doesn't draw anything + if (mopriority & 4) + continue; + + // compute the FORCEMC signal + int forcemc0 = 0; + if (!(pf[x] & 8)) + { + if (((pfpriority == 3) && !(mopriority & 1)) || + ((pfpriority & 2) && !(mopriority & 2)) || + ((pfpriority & 1) && (mopriority == 0))) + forcemc0 = 1; + } + + // compute the SHADE signal + int shade = 1; + if (((mo[x] & 0x0f) != 1) || + ((mo[x] & 0xf0) == 0) || + forcemc0) + shade = 0; + + // compute the PF/M signal + int pfm = 1; + if ((mopriority == 3) || + (pf[x] & 8) || + (!(pfpriority & 1) && (mopriority & 2)) || + (!(pfpriority & 2) && (mopriority & 2)) || + (!(pfpriority & 2) && (mopriority & 1)) || + ((pfpriority == 0) && (mopriority == 0))) + pfm = 0; + + // compute the M7 signal + int m7 = 0; + if ((mo[x] & 0x0f) == 1) + m7 = 1; + + // PF/M and M7 go in the GPC ASIC and select playfield or MO layers + if (!pfm && !m7) + { + if (!forcemc0) + pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; + else + pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK & ~0x70; + } + else + { + if (shade) + pf[x] |= 0x100; + if (m7) + pf[x] |= 0x080; + } + } + } + + // add the alpha on top + m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // now go back and process the upper bit of MO priority + for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) + for (int y = rect->top(); y <= rect->bottom(); y++) + { + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + for (int x = rect->left(); x <= rect->right(); x++) + if (mo[x] != 0xffff) + { + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + + // upper bit of MO priority might mean palette kludges + if (mopriority & 4) + { + // if bit 2 is set, start setting high palette bits + if (mo[x] & 2) + m_mob->apply_stain(bitmap, pf, mo, x, y); + } + } + } + return 0; +} + + +uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if (m_video_disable) + { + bitmap.fill(m_palette->black_pen(), cliprect); + return 0; + } + + update_palette(); + + // start drawing + m_mob->draw_async(cliprect); + + // draw the playfield + m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw and merge the MO + bitmap_ind16 &mobitmap = m_mob->bitmap(); + for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) + for (int y = rect->top(); y <= rect->bottom(); y++) + { + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + for (int x = rect->left(); x <= rect->right(); x++) + if (mo[x] != 0xffff) + { + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 5) & 3; + + // upper bit of MO priority signals special rendering and doesn't draw anything + if (mopriority & 4) + continue; + + // check the priority + if (!(pf[x] & 8) || mopriority >= pfpriority) + pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; + } + } + + // add the alpha on top + m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // now go back and process the upper bit of MO priority + for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) + for (int y = rect->top(); y <= rect->bottom(); y++) + { + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + for (int x = rect->left(); x <= rect->right(); x++) + if (mo[x] != 0xffff) + { + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + + // upper bit of MO priority might mean palette kludges + if (mopriority & 4) + { + // if bit 2 is set, start setting high palette bits + if (mo[x] & 2) + m_mob->apply_stain(bitmap, pf, mo, x, y); + } + } + } + + return 0; +} + + +// machine /************************************* * @@ -48,13 +523,9 @@ void eprom_state::video_int_ack_w(uint16_t data) m_extra->set_input_line(M68K_IRQ_4, CLEAR_LINE); } -void eprom_state::machine_start() -{ -} - void eprom_state::machine_reset() { - m_share1[0xcc00/2] = 0; + m_shared_ram[0xcc00 / 2] = 0; } @@ -88,16 +559,16 @@ void eprom_state::eprom_latch_w(uint8_t data) { if (m_extra.found()) { - /* bit 0: reset extra CPU */ + // bit 0: reset extra CPU if (data & 1) m_extra->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); else m_extra->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - /* bits 1-4: screen intensity */ + // bits 1-4: screen intensity m_screen_intensity = (data & 0x1e) >> 1; - /* bit 5: video disable */ + // bit 5: video disable m_video_disable = (data & 0x20); } } @@ -112,9 +583,9 @@ void eprom_state::eprom_latch_w(uint8_t data) template void eprom_state::sync_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - u16 oldword = m_share1[0xcc00/2]; - COMBINE_DATA(&m_share1[0xcc00/2]); - u16 newword = m_share1[0xcc00/2]; + u16 oldword = m_shared_ram[0xcc00 / 2]; + COMBINE_DATA(&m_shared_ram[0xcc00 / 2]); + u16 newword = m_shared_ram[0xcc00 / 2]; if ((oldword & 0xff00) != (newword & 0xff00)) (maincpu ? m_maincpu->yield() : m_extra->yield()); @@ -131,7 +602,7 @@ void eprom_state::main_map(address_map &map) { map(0x000000, 0x09ffff).rom(); map(0x0e0000, 0x0e03ff).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)).umask16(0x00ff); - map(0x160000, 0x16ffff).ram().share("share1"); + map(0x160000, 0x16ffff).ram().share(m_shared_ram); map(0x16cc00, 0x16cc01).w(FUNC(eprom_state::sync_w)); map(0x1f0000, 0x1fffff).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16)); map(0x260000, 0x26000f).portr("260000"); @@ -143,7 +614,7 @@ void eprom_state::main_map(address_map &map) map(0x360011, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); map(0x360020, 0x360021).w(m_jsa, FUNC(atari_jsa_base_device::sound_reset_w)); map(0x360031, 0x360031).w(m_jsa, FUNC(atari_jsa_base_device::main_command_w)); - map(0x3e0000, 0x3e0fff).ram().share("paletteram"); + map(0x3e0000, 0x3e0fff).ram().share(m_paletteram); map(0x3f0000, 0x3f1fff).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16)).share("playfield"); map(0x3f2000, 0x3f3fff).ram().share("mob"); map(0x3f4000, 0x3f4f7f).ram().w(m_alpha_tilemap, FUNC(tilemap_device::write16)).share("alpha"); @@ -157,7 +628,7 @@ void eprom_state::guts_map(address_map &map) { map(0x000000, 0x09ffff).rom(); map(0x0e0000, 0x0e03ff).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)).umask16(0x00ff); - map(0x160000, 0x16ffff).ram().share("share1"); + map(0x160000, 0x16ffff).ram().share(m_shared_ram); map(0x16cc00, 0x16cc01).w(FUNC(eprom_state::sync_w)); map(0x1f0000, 0x1fffff).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16)); map(0x260000, 0x26000f).portr("260000"); @@ -169,7 +640,7 @@ void eprom_state::guts_map(address_map &map) // map(0x360011, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); map(0x360020, 0x360021).w(m_jsa, FUNC(atari_jsa_ii_device::sound_reset_w)); map(0x360031, 0x360031).w(m_jsa, FUNC(atari_jsa_ii_device::main_command_w)); - map(0x3e0000, 0x3e0fff).ram().share("paletteram"); + map(0x3e0000, 0x3e0fff).ram().share(m_paletteram); map(0xff0000, 0xff1fff).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16_ext)).share("playfield_ext"); map(0xff8000, 0xff9fff).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16)).share("playfield"); map(0xffa000, 0xffbfff).ram().share("mob"); @@ -189,7 +660,7 @@ void eprom_state::guts_map(address_map &map) void eprom_state::extra_map(address_map &map) { map(0x000000, 0x07ffff).rom(); - map(0x160000, 0x16ffff).ram().share("share1"); + map(0x160000, 0x16ffff).ram().share(m_shared_ram); map(0x16cc00, 0x16cc01).w(FUNC(eprom_state::sync_w)); map(0x260000, 0x26000f).portr("260000"); map(0x260010, 0x26001f).portr("260010"); @@ -221,8 +692,8 @@ static INPUT_PORTS_START( eprom ) PORT_START("260010") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_SERVICE( 0x0002, IP_ACTIVE_LOW ) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") /* Input buffer full (@260030) */ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") /* Output buffer full (@360030) */ + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") // Input buffer full (@260030) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") // Output buffer full (@360030) PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("adc", adc0808_device, eoc_r) PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) @@ -231,16 +702,16 @@ static INPUT_PORTS_START( eprom ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("ADC0") /* ADC0 @ 0x260020 */ + PORT_START("ADC0") // ADC0 @ 0x260020 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) - PORT_START("ADC1") /* ADC1 @ 0x260022 */ + PORT_START("ADC1") // ADC1 @ 0x260022 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1) - PORT_START("ADC2") /* ADC0 @ 0x260024 */ + PORT_START("ADC2") // ADC0 @ 0x260024 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) - PORT_START("ADC3") /* ADC1 @ 0x260026 */ + PORT_START("ADC3") // ADC1 @ 0x260026 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2) INPUT_PORTS_END @@ -260,8 +731,8 @@ static INPUT_PORTS_START( klaxp ) PORT_START("260010") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_SERVICE( 0x0002, IP_ACTIVE_LOW ) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") /* Input buffer full (@260030) */ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") /* Output buffer full (@360030) */ + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") // Input buffer full (@260030) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") // Output buffer full (@360030) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) @@ -276,7 +747,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( guts ) - PORT_START("260000") /* 260000 */ + PORT_START("260000") PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) @@ -284,11 +755,11 @@ static INPUT_PORTS_START( guts ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("260010") /* 260010 */ + PORT_START("260010") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_SERVICE( 0x0002, IP_ACTIVE_LOW ) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") /* Input buffer full (@260030) */ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") /* Output buffer full (@360030) */ + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") // Input buffer full (@260030) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") // Output buffer full (@360030) PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("adc", adc0808_device, eoc_r) PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) @@ -297,16 +768,16 @@ static INPUT_PORTS_START( guts ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("ADC0") /* ADC0 @ 0x260020 */ + PORT_START("ADC0") // ADC0 @ 0x260020 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) - PORT_START("ADC1") /* ADC1 @ 0x260022 */ + PORT_START("ADC1") // ADC1 @ 0x260022 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_REVERSE - PORT_START("ADC2") /* ADC0 @ 0x260024 */ + PORT_START("ADC2") //* ADC0 @ 0x260024 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) - PORT_START("ADC3") /* ADC1 @ 0x260026 */ + PORT_START("ADC3") // ADC1 @ 0x260026 PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_REVERSE INPUT_PORTS_END @@ -343,15 +814,15 @@ static const gfx_layout pfmolayout = static GFXDECODE_START( gfx_eprom ) - GFXDECODE_ENTRY( "gfx1", 0, pfmolayout, 256, 32 ) /* sprites & playfield */ - GFXDECODE_ENTRY( "gfx2", 0, anlayout, 0, 64 ) /* characters 8x8 */ + GFXDECODE_ENTRY( "spr_tiles", 0, pfmolayout, 256, 32 ) + GFXDECODE_ENTRY( "chars", 0, anlayout, 0, 64 ) GFXDECODE_END static GFXDECODE_START( gfx_guts ) - GFXDECODE_ENTRY( "gfx1", 0, pfmolayout, 256, 32 ) /* sprites */ - GFXDECODE_ENTRY( "gfx2", 0, anlayout, 0, 64 ) /* characters 8x8 */ - GFXDECODE_ENTRY( "gfx3", 0, pfmolayout, 256, 32 ) /* playfield */ + GFXDECODE_ENTRY( "sprites", 0, pfmolayout, 256, 32 ) + GFXDECODE_ENTRY( "chars", 0, anlayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0, pfmolayout, 256, 32 ) GFXDECODE_END @@ -364,18 +835,18 @@ GFXDECODE_END void eprom_state::eprom(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 14.318181_MHz_XTAL/2); + // basic machine hardware + M68000(config, m_maincpu, 14.318181_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &eprom_state::main_map); - M68000(config, m_extra, 14.318181_MHz_XTAL/2); + M68000(config, m_extra, 14.318181_MHz_XTAL / 2); m_extra->set_addrmap(AS_PROGRAM, &eprom_state::extra_map); config.set_maximum_quantum(attotime::from_hz(6000)); TIMER(config, "scantimer").configure_scanline(FUNC(eprom_state::scanline_update), m_screen, 0, 8); - ADC0809(config, m_adc, 14.318181_MHz_XTAL/16); + ADC0809(config, m_adc, 14.318181_MHz_XTAL / 16); m_adc->in_callback<0>().set_ioport("ADC0"); m_adc->in_callback<1>().set_ioport("ADC1"); m_adc->in_callback<2>().set_ioport("ADC2"); @@ -385,27 +856,27 @@ void eprom_state::eprom(machine_config &config) WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware GFXDECODE(config, m_gfxdecode, m_palette, gfx_eprom); PALETTE(config, m_palette).set_entries(2048); - TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_COLS, 64,64).set_info_callback(FUNC(eprom_state::get_playfield_tile_info)); - TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_ROWS, 64,32, 0).set_info_callback(FUNC(eprom_state::get_alpha_tile_info)); + TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64).set_info_callback(FUNC(eprom_state::get_playfield_tile_info)); + TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_ROWS, 64, 32, 0).set_info_callback(FUNC(eprom_state::get_alpha_tile_info)); ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, eprom_state::s_mob_config); m_mob->set_gfxdecode(m_gfxdecode); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); - /* note: these parameters are from published specs, not derived */ - /* the board uses a SYNGEN chip to generate video signals */ - m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240); + // note: these parameters are from published specs, not derived + // the board uses a SYNGEN chip to generate video signals + m_screen->set_raw(14.318181_MHz_XTAL / 2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(eprom_state::screen_update_eprom)); m_screen->set_palette(m_palette); m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); m_screen->screen_vblank().append_inputline(m_extra, M68K_IRQ_4, ASSERT_LINE); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ATARI_JSA_I(config, m_jsa, 0); @@ -418,8 +889,8 @@ void eprom_state::eprom(machine_config &config) void eprom_state::klaxp(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 14.318181_MHz_XTAL/2); + // basic machine hardware + M68000(config, m_maincpu, 14.318181_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &eprom_state::main_map); config.set_maximum_quantum(attotime::from_hz(600)); @@ -434,22 +905,22 @@ void eprom_state::klaxp(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_eprom); PALETTE(config, m_palette).set_entries(2048); - TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_COLS, 64,64).set_info_callback(FUNC(eprom_state::get_playfield_tile_info)); - TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_ROWS, 64,32, 0).set_info_callback(FUNC(eprom_state::get_alpha_tile_info)); + TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64).set_info_callback(FUNC(eprom_state::get_playfield_tile_info)); + TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_ROWS, 64, 32, 0).set_info_callback(FUNC(eprom_state::get_alpha_tile_info)); ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, eprom_state::s_mob_config); m_mob->set_gfxdecode(m_gfxdecode); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); - /* note: these parameters are from published specs, not derived */ - /* the board uses a SYNGEN chip to generate video signals */ - m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240); + // note: these parameters are from published specs, not derived + // the board uses a SYNGEN chip to generate video signals + m_screen->set_raw(14.318181_MHz_XTAL / 2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(eprom_state::screen_update_eprom)); m_screen->set_palette(m_palette); m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ATARI_JSA_II(config, m_jsa, 0); @@ -461,15 +932,15 @@ void eprom_state::klaxp(machine_config &config) void eprom_state::guts(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 14.318181_MHz_XTAL/2); + // basic machine hardware + M68000(config, m_maincpu, 14.318181_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &eprom_state::guts_map); config.set_maximum_quantum(attotime::from_hz(600)); TIMER(config, "scantimer").configure_scanline(FUNC(eprom_state::scanline_update), m_screen, 0, 8); - ADC0809(config, m_adc, 14.318181_MHz_XTAL/16); + ADC0809(config, m_adc, 14.318181_MHz_XTAL / 16); m_adc->in_callback<0>().set_ioport("ADC0"); m_adc->in_callback<1>().set_ioport("ADC1"); m_adc->in_callback<2>().set_ioport("ADC2"); @@ -479,26 +950,26 @@ void eprom_state::guts(machine_config &config) WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware GFXDECODE(config, m_gfxdecode, m_palette, gfx_guts); PALETTE(config, m_palette).set_entries(2048); - TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_COLS, 64,64).set_info_callback(FUNC(eprom_state::guts_get_playfield_tile_info)); - TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_ROWS, 64,32, 0).set_info_callback(FUNC(eprom_state::get_alpha_tile_info)); + TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64).set_info_callback(FUNC(eprom_state::guts_get_playfield_tile_info)); + TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_ROWS, 64, 32, 0).set_info_callback(FUNC(eprom_state::get_alpha_tile_info)); ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, eprom_state::s_guts_mob_config); m_mob->set_gfxdecode(m_gfxdecode); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); - /* note: these parameters are from published specs, not derived */ - /* the board uses a SYNGEN chip to generate video signals */ - m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240); + // note: these parameters are from published specs, not derived + // the board uses a SYNGEN chip to generate video signals + m_screen->set_raw(14.318181_MHz_XTAL / 2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(eprom_state::screen_update_guts)); m_screen->set_palette(m_palette); m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ATARI_JSA_II(config, m_jsa, 0); @@ -516,7 +987,7 @@ void eprom_state::guts(machine_config &config) *************************************/ ROM_START( eprom ) - ROM_REGION( 0xa0000, "maincpu", 0 ) /* 10*64k for 68000 code */ + ROM_REGION( 0xa0000, "maincpu", 0 ) ROM_LOAD16_BYTE( "136069-3025.50a", 0x00000, 0x10000, CRC(08888dec) SHA1(a0a137828b9e1efbdbc0e5ddaf4d73d24b36948a) ) ROM_LOAD16_BYTE( "136069-3024.40a", 0x00001, 0x10000, CRC(29cb1e97) SHA1(ccf7024dccbd61983d61450f15c805422e4eee09) ) ROM_LOAD16_BYTE( "136069-4027.50b", 0x20000, 0x10000, CRC(702241c9) SHA1(cba27e92f64fd201c16aed6a8f2dc64c4f887e4f) ) @@ -526,15 +997,15 @@ ROM_START( eprom ) ROM_LOAD16_BYTE( "136069-2033.40k", 0x60000, 0x10000, CRC(130650f6) SHA1(bea7780d54a4e1f3e93f14494c82446a4bb48e19) ) ROM_LOAD16_BYTE( "136069-2032.50k", 0x60001, 0x10000, CRC(1da21ed8) SHA1(3b00e3cf5a25918c1f3158d8b2192158f77cb521) ) - ROM_REGION( 0x80000, "extra", 0 ) /* 8*64k for 68000 code */ + ROM_REGION( 0x80000, "extra", 0 ) ROM_LOAD16_BYTE( "136069-2035.10s", 0x00000, 0x10000, CRC(deff6469) SHA1(2fe4d42d60965581579e8edad49b86fbd321d1db) ) ROM_LOAD16_BYTE( "136069-2034.10u", 0x00001, 0x10000, CRC(5d7afca2) SHA1(a37ecd2909049dd0b3ddbe602f0173c44b065f6f) ) ROM_COPY( "maincpu", 0x60000, 0x60000, 0x20000 ) - ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 64k for 6502 code */ + ROM_REGION( 0x10000, "jsa:cpu", 0 ) ROM_LOAD( "136069-1040.7b", 0x00000, 0x10000, CRC(86e93695) SHA1(63ddab02df139dd41a8260c303798b2a550b9fe6) ) - ROM_REGION( 0x100000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x100000, "spr_tiles", ROMREGION_INVERT ) ROM_LOAD( "136069-1020.47s", 0x00000, 0x10000, CRC(0de9d98d) SHA1(c2f963a8a4573e135a2825929cbc5535ce3b0215) ) ROM_LOAD( "136069-1013.43s", 0x10000, 0x10000, CRC(8eb106ad) SHA1(ece0ddba8fafe6e720f843c4d3f69ae654ae9d92) ) ROM_LOAD( "136069-1018.38s", 0x20000, 0x10000, CRC(bf3d0e18) SHA1(c81dacd06ce2580e37ff480d1182ab6c7e74d600) ) @@ -552,7 +1023,7 @@ ROM_START( eprom ) ROM_LOAD( "136069-1014.64u", 0xe0000, 0x10000, CRC(0e07493b) SHA1(c5839ac4824b6fedb5397779cd30f6b1eff962d5) ) ROM_LOAD( "136069-1019.57u", 0xf0000, 0x10000, CRC(34f8f0ed) SHA1(9096aa2a188a15c2e78acf48d33def0c9f2a419f) ) - ROM_REGION( 0x04000, "gfx2", 0 ) + ROM_REGION( 0x04000, "chars", 0 ) ROM_LOAD( "136069-1007.125d", 0x00000, 0x04000, CRC(409d818e) SHA1(63dcde3ce87c1a9d5afef8089432c499cc70f8f0) ) ROM_REGION( 0x0c00, "plds", 0 ) @@ -566,7 +1037,7 @@ ROM_END ROM_START( eprom2 ) - ROM_REGION( 0xa0000, "maincpu", 0 ) /* 10*64k for 68000 code */ + ROM_REGION( 0xa0000, "maincpu", 0 ) ROM_LOAD16_BYTE( "136069-1025.50a", 0x00000, 0x10000, CRC(b0c9a476) SHA1(6d0edeeb9458e92191f6623307eddc9b2f830d4d) ) ROM_LOAD16_BYTE( "136069-1024.40a", 0x00001, 0x10000, CRC(4cc2c50c) SHA1(088908cc57b07d71a5d664674e38fa02c55bb4fc) ) ROM_LOAD16_BYTE( "136069-1027.50b", 0x20000, 0x10000, CRC(84f533ea) SHA1(c1da671be5149bff26acd19b14cd18db0df695b7) ) @@ -578,15 +1049,15 @@ ROM_START( eprom2 ) ROM_LOAD16_BYTE( "136069-1037.50e", 0x80000, 0x10000, CRC(ad39a3dd) SHA1(00dcdcb30b7f8441df4216f9be4de15791ac5fc8) ) ROM_LOAD16_BYTE( "136069-1036.40e", 0x80001, 0x10000, CRC(34fc8895) SHA1(0c167c3a778e064a37517b52fd7a52f16d844f77) ) - ROM_REGION( 0x80000, "extra", 0 ) /* 8*64k for 68000 code */ + ROM_REGION( 0x80000, "extra", 0 ) ROM_LOAD16_BYTE( "136069-1035.10s", 0x00000, 0x10000, CRC(ffeb5647) SHA1(fbd9217a96e51dd0c0cbc0ba9dfdaaa36fbc1ae9) ) ROM_LOAD16_BYTE( "136069-1034.10u", 0x00001, 0x10000, CRC(c68f58dd) SHA1(0ec300f32e67b710ac33efb60b8eccceb43faca6) ) ROM_COPY( "maincpu", 0x60000, 0x60000, 0x20000 ) - ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 64k for 6502 code */ + ROM_REGION( 0x10000, "jsa:cpu", 0 ) ROM_LOAD( "136069-1040.7b", 0x00000, 0x10000, CRC(86e93695) SHA1(63ddab02df139dd41a8260c303798b2a550b9fe6) ) - ROM_REGION( 0x100000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x100000, "spr_tiles", ROMREGION_INVERT ) ROM_LOAD( "136069-1020.47s", 0x00000, 0x10000, CRC(0de9d98d) SHA1(c2f963a8a4573e135a2825929cbc5535ce3b0215) ) ROM_LOAD( "136069-1013.43s", 0x10000, 0x10000, CRC(8eb106ad) SHA1(ece0ddba8fafe6e720f843c4d3f69ae654ae9d92) ) ROM_LOAD( "136069-1018.38s", 0x20000, 0x10000, CRC(bf3d0e18) SHA1(c81dacd06ce2580e37ff480d1182ab6c7e74d600) ) @@ -604,7 +1075,7 @@ ROM_START( eprom2 ) ROM_LOAD( "136069-1014.64u", 0xe0000, 0x10000, CRC(0e07493b) SHA1(c5839ac4824b6fedb5397779cd30f6b1eff962d5) ) ROM_LOAD( "136069-1019.57u", 0xf0000, 0x10000, CRC(34f8f0ed) SHA1(9096aa2a188a15c2e78acf48d33def0c9f2a419f) ) - ROM_REGION( 0x04000, "gfx2", 0 ) + ROM_REGION( 0x04000, "chars", 0 ) ROM_LOAD( "136069.125d", 0x00000, 0x04000, CRC(409d818e) SHA1(63dcde3ce87c1a9d5afef8089432c499cc70f8f0) ) ROM_REGION( 0x0c00, "plds", 0 ) @@ -618,62 +1089,62 @@ ROM_END ROM_START( klaxp1 ) - ROM_REGION( 0xa0000, "maincpu", 0 ) /* 10*64k for 68000 code */ + ROM_REGION( 0xa0000, "maincpu", 0 ) ROM_LOAD16_BYTE( "klax_ft1.50a", 0x00000, 0x10000, CRC(87ee72d1) SHA1(39ae6f8406f0768480bcc80d395a14d9c2c65dca) ) ROM_LOAD16_BYTE( "klax_ft1.40a", 0x00001, 0x10000, CRC(ba139fdb) SHA1(98a8ac5e0349b934f55d0d9de85abacd3fd0d77d) ) - ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 64k for 6502 code */ + ROM_REGION( 0x10000, "jsa:cpu", 0 ) ROM_LOAD( "klaxsnd.10c", 0x00000, 0x10000, CRC(744734cb) SHA1(3630428d69ddd2a4d5dd76bb4ee9485c943129e9) ) - ROM_REGION( 0x40000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x40000, "spr_tiles", ROMREGION_INVERT ) ROM_LOAD( "klaxprot.43s", 0x00000, 0x10000, CRC(a523c966) SHA1(8e284901cd1c68b25aa9dec1c87374b93cceeb40) ) ROM_LOAD( "klaxprot.76s", 0x10000, 0x10000, CRC(dbc678cd) SHA1(4e6db153d29300e8d5960937d3bfebbd1ae2e78a) ) ROM_LOAD( "klaxprot.47u", 0x20000, 0x10000, CRC(af184754) SHA1(4567337e1af1f748b1663e0b4c3e8ea746aac56c) ) ROM_LOAD( "klaxprot.76u", 0x30000, 0x10000, CRC(7a56ffab) SHA1(96c491e51931c6641e63e55da173ecd41df7c7b3) ) - ROM_REGION( 0x04000, "gfx2", 0 ) + ROM_REGION( 0x04000, "chars", 0 ) ROM_LOAD( "klax125d", 0x00000, 0x04000, CRC(409d818e) SHA1(63dcde3ce87c1a9d5afef8089432c499cc70f8f0) ) - ROM_REGION( 0x40000, "jsa:oki1", 0 ) /* ADPCM data */ + ROM_REGION( 0x40000, "jsa:oki1", 0 ) // ADPCM data ROM_LOAD( "klaxadp0.1f", 0x00000, 0x10000, CRC(ba1e864f) SHA1(7c45e9040701b54c8be398c6e5cdf9201dc37c17) ) ROM_LOAD( "klaxadp1.1e", 0x10000, 0x10000, CRC(dec9a5ac) SHA1(8039d946ac3613fa6193b557cc8775c81871831d) ) ROM_END ROM_START( klaxp2 ) - ROM_REGION( 0xa0000, "maincpu", 0 ) /* 10*64k for 68000 code */ + ROM_REGION( 0xa0000, "maincpu", 0 ) ROM_LOAD16_BYTE( "klax_ft2.50a", 0x00000, 0x10000, CRC(7d401937) SHA1(8db0560528a86b9cb01c4598a49694bd44b00dba) ) ROM_LOAD16_BYTE( "klax_ft2.40a", 0x00001, 0x10000, CRC(c5ca33a9) SHA1(c2e2948f987ba43f61c043baed06ffea8787be43) ) - ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 64k for 6502 code */ + ROM_REGION( 0x10000, "jsa:cpu", 0 ) ROM_LOAD( "klaxsnd.10c", 0x00000, 0x10000, CRC(744734cb) SHA1(3630428d69ddd2a4d5dd76bb4ee9485c943129e9) ) - ROM_REGION( 0x40000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x40000, "spr_tiles", ROMREGION_INVERT ) ROM_LOAD( "klaxprot.43s", 0x00000, 0x10000, CRC(a523c966) SHA1(8e284901cd1c68b25aa9dec1c87374b93cceeb40) ) ROM_LOAD( "klaxprot.76s", 0x10000, 0x10000, CRC(dbc678cd) SHA1(4e6db153d29300e8d5960937d3bfebbd1ae2e78a) ) ROM_LOAD( "klaxprot.47u", 0x20000, 0x10000, CRC(af184754) SHA1(4567337e1af1f748b1663e0b4c3e8ea746aac56c) ) ROM_LOAD( "klaxprot.76u", 0x30000, 0x10000, CRC(7a56ffab) SHA1(96c491e51931c6641e63e55da173ecd41df7c7b3) ) - ROM_REGION( 0x04000, "gfx2", 0 ) + ROM_REGION( 0x04000, "chars", 0 ) ROM_LOAD( "klax125d", 0x00000, 0x04000, CRC(409d818e) SHA1(63dcde3ce87c1a9d5afef8089432c499cc70f8f0) ) - ROM_REGION( 0x40000, "jsa:oki1", 0 ) /* ADPCM data */ + ROM_REGION( 0x40000, "jsa:oki1", 0 ) // ADPCM data ROM_LOAD( "klaxadp0.1f", 0x00000, 0x10000, CRC(ba1e864f) SHA1(7c45e9040701b54c8be398c6e5cdf9201dc37c17) ) ROM_LOAD( "klaxadp1.1e", 0x10000, 0x10000, CRC(dec9a5ac) SHA1(8039d946ac3613fa6193b557cc8775c81871831d) ) ROM_END ROM_START( guts ) - ROM_REGION( 0xa0000, "maincpu", 0 ) /* 10*64k for 68000 code */ + ROM_REGION( 0xa0000, "maincpu", 0 ) ROM_LOAD16_BYTE( "guts-hi0.50a", 0x00000, 0x10000, CRC(3afca24a) SHA1(4910c958ac2124de13d4069420fb2cfd18b12cec) ) ROM_LOAD16_BYTE( "guts-lo0.40a", 0x00001, 0x10000, CRC(ce86cf23) SHA1(28504e2e8dcf1eaa96364eed1faf00fec9e98788) ) ROM_LOAD16_BYTE( "guts-hi1.50b", 0x20000, 0x10000, CRC(a231f65d) SHA1(9c8ccd265ed0e9f6d7181d216ed41a0c5cc0cd5f) ) ROM_LOAD16_BYTE( "guts-lo1.40b", 0x20001, 0x10000, CRC(dbdd4910) SHA1(9ca22321398b6397902aa99a3ef46f1a78ccc438) ) - ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 64k for 6502 code */ + ROM_REGION( 0x10000, "jsa:cpu", 0 ) ROM_LOAD( "guts-snd.10c", 0x00000, 0x10000, CRC(9fe065d7) SHA1(0d202af3d6c62fdcfc3bb2ea95bbf4e37c0d43cf) ) - ROM_REGION( 0x100000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x100000, "sprites", ROMREGION_INVERT ) ROM_LOAD( "guts-mo0.bin", 0x00000, 0x10000, CRC(b8d8d8da) SHA1(6426607402aa9f1c872290910eefc57a8dd60e17) ) ROM_LOAD( "guts-mo1.bin", 0x10000, 0x10000, CRC(d01b5a7f) SHA1(19aead56ddb92e0b1fc78d9065b1f139fe2a5668) ) ROM_LOAD( "guts-mo2.bin", 0x20000, 0x10000, CRC(4577b807) SHA1(df0ead177342ab360cfab9b6defb7d0129d921e4) ) @@ -691,10 +1162,10 @@ ROM_START( guts ) ROM_LOAD( "guts-moe.bin", 0xe0000, 0x10000, CRC(ee372eac) SHA1(bb1248bb3415853e16819a7b6b64ec67f87a2c58) ) ROM_LOAD( "guts-mof.bin", 0xf0000, 0x10000, CRC(028ec56e) SHA1(8a95cffe5c00296e4df725335046a810efab533a) ) - ROM_REGION( 0x04000, "gfx2", 0 ) + ROM_REGION( 0x04000, "chars", 0 ) ROM_LOAD( "guts-alpha.bin", 0x00000, 0x04000, CRC(ee965058) SHA1(ccd3f6550bd5b531e8dd70ca88c30cdabf30e1e9) ) - ROM_REGION( 0x100000, "gfx3", ROMREGION_INVERT ) + ROM_REGION( 0x100000, "tiles", ROMREGION_INVERT ) ROM_LOAD( "guts-pf0.bin", 0x00000, 0x10000, CRC(1669fdb3) SHA1(d8d27b0f5877e215bf3d5343893c979860b1b45f) ) ROM_LOAD( "guts-pf1.bin", 0x10000, 0x10000, CRC(135c41bd) SHA1(945ad9edbfcc5fe807cb15aa72b1be9e05974cb2) ) ROM_LOAD( "guts-pf2.bin", 0x20000, 0x10000, CRC(c0408d39) SHA1(187ecea51f607c7f2565a9853c728e80118fefb1) ) @@ -708,11 +1179,12 @@ ROM_START( guts ) ROM_LOAD( "guts-pfd.bin", 0xd0000, 0x10000, CRC(979af5b2) SHA1(574a41552eb641668841cf01aeed442ccd3bc8e5) ) ROM_LOAD( "guts-pfe.bin", 0xe0000, 0x10000, CRC(bf384e4d) SHA1(c4810b5a3ee754b169efa01f06941a02b50c53a0) ) - ROM_REGION( 0x40000, "jsa:oki1", 0 ) /* ADPCM data */ + ROM_REGION( 0x40000, "jsa:oki1", 0 ) // ADPCM data ROM_LOAD( "guts-adpcm0.1f", 0x00000, 0x10000, CRC(92e9c35d) SHA1(dcc724f915e113bc34f499af9fd7c8ebb6d8ba98) ) ROM_LOAD( "guts-adpcm1.1e", 0x10000, 0x10000, CRC(0afddd3a) SHA1(e1a43825ad02325a64869ec8048c8176da01b286) ) ROM_END +} // anonymous namespace /************************************* @@ -723,6 +1195,6 @@ ROM_END GAME( 1989, eprom, 0, eprom, eprom, eprom_state, empty_init, ROT0, "Atari Games", "Escape from the Planet of the Robot Monsters (set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, eprom2, eprom, eprom, eprom, eprom_state, empty_init, ROT0, "Atari Games", "Escape from the Planet of the Robot Monsters (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, klaxp1, klax, klaxp, klaxp, eprom_state, empty_init, ROT0, "Atari Games", "Klax (prototype set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, klaxp2, klax, klaxp, klaxp, eprom_state, empty_init, ROT0, "Atari Games", "Klax (prototype set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, guts, 0, guts, guts, eprom_state, empty_init, ROT0, "Atari Games", "Guts n' Glory (prototype)", 0 ) +GAME( 1989, klaxp1, klax, klaxp, klaxp, eprom_state, empty_init, ROT0, "Atari Games", "Klax (prototype set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, klaxp2, klax, klaxp, klaxp, eprom_state, empty_init, ROT0, "Atari Games", "Klax (prototype set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, guts, 0, guts, guts, eprom_state, empty_init, ROT0, "Atari Games", "Guts n' Glory (prototype)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/atari/eprom.h b/src/mame/atari/eprom.h deleted file mode 100644 index 8f195890918..00000000000 --- a/src/mame/atari/eprom.h +++ /dev/null @@ -1,83 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/************************************************************************* - - Atari Escape hardware - -*************************************************************************/ -#ifndef MAME_ATARI_EPROM_H -#define MAME_ATARI_EPROM_H - -#pragma once - -#include "machine/adc0808.h" -#include "machine/timer.h" -#include "atarijsa.h" -#include "atarimo.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -class eprom_state : public driver_device -{ -public: - eprom_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_playfield_tilemap(*this, "playfield"), - m_alpha_tilemap(*this, "alpha"), - m_mob(*this, "mob"), - m_jsa(*this, "jsa"), - m_share1(*this, "share1"), - m_adc(*this, "adc"), - m_extra(*this, "extra"), - m_palette(*this, "palette"), - m_paletteram(*this, "paletteram") - { } - - void guts(machine_config &config); - void eprom(machine_config &config); - void klaxp(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_playfield_tilemap; - required_device m_alpha_tilemap; - required_device m_mob; - required_device m_jsa; - required_shared_ptr m_share1; - uint8_t m_screen_intensity = 0U; - uint8_t m_video_disable = 0U; - optional_device m_adc; - optional_device m_extra; - required_device m_palette; - optional_shared_ptr m_paletteram; - static const atari_motion_objects_config s_mob_config; - static const atari_motion_objects_config s_guts_mob_config; - - void video_int_ack_w(uint16_t data); - TIMER_DEVICE_CALLBACK_MEMBER(scanline_update); - uint8_t adc_r(offs_t offset); - void eprom_latch_w(uint8_t data); - template void sync_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - TILE_GET_INFO_MEMBER(get_alpha_tile_info); - TILE_GET_INFO_MEMBER(get_playfield_tile_info); - TILE_GET_INFO_MEMBER(guts_get_playfield_tile_info); - uint32_t screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void update_palette(); - void extra_map(address_map &map); - void guts_map(address_map &map); - void main_map(address_map &map); -}; - -#endif // MAME_ATARI_EPROM_H diff --git a/src/mame/atari/eprom_v.cpp b/src/mame/atari/eprom_v.cpp deleted file mode 100644 index cef48d48db9..00000000000 --- a/src/mame/atari/eprom_v.cpp +++ /dev/null @@ -1,412 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - Atari Escape hardware - -****************************************************************************/ - -#include "emu.h" -#include "eprom.h" - - -/************************************* - * - * Palette - * - *************************************/ - -void eprom_state::update_palette() -{ - int color; - - for (color = 0; color < 0x800; ++color) - { - int i, r, g, b; - uint16_t const data = m_paletteram[color]; - - /* FIXME this is only a very crude approximation of the palette output. - * The circuit involves a dozen transistors and probably has an output - * which is quite different from this. - * This is, however, good enough to match the video and description - * of MAMETesters bug #02677. - */ - i = (((data >> 12) & 15) + 1) * (4 - m_screen_intensity); - if (i < 0) - i = 0; - - r = ((data >> 8) & 15) * i / 4; - g = ((data >> 4) & 15) * i / 4; - b = ((data >> 0) & 15) * i / 4; - - m_palette->set_pen_color(color, r, g, b); - } -} - - - -/************************************* - * - * Tilemap callbacks - * - *************************************/ - -TILE_GET_INFO_MEMBER(eprom_state::get_alpha_tile_info) -{ - uint16_t data = m_alpha_tilemap->basemem_read(tile_index); - int code = data & 0x3ff; - int color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20); - int opaque = data & 0x8000; - tileinfo.set(1, code, color, opaque ? TILE_FORCE_LAYER0 : 0); -} - - -TILE_GET_INFO_MEMBER(eprom_state::get_playfield_tile_info) -{ - uint16_t data1 = m_playfield_tilemap->basemem_read(tile_index); - uint16_t data2 = m_playfield_tilemap->extmem_read(tile_index) >> 8; - int code = data1 & 0x7fff; - int color = 0x10 + (data2 & 0x0f); - tileinfo.set(0, code, color, (data1 >> 15) & 1); -} - - -TILE_GET_INFO_MEMBER(eprom_state::guts_get_playfield_tile_info) -{ - uint16_t data1 = m_playfield_tilemap->basemem_read(tile_index); - uint16_t data2 = m_playfield_tilemap->extmem_read(tile_index) >> 8; - int code = data1 & 0x7fff; - int color = 0x10 + (data2 & 0x0f); - tileinfo.set(2, code, color, (data1 >> 15) & 1); -} - - - -/************************************* - * - * Video system start - * - *************************************/ - -const atari_motion_objects_config eprom_state::s_mob_config = -{ - 0, /* index to which gfx system */ - 1, /* number of motion object banks */ - 1, /* are the entries linked? */ - 0, /* are the entries split? */ - 1, /* render in reverse order? */ - 0, /* render in swapped X/Y order? */ - 0, /* does the neighbor bit affect the next object? */ - 8, /* pixels per SLIP entry (0 for no-slip) */ - 0, /* pixel offset for SLIPs */ - 0, /* maximum number of links to visit/scanline (0=all) */ - - 0x100, /* base palette entry */ - 0x100, /* maximum number of colors */ - 0, /* transparent pen index */ - - {{ 0x03ff,0,0,0 }}, /* mask for the link */ - {{ 0,0x7fff,0,0 }}, /* mask for the code index */ - {{ 0,0,0x000f,0 }}, /* mask for the color */ - {{ 0,0,0xff80,0 }}, /* mask for the X position */ - {{ 0,0,0,0xff80 }}, /* mask for the Y position */ - {{ 0,0,0,0x0070 }}, /* mask for the width, in tiles*/ - {{ 0,0,0,0x0007 }}, /* mask for the height, in tiles */ - {{ 0,0,0,0x0008 }}, /* mask for the horizontal flip */ - {{ 0 }}, /* mask for the vertical flip */ - {{ 0,0,0x0070,0 }}, /* mask for the priority */ - {{ 0 }}, /* mask for the neighbor */ - {{ 0 }}, /* mask for absolute coordinates */ - - {{ 0 }}, /* mask for the special value */ - 0 /* resulting value to indicate "special" */ -}; - -void eprom_state::video_start() -{ - /* save states */ - save_item(NAME(m_screen_intensity)); - save_item(NAME(m_video_disable)); - - m_screen_intensity = 0; - m_video_disable = 0; -} - - -const atari_motion_objects_config eprom_state::s_guts_mob_config = -{ - 0, /* index to which gfx system */ - 1, /* number of motion object banks */ - 1, /* are the entries linked? */ - 0, /* are the entries split? */ - 0, /* render in reverse order? */ - 0, /* render in swapped X/Y order? */ - 0, /* does the neighbor bit affect the next object? */ - 8, /* pixels per SLIP entry (0 for no-slip) */ - 0, /* pixel offset for SLIPs */ - 0, /* maximum number of links to visit/scanline (0=all) */ - - 0x100, /* base palette entry */ - 0x100, /* maximum number of colors */ - 0, /* transparent pen index */ - - {{ 0x03ff,0,0,0 }}, /* mask for the link */ - {{ 0,0x7fff,0,0 }}, /* mask for the code index */ - {{ 0,0,0x000f,0 }}, /* mask for the color */ - {{ 0,0,0xff80,0 }}, /* mask for the X position */ - {{ 0,0,0,0xff80 }}, /* mask for the Y position */ - {{ 0,0,0,0x0070 }}, /* mask for the width, in tiles*/ - {{ 0,0,0,0x000f }}, /* mask for the height, in tiles */ - {{ 0,0x8000,0,0 }}, /* mask for the horizontal flip */ - {{ 0 }}, /* mask for the vertical flip */ - {{ 0,0,0x0070,0 }}, /* mask for the priority */ - {{ 0 }}, /* mask for the neighbor */ - {{ 0 }}, /* mask for absolute coordinates */ - - {{ 0 }}, /* mask for the special value */ - 0 /* resulting value to indicate "special" */ -}; - - -/************************************* - * - * Periodic scanline updater - * - *************************************/ - -TIMER_DEVICE_CALLBACK_MEMBER(eprom_state::scanline_update) -{ - /* update the playfield */ - if (param == 0) - { - int xscroll = (m_alpha_tilemap->basemem_read(0x780) >> 7) & 0x1ff; - int yscroll = (m_alpha_tilemap->basemem_read(0x781) >> 7) & 0x1ff; - m_playfield_tilemap->set_scrollx(0, xscroll); - m_playfield_tilemap->set_scrolly(0, yscroll); - m_mob->set_scroll(xscroll, yscroll); - } -} - - - -/************************************* - * - * Main refresh - * - *************************************/ - -uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if (m_video_disable) - { - bitmap.fill(m_palette->black_pen(), cliprect); - return 0; - } - - update_palette(); - - // start drawing - m_mob->draw_async(cliprect); - - /* draw the playfield */ - m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - // draw and merge the MO - bitmap_ind16 &mobitmap = m_mob->bitmap(); - for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->top(); y <= rect->bottom(); y++) - { - uint16_t const *const mo = &mobitmap.pix(y); - uint16_t *const pf = &bitmap.pix(y); - for (int x = rect->left(); x <= rect->right(); x++) - if (mo[x] != 0xffff) - { - /* verified from the GALs on the real PCB; equations follow - * - * --- FORCEMC0 forces 3 bits of the MO color to 0 under some conditions - * FORCEMC0=!PFX3*PFX4*PFX5*!MPR0 - * +!PFX3*PFX5*!MPR1 - * +!PFX3*PFX4*!MPR0*!MPR1 - * - * --- SHADE selects an alternate color bank for the playfield - * !SHADE=!MPX0 - * +MPX1 - * +MPX2 - * +MPX3 - * +!MPX4*!MPX5*!MPX6*!MPX7 - * +FORCEMC0 - * - * --- PF/M is 1 if playfield has priority, or 0 if MOs have priority - * !PF/M=MPR0*MPR1 - * +PFX3 - * +!PFX4*MPR1 - * +!PFX5*MPR1 - * +!PFX5*MPR0 - * +!PFX4*!PFX5*!MPR0*!MPR1 - * - * --- M7 is passed as the upper MO bit to the GPC ASIC - * M7=MPX0*!MPX1*!MPX2*!MPX3 - * - * --- CL10-9 are outputs from the GPC, specifying which layer to render - * CL10 = 1 if pf - * CL9 = 1 if mo - * - * --- CRA10 is the 0x200 bit of the color RAM index; it comes directly from the GPC - * CRA10 = CL10 - * - * --- CRA9 is the 0x100 bit of the color RAM index; is comes directly from the GPC - * or if the SHADE flag is set, it affects the playfield color bank - * CRA9 = SHADE*CL10 - * +CL9 - * - * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected - */ - int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int const pfpriority = (pf[x] >> 4) & 3; - - /* upper bit of MO priority signals special rendering and doesn't draw anything */ - if (mopriority & 4) - continue; - - /* compute the FORCEMC signal */ - int forcemc0 = 0; - if (!(pf[x] & 8)) - { - if (((pfpriority == 3) && !(mopriority & 1)) || - ((pfpriority & 2) && !(mopriority & 2)) || - ((pfpriority & 1) && (mopriority == 0))) - forcemc0 = 1; - } - - /* compute the SHADE signal */ - int shade = 1; - if (((mo[x] & 0x0f) != 1) || - ((mo[x] & 0xf0) == 0) || - forcemc0) - shade = 0; - - /* compute the PF/M signal */ - int pfm = 1; - if ((mopriority == 3) || - (pf[x] & 8) || - (!(pfpriority & 1) && (mopriority & 2)) || - (!(pfpriority & 2) && (mopriority & 2)) || - (!(pfpriority & 2) && (mopriority & 1)) || - ((pfpriority == 0) && (mopriority == 0))) - pfm = 0; - - /* compute the M7 signal */ - int m7 = 0; - if ((mo[x] & 0x0f) == 1) - m7 = 1; - - /* PF/M and M7 go in the GPC ASIC and select playfield or MO layers */ - if (!pfm && !m7) - { - if (!forcemc0) - pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; - else - pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK & ~0x70; - } - else - { - if (shade) - pf[x] |= 0x100; - if (m7) - pf[x] |= 0x080; - } - } - } - - /* add the alpha on top */ - m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* now go back and process the upper bit of MO priority */ - for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->top(); y <= rect->bottom(); y++) - { - uint16_t const *const mo = &mobitmap.pix(y); - uint16_t *const pf = &bitmap.pix(y); - for (int x = rect->left(); x <= rect->right(); x++) - if (mo[x] != 0xffff) - { - int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - - /* upper bit of MO priority might mean palette kludges */ - if (mopriority & 4) - { - /* if bit 2 is set, start setting high palette bits */ - if (mo[x] & 2) - m_mob->apply_stain(bitmap, pf, mo, x, y); - } - } - } - return 0; -} - - -uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if (m_video_disable) - { - bitmap.fill(m_palette->black_pen(), cliprect); - return 0; - } - - update_palette(); - - // start drawing - m_mob->draw_async(cliprect); - - /* draw the playfield */ - m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - // draw and merge the MO - bitmap_ind16 &mobitmap = m_mob->bitmap(); - for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->top(); y <= rect->bottom(); y++) - { - uint16_t const *const mo = &mobitmap.pix(y); - uint16_t *const pf = &bitmap.pix(y); - for (int x = rect->left(); x <= rect->right(); x++) - if (mo[x] != 0xffff) - { - int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int const pfpriority = (pf[x] >> 5) & 3; - - /* upper bit of MO priority signals special rendering and doesn't draw anything */ - if (mopriority & 4) - continue; - - /* check the priority */ - if (!(pf[x] & 8) || mopriority >= pfpriority) - pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; - } - } - - /* add the alpha on top */ - m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* now go back and process the upper bit of MO priority */ - for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->top(); y <= rect->bottom(); y++) - { - uint16_t const *const mo = &mobitmap.pix(y); - uint16_t *const pf = &bitmap.pix(y); - for (int x = rect->left(); x <= rect->right(); x++) - if (mo[x] != 0xffff) - { - int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - - /* upper bit of MO priority might mean palette kludges */ - if (mopriority & 4) - { - /* if bit 2 is set, start setting high palette bits */ - if (mo[x] & 2) - m_mob->apply_stain(bitmap, pf, mo, x, y); - } - } - } - - return 0; -} diff --git a/src/mame/atari/firetrk.cpp b/src/mame/atari/firetrk.cpp index 352c9770da3..4951c092672 100644 --- a/src/mame/atari/firetrk.cpp +++ b/src/mame/atari/firetrk.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Phil Stroffolino +// copyright-holders: Phil Stroffolino + /*************************************************************************** Atari Fire Truck + Super Bug + Monte Carlo driver @@ -7,26 +8,670 @@ ***************************************************************************/ #include "emu.h" -#include "firetrk.h" + +#include "firetrk_a.h" #include "cpu/m6800/m6800.h" +#include "machine/timer.h" +#include "machine/watchdog.h" #include "sound/discrete.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +#include "tilemap.h" #include "superbug.lh" -static constexpr XTAL MASTER_CLOCK = 12.096_MHz_XTAL; +namespace { + +class firetrk_state : public driver_device +{ +public: + firetrk_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_watchdog(*this, "watchdog") + , m_discrete(*this, "discrete") + , m_alpha_num_ram(*this, "alpha_num_ram") + , m_playfield_ram(*this, "playfield_ram") + , m_scroll_y(*this, "scroll_y") + , m_scroll_x(*this, "scroll_x") + , m_car_rot(*this, "car_rot") + , m_blink(*this, "blink") + , m_drone_x(*this, "drone_x") + , m_drone_y(*this, "drone_y") + , m_drone_rot(*this, "drone_rot") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_bit_0(*this, "BIT_0") + , m_bit_6(*this, "BIT_6") + , m_bit_7(*this, "BIT_7") + , m_dips(*this, {"DIP_0", "DIP_1"}) + , m_steer(*this, "STEER_%u", 1U) + , m_leds(*this, "led%u", 0U) + , m_p1gear(*this, "P1gear") + { } + + void firetrk(machine_config &config); + + template DECLARE_READ_LINE_MEMBER(steer_dir_r); + template DECLARE_READ_LINE_MEMBER(steer_flag_r); + template DECLARE_READ_LINE_MEMBER(skid_r); + template DECLARE_READ_LINE_MEMBER(crash_r); + template DECLARE_READ_LINE_MEMBER(gear_r); + DECLARE_INPUT_CHANGED_MEMBER(service_mode_switch_changed); + DECLARE_INPUT_CHANGED_MEMBER(firetrk_horn_changed); + DECLARE_INPUT_CHANGED_MEMBER(gear_changed); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_watchdog; + required_device m_discrete; + required_shared_ptr m_alpha_num_ram; + required_shared_ptr m_playfield_ram; + required_shared_ptr m_scroll_y; + required_shared_ptr m_scroll_x; + required_shared_ptr m_car_rot; + optional_shared_ptr m_blink; + optional_shared_ptr m_drone_x; + optional_shared_ptr m_drone_y; + optional_shared_ptr m_drone_rot; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + optional_ioport m_bit_0; + optional_ioport m_bit_6; + optional_ioport m_bit_7; + required_ioport_array<2> m_dips; + optional_ioport_array<2> m_steer; + output_finder<4> m_leds; + output_finder<> m_p1gear; + + uint8_t m_in_service_mode = 0; + uint32_t m_dial[2]{}; + uint8_t m_steer_dir[2]{}; + uint8_t m_steer_flag[2]{}; + uint8_t m_gear = 0; + + uint8_t m_flash = 0; + uint8_t m_crash[2]{}; + uint8_t m_skid[2]{}; + bitmap_ind16 m_helper[2]{}; + uint32_t m_color_mask[2]{}; + tilemap_t *m_tilemap[2]{}; + + const rectangle m_playfield_window { rectangle(0x02a, 0x115, 0x000, 0x0ff) }; + + uint8_t dip_r(offs_t offset); + uint8_t input_r(offs_t offset); + void blink_on_w(uint8_t data); + void steer_reset_w(uint8_t data); + void crash_reset_w(uint8_t data); + void skid_reset_w(uint8_t data); + void crash_snd_w(uint8_t data); + void skid_snd_w(uint8_t data); + void motor_snd_w(uint8_t data); + void xtndply_w(uint8_t data); + void check_collision(int which); + void draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *alpha_ram, int x, int count, int height); + +private: + static constexpr XTAL MASTER_CLOCK = 12.096_MHz_XTAL; + + void output_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); + void draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flash); + void set_service_mode(int enable); + + void palette(palette_device &palette); + TILE_GET_INFO_MEMBER(get_tile_info1); + TILE_GET_INFO_MEMBER(get_tile_info2); + + void program_map(address_map &map); +}; + +class montecar_state : public firetrk_state +{ +public: + using firetrk_state::firetrk_state; + + void montecar(machine_config &config); + +protected: + virtual void video_start() override; + +private: + void output_1_w(uint8_t data); + void output_2_w(uint8_t data); + uint8_t dip_r(offs_t offset); + uint8_t input_r(offs_t offset); + void car_reset_w(uint8_t data); + void drone_reset_w(uint8_t data); + void skid_reset_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int is_collision_detection); + + void prom_to_palette(int number, uint8_t val); + void palette(palette_device &palette); + TILE_GET_INFO_MEMBER(get_tile_info1); + TILE_GET_INFO_MEMBER(get_tile_info2); + + void program_map(address_map &map); +}; + +class superbug_state : public firetrk_state +{ +public: + using firetrk_state::firetrk_state; + + void superbug(machine_config &config); + +protected: + virtual void video_start() override; + +private: + void output_w(offs_t offset, uint8_t data); + void motor_snd_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int flash); + + TILE_GET_INFO_MEMBER(get_tile_info1); + TILE_GET_INFO_MEMBER(get_tile_info2); + + void program_map(address_map &map); +}; + + +// video + +void firetrk_state::palette(palette_device &palette) +{ + static constexpr uint8_t colortable_source[] = + { + 0, 0, 1, 0, + 2, 0, 3, 0, + 3, 3, 2, 3, + 1, 3, 0, 3, + 0, 0, 1, 0, + 2, 0, 0, 3, + 3, 0, 0, 3 + }; + static constexpr rgb_t palette_source[] = + { + rgb_t::black(), + rgb_t(0x5b, 0x5b, 0x5b), + rgb_t(0xa4, 0xa4, 0xa4), + rgb_t::white() + }; + + m_color_mask[0] = m_color_mask[1] = 0; + + for (int i = 0; i < std::size(colortable_source); i++) + { + uint8_t const color = colortable_source[i]; + + if (color == 1) + m_color_mask[0] |= 1 << i; + else if (color == 2) + m_color_mask[1] |= 1 << i; + + palette.set_pen_color(i, palette_source[color]); + } +} + + +void montecar_state::prom_to_palette(int number, uint8_t val) +{ + m_palette->set_pen_color(number, rgb_t(pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0))); +} + + +void montecar_state::palette(palette_device &palette) +{ + const uint8_t *color_prom = memregion("proms")->base(); + + static constexpr uint8_t colortable_source[] = + { + 0x00, 0x00, 0x00, 0x01, + 0x00, 0x02, 0x00, 0x03, + 0x03, 0x03, 0x03, 0x02, + 0x03, 0x01, 0x03, 0x00, + 0x00, 0x00, 0x02, 0x00, + 0x02, 0x01, 0x02, 0x02, + 0x00, 0x10, 0x20, 0x30, + 0x00, 0x04, 0x08, 0x0c, + 0x00, 0x44, 0x48, 0x4c, + 0x00, 0x84, 0x88, 0x8c, + 0x00, 0xc4, 0xc8, 0xcc + }; + + /* + * The color PROM is addressed as follows: + * + * A0 => PLAYFIELD 1 + * A1 => PLAYFIELD 2 + * A2 => DRONE 1 + * A3 => DRONE 2 + * A4 => CAR 1 + * A5 => CAR 2 + * A6 => DRONE COLOR 1 + * A7 => DRONE COLOR 2 + * A8 => PLAYFIELD WINDOW + * + * This driver hard-codes some behavior which actually depends + * on the PROM, like priorities, clipping and transparency. + * + */ + + m_color_mask[0] = m_color_mask[1] = 0; + + for (int i = 0; i < std::size(colortable_source); i++) + { + uint8_t const color = colortable_source[i]; + + if (color == 1) + m_color_mask[0] |= 1 << i; + else if (color == 2) + m_color_mask[1] |= 1 << i; + + prom_to_palette(i, color_prom[0x100 + colortable_source[i]]); + } + + palette.set_pen_color(std::size(colortable_source) + 0, rgb_t::black()); + palette.set_pen_color(std::size(colortable_source) + 1, rgb_t::white()); +} + + +TILE_GET_INFO_MEMBER(firetrk_state::get_tile_info1) +{ + int const code = m_playfield_ram[tile_index] & 0x3f; + int color = (m_playfield_ram[tile_index] >> 6) & 0x03; + + if (*m_blink && (code >= 0x04) && (code <= 0x0b)) + color = 0; + + if (m_flash) + color = color | 0x04; + + tileinfo.set(1, code, color, 0); +} + + +TILE_GET_INFO_MEMBER(superbug_state::get_tile_info1) +{ + int const code = m_playfield_ram[tile_index] & 0x3f; + int color = (m_playfield_ram[tile_index] >> 6) & 0x03; + + if (*m_blink && (code >= 0x08) && (code <= 0x0f)) + color = 0; + + if (m_flash) + color = color | 0x04; + + tileinfo.set(1, code, color, 0); +} + + +TILE_GET_INFO_MEMBER(montecar_state::get_tile_info1) +{ + int const code = m_playfield_ram[tile_index] & 0x3f; + int color = (m_playfield_ram[tile_index] >> 6) & 0x03; + + if (m_flash) + color = color | 0x04; + + tileinfo.set(1, code, color, 0); +} + + +TILE_GET_INFO_MEMBER(firetrk_state::get_tile_info2) +{ + uint8_t const code = m_playfield_ram[tile_index] & 0x3f; + int color = 0; + + // palette 1 for crash and palette 2 for skid + if (((code & 0x30) != 0x00) || ((code & 0x0c) == 0x00)) + color = 1; // palette 0, 1 + + if ((code & 0x3c) == 0x0c) + color = 2; // palette 0, 2 + + tileinfo.set(2, code, color, 0); +} + + +TILE_GET_INFO_MEMBER(superbug_state::get_tile_info2) +{ + uint8_t const code = m_playfield_ram[tile_index] & 0x3f; + int color = 0; + + // palette 1 for crash and palette 2 for skid + if ((code & 0x30) != 0x00) + color = 1; // palette 0, 1 + + if ((code & 0x38) == 0x00) + color = 2; // palette 0, 2 + + tileinfo.set(2, code, color, 0); +} + + +TILE_GET_INFO_MEMBER(montecar_state::get_tile_info2) +{ + uint8_t const code = m_playfield_ram[tile_index]; + int color = 0; + + // palette 1 for crash and palette 2 for skid + if (((code & 0xc0) == 0x40) || ((code & 0xc0) == 0x80)) + color = 2; // palette 2, 1 + + if ((code & 0xc0) == 0xc0) + color = 1; // palette 2, 0 + + if ((code & 0xc0) == 0x00) + color = 3; // palette 2, 2 + + if ((code & 0x30) == 0x30) + color = 0; // palette 0, 0 + + tileinfo.set(2, code & 0x3f, color, 0); +} + + +void firetrk_state::video_start() +{ + m_screen->register_screen_bitmap(m_helper[0]); + m_screen->register_screen_bitmap(m_helper[1]); + + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); + m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); +} + + +void superbug_state::video_start() +{ + m_screen->register_screen_bitmap(m_helper[0]); + m_screen->register_screen_bitmap(m_helper[1]); + + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(superbug_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); + m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(superbug_state::get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); +} + + +void montecar_state::video_start() +{ + m_screen->register_screen_bitmap(m_helper[0]); + m_screen->register_screen_bitmap(m_helper[1]); + + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(montecar_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); + m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(montecar_state::get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); +} + + +void firetrk_state::draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flash) +{ + int gfx_bank, code, color, flip_x, flip_y, x, y; + + if (which) + { + gfx_bank = 5; + code = *m_drone_rot & 0x07; + color = flash ? 1 : 0; + flip_x = *m_drone_rot & 0x08; + flip_y = *m_drone_rot & 0x10; + x = (flip_x ? *m_drone_x - 63 : 192 - *m_drone_x) + 36; + y = flip_y ? *m_drone_y - 63 : 192 - *m_drone_y; + } + else + { + gfx_bank = (*m_car_rot & 0x10) ? 4 : 3; + code = *m_car_rot & 0x03; + color = flash ? 1 : 0; + flip_x = *m_car_rot & 0x04; + flip_y = *m_car_rot & 0x08; + x = 144; + y = 104; + } + + m_gfxdecode->gfx(gfx_bank)->transpen(bitmap, cliprect, code, color, flip_x, flip_y, x, y, 0); +} + + +void superbug_state::draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int flash) +{ + int const gfx_bank = (*m_car_rot & 0x10) ? 4 : 3; + int const code = ~*m_car_rot & 0x03; + int const color = flash ? 1 : 0; + int const flip_x = *m_car_rot & 0x04; + int const flip_y = *m_car_rot & 0x08; + + m_gfxdecode->gfx(gfx_bank)->transpen(bitmap, cliprect, code, color, flip_x, flip_y, 144, 104, 0); +} + + +void montecar_state::draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int is_collision_detection) +{ + int gfx_bank, code, color, flip_x, flip_y, x, y; + + if (which) + { + gfx_bank = 4; + code = *m_drone_rot & 0x07; + color = is_collision_detection ? 0 : (((*m_car_rot & 0x80) >> 6) | ((*m_drone_rot & 0x80) >> 7)); + flip_x = *m_drone_rot & 0x10; + flip_y = *m_drone_rot & 0x08; + x = (flip_x ? *m_drone_x - 31 : 224 - *m_drone_x) + 34; + y = flip_y ? *m_drone_y - 31 : 224 - *m_drone_y; + } + else + { + gfx_bank = 3; + code = *m_car_rot & 0x07; + color = 0; + flip_x = *m_car_rot & 0x10; + flip_y = *m_car_rot & 0x08; + x = 144; + y = 104; + } + + m_gfxdecode->gfx(gfx_bank)->transpen(bitmap, cliprect, code, color, flip_x, flip_y, x, y, 0); +} + + +void firetrk_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *alpha_ram, int x, int count, int height) +{ + for (int i = 0; i < count; i++) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, alpha_ram[i], 0, 0, 0, x, i * height); +} + + +void firetrk_state::check_collision(int which) +{ + for (int y = m_playfield_window.top(); y <= m_playfield_window.bottom(); y++) + for (int x = m_playfield_window.left(); x <= m_playfield_window.right(); x++) + { + pen_t const a = m_helper[0].pix(y, x); + pen_t const b = m_helper[1].pix(y, x); + + if (b != 0xff && (m_color_mask[0] >> a) & 1) + m_crash[which] = 1; + + if (b != 0xff && (m_color_mask[1] >> a) & 1) + m_skid[which] = 1; + } +} + + +uint32_t firetrk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + machine().tilemap().mark_all_dirty(); + m_tilemap[0]->set_scrollx(0, *m_scroll_x - 37); + m_tilemap[1]->set_scrollx(0, *m_scroll_x - 37); + m_tilemap[0]->set_scrolly(0, *m_scroll_y); + m_tilemap[1]->set_scrolly(0, *m_scroll_y); + + bitmap.fill(0, cliprect); + m_tilemap[0]->draw(screen, bitmap, m_playfield_window, 0, 0); + draw_car(bitmap, m_playfield_window, 0, m_flash); + draw_car(bitmap, m_playfield_window, 1, m_flash); + draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10); + draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10); + + if (cliprect.bottom() == screen.visible_area().bottom()) + { + m_tilemap[1]->draw(screen, m_helper[0], m_playfield_window, 0, 0); + + m_helper[1].fill(0xff, m_playfield_window); + draw_car(m_helper[1], m_playfield_window, 0, false); + check_collision(0); + + m_helper[1].fill(0xff, m_playfield_window); + draw_car(m_helper[1], m_playfield_window, 1, false); + check_collision(1); + + *m_blink = false; + } + + return 0; +} + + +uint32_t superbug_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + machine().tilemap().mark_all_dirty(); + m_tilemap[0]->set_scrollx(0, *m_scroll_x - 37); + m_tilemap[1]->set_scrollx(0, *m_scroll_x - 37); + m_tilemap[0]->set_scrolly(0, *m_scroll_y); + m_tilemap[1]->set_scrolly(0, *m_scroll_y); + + bitmap.fill(0, cliprect); + m_tilemap[0]->draw(screen, bitmap, m_playfield_window, 0, 0); + draw_car(bitmap, m_playfield_window, m_flash); + draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10); + draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10); + + if (cliprect.bottom() == screen.visible_area().bottom()) + { + m_tilemap[1]->draw(screen, m_helper[0], m_playfield_window, 0, 0); + + m_helper[1].fill(0xff, m_playfield_window); + draw_car(m_helper[1], m_playfield_window, false); + check_collision(0); + + *m_blink = false; + } + + return 0; +} + + +uint32_t montecar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + machine().tilemap().mark_all_dirty(); + m_tilemap[0]->set_scrollx(0, *m_scroll_x - 37); + m_tilemap[1]->set_scrollx(0, *m_scroll_x - 37); + m_tilemap[0]->set_scrolly(0, *m_scroll_y); + m_tilemap[1]->set_scrolly(0, *m_scroll_y); + + bitmap.fill(0x2c, cliprect); + m_tilemap[0]->draw(screen, bitmap, m_playfield_window, 0, 0); + draw_car(bitmap, m_playfield_window, 0, false); + draw_car(bitmap, m_playfield_window, 1, false); + draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 24, 0x20, 0x08); + draw_text(bitmap, cliprect, m_alpha_num_ram + 0x20, 16, 0x20, 0x08); + + if (cliprect.bottom() == screen.visible_area().bottom()) + { + m_tilemap[1]->draw(screen, m_helper[0], m_playfield_window, 0, 0); + + m_helper[1].fill(0xff, m_playfield_window); + draw_car(m_helper[1], m_playfield_window, 0, true); + check_collision(0); + + m_helper[1].fill(0xff, m_playfield_window); + draw_car(m_helper[1], m_playfield_window, 1, true); + check_collision(1); + } + + return 0; +} + + +// audio + +void firetrk_state::skid_reset_w(uint8_t data) +{ + m_skid[0] = 0; + m_skid[1] = 0; + + // also SUPERBUG_SKID_EN + m_discrete->write(FIRETRUCK_SKID_EN, 1); +} + + +void montecar_state::skid_reset_w(uint8_t data) +{ + m_discrete->write(MONTECAR_SKID_EN, 1); +} + + +void firetrk_state::crash_snd_w(uint8_t data) +{ + // also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA + m_discrete->write(FIRETRUCK_CRASH_DATA, data >> 4); +} + + +void firetrk_state::skid_snd_w(uint8_t data) +{ + // also SUPERBUG_SKID_EN and MONTECAR_SKID_EN + m_discrete->write(FIRETRUCK_SKID_EN, 0); +} + + +void firetrk_state::motor_snd_w(uint8_t data) +{ + // also MONTECAR_DRONE_MOTOR_DATA + m_discrete->write(FIRETRUCK_SIREN_DATA, data >> 4); + + // also MONTECAR_MOTOR_DATA + m_discrete->write(FIRETRUCK_MOTOR_DATA, data & 0x0f); +} + + +void superbug_state::motor_snd_w(uint8_t data) +{ + m_discrete->write(SUPERBUG_SPEED_DATA, data & 0x0f); +} + + +void firetrk_state::xtndply_w(uint8_t data) +{ + // also SUPERBUG_ASR_EN (extended play) + m_discrete->write(FIRETRUCK_XTNDPLY_EN, data); +} + + +// machine void firetrk_state::set_service_mode(int enable) { m_in_service_mode = enable; - /* watchdog is disabled during service mode */ + // watchdog is disabled during service mode m_watchdog->watchdog_enable(!enable); - /* change CPU clock speed according to service switch change */ - m_maincpu->set_unscaled_clock(enable ? (MASTER_CLOCK/16) : (MASTER_CLOCK/12)); + // change CPU clock speed according to service switch change + m_maincpu->set_unscaled_clock(enable ? (MASTER_CLOCK / 16) : (MASTER_CLOCK / 12)); } @@ -47,18 +692,18 @@ INPUT_CHANGED_MEMBER(firetrk_state::gear_changed) if (newval) { m_gear = param; - output().set_value("P1gear", m_gear+1); + m_p1gear = m_gear + 1; } } -TIMER_DEVICE_CALLBACK_MEMBER(firetrk_state::firetrk_scanline) +TIMER_DEVICE_CALLBACK_MEMBER(firetrk_state::scanline) { - int scanline = param; + int const scanline = param; // periodic IRQs are generated by inverse 16V signal if ((scanline & 0x1f) == 0 && scanline != 0) - m_maincpu->pulse_input_line(0, attotime::from_hz(MASTER_CLOCK/2/64)); + m_maincpu->pulse_input_line(0, attotime::from_hz(MASTER_CLOCK / 2 / 64)); // vblank interrupt // NMIs are disabled during service mode @@ -67,79 +712,79 @@ TIMER_DEVICE_CALLBACK_MEMBER(firetrk_state::firetrk_scanline) } -void firetrk_state::firetrk_output_w(uint8_t data) +void firetrk_state::output_w(uint8_t data) { - /* BIT0 => START1 LAMP */ + // BIT0 => START1 LAMP m_leds[0] = BIT(~data, 0); - /* BIT1 => START2 LAMP */ - m_leds[1]= BIT(~data, 1); + // BIT1 => START2 LAMP + m_leds[1] = BIT(~data, 1); - /* BIT2 => FLASH */ + // BIT2 => FLASH m_flash = data & 0x04; - /* BIT3 => TRACK LAMP */ + // BIT3 => TRACK LAMP m_leds[3] = BIT(~data, 3); - /* BIT4 => ATTRACT */ + // BIT4 => ATTRACT m_discrete->write(FIRETRUCK_ATTRACT_EN, data & 0x10); machine().bookkeeping().coin_lockout_w(0, !(data & 0x10)); machine().bookkeeping().coin_lockout_w(1, !(data & 0x10)); - /* BIT5 => START3 LAMP */ + // BIT5 => START3 LAMP m_leds[2] = BIT(~data, 5); - /* BIT6 => UNUSED */ + // BIT6 => UNUSED - /* BIT7 => BELL OUT */ + // BIT7 => BELL OUT m_discrete->write(FIRETRUCK_BELL_EN, data & 0x80); } -void firetrk_state::superbug_output_w(offs_t offset, uint8_t data) +void superbug_state::output_w(offs_t offset, uint8_t data) { - /* BIT0 => START LAMP */ + // BIT0 => START LAMP m_leds[0] = BIT(offset, 0); - /* BIT1 => ATTRACT */ + // BIT1 => ATTRACT m_discrete->write(SUPERBUG_ATTRACT_EN, offset & 0x02); machine().bookkeeping().coin_lockout_w(0, !(offset & 0x02)); machine().bookkeeping().coin_lockout_w(1, !(offset & 0x02)); - /* BIT2 => FLASH */ + // BIT2 => FLASH m_flash = offset & 0x04; - /* BIT3 => TRACK LAMP */ + // BIT3 => TRACK LAMP m_leds[1] = BIT(offset, 3); } -void firetrk_state::montecar_output_1_w(uint8_t data) +void montecar_state::output_1_w(uint8_t data) { - /* BIT0 => START LAMP */ + // BIT0 => START LAMP m_leds[0] = BIT(~data, 0); - /* BIT1 => TRACK LAMP */ + // BIT1 => TRACK LAMP m_leds[1] = BIT(~data, 1); - /* BIT2 => ATTRACT */ + // BIT2 => ATTRACT m_discrete->write(MONTECAR_ATTRACT_INV, data & 0x04); - /* BIT3 => UNUSED */ - /* BIT4 => UNUSED */ + // BIT3 => UNUSED + // BIT4 => UNUSED - /* BIT5 => COIN3 COUNTER */ + // BIT5 => COIN3 COUNTER machine().bookkeeping().coin_counter_w(0, data & 0x80); - /* BIT6 => COIN2 COUNTER */ + // BIT6 => COIN2 COUNTER machine().bookkeeping().coin_counter_w(1, data & 0x40); - /* BIT7 => COIN1 COUNTER */ + // BIT7 => COIN1 COUNTER machine().bookkeeping().coin_counter_w(2, data & 0x20); } -void firetrk_state::montecar_output_2_w(uint8_t data) +void montecar_state::output_2_w(uint8_t data) { m_flash = data & 0x80; @@ -148,16 +793,31 @@ void firetrk_state::montecar_output_2_w(uint8_t data) } +void firetrk_state::machine_start() +{ + m_leds.resolve(); + m_p1gear.resolve(); + + save_item(NAME(m_in_service_mode)); + save_item(NAME(m_dial)); + save_item(NAME(m_steer_dir)); + save_item(NAME(m_steer_flag)); + save_item(NAME(m_gear)); + save_item(NAME(m_crash)); + save_item(NAME(m_skid)); +} + + void firetrk_state::machine_reset() { set_service_mode(0); } -uint8_t firetrk_state::firetrk_dip_r(offs_t offset) +uint8_t firetrk_state::dip_r(offs_t offset) { uint8_t val0 = m_dips[0]->read(); - uint8_t val1 = m_dips[1]->read(); + uint8_t const val1 = m_dips[1]->read(); if (val1 & (1 << (2 * offset + 0))) val0 |= 1; if (val1 & (1 << (2 * offset + 1))) val0 |= 2; @@ -166,10 +826,10 @@ uint8_t firetrk_state::firetrk_dip_r(offs_t offset) } -uint8_t firetrk_state::montecar_dip_r(offs_t offset) +uint8_t montecar_state::dip_r(offs_t offset) { uint8_t val0 = m_dips[0]->read(); - uint8_t val1 = m_dips[1]->read(); + uint8_t const val1 = m_dips[1]->read(); if (val1 & (1 << (3 - offset))) val0 |= 1; if (val1 & (1 << (7 - offset))) val0 |= 2; @@ -227,9 +887,9 @@ READ_LINE_MEMBER(firetrk_state::gear_r) } -uint8_t firetrk_state::firetrk_input_r(offs_t offset) +uint8_t firetrk_state::input_r(offs_t offset) { - /* update steering wheels */ + // update steering wheels for (int i = 0; i < 2; i++) { uint32_t const new_dial = m_steer[i].read_safe(0); @@ -250,14 +910,14 @@ uint8_t firetrk_state::firetrk_input_r(offs_t offset) } -uint8_t firetrk_state::montecar_input_r(offs_t offset) +uint8_t montecar_state::input_r(offs_t offset) { - uint8_t ret = firetrk_input_r(offset); + uint8_t ret = firetrk_state::input_r(offset); if (m_crash[0]) ret |= 0x02; - /* can this be right, bit 0 again ???? */ + // can this be right, bit 0 again ???? if (m_crash[1]) ret |= 0x01; @@ -271,14 +931,14 @@ void firetrk_state::blink_on_w(uint8_t data) } -void firetrk_state::montecar_car_reset_w(uint8_t data) +void montecar_state::car_reset_w(uint8_t data) { m_crash[0] = 0; m_skid[0] = 0; } -void firetrk_state::montecar_drone_reset_w(uint8_t data) +void montecar_state::drone_reset_w(uint8_t data) { m_crash[1] = 0; m_skid[1] = 0; @@ -299,81 +959,81 @@ void firetrk_state::crash_reset_w(uint8_t data) } -void firetrk_state::firetrk_map(address_map &map) +void firetrk_state::program_map(address_map &map) { map.global_mask(0x3fff); - map(0x0000, 0x00ff).mirror(0x0700).ram().share("alpha_num_ram"); - map(0x0800, 0x08ff).mirror(0x0700).ram().share("playfield_ram"); - map(0x1000, 0x1000).mirror(0x001f).writeonly().share("scroll_y"); - map(0x1020, 0x1020).mirror(0x001f).writeonly().share("scroll_x"); + map(0x0000, 0x00ff).mirror(0x0700).ram().share(m_alpha_num_ram); + map(0x0800, 0x08ff).mirror(0x0700).ram().share(m_playfield_ram); + map(0x1000, 0x1000).mirror(0x001f).writeonly().share(m_scroll_y); + map(0x1020, 0x1020).mirror(0x001f).writeonly().share(m_scroll_x); map(0x1040, 0x1040).mirror(0x001f).w(FUNC(firetrk_state::crash_reset_w)); - map(0x1060, 0x1060).mirror(0x001f).w(FUNC(firetrk_state::firetrk_skid_reset_w)); - map(0x1080, 0x1080).mirror(0x001f).writeonly().share("car_rot"); + map(0x1060, 0x1060).mirror(0x001f).w(FUNC(firetrk_state::skid_reset_w)); + map(0x1080, 0x1080).mirror(0x001f).writeonly().share(m_car_rot); map(0x10a0, 0x10a0).mirror(0x001f).w(FUNC(firetrk_state::steer_reset_w)); map(0x10c0, 0x10c0).mirror(0x001f).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); - map(0x10e0, 0x10e0).mirror(0x001f).w(FUNC(firetrk_state::blink_on_w)).share("blink"); - map(0x1400, 0x1400).mirror(0x001f).w(FUNC(firetrk_state::firetrk_motor_snd_w)); - map(0x1420, 0x1420).mirror(0x001f).w(FUNC(firetrk_state::firetrk_crash_snd_w)); - map(0x1440, 0x1440).mirror(0x001f).w(FUNC(firetrk_state::firetrk_skid_snd_w)); - map(0x1460, 0x1460).mirror(0x001f).writeonly().share("drone_x"); - map(0x1480, 0x1480).mirror(0x001f).writeonly().share("drone_y"); - map(0x14a0, 0x14a0).mirror(0x001f).writeonly().share("drone_rot"); - map(0x14c0, 0x14c0).mirror(0x001f).w(FUNC(firetrk_state::firetrk_output_w)); - map(0x14e0, 0x14e0).mirror(0x001f).w(FUNC(firetrk_state::firetrk_xtndply_w)); - map(0x1800, 0x1807).mirror(0x03f8).r(FUNC(firetrk_state::firetrk_input_r)).nopw(); - map(0x1c00, 0x1c03).mirror(0x03fc).r(FUNC(firetrk_state::firetrk_dip_r)); + map(0x10e0, 0x10e0).mirror(0x001f).w(FUNC(firetrk_state::blink_on_w)).share(m_blink); + map(0x1400, 0x1400).mirror(0x001f).w(FUNC(firetrk_state::motor_snd_w)); + map(0x1420, 0x1420).mirror(0x001f).w(FUNC(firetrk_state::crash_snd_w)); + map(0x1440, 0x1440).mirror(0x001f).w(FUNC(firetrk_state::skid_snd_w)); + map(0x1460, 0x1460).mirror(0x001f).writeonly().share(m_drone_x); + map(0x1480, 0x1480).mirror(0x001f).writeonly().share(m_drone_y); + map(0x14a0, 0x14a0).mirror(0x001f).writeonly().share(m_drone_rot); + map(0x14c0, 0x14c0).mirror(0x001f).w(FUNC(firetrk_state::output_w)); + map(0x14e0, 0x14e0).mirror(0x001f).w(FUNC(firetrk_state::xtndply_w)); + map(0x1800, 0x1807).mirror(0x03f8).r(FUNC(firetrk_state::input_r)).nopw(); + map(0x1c00, 0x1c03).mirror(0x03fc).r(FUNC(firetrk_state::dip_r)); map(0x2000, 0x3fff).rom(); } -void firetrk_state::superbug_map(address_map &map) +void superbug_state::program_map(address_map &map) { map.global_mask(0x1fff); map(0x0000, 0x00ff).ram(); - map(0x0100, 0x0100).mirror(0x001f).writeonly().share("scroll_y"); - map(0x0120, 0x0120).mirror(0x001f).writeonly().share("scroll_x"); - map(0x0140, 0x0140).mirror(0x001f).w(FUNC(firetrk_state::crash_reset_w)); - map(0x0160, 0x0160).mirror(0x001f).w(FUNC(firetrk_state::firetrk_skid_reset_w)); - map(0x0180, 0x0180).mirror(0x001f).writeonly().share("car_rot"); - map(0x01a0, 0x01a0).mirror(0x001f).w(FUNC(firetrk_state::steer_reset_w)); + map(0x0100, 0x0100).mirror(0x001f).writeonly().share(m_scroll_y); + map(0x0120, 0x0120).mirror(0x001f).writeonly().share(m_scroll_x); + map(0x0140, 0x0140).mirror(0x001f).w(FUNC(superbug_state::crash_reset_w)); + map(0x0160, 0x0160).mirror(0x001f).w(FUNC(superbug_state::skid_reset_w)); + map(0x0180, 0x0180).mirror(0x001f).writeonly().share(m_car_rot); + map(0x01a0, 0x01a0).mirror(0x001f).w(FUNC(superbug_state::steer_reset_w)); map(0x01c0, 0x01c0).mirror(0x001f).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); - map(0x01e0, 0x01e0).mirror(0x001f).w(FUNC(firetrk_state::blink_on_w)).share("blink"); - map(0x0200, 0x0207).mirror(0x0018).r(FUNC(firetrk_state::firetrk_input_r)); - map(0x0220, 0x0220).mirror(0x001f).w(FUNC(firetrk_state::firetrk_xtndply_w)); - map(0x0240, 0x0243).mirror(0x001c).r(FUNC(firetrk_state::firetrk_dip_r)); - map(0x0260, 0x026f).mirror(0x0010).w(FUNC(firetrk_state::superbug_output_w)); - map(0x0280, 0x0280).mirror(0x001f).w(FUNC(firetrk_state::superbug_motor_snd_w)); - map(0x02a0, 0x02a0).mirror(0x001f).w(FUNC(firetrk_state::firetrk_crash_snd_w)); - map(0x02c0, 0x02c0).mirror(0x001f).w(FUNC(firetrk_state::firetrk_skid_snd_w)); - map(0x0400, 0x041f).ram().share("alpha_num_ram"); - map(0x0500, 0x05ff).ram().share("playfield_ram"); + map(0x01e0, 0x01e0).mirror(0x001f).w(FUNC(superbug_state::blink_on_w)).share(m_blink); + map(0x0200, 0x0207).mirror(0x0018).r(FUNC(superbug_state::input_r)); + map(0x0220, 0x0220).mirror(0x001f).w(FUNC(superbug_state::xtndply_w)); + map(0x0240, 0x0243).mirror(0x001c).r(FUNC(superbug_state::dip_r)); + map(0x0260, 0x026f).mirror(0x0010).w(FUNC(superbug_state::output_w)); + map(0x0280, 0x0280).mirror(0x001f).w(FUNC(superbug_state::motor_snd_w)); + map(0x02a0, 0x02a0).mirror(0x001f).w(FUNC(superbug_state::crash_snd_w)); + map(0x02c0, 0x02c0).mirror(0x001f).w(FUNC(superbug_state::skid_snd_w)); + map(0x0400, 0x041f).ram().share(m_alpha_num_ram); + map(0x0500, 0x05ff).ram().share(m_playfield_ram); map(0x0800, 0x1fff).rom(); } -void firetrk_state::montecar_map(address_map &map) +void montecar_state::program_map(address_map &map) { map.global_mask(0x3fff); - map(0x0000, 0x00ff).mirror(0x0700).ram().share("alpha_num_ram"); - map(0x0800, 0x08ff).mirror(0x0700).ram().share("playfield_ram"); - map(0x1000, 0x1000).mirror(0x001f).writeonly().share("scroll_y"); - map(0x1020, 0x1020).mirror(0x001f).writeonly().share("scroll_x"); - map(0x1040, 0x1040).mirror(0x001f).w(FUNC(firetrk_state::montecar_drone_reset_w)); - map(0x1060, 0x1060).mirror(0x001f).w(FUNC(firetrk_state::montecar_car_reset_w)); - map(0x1080, 0x1080).mirror(0x001f).writeonly().share("car_rot"); - map(0x10a0, 0x10a0).mirror(0x001f).w(FUNC(firetrk_state::steer_reset_w)); + map(0x0000, 0x00ff).mirror(0x0700).ram().share(m_alpha_num_ram); + map(0x0800, 0x08ff).mirror(0x0700).ram().share(m_playfield_ram); + map(0x1000, 0x1000).mirror(0x001f).writeonly().share(m_scroll_y); + map(0x1020, 0x1020).mirror(0x001f).writeonly().share(m_scroll_x); + map(0x1040, 0x1040).mirror(0x001f).w(FUNC(montecar_state::drone_reset_w)); + map(0x1060, 0x1060).mirror(0x001f).w(FUNC(montecar_state::car_reset_w)); + map(0x1080, 0x1080).mirror(0x001f).writeonly().share(m_car_rot); + map(0x10a0, 0x10a0).mirror(0x001f).w(FUNC(montecar_state::steer_reset_w)); map(0x10c0, 0x10c0).mirror(0x001f).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); - map(0x10e0, 0x10e0).mirror(0x001f).w(FUNC(firetrk_state::montecar_skid_reset_w)); - map(0x1400, 0x1400).mirror(0x001f).w(FUNC(firetrk_state::firetrk_motor_snd_w)); - map(0x1420, 0x1420).mirror(0x001f).w(FUNC(firetrk_state::firetrk_crash_snd_w)); - map(0x1440, 0x1440).mirror(0x001f).w(FUNC(firetrk_state::firetrk_skid_snd_w)); - map(0x1460, 0x1460).mirror(0x001f).writeonly().share("drone_x"); - map(0x1480, 0x1480).mirror(0x001f).writeonly().share("drone_y"); - map(0x14a0, 0x14a0).mirror(0x001f).writeonly().share("drone_rot"); - map(0x14c0, 0x14c0).mirror(0x001f).w(FUNC(firetrk_state::montecar_output_1_w)); - map(0x14e0, 0x14e0).mirror(0x001f).w(FUNC(firetrk_state::montecar_output_2_w)); - map(0x1800, 0x1807).mirror(0x03f8).r(FUNC(firetrk_state::montecar_input_r)).nopw(); - map(0x1c00, 0x1c03).mirror(0x03fc).r(FUNC(firetrk_state::montecar_dip_r)); + map(0x10e0, 0x10e0).mirror(0x001f).w(FUNC(montecar_state::skid_reset_w)); + map(0x1400, 0x1400).mirror(0x001f).w(FUNC(montecar_state::motor_snd_w)); + map(0x1420, 0x1420).mirror(0x001f).w(FUNC(montecar_state::crash_snd_w)); + map(0x1440, 0x1440).mirror(0x001f).w(FUNC(montecar_state::skid_snd_w)); + map(0x1460, 0x1460).mirror(0x001f).writeonly().share(m_drone_x); + map(0x1480, 0x1480).mirror(0x001f).writeonly().share(m_drone_y); + map(0x14a0, 0x14a0).mirror(0x001f).writeonly().share(m_drone_rot); + map(0x14c0, 0x14c0).mirror(0x001f).w(FUNC(montecar_state::output_1_w)); + map(0x14e0, 0x14e0).mirror(0x001f).w(FUNC(montecar_state::output_2_w)); + map(0x1800, 0x1807).mirror(0x03f8).r(FUNC(montecar_state::input_r)).nopw(); + map(0x1c00, 0x1c03).mirror(0x03fc).r(FUNC(montecar_state::dip_r)); map(0x2000, 0x3fff).rom(); } @@ -386,8 +1046,8 @@ static INPUT_PORTS_START( firetrk ) PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_START("DIP_0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // other DIPs connect here + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // other DIPs connect here PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Coinage )) PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C )) PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C )) @@ -462,8 +1122,8 @@ static INPUT_PORTS_START( superbug ) PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_START("DIP_0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // other DIPs connect here + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // other DIPs connect here PORT_START("DIP_1") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) @@ -523,8 +1183,8 @@ static INPUT_PORTS_START( montecar ) PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_START("DIP_0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // other DIPs connect here + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // other DIPs connect here PORT_DIPNAME( 0x0c, 0x0c, "Coin 3 Multiplier" ) PORT_DIPSETTING( 0x0c, "1" ) PORT_DIPSETTING( 0x08, "4" ) @@ -595,10 +1255,10 @@ INPUT_PORTS_END static const gfx_layout firetrk_text_layout = { - 16, 16, /* width, height */ - 32, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 16, 16, // width, height + 32, // total + 1, // planes + { 0 }, // plane offsets { 0x1c, 0x1d, 0x1e, 0x1f, 0x04, 0x05, 0x06, 0x07, 0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17 @@ -613,10 +1273,10 @@ static const gfx_layout firetrk_text_layout = static const gfx_layout superbug_text_layout = { - 16, 16, /* width, height */ - 32, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 16, 16, // width, height + 32, // total + 1, // planes + { 0 }, // plane offsets { 0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17, 0x1c, 0x1d, 0x1e, 0x1f, 0x04, 0x05, 0x06, 0x07 @@ -631,10 +1291,10 @@ static const gfx_layout superbug_text_layout = static const gfx_layout montecar_text_layout = { - 8, 8, /* width, height */ - 64, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 8, 8, // width, height + 64, // total + 1, // planes + { 0 }, // plane offsets { 0xc, 0xd, 0xe, 0xf, 0x4, 0x5, 0x6, 0x7 }, @@ -647,10 +1307,10 @@ static const gfx_layout montecar_text_layout = static const gfx_layout firetrk_tile_layout = { - 16, 16, /* width, height */ - 64, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 16, 16, // width, height + 64, // total + 1, // planes + { 0 }, // plane offsets { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf @@ -665,10 +1325,10 @@ static const gfx_layout firetrk_tile_layout = static const gfx_layout superbug_tile_layout = { - 16, 16, /* width, height */ - 64, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 16, 16, // width, height + 64, // total + 1, // planes + { 0 }, // plane offsets { 0x07, 0x06, 0x05, 0x04, 0x0f, 0x0e, 0x0d, 0x0c, 0x17, 0x16, 0x15, 0x14, 0x1f, 0x1e, 0x1d, 0x1c @@ -683,10 +1343,10 @@ static const gfx_layout superbug_tile_layout = static const gfx_layout firetrk_car_layout1 = { - 32, 32, /* width, height */ - 4, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 32, 32, // width, height + 4, // total + 1, // planes + { 0 }, // plane offsets { 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0, @@ -705,10 +1365,10 @@ static const gfx_layout firetrk_car_layout1 = static const gfx_layout superbug_car_layout1 = { - 32, 32, /* width, height */ - 4, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 32, 32, // width, height + 4, // total + 1, // planes + { 0 }, // plane offsets { 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, @@ -727,10 +1387,10 @@ static const gfx_layout superbug_car_layout1 = static const gfx_layout montecar_car_layout = { - 32, 32, /* width, height */ - 8, /* total */ - 2, /* planes */ - /* plane offsets */ + 32, 32, // width, height + 8, // total + 2, // planes + // plane offsets { 1, 0 }, { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, @@ -750,10 +1410,10 @@ static const gfx_layout montecar_car_layout = static const gfx_layout firetrk_car_layout2 = { - 32, 32, /* width, height */ - 4, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 32, 32, // width, height + 4, // total + 1, // planes + { 0 }, // plane offsets { 0x04, 0x05, 0x06, 0x07, 0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17, 0x1c, 0x1d, 0x1e, 0x1f, @@ -772,10 +1432,10 @@ static const gfx_layout firetrk_car_layout2 = static const gfx_layout superbug_car_layout2 = { - 32, 32, /* width, height */ - 4, /* total */ - 1, /* planes */ - { 0 }, /* plane offsets */ + 32, 32, // width, height + 4, // total + 1, // planes + { 0 }, // plane offsets { 0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c, 0x44, 0x4c, 0x54, 0x5c, 0x64, 0x6c, 0x74, 0x7c, @@ -817,9 +1477,9 @@ static const uint32_t firetrk_trailer_layout_yoffset[64] = static const gfx_layout firetrk_trailer_layout = { - 64, 64, /* width, height */ - 8, /* total */ - 1, /* planes */ + 64, 64, // width, height + 8, // total + 1, // planes { 0 }, EXTENDED_XOFFS, EXTENDED_YOFFS, @@ -830,92 +1490,90 @@ static const gfx_layout firetrk_trailer_layout = static GFXDECODE_START( gfx_firetrk ) - GFXDECODE_ENTRY( "gfx1", 0, firetrk_text_layout, 26, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, firetrk_tile_layout, 0, 8 ) - GFXDECODE_ENTRY( "gfx2", 0, firetrk_tile_layout, 16, 3 ) - GFXDECODE_ENTRY( "gfx3", 0, firetrk_car_layout1, 22, 2 ) - GFXDECODE_ENTRY( "gfx3", 0, firetrk_car_layout2, 22, 2 ) - GFXDECODE_ENTRY( "gfx4", 0, firetrk_trailer_layout, 22, 2 ) + GFXDECODE_ENTRY( "chars", 0, firetrk_text_layout, 26, 1 ) + GFXDECODE_ENTRY( "tiles", 0, firetrk_tile_layout, 0, 8 ) + GFXDECODE_ENTRY( "tiles", 0, firetrk_tile_layout, 16, 3 ) + GFXDECODE_ENTRY( "cars", 0, firetrk_car_layout1, 22, 2 ) + GFXDECODE_ENTRY( "cars", 0, firetrk_car_layout2, 22, 2 ) + GFXDECODE_ENTRY( "trailer", 0, firetrk_trailer_layout, 22, 2 ) GFXDECODE_END static GFXDECODE_START( gfx_superbug ) - GFXDECODE_ENTRY( "gfx1", 0, superbug_text_layout, 26, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, superbug_tile_layout, 0, 8 ) - GFXDECODE_ENTRY( "gfx2", 0, superbug_tile_layout, 16, 3 ) - GFXDECODE_ENTRY( "gfx3", 0, superbug_car_layout1, 22, 2 ) - GFXDECODE_ENTRY( "gfx3", 0, superbug_car_layout2, 22, 2 ) + GFXDECODE_ENTRY( "chars", 0, superbug_text_layout, 26, 1 ) + GFXDECODE_ENTRY( "tiles", 0, superbug_tile_layout, 0, 8 ) + GFXDECODE_ENTRY( "tiles", 0, superbug_tile_layout, 16, 3 ) + GFXDECODE_ENTRY( "cars", 0, superbug_car_layout1, 22, 2 ) + GFXDECODE_ENTRY( "cars", 0, superbug_car_layout2, 22, 2 ) GFXDECODE_END static GFXDECODE_START( gfx_montecar ) - GFXDECODE_ENTRY( "gfx1", 0, montecar_text_layout, 44, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, firetrk_tile_layout, 0, 8 ) - GFXDECODE_ENTRY( "gfx2", 0, firetrk_tile_layout, 16, 4 ) - GFXDECODE_ENTRY( "gfx3", 0, montecar_car_layout, 24, 1 ) - GFXDECODE_ENTRY( "gfx4", 0, montecar_car_layout, 28, 4 ) + GFXDECODE_ENTRY( "chars", 0, montecar_text_layout, 44, 1 ) + GFXDECODE_ENTRY( "tiles", 0, firetrk_tile_layout, 0, 8 ) + GFXDECODE_ENTRY( "tiles", 0, firetrk_tile_layout, 16, 4 ) + GFXDECODE_ENTRY( "cars", 0, montecar_car_layout, 24, 1 ) + GFXDECODE_ENTRY( "drone", 0, montecar_car_layout, 28, 4 ) GFXDECODE_END void firetrk_state::firetrk(machine_config &config) { - /* basic machine hardware */ - M6800(config, m_maincpu, MASTER_CLOCK/12); /* 750Khz during service mode */ - m_maincpu->set_addrmap(AS_PROGRAM, &firetrk_state::firetrk_map); - TIMER(config, "scantimer").configure_scanline(FUNC(firetrk_state::firetrk_scanline), "screen", 0, 1); + // basic machine hardware + M6800(config, m_maincpu, MASTER_CLOCK / 12); // 750Khz during service mode + m_maincpu->set_addrmap(AS_PROGRAM, &firetrk_state::program_map); + TIMER(config, "scantimer").configure_scanline(FUNC(firetrk_state::scanline), "screen", 0, 1); WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 5); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); - m_screen->set_raw(MASTER_CLOCK/2, 384, 0, 320, 262, 0, 240); - m_screen->set_screen_update(FUNC(firetrk_state::screen_update_firetrk)); + m_screen->set_raw(MASTER_CLOCK / 2, 384, 0, 320, 262, 0, 240); + m_screen->set_screen_update(FUNC(firetrk_state::screen_update)); m_screen->set_palette(m_palette); - PALETTE(config, m_palette, FUNC(firetrk_state::firetrk_palette), 28); + PALETTE(config, m_palette, FUNC(firetrk_state::palette), 28); GFXDECODE(config, m_gfxdecode, m_palette, gfx_firetrk); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); DISCRETE(config, m_discrete, firetrk_discrete).add_route(ALL_OUTPUTS, "mono", 1.0); } -void firetrk_state::superbug(machine_config &config) +void superbug_state::superbug(machine_config &config) { firetrk(config); - /* basic machine hardware */ - m_maincpu->set_addrmap(AS_PROGRAM, &firetrk_state::superbug_map); + // basic machine hardware + m_maincpu->set_addrmap(AS_PROGRAM, &superbug_state::program_map); - /* video hardware */ - m_screen->set_screen_update(FUNC(firetrk_state::screen_update_superbug)); + // video hardware + m_screen->set_screen_update(FUNC(superbug_state::screen_update)); - MCFG_VIDEO_START_OVERRIDE(firetrk_state,superbug) m_gfxdecode->set_info(gfx_superbug); - /* sound hardware */ + // sound hardware DISCRETE(config.replace(), m_discrete, superbug_discrete).add_route(ALL_OUTPUTS, "mono", 1.0); } -void firetrk_state::montecar(machine_config &config) +void montecar_state::montecar(machine_config &config) { firetrk(config); - /* basic machine hardware */ - m_maincpu->set_addrmap(AS_PROGRAM, &firetrk_state::montecar_map); + // basic machine hardware + m_maincpu->set_addrmap(AS_PROGRAM, &montecar_state::program_map); - /* video hardware */ - m_screen->set_screen_update(FUNC(firetrk_state::screen_update_montecar)); + // video hardware + m_screen->set_screen_update(FUNC(montecar_state::screen_update)); - MCFG_VIDEO_START_OVERRIDE(firetrk_state,montecar) m_gfxdecode->set_info(gfx_montecar); m_palette->set_entries(46); - m_palette->set_init(FUNC(firetrk_state::montecar_palette)); + m_palette->set_init(FUNC(montecar_state::palette)); /* sound hardware */ DISCRETE(config.replace(), m_discrete, montecar_discrete).add_route(ALL_OUTPUTS, "mono", 1.0); @@ -931,21 +1589,21 @@ ROM_START( firetrk ) ROM_LOAD_NIB_HIGH( "032815-01.j1", 0x3800, 0x800, CRC(506ee759) SHA1(d111356c84f3d9942a27fbe243e716d14c258a16) ) ROM_LOAD_NIB_LOW ( "032819-01.j2", 0x3800, 0x800, CRC(f1c3fa87) SHA1(d75cf4ad0bcac3289c068837fc24cfe84ce7542a) ) - ROM_REGION( 0x0800, "gfx1", 0 ) /* text */ + ROM_REGION( 0x0800, "chars", 0 ) ROM_LOAD( "032827-01.r3", 0x000, 0x800, CRC(cca31d2b) SHA1(78235176c9cb2abd73a5778b54560b87634ca0e4) ) - ROM_REGION( 0x0800, "gfx2", 0 ) /* tiles */ + ROM_REGION( 0x0800, "tiles", 0 ) ROM_LOAD( "032828-02.f5", 0x000, 0x800, CRC(68ef5f19) SHA1(df227d6a57bba6298ebdeb5a118878da21d889f6) ) - ROM_REGION( 0x0400, "gfx3", 0 ) /* cab */ + ROM_REGION( 0x0400, "cars", 0 ) ROM_LOAD( "032831-01.p7", 0x000, 0x400, CRC(bb8d144f) SHA1(9a1355ea6f88e96926c32e0e36ac0525b0243906) ) - ROM_REGION( 0x1000, "gfx4", 0 ) /* trailer */ + ROM_REGION( 0x1000, "trailer", 0 ) ROM_LOAD( "032829-01.j5", 0x000, 0x800, CRC(e7267d71) SHA1(7132b98622e899227a378ba8c010dde39c479978) ) ROM_LOAD( "032830-01.l5", 0x800, 0x800, CRC(e4d8b685) SHA1(30978658899c83e32dabdf554a13cf5e5235c725) ) ROM_REGION( 0x100, "proms", 0 ) - ROM_LOAD( "009114.prm", 0x0000, 0x100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) /* sync */ + ROM_LOAD( "009114.prm", 0x0000, 0x100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) // sync ROM_END @@ -955,21 +1613,21 @@ ROM_START( superbug ) ROM_LOAD( "009122.c1", 0x1000, 0x800, CRC(eb6e3e37) SHA1(5237f6bd3a7a3eca737c728296230cf0d1f436b0) ) ROM_LOAD( "009123.a1", 0x1800, 0x800, CRC(f42c6bbe) SHA1(41470984fe951eac9f6dc77862b00ecfe8aaa51d) ) - ROM_REGION( 0x0800, "gfx1", 0 ) /* text */ + ROM_REGION( 0x0800, "chars", 0 ) ROM_LOAD( "009124.m3", 0x0000, 0x400, CRC(f8af8dd5) SHA1(49ab85550f546f85048e2f73163837c602dde568) ) ROM_LOAD( "009471.n3", 0x0400, 0x400, CRC(52250698) SHA1(cc55254c54dbcd3fd1465c82a715f2e567f44951) ) - ROM_REGION( 0x1000, "gfx2", 0 ) /* tiles */ + ROM_REGION( 0x1000, "tiles", 0 ) ROM_LOAD( "009126.f5", 0x0000, 0x400, CRC(ee695137) SHA1(295fdfef88e0c841fe8ad505151ca0837e77ef83) ) ROM_LOAD( "009472.h5", 0x0400, 0x400, CRC(5ddb80ac) SHA1(bdbbbba6efdd4cca75630d203f7c7eaf41b1a32d) ) ROM_LOAD( "009127.e5", 0x0800, 0x400, CRC(be1386b4) SHA1(17e92df58b25075ec7a383a958db02b42066578a) ) ROM_RELOAD( 0x0C00, 0x400 ) - ROM_REGION( 0x0400, "gfx3", 0 ) /* car */ + ROM_REGION( 0x0400, "cars", 0 ) ROM_LOAD( "009125.k6", 0x0000, 0x400, CRC(a3c835df) SHA1(e9b6dba1919c389bb55a8fe3c074b6702322e4e5) ) ROM_REGION( 0x0100, "proms", 0 ) - ROM_LOAD( "009114.prm", 0x0000, 0x100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) /* sync */ + ROM_LOAD( "009114.prm", 0x0000, 0x100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) // sync ROM_END @@ -980,24 +1638,26 @@ ROM_START( montecar ) ROM_LOAD( "35764-01.d1", 0x3000, 0x800, CRC(899aaf4e) SHA1(84fab58d135ffc6e4b076d438b4d588b394364b6) ) ROM_LOAD( "35763-01.c1", 0x3800, 0x800, CRC(378bfe47) SHA1(fd6b28907340a2ffc82a4e634273c3f03ab76642) ) - ROM_REGION( 0x0400, "gfx1", 0 ) /* text */ + ROM_REGION( 0x0400, "chars", 0 ) ROM_LOAD( "35778-01.m4", 0x0000, 0x400, CRC(294ee08e) SHA1(fbb0656468a027b2795073d811affc93c50994ec) ) - ROM_REGION( 0x0800, "gfx2", 0 ) /* tiles */ + ROM_REGION( 0x0800, "tiles", 0 ) ROM_LOAD( "35775-01.e6", 0x0000, 0x800, CRC(504106e9) SHA1(33eae2cf39b24eaf5b438a2af3060b2fdc0012b5) ) - ROM_REGION( 0x0800, "gfx3", 0 ) /* car */ + ROM_REGION( 0x0800, "cars", 0 ) ROM_LOAD( "35779-01.m6", 0x0000, 0x800, CRC(4fbb3fe1) SHA1(4267cd098a19892322d21f8fa7b55896158f8d6a) ) - ROM_REGION( 0x0800, "gfx4", 0 ) /* drone */ + ROM_REGION( 0x0800, "drone", 0 ) ROM_LOAD( "35780-01.b6", 0x0000, 0x800, CRC(9d0f1374) SHA1(52d1130d48dc877e1e47e26b2e4548633ed91b21) ) ROM_REGION( 0x300, "proms", 0 ) - ROM_LOAD( "35785-01.e7", 0x0000, 0x200, CRC(386c543a) SHA1(04edda180e6ff432b438947ffa46621ca0a823b4) ) /* color */ - ROM_LOAD( "9114.prm", 0x0200, 0x100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) /* sync */ + ROM_LOAD( "35785-01.e7", 0x0000, 0x200, CRC(386c543a) SHA1(04edda180e6ff432b438947ffa46621ca0a823b4) ) // color + ROM_LOAD( "9114.prm", 0x0200, 0x100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) // sync ROM_END +} // anonymous namespace -GAMEL( 1977, superbug, 0, superbug, superbug, firetrk_state, empty_init, ROT270, "Atari (Kee Games)", "Super Bug", 0, layout_superbug ) -GAME( 1978, firetrk, 0, firetrk, firetrk, firetrk_state, empty_init, ROT270, "Atari", "Fire Truck / Smokey Joe", 0 ) -GAME( 1979, montecar, 0, montecar, montecar, firetrk_state, empty_init, ROT270, "Atari", "Monte Carlo", 0 ) + +GAMEL( 1977, superbug, 0, superbug, superbug, superbug_state, empty_init, ROT270, "Atari (Kee Games)", "Super Bug", MACHINE_SUPPORTS_SAVE, layout_superbug ) +GAME( 1978, firetrk, 0, firetrk, firetrk, firetrk_state, empty_init, ROT270, "Atari", "Fire Truck / Smokey Joe", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, montecar, 0, montecar, montecar, montecar_state, empty_init, ROT270, "Atari", "Monte Carlo", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/atari/firetrk.h b/src/mame/atari/firetrk.h deleted file mode 100644 index 809a41d28b0..00000000000 --- a/src/mame/atari/firetrk.h +++ /dev/null @@ -1,182 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phil Stroffolino -/************************************************************************* - -Atari Fire Truck + Super Bug + Monte Carlo driver - -*************************************************************************/ -#ifndef MAME_ATARI_FIRETRK_H -#define MAME_ATARI_FIRETRK_H - -#pragma once - -#include "machine/timer.h" -#include "machine/watchdog.h" -#include "sound/discrete.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -#define FIRETRUCK_MOTOR_DATA NODE_01 -#define FIRETRUCK_HORN_EN NODE_02 -#define FIRETRUCK_SIREN_DATA NODE_03 -#define FIRETRUCK_CRASH_DATA NODE_04 -#define FIRETRUCK_SKID_EN NODE_05 -#define FIRETRUCK_BELL_EN NODE_06 -#define FIRETRUCK_ATTRACT_EN NODE_07 -#define FIRETRUCK_XTNDPLY_EN NODE_08 - -#define SUPERBUG_SPEED_DATA FIRETRUCK_MOTOR_DATA -#define SUPERBUG_CRASH_DATA FIRETRUCK_CRASH_DATA -#define SUPERBUG_SKID_EN FIRETRUCK_SKID_EN -#define SUPERBUG_ASR_EN FIRETRUCK_XTNDPLY_EN -#define SUPERBUG_ATTRACT_EN FIRETRUCK_ATTRACT_EN - -#define MONTECAR_MOTOR_DATA FIRETRUCK_MOTOR_DATA -#define MONTECAR_CRASH_DATA FIRETRUCK_CRASH_DATA -#define MONTECAR_DRONE_MOTOR_DATA FIRETRUCK_SIREN_DATA -#define MONTECAR_SKID_EN FIRETRUCK_SKID_EN -#define MONTECAR_DRONE_LOUD_DATA FIRETRUCK_BELL_EN -#define MONTECAR_BEEPER_EN FIRETRUCK_XTNDPLY_EN -#define MONTECAR_ATTRACT_INV FIRETRUCK_ATTRACT_EN - - -class firetrk_state : public driver_device -{ -public: - firetrk_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_watchdog(*this, "watchdog") - , m_discrete(*this, "discrete") - , m_alpha_num_ram(*this, "alpha_num_ram") - , m_playfield_ram(*this, "playfield_ram") - , m_scroll_y(*this, "scroll_y") - , m_scroll_x(*this, "scroll_x") - , m_car_rot(*this, "car_rot") - , m_blink(*this, "blink") - , m_drone_x(*this, "drone_x") - , m_drone_y(*this, "drone_y") - , m_drone_rot(*this, "drone_rot") - , m_gfxdecode(*this, "gfxdecode") - , m_screen(*this, "screen") - , m_palette(*this, "palette") - , m_bit_0(*this, "BIT_0") - , m_bit_6(*this, "BIT_6") - , m_bit_7(*this, "BIT_7") - , m_dips(*this, {"DIP_0", "DIP_1"}) - , m_steer(*this, "STEER_%u", 1U) - , m_leds(*this, "led%u", 0U) - { } - - void firetrk(machine_config &config); - void montecar(machine_config &config); - void superbug(machine_config &config); - - template DECLARE_READ_LINE_MEMBER(steer_dir_r); - template DECLARE_READ_LINE_MEMBER(steer_flag_r); - template DECLARE_READ_LINE_MEMBER(skid_r); - template DECLARE_READ_LINE_MEMBER(crash_r); - template DECLARE_READ_LINE_MEMBER(gear_r); - DECLARE_INPUT_CHANGED_MEMBER(service_mode_switch_changed); - DECLARE_INPUT_CHANGED_MEMBER(firetrk_horn_changed); - DECLARE_INPUT_CHANGED_MEMBER(gear_changed); - -private: - void firetrk_output_w(uint8_t data); - void superbug_output_w(offs_t offset, uint8_t data); - void montecar_output_1_w(uint8_t data); - void montecar_output_2_w(uint8_t data); - uint8_t firetrk_dip_r(offs_t offset); - uint8_t montecar_dip_r(offs_t offset); - uint8_t firetrk_input_r(offs_t offset); - uint8_t montecar_input_r(offs_t offset); - void blink_on_w(uint8_t data); - void montecar_car_reset_w(uint8_t data); - void montecar_drone_reset_w(uint8_t data); - void steer_reset_w(uint8_t data); - void crash_reset_w(uint8_t data); - TILE_GET_INFO_MEMBER(firetrk_get_tile_info1); - TILE_GET_INFO_MEMBER(superbug_get_tile_info1); - TILE_GET_INFO_MEMBER(montecar_get_tile_info1); - TILE_GET_INFO_MEMBER(firetrk_get_tile_info2); - TILE_GET_INFO_MEMBER(superbug_get_tile_info2); - TILE_GET_INFO_MEMBER(montecar_get_tile_info2); - void firetrk_palette(palette_device &palette); - DECLARE_VIDEO_START(superbug); - DECLARE_VIDEO_START(montecar); - void montecar_palette(palette_device &palette); - uint32_t screen_update_firetrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_superbug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_montecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(firetrk_scanline); - void firetrk_skid_reset_w(uint8_t data); - void montecar_skid_reset_w(uint8_t data); - void firetrk_crash_snd_w(uint8_t data); - void firetrk_skid_snd_w(uint8_t data); - void firetrk_motor_snd_w(uint8_t data); - void superbug_motor_snd_w(uint8_t data); - void firetrk_xtndply_w(uint8_t data); - void prom_to_palette(int number, uint8_t val); - void firetrk_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flash); - void superbug_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int flash); - void montecar_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int is_collision_detection); - void check_collision(int which); - void set_service_mode(int enable); - void draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *alpha_ram, int x, int count, int height); - void firetrk_map(address_map &map); - void montecar_map(address_map &map); - void superbug_map(address_map &map); - - virtual void machine_start() override { m_leds.resolve(); } - virtual void machine_reset() override; - virtual void video_start() override; - - required_device m_maincpu; - required_device m_watchdog; - required_device m_discrete; - required_shared_ptr m_alpha_num_ram; - required_shared_ptr m_playfield_ram; - required_shared_ptr m_scroll_y; - required_shared_ptr m_scroll_x; - required_shared_ptr m_car_rot; - optional_shared_ptr m_blink; - optional_shared_ptr m_drone_x; - optional_shared_ptr m_drone_y; - optional_shared_ptr m_drone_rot; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - optional_ioport m_bit_0; - optional_ioport m_bit_6; - optional_ioport m_bit_7; - required_ioport_array<2> m_dips; - optional_ioport_array<2> m_steer; - output_finder<4> m_leds; - - uint8_t m_in_service_mode = 0; - uint32_t m_dial[2]{}; - uint8_t m_steer_dir[2]{}; - uint8_t m_steer_flag[2]{}; - uint8_t m_gear = 0; - - uint8_t m_flash = 0; - uint8_t m_crash[2]{}; - uint8_t m_skid[2]{}; - bitmap_ind16 m_helper1; - bitmap_ind16 m_helper2; - uint32_t m_color1_mask = 0; - uint32_t m_color2_mask = 0; - tilemap_t *m_tilemap1 = nullptr; - tilemap_t *m_tilemap2 = nullptr; -}; - - -/*----------- defined in audio/firetrk.c -----------*/ - -DISCRETE_SOUND_EXTERN( firetrk_discrete ); -DISCRETE_SOUND_EXTERN( superbug_discrete ); -DISCRETE_SOUND_EXTERN( montecar_discrete ); - -#endif // MAME_ATARI_FIRETRK_H diff --git a/src/mame/atari/firetrk_a.cpp b/src/mame/atari/firetrk_a.cpp index 628548bd54d..e9528917f8e 100644 --- a/src/mame/atari/firetrk_a.cpp +++ b/src/mame/atari/firetrk_a.cpp @@ -1,68 +1,15 @@ // license:BSD-3-Clause -// copyright-holders:K.Wilkins,Derrick Renaud +// copyright-holders: K.Wilkins, Derrick Renaud + /************************************************************************* - audio\firetrk.cpp + atari/firetrk_a.cpp *************************************************************************/ #include "emu.h" -#include "firetrk.h" -#include "sound/discrete.h" - - -void firetrk_state::firetrk_skid_reset_w(uint8_t data) -{ - m_skid[0] = 0; - m_skid[1] = 0; - - // also SUPERBUG_SKID_EN - m_discrete->write(FIRETRUCK_SKID_EN, 1); -} - - -void firetrk_state::montecar_skid_reset_w(uint8_t data) -{ - m_discrete->write(MONTECAR_SKID_EN, 1); -} - - -void firetrk_state::firetrk_crash_snd_w(uint8_t data) -{ - // also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA - m_discrete->write(FIRETRUCK_CRASH_DATA, data >> 4); -} - - -void firetrk_state::firetrk_skid_snd_w(uint8_t data) -{ - // also SUPERBUG_SKID_EN and MONTECAR_SKID_EN - m_discrete->write(FIRETRUCK_SKID_EN, 0); -} - - -void firetrk_state::firetrk_motor_snd_w(uint8_t data) -{ - // also MONTECAR_DRONE_MOTOR_DATA - m_discrete->write(FIRETRUCK_SIREN_DATA, data >> 4); - - // also MONTECAR_MOTOR_DATA - m_discrete->write(FIRETRUCK_MOTOR_DATA, data & 0x0f); -} - - -void firetrk_state::superbug_motor_snd_w(uint8_t data) -{ - m_discrete->write(SUPERBUG_SPEED_DATA, data & 0x0f); -} - - -void firetrk_state::firetrk_xtndply_w(uint8_t data) -{ - // also SUPERBUG_ASR_EN (extended play) - m_discrete->write(FIRETRUCK_XTNDPLY_EN, data); -} +#include "firetrk_a.h" #define FIRETRUCK_HSYNC 15750.0 /* not checked */ #define FIRETRUCK_1V FIRETRUCK_HSYNC/2 @@ -198,7 +145,7 @@ DISCRETE_SOUND_START(firetrk_discrete) /************************************************/ /* Motor sound circuit is based on a 556 VCO */ /* with the input frequency set by the MotorSND */ - /* latch (4 bit). This freqency is then used to */ + /* latch (4 bit). This frequency is then used to*/ /* drive a modulo 12 counter, with div6 & div12 */ /* summed as the output of the circuit. */ /************************************************/ @@ -283,7 +230,7 @@ DISCRETE_SOUND_START(firetrk_discrete) /* counter. */ /************************************************/ DISCRETE_RCDISC2(NODE_70, FIRETRUCK_BELL_EN, - 4.4, 10, // Q3 instantally charges C42 + 4.4, 10, // Q3 instantaneously charges C42 0, RES_K(33), // discharges through R66 CAP_U(10)) // C42 DISCRETE_TRANSFORM2(NODE_71, NODE_70, @@ -402,7 +349,7 @@ DISCRETE_SOUND_START(superbug_discrete) /************************************************/ /* Motor sound circuit is based on a 556 VCO */ /* with the input frequency set by the MotorSND */ - /* latch (4 bit). This freqency is then used to */ + /* latch (4 bit). This frequency is then used to*/ /* drive a modulo 12 counter. */ /************************************************/ DISCRETE_ADJUSTMENT(NODE_20, @@ -585,7 +532,7 @@ DISCRETE_SOUND_START(montecar_discrete) /************************************************/ /* Motor sound circuit is based on a 556 VCO */ /* with the input frequency set by the MotorSND */ - /* latch (4 bit). This freqency is then used to */ + /* latch (4 bit). This frequency is then used to*/ /* driver a modulo 12 counter, with div6, 4 & 3 */ /* summed as the output of the circuit. */ /************************************************/ diff --git a/src/mame/atari/firetrk_a.h b/src/mame/atari/firetrk_a.h new file mode 100644 index 00000000000..94ccc87b5c6 --- /dev/null +++ b/src/mame/atari/firetrk_a.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders: K.Wilkins, Derrick Renaud + +/*************************************************************************** + +Fire Truck / Monte Carlo - Super Bug audio + +***************************************************************************/ + +#ifndef MAME_ATARI_FIRETRK_A_H +#define MAME_ATARI_FIRETRK_A_H + +#pragma once + +#include "sound/discrete.h" + +// discrete sound input nodes + +#define FIRETRUCK_MOTOR_DATA NODE_01 +#define FIRETRUCK_HORN_EN NODE_02 +#define FIRETRUCK_SIREN_DATA NODE_03 +#define FIRETRUCK_CRASH_DATA NODE_04 +#define FIRETRUCK_SKID_EN NODE_05 +#define FIRETRUCK_BELL_EN NODE_06 +#define FIRETRUCK_ATTRACT_EN NODE_07 +#define FIRETRUCK_XTNDPLY_EN NODE_08 + +#define MONTECAR_MOTOR_DATA FIRETRUCK_MOTOR_DATA +#define MONTECAR_CRASH_DATA FIRETRUCK_CRASH_DATA +#define MONTECAR_DRONE_MOTOR_DATA FIRETRUCK_SIREN_DATA +#define MONTECAR_SKID_EN FIRETRUCK_SKID_EN +#define MONTECAR_DRONE_LOUD_DATA FIRETRUCK_BELL_EN +#define MONTECAR_BEEPER_EN FIRETRUCK_XTNDPLY_EN +#define MONTECAR_ATTRACT_INV FIRETRUCK_ATTRACT_EN + +#define SUPERBUG_SPEED_DATA FIRETRUCK_MOTOR_DATA +#define SUPERBUG_CRASH_DATA FIRETRUCK_CRASH_DATA +#define SUPERBUG_SKID_EN FIRETRUCK_SKID_EN +#define SUPERBUG_ASR_EN FIRETRUCK_XTNDPLY_EN +#define SUPERBUG_ATTRACT_EN FIRETRUCK_ATTRACT_EN + + +DISCRETE_SOUND_EXTERN( firetrk_discrete ); +DISCRETE_SOUND_EXTERN( montecar_discrete ); +DISCRETE_SOUND_EXTERN( superbug_discrete ); + +#endif // MAME_ATARI_FIRETRK_A_H diff --git a/src/mame/atari/firetrk_v.cpp b/src/mame/atari/firetrk_v.cpp deleted file mode 100644 index cf0f2098872..00000000000 --- a/src/mame/atari/firetrk_v.cpp +++ /dev/null @@ -1,428 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phil Stroffolino -/*************************************************************************** - -Atari Fire Truck + Super Bug + Monte Carlo video emulation - -***************************************************************************/ - -#include "emu.h" -#include "firetrk.h" - -static const rectangle playfield_window(0x02a, 0x115, 0x000, 0x0ff); - - -void firetrk_state::firetrk_palette(palette_device &palette) -{ - static constexpr uint8_t colortable_source[] = - { - 0, 0, 1, 0, - 2, 0, 3, 0, - 3, 3, 2, 3, - 1, 3, 0, 3, - 0, 0, 1, 0, - 2, 0, 0, 3, - 3, 0, 0, 3 - }; - static constexpr rgb_t palette_source[] = - { - rgb_t::black(), - rgb_t(0x5b, 0x5b, 0x5b), - rgb_t(0xa4, 0xa4, 0xa4), - rgb_t::white() - }; - - m_color1_mask = m_color2_mask = 0; - - for (int i = 0; i < std::size(colortable_source); i++) - { - uint8_t color = colortable_source[i]; - - if (color == 1) - m_color1_mask |= 1 << i; - else if (color == 2) - m_color2_mask |= 1 << i; - - palette.set_pen_color(i, palette_source[color]); - } -} - - -void firetrk_state::prom_to_palette(int number, uint8_t val) -{ - m_palette->set_pen_color(number, rgb_t(pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0))); -} - - -void firetrk_state::montecar_palette(palette_device &palette) -{ - const uint8_t *color_prom = memregion("proms")->base(); - - static constexpr uint8_t colortable_source[] = - { - 0x00, 0x00, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x03, - 0x03, 0x03, 0x03, 0x02, - 0x03, 0x01, 0x03, 0x00, - 0x00, 0x00, 0x02, 0x00, - 0x02, 0x01, 0x02, 0x02, - 0x00, 0x10, 0x20, 0x30, - 0x00, 0x04, 0x08, 0x0c, - 0x00, 0x44, 0x48, 0x4c, - 0x00, 0x84, 0x88, 0x8c, - 0x00, 0xc4, 0xc8, 0xcc - }; - - /* - * The color PROM is addressed as follows: - * - * A0 => PLAYFIELD 1 - * A1 => PLAYFIELD 2 - * A2 => DRONE 1 - * A3 => DRONE 2 - * A4 => CAR 1 - * A5 => CAR 2 - * A6 => DRONE COLOR 1 - * A7 => DRONE COLOR 2 - * A8 => PLAYFIELD WINDOW - * - * This driver hard-codes some behavior which actually depends - * on the PROM, like priorities, clipping and transparency. - * - */ - - m_color1_mask = m_color2_mask = 0; - - for (int i = 0; i < std::size(colortable_source); i++) - { - uint8_t color = colortable_source[i]; - - if (color == 1) - m_color1_mask |= 1 << i; - else if (color == 2) - m_color2_mask |= 1 << i; - - prom_to_palette(i, color_prom[0x100 + colortable_source[i]]); - } - - palette.set_pen_color(std::size(colortable_source) + 0, rgb_t::black()); - palette.set_pen_color(std::size(colortable_source) + 1, rgb_t::white()); -} - - -TILE_GET_INFO_MEMBER(firetrk_state::firetrk_get_tile_info1) -{ - int code = m_playfield_ram[tile_index] & 0x3f; - int color = (m_playfield_ram[tile_index] >> 6) & 0x03; - - if (*m_blink && (code >= 0x04) && (code <= 0x0b)) - color = 0; - - if (m_flash) - color = color | 0x04; - - tileinfo.set(1, code, color, 0); -} - - -TILE_GET_INFO_MEMBER(firetrk_state::superbug_get_tile_info1) -{ - int code = m_playfield_ram[tile_index] & 0x3f; - int color = (m_playfield_ram[tile_index] >> 6) & 0x03; - - if (*m_blink && (code >= 0x08) && (code <= 0x0f)) - color = 0; - - if (m_flash) - color = color | 0x04; - - tileinfo.set(1, code, color, 0); -} - - -TILE_GET_INFO_MEMBER(firetrk_state::montecar_get_tile_info1) -{ - int code = m_playfield_ram[tile_index] & 0x3f; - int color = (m_playfield_ram[tile_index] >> 6) & 0x03; - - if (m_flash) - color = color | 0x04; - - tileinfo.set(1, code, color, 0); -} - - -TILE_GET_INFO_MEMBER(firetrk_state::firetrk_get_tile_info2) -{ - uint8_t code = m_playfield_ram[tile_index] & 0x3f; - int color = 0; - - /* palette 1 for crash and palette 2 for skid */ - if (((code & 0x30) != 0x00) || ((code & 0x0c) == 0x00)) - color = 1; /* palette 0, 1 */ - - if ((code & 0x3c) == 0x0c) - color = 2; /* palette 0, 2 */ - - tileinfo.set(2, code, color, 0); -} - - -TILE_GET_INFO_MEMBER(firetrk_state::superbug_get_tile_info2) -{ - uint8_t code = m_playfield_ram[tile_index] & 0x3f; - int color = 0; - - /* palette 1 for crash and palette 2 for skid */ - if ((code & 0x30) != 0x00) - color = 1; /* palette 0, 1 */ - - if ((code & 0x38) == 0x00) - color = 2; /* palette 0, 2 */ - - tileinfo.set(2, code, color, 0); -} - - -TILE_GET_INFO_MEMBER(firetrk_state::montecar_get_tile_info2) -{ - uint8_t code = m_playfield_ram[tile_index]; - int color = 0; - - /* palette 1 for crash and palette 2 for skid */ - if (((code & 0xc0) == 0x40) || ((code & 0xc0) == 0x80)) - color = 2; /* palette 2, 1 */ - - if ((code & 0xc0) == 0xc0) - color = 1; /* palette 2, 0 */ - - if ((code & 0xc0) == 0x00) - color = 3; /* palette 2, 2 */ - - if ((code & 0x30) == 0x30) - color = 0; /* palette 0, 0 */ - - tileinfo.set(2, code & 0x3f, color, 0); -} - - -void firetrk_state::video_start() -{ - m_screen->register_screen_bitmap(m_helper1); - m_screen->register_screen_bitmap(m_helper2); - - m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::firetrk_get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); - m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::firetrk_get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); -} - - -VIDEO_START_MEMBER(firetrk_state,superbug) -{ - m_screen->register_screen_bitmap(m_helper1); - m_screen->register_screen_bitmap(m_helper2); - - m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::superbug_get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); - m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::superbug_get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); -} - - -VIDEO_START_MEMBER(firetrk_state,montecar) -{ - m_screen->register_screen_bitmap(m_helper1); - m_screen->register_screen_bitmap(m_helper2); - - m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::montecar_get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); - m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::montecar_get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); -} - - -void firetrk_state::firetrk_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flash) -{ - int gfx_bank, code, color, flip_x, flip_y, x, y; - - if (which) - { - gfx_bank = 5; - code = *m_drone_rot & 0x07; - color = flash ? 1 : 0; - flip_x = *m_drone_rot & 0x08; - flip_y = *m_drone_rot & 0x10; - x = (flip_x ? *m_drone_x - 63 : 192 - *m_drone_x) + 36; - y = flip_y ? *m_drone_y - 63 : 192 - *m_drone_y; - } - else - { - gfx_bank = (*m_car_rot & 0x10) ? 4 : 3; - code = *m_car_rot & 0x03; - color = flash ? 1 : 0; - flip_x = *m_car_rot & 0x04; - flip_y = *m_car_rot & 0x08; - x = 144; - y = 104; - } - - m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, x, y, 0); -} - - -void firetrk_state::superbug_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int flash) -{ - int gfx_bank = (*m_car_rot & 0x10) ? 4 : 3; - int code = ~*m_car_rot & 0x03; - int color = flash ? 1 : 0; - int flip_x = *m_car_rot & 0x04; - int flip_y = *m_car_rot & 0x08; - - m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, 144, 104, 0); -} - - -void firetrk_state::montecar_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int is_collision_detection) -{ - int gfx_bank, code, color, flip_x, flip_y, x, y; - - if (which) - { - gfx_bank = 4; - code = *m_drone_rot & 0x07; - color = is_collision_detection ? 0 : (((*m_car_rot & 0x80) >> 6) | ((*m_drone_rot & 0x80) >> 7)); - flip_x = *m_drone_rot & 0x10; - flip_y = *m_drone_rot & 0x08; - x = (flip_x ? *m_drone_x - 31 : 224 - *m_drone_x) + 34; - y = flip_y ? *m_drone_y - 31 : 224 - *m_drone_y; - } - else - { - gfx_bank = 3; - code = *m_car_rot & 0x07; - color = 0; - flip_x = *m_car_rot & 0x10; - flip_y = *m_car_rot & 0x08; - x = 144; - y = 104; - } - - m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, x, y, 0); -} - - -void firetrk_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *alpha_ram, - int x, int count, int height) -{ - int i; - - for (i = 0; i < count; i++) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, alpha_ram[i], 0, 0, 0, x, i * height); -} - - -void firetrk_state::check_collision(int which) -{ - for (int y = playfield_window.top(); y <= playfield_window.bottom(); y++) - for (int x = playfield_window.left(); x <= playfield_window.right(); x++) - { - pen_t const a = m_helper1.pix(y, x); - pen_t const b = m_helper2.pix(y, x); - - if (b != 0xff && (m_color1_mask >> a) & 1) - m_crash[which] = 1; - - if (b != 0xff && (m_color2_mask >> a) & 1) - m_skid[which] = 1; - } -} - - -uint32_t firetrk_state::screen_update_firetrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - machine().tilemap().mark_all_dirty(); - m_tilemap1->set_scrollx(0, *m_scroll_x - 37); - m_tilemap2->set_scrollx(0, *m_scroll_x - 37); - m_tilemap1->set_scrolly(0, *m_scroll_y); - m_tilemap2->set_scrolly(0, *m_scroll_y); - - bitmap.fill(0, cliprect); - m_tilemap1->draw(screen, bitmap, playfield_window, 0, 0); - firetrk_draw_car(bitmap, playfield_window, 0, m_flash); - firetrk_draw_car(bitmap, playfield_window, 1, m_flash); - draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10); - draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10); - - if (cliprect.bottom() == screen.visible_area().bottom()) - { - m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0); - - m_helper2.fill(0xff, playfield_window); - firetrk_draw_car(m_helper2, playfield_window, 0, false); - check_collision(0); - - m_helper2.fill(0xff, playfield_window); - firetrk_draw_car(m_helper2, playfield_window, 1, false); - check_collision(1); - - *m_blink = false; - } - - return 0; -} - - -uint32_t firetrk_state::screen_update_superbug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - machine().tilemap().mark_all_dirty(); - m_tilemap1->set_scrollx(0, *m_scroll_x - 37); - m_tilemap2->set_scrollx(0, *m_scroll_x - 37); - m_tilemap1->set_scrolly(0, *m_scroll_y); - m_tilemap2->set_scrolly(0, *m_scroll_y); - - bitmap.fill(0, cliprect); - m_tilemap1->draw(screen, bitmap, playfield_window, 0, 0); - superbug_draw_car(bitmap, playfield_window, m_flash); - draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10); - draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10); - - if (cliprect.bottom() == screen.visible_area().bottom()) - { - m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0); - - m_helper2.fill(0xff, playfield_window); - superbug_draw_car(m_helper2, playfield_window, false); - check_collision(0); - - *m_blink = false; - } - - return 0; -} - - -uint32_t firetrk_state::screen_update_montecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - machine().tilemap().mark_all_dirty(); - m_tilemap1->set_scrollx(0, *m_scroll_x - 37); - m_tilemap2->set_scrollx(0, *m_scroll_x - 37); - m_tilemap1->set_scrolly(0, *m_scroll_y); - m_tilemap2->set_scrolly(0, *m_scroll_y); - - bitmap.fill(0x2c, cliprect); - m_tilemap1->draw(screen, bitmap, playfield_window, 0, 0); - montecar_draw_car(bitmap, playfield_window, 0, false); - montecar_draw_car(bitmap, playfield_window, 1, false); - draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 24, 0x20, 0x08); - draw_text(bitmap, cliprect, m_alpha_num_ram + 0x20, 16, 0x20, 0x08); - - if (cliprect.bottom() == screen.visible_area().bottom()) - { - m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0); - - m_helper2.fill(0xff, playfield_window); - montecar_draw_car(m_helper2, playfield_window, 0, true); - check_collision(0); - - m_helper2.fill(0xff, playfield_window); - montecar_draw_car(m_helper2, playfield_window, 1, true); - check_collision(1); - } - - return 0; -}