diff options
| author | 2026-02-06 10:22:33 -0500 | |
|---|---|---|
| committer | 2026-02-06 16:22:33 +0100 | |
| commit | 9c9a4170440c2233b34489bda91965da1ae982b5 (patch) | |
| tree | 06a6b78db5e79c77bf5eae77bda0726f2efbca17 | |
| parent | 060d10af01af3258c33b1c0fe79d694a11cab8b5 (diff) | |
sinclair/screen_ula.cpp: Allowed border to respect priority and draw separatly from background below the main screen (#14927)
| -rw-r--r-- | src/mame/sinclair/chloe.cpp | 2 | ||||
| -rw-r--r-- | src/mame/sinclair/screen_ula.cpp | 32 | ||||
| -rw-r--r-- | src/mame/sinclair/screen_ula.h | 2 | ||||
| -rw-r--r-- | src/mame/sinclair/specnext.cpp | 25 |
4 files changed, 30 insertions, 31 deletions
diff --git a/src/mame/sinclair/chloe.cpp b/src/mame/sinclair/chloe.cpp index 6248abde80d..b6cab842d3e 100644 --- a/src/mame/sinclair/chloe.cpp +++ b/src/mame/sinclair/chloe.cpp @@ -226,7 +226,7 @@ u32 chloe_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, cons clip256x192 &= cliprect; screen.priority().fill(0, cliprect); - m_ula_scr->draw_border(bitmap, cliprect, m_port_fe_data & 0x07); + m_ula_scr->draw_border(screen, bitmap, cliprect, m_port_fe_data & 0x07); const bool flash = u64(screen.frame_number() / m_frame_invert_count) & 1; m_ula_scr->draw(screen, bitmap, clip256x192, flash, 0); diff --git a/src/mame/sinclair/screen_ula.cpp b/src/mame/sinclair/screen_ula.cpp index e8b3894a9b4..fb0cce46aa1 100644 --- a/src/mame/sinclair/screen_ula.cpp +++ b/src/mame/sinclair/screen_ula.cpp @@ -47,7 +47,7 @@ u8 screen_ula_device::screen_mode() return ((m_ula_type == ULA_TYPE_NEXT) && m_ula_shadow_en) ? 0b000 : (m_port_ff_reg & 7); } -void screen_ula_device::draw_border(bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 border_color) +void screen_ula_device::draw_border(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 border_color, u8 pcode) { u8 pap_attr = border_color << 3; if ((m_ula_type == ULA_TYPE_NEXT) && m_ulanext_en) @@ -60,18 +60,28 @@ void screen_ula_device::draw_border(bitmap_rgb32 &bitmap, const rectangle &clipr const rgb_t gt1 = rgbexpand<3,3,3>((m_global_transparent << 1) | 1, 6, 3, 0); if (pap != gt0 && pap != gt1) { - bitmap.fill(pap, cliprect); + rectangle scr = { SCREEN_AREA.left() << 1, (SCREEN_AREA.right() << 1) | 1, SCREEN_AREA.top(), SCREEN_AREA.bottom() }; + scr.offset(m_offset_h, m_offset_v); - rectangle clip = { SCREEN_AREA.left() << 1, (SCREEN_AREA.right() << 1) | 1, SCREEN_AREA.top(), SCREEN_AREA.bottom() }; - clip.offset(m_offset_h, m_offset_v); - clip &= cliprect; - - if (!clip.empty()) - bitmap.fill(palette().pen_color(UTM_FALLBACK_PEN), clip); + const rectangle vis = screen.visible_area(); + rectangle bsides[4] = + { + rectangle(vis.left(), vis.right(), vis.top(), scr.top() - 1), + rectangle(vis.left(), scr.left() - 1, scr.top(), scr.bottom()), + rectangle(scr.right() + 1, vis.right(), scr.top(), scr.bottom()), + rectangle(vis.left(), vis.right(), scr.bottom() + 1, vis.bottom()) + }; + for (auto i = 0; i < 4; i++) + { + const rectangle border = bsides[i] & cliprect; + if (!border.empty()) + { + if (pcode) + screen.priority().fill(pcode, border); + bitmap.fill(pap, border); + } + } } - else - bitmap.fill(palette().pen_color(UTM_FALLBACK_PEN), cliprect); - } void screen_ula_device::draw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool flash, u8 pcode) diff --git a/src/mame/sinclair/screen_ula.h b/src/mame/sinclair/screen_ula.h index 3d794449287..24b7f411fd1 100644 --- a/src/mame/sinclair/screen_ula.h +++ b/src/mame/sinclair/screen_ula.h @@ -30,7 +30,7 @@ public: void ula_scroll_y_w(u8 ula_scroll_y) { m_ula_scroll_y = ula_scroll_y; } void ula_fine_scroll_x_w (bool ula_fine_scroll_x) { m_ula_fine_scroll_x = ula_fine_scroll_x; } - void draw_border(bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 border_color); + void draw_border(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 border_color, u8 pcode = 0); void draw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool flash = 0, u8 pcode = 0); protected: diff --git a/src/mame/sinclair/specnext.cpp b/src/mame/sinclair/specnext.cpp index c1ffc182c52..94590152155 100644 --- a/src/mame/sinclair/specnext.cpp +++ b/src/mame/sinclair/specnext.cpp @@ -209,7 +209,6 @@ private: virtual TIMER_CALLBACK_MEMBER(irq_on) override; INTERRUPT_GEN_MEMBER(specnext_interrupt); TIMER_CALLBACK_MEMBER(line_irq_on); - void ctc_int_w(int state); INTERRUPT_GEN_MEMBER(line_interrupt); TIMER_CALLBACK_MEMBER(spi_clock); void line_irq_adjust(); @@ -972,18 +971,11 @@ u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c const bool flash = u64(screen.frame_number() / m_frame_invert_count) & 1; // background - if (ula_en) - { - m_ula_scr->draw_border(bitmap, cliprect, m_port_fe_data & 0x07); - bitmap.fill(m_palette->pen_color(UTM_FALLBACK_PEN), clip256x192); - } - else - bitmap.fill(m_palette->pen_color(UTM_FALLBACK_PEN), cliprect); + screen.priority().fill(0, cliprect); + bitmap.fill(m_palette->pen_color(UTM_FALLBACK_PEN), cliprect); if (m_nr_15_layer_priority < 0b110) { - screen.priority().fill(0, cliprect); - static const u8 lcfg[][3] = { // tiles+ula priority; l2 priority; l2 mask @@ -1000,6 +992,7 @@ u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c if (tiles_en) m_tiles->draw(screen, bitmap, clip320x256, TILEMAP_DRAW_CATEGORY(1), l[0]); if (ula_en) { + m_ula_scr->draw_border(screen, bitmap, cliprect, m_port_fe_data & 0x07); if (m_nr_15_lores_en) m_lores->draw(screen, bitmap, clip256x192, l[0]); else m_ula_scr->draw(screen, bitmap, clip256x192, flash, l[0]); } @@ -1008,18 +1001,11 @@ u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c } else // colors mixing case { - if (ula_en && (m_nr_68_blend_mode == 0b00 || m_nr_68_blend_mode == 0b10)) // blending with ULA - { - screen.priority().fill(1, cliprect); - screen.priority().fill(0, clip256x192); - } - else - screen.priority().fill(0, cliprect); - if (m_nr_68_blend_mode == 0b00) // Use ULA as blend layer { if (ula_en) { + m_ula_scr->draw_border(screen, bitmap, cliprect, m_port_fe_data & 0x07, 1); if (m_nr_15_lores_en) m_lores->draw(screen, bitmap, clip256x192, 1); else m_ula_scr->draw(screen, bitmap, clip256x192, flash, 1); } @@ -1032,6 +1018,7 @@ u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c if (tiles_en) m_tiles->draw(screen, bitmap, clip320x256, TILEMAP_DRAW_CATEGORY(1), 1); if (ula_en) { + m_ula_scr->draw_border(screen, bitmap, cliprect, m_port_fe_data & 0x07, 1); if (m_nr_15_lores_en) m_lores->draw(screen, bitmap, clip256x192, 1); else m_ula_scr->draw(screen, bitmap, clip256x192, flash, 1); } @@ -1044,6 +1031,7 @@ u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c if (layer2_en) m_layer2->draw_mix(screen, bitmap, m_blendprio_bitmap, clip320x256, m_nr_15_layer_priority & 1); if (ula_en) { + m_ula_scr->draw_border(screen, bitmap, cliprect, m_port_fe_data & 0x07); if (m_nr_15_lores_en) m_lores->draw(screen, bitmap, clip256x192); else m_ula_scr->draw(screen, bitmap, clip256x192, flash); } @@ -1054,6 +1042,7 @@ u32 specnext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c if (tiles_en) m_tiles->draw(screen, bitmap, clip320x256, TILEMAP_DRAW_CATEGORY(1), 2); if (ula_en) { + m_ula_scr->draw_border(screen, bitmap, cliprect, m_port_fe_data & 0x07); if (m_nr_15_lores_en) m_lores->draw(screen, bitmap, clip256x192, 2); else m_ula_scr->draw(screen, bitmap, clip256x192, flash, 2); } |
