diff options
Diffstat (limited to 'src/mame/atari/vindictr.cpp')
-rw-r--r-- | src/mame/atari/vindictr.cpp | 133 |
1 files changed, 70 insertions, 63 deletions
diff --git a/src/mame/atari/vindictr.cpp b/src/mame/atari/vindictr.cpp index a067915ab50..1c72a5a7692 100644 --- a/src/mame/atari/vindictr.cpp +++ b/src/mame/atari/vindictr.cpp @@ -57,7 +57,7 @@ public: void vindictr(machine_config &config); protected: - virtual void video_start() override; + virtual void video_start() override ATTR_COLD; private: required_device<cpu_device> m_maincpu; @@ -85,12 +85,10 @@ private: void paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); static const atari_motion_objects_config s_mob_config; - void main_map(address_map &map); + void main_map(address_map &map) ATTR_COLD; }; -// video - /************************************* * * Tilemap callbacks @@ -137,7 +135,6 @@ const atari_motion_objects_config vindictr_state::s_mob_config = 0, // maximum number of links to visit/scanline (0=all) 0x100, // base palette entry - 0x100, // maximum number of colors 0, // transparent pen index {{ 0,0,0,0x03ff }}, // mask for the link @@ -291,75 +288,86 @@ uint32_t vindictr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // 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) + m_mob->iterate_dirty_rects( + cliprect, + [&bitmap, &mobitmap] (rectangle const &rect) + { + for (int y = rect.top(); y <= rect.bottom(); y++) { - /* partially verified via schematics (there are a lot of PALs involved!): - - SHADE = PAL(MPR1-0, LB7-0, PFX6-5, PFX3-2, PF/M) - - if (SHADE) - CRA |= 0x100 - - MOG3-1 = ~MAT3-1 if MAT6==1 and MSD3==1 - */ - int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - - // upper bit of MO priority signals special rendering and doesn't draw anything - if (mopriority & 4) - continue; - - // MO pen 1 doesn't draw, but it sets the SHADE flag and bumps the palette offset - if ((mo[x] & 0x0f) == 1) + 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] & 0xf0) != 0) - pf[x] |= 0x100; + if (mo[x] != 0xffff) + { + /* partially verified via schematics (there are a lot of PALs involved!): + + SHADE = PAL(MPR1-0, LB7-0, PFX6-5, PFX3-2, PF/M) + + if (SHADE) + CRA |= 0x100 + + MOG3-1 = ~MAT3-1 if MAT6==1 and MSD3==1 + */ + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + + // upper bit of MO priority signals special rendering and doesn't draw anything + if (mopriority & 4) + continue; + + // MO pen 1 doesn't draw, but it sets the SHADE flag and bumps the palette offset + if ((mo[x] & 0x0f) == 1) + { + if ((mo[x] & 0xf0) != 0) + pf[x] |= 0x100; + } + else + pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; + + // don't erase yet -- we need to make another pass later + } } - else - pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; - - // don't erase yet -- we need to make another pass later } - } + }); // 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) + m_mob->iterate_dirty_rects( + cliprect, + [this, &bitmap, &mobitmap] (rectangle const &rect) + { + for (int y = rect.top(); y <= rect.bottom(); y++) { - int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - - // upper bit of MO priority might mean palette kludges - if (mopriority & 4) + 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 bit 2 is set, start setting high palette bits - if (mo[x] & 2) - m_mob->apply_stain(bitmap, pf, mo, x, y); - - // if the upper bit of pen data is set, we adjust the final intensity - if (mo[x] & 8) - pf[x] |= (~mo[x] & 0xe0) << 6; + 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); + + // if the upper bit of pen data is set, we adjust the final intensity + if (mo[x] & 8) + pf[x] |= (~mo[x] & 0xe0) << 6; + } + } } } - } + }); + return 0; } -// machine - /************************************* * * Initialization @@ -445,7 +453,7 @@ static INPUT_PORTS_START( vindictr ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_2WAY PORT_PLAYER(1) PORT_START("260010") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("screen", FUNC(screen_device::vblank)) PORT_SERVICE( 0x0002, IP_ACTIVE_LOW ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") @@ -529,7 +537,7 @@ void vindictr_state::vindictr(machine_config &config) PALETTE(config, m_palette).set_entries(2048*8); TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64).set_info_callback(FUNC(vindictr_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(vindictr_state::get_alpha_tile_info)); + TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_ROWS, 64, 31, 0).set_info_callback(FUNC(vindictr_state::get_alpha_tile_info)); ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, vindictr_state::s_mob_config); m_mob->set_gfxdecode(m_gfxdecode); @@ -543,14 +551,13 @@ void vindictr_state::vindictr(machine_config &config) m_screen->set_palette(m_palette); // sound hardware - SPEAKER(config, "lspeaker").front_left(); - SPEAKER(config, "rspeaker").front_right(); + SPEAKER(config, "speaker", 2).front(); ATARI_JSA_I(config, m_jsa, 0); m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_6); m_jsa->test_read_cb().set_ioport("260010").bit(12); - m_jsa->add_route(0, "lspeaker", 1.0); - m_jsa->add_route(1, "rspeaker", 1.0); + m_jsa->add_route(0, "speaker", 1.0, 0); + m_jsa->add_route(1, "speaker", 1.0, 1); config.device_remove("jsa:tms"); } |