diff options
| author | 2026-03-25 13:19:47 +0100 | |
|---|---|---|
| committer | 2026-03-25 16:56:56 +0100 | |
| commit | 1d96bb63bd9c827b8cc0674b93d57ef2a9fe1243 (patch) | |
| tree | e373da7297ba8c06be804913a0f15fcc6ffdbe6f /src | |
| parent | 0bc667ed21969964962a5a449d911d8a9601e292 (diff) | |
bus/pci/sis6326.cpp: add shifter behaviour on High/True Color depths
Diffstat (limited to 'src')
| -rw-r--r-- | src/devices/bus/pci/sis6326.cpp | 82 | ||||
| -rw-r--r-- | src/devices/bus/pci/sis6326.h | 28 | ||||
| -rw-r--r-- | src/devices/cpu/ssp1601/ssp1601.h | 2 | ||||
| -rw-r--r-- | src/devices/machine/sis950_lpc.cpp | 4 | ||||
| -rw-r--r-- | src/devices/machine/vt82c586b_isa.cpp | 6 | ||||
| -rw-r--r-- | src/devices/video/pc_vga.h | 2 | ||||
| -rw-r--r-- | src/devices/video/pc_vga_sis.cpp | 26 | ||||
| -rw-r--r-- | src/devices/video/pc_vga_sis.h | 2 |
8 files changed, 103 insertions, 49 deletions
diff --git a/src/devices/bus/pci/sis6326.cpp b/src/devices/bus/pci/sis6326.cpp index 376e3c545d6..e185a20c426 100644 --- a/src/devices/bus/pci/sis6326.cpp +++ b/src/devices/bus/pci/sis6326.cpp @@ -4,6 +4,14 @@ SiS 6326 +TODO: +- Move rendering in own unit, as SIS6326_GUI; +- Fix transparency issues, particularly at 8-bit color depth (Windows start logo); +- Add Turbo Queue (currently scoring too high in benchmark tests); +- Make AGP to install properly (bridge fault?); +- 3d rendering; +- MPEG acceleration for DVD; + **************************************************************************************************/ #include "emu.h" @@ -162,16 +170,16 @@ void sis6326_pci_device::mmio_map(address_map &map) ); map(0x8290, 0x8293).lw32( NAME([this] (offs_t offset, u32 data, u32 mem_mask) { - COMBINE_DATA(&m_fg_color); - m_fg_color &= 0xff'ffff; + COMBINE_DATA(&m_fg_color.u); + m_fg_color.u &= 0xff'ffff; if (ACCESSING_BITS_24_31) m_fg_rop = data >> 24; }) ); map(0x8294, 0x8297).lw32( NAME([this] (offs_t offset, u32 data, u32 mem_mask) { - COMBINE_DATA(&m_bg_color); - m_bg_color &= 0xff'ffff; + COMBINE_DATA(&m_bg_color.u); + m_bg_color.u &= 0xff'ffff; if (ACCESSING_BITS_24_31) m_bg_rop = data >> 24; }) @@ -210,6 +218,10 @@ void sis6326_pci_device::mmio_map(address_map &map) NAME([] (offs_t offset) { return 0x8000; }), NAME([this] (offs_t offset, u16 data, u16 mem_mask) { COMBINE_DATA(&m_draw_command); + // TODO: fix transparency issues from here + // "a word write initiates 2d command" according to doc + // - win98se actually uses byte writes when initiating a CPU BitBlt anyway, + // where's the trigger for it? if (mem_mask == 0xffff) trigger_2d_command(); }) @@ -280,23 +292,23 @@ const sis6326_pci_device::get_src_func sis6326_pci_device::get_src_table[4] = }; -u8 sis6326_pci_device::get_src_bgcol(u32 offset_base, u32 x) +u8 sis6326_pci_device::get_src_bgcol(u32 offset_base, u32 x, u8 shifter) { - return m_bg_color; + return m_bg_color.b[shifter]; } -u8 sis6326_pci_device::get_src_fgcol(u32 offset_base, u32 x) +u8 sis6326_pci_device::get_src_fgcol(u32 offset_base, u32 x, u8 shifter) { - return m_fg_color; + return m_fg_color.b[shifter]; } -u8 sis6326_pci_device::get_src_mem(u32 offset_base, u32 x) +u8 sis6326_pci_device::get_src_mem(u32 offset_base, u32 x, u8 shifter) { return m_vga->read_memory(offset_base + x); } // TODO: no idea about this yet -u8 sis6326_pci_device::get_src_cpu(u32 offset_base, u32 x) +u8 sis6326_pci_device::get_src_cpu(u32 offset_base, u32 x, u8 shifter) { return x & 1 ? 0x55 : 0xaa; } @@ -309,24 +321,24 @@ const sis6326_pci_device::get_pat_func sis6326_pci_device::get_pat_table[4] = &sis6326_pci_device::get_pat_ddraw }; -u8 sis6326_pci_device::get_pat_bgcol(u32 y, u32 x) +u8 sis6326_pci_device::get_pat_bgcol(u32 y, u32 x, u8 shifter) { - return m_bg_color; + return m_bg_color.b[shifter]; } -u8 sis6326_pci_device::get_pat_fgcol(u32 y, u32 x) +u8 sis6326_pci_device::get_pat_fgcol(u32 y, u32 x, u8 shifter) { - return m_fg_color; + return m_fg_color.b[shifter]; } // testable in win98se shutdown options -u8 sis6326_pci_device::get_pat_regs(u32 y, u32 x) +u8 sis6326_pci_device::get_pat_regs(u32 y, u32 x, u8 shifter) { return m_pattern_data[((y & 7) << 3) | (x & 7)]; } // TODO: this is special, uses regs in a different way -u8 sis6326_pci_device::get_pat_ddraw(u32 y, u32 x) +u8 sis6326_pci_device::get_pat_ddraw(u32 y, u32 x, u8 shifter) { return x & 1 ? 0x55 : 0xaa; } @@ -427,10 +439,11 @@ void sis6326_pci_device::trigger_2d_command() return; } } + u8 shifter; + const u8 color_depth = m_vga->get_video_depth(); + const u8 shifter_mask = color_depth >> 3; // bits 15-14 are r/o - // TODO: currently using 256 colors only - // how this even acknowledge a change in color mode? switch(cmd_type) { case 0: @@ -438,7 +451,7 @@ void sis6326_pci_device::trigger_2d_command() LOGBLIT("\tBitBlt\n"); LOGBLIT("\tSRC Addr %06x DST Addr %06x Sel %02x\n", m_src_start_addr, m_dst_start_addr, m_draw_sel); LOGBLIT("\tSRC Pitch %d DST Pitch %d Rect %dx%d\n", m_src_pitch, m_dst_pitch, m_rect_width, m_rect_height); - LOGBLIT("\tFG ROP %02x Color %06x | BG ROP %02x Color %06x\n", m_fg_rop, m_fg_color, m_bg_rop, m_bg_color); + LOGBLIT("\tFG ROP %02x Color %06x | BG ROP %02x Color %06x\n", m_fg_rop, m_fg_color.u, m_bg_rop, m_bg_color.u); for (s32 y = 0; y < m_rect_height; y++) { @@ -453,6 +466,7 @@ void sis6326_pci_device::trigger_2d_command() const u32 src_base = (yi * m_src_pitch) + m_src_start_addr; const u32 dst_base = (yi * m_dst_pitch) + m_dst_start_addr; + for (s32 x = 0; x < m_rect_width; x++) { const s32 xi = x * x_dir; @@ -464,9 +478,10 @@ void sis6326_pci_device::trigger_2d_command() continue; } - const u8 src = (this->*get_src_table[src_select])(src_base, xi); + shifter = x % shifter_mask; + const u8 src = (this->*get_src_table[src_select])(src_base, xi, shifter); const u8 dst = m_vga->read_memory(xi + dst_base); - const u8 pat = (this->*get_pat_table[pat_select])(y, x); + const u8 pat = (this->*get_pat_table[pat_select])(y, x, shifter); const u8 res = GetROP(m_fg_rop, src, dst, pat) & 0xff; m_vga->write_memory(xi + dst_base, res); } @@ -484,10 +499,13 @@ void sis6326_pci_device::trigger_2d_command() { const bool color_exp = !!BIT(m_draw_command, 12); const bool font_exp = !!BIT(m_draw_command, 13); + // TODO: not yet right for 16-bit color depth and res <= 800x600 + const u8 pattern_shift = shifter_mask - 1; + LOGBLIT("\tColor/Font expansion: Color enhanced %d Font enhanced %d\n", color_exp, font_exp); LOGBLIT("\tSRC Addr %06x DST Addr %06x Sel %02x\n", m_src_start_addr, m_dst_start_addr, m_draw_sel); LOGBLIT("\tSRC Pitch %d DST Pitch %d Rect %dx%d\n", m_src_pitch, m_dst_pitch, m_rect_width, m_rect_height); - LOGBLIT("\tFG ROP %02x Color %06x | BG ROP %02x Color %06x\n", m_fg_rop, m_fg_color, m_bg_rop, m_bg_color); + LOGBLIT("\tFG ROP %02x Color %06x | BG ROP %02x Color %06x\n", m_fg_rop, m_fg_color.u, m_bg_rop, m_bg_color.u); if (m_rect_width > 8) { @@ -521,12 +539,13 @@ void sis6326_pci_device::trigger_2d_command() continue; } - const u8 src = (this->*get_src_table[src_select])(src_base, xi); + shifter = x % shifter_mask; + const u8 src = (this->*get_src_table[src_select])(src_base, xi, shifter); const u8 dst = m_vga->read_memory(xi + dst_base); - const u8 dot = (m_pattern_data[pattern_base] >> (7 - x) & 1); + const u8 dot = (m_pattern_data[pattern_base] >> (7 - (x >> pattern_shift)) & 1); // ROP and pattern depends on dot output // - win98se start menu hovering - const u8 res = GetROP(dot ? m_fg_rop : m_bg_rop, src, dst, dot ? m_fg_color : m_bg_color) & 0xff; + const u8 res = GetROP(dot ? m_fg_rop : m_bg_rop, src, dst, dot ? m_fg_color.b[shifter] : m_bg_color.b[shifter]) & 0xff; m_vga->write_memory(xi + dst_base, res); } } @@ -548,7 +567,7 @@ void sis6326_pci_device::trigger_2d_command() LOGBLIT("\tLine: major axis %s last pixel %d\n", major_axis ? "Y" : "X", !last_pixel); LOGBLIT("\tX Start %d Y Start %d\n", xs, ys); LOGBLIT("\tMajor Axial Pixel Count %d K1 %d K2 %d error %d style %04x\n", m_rect_width, k1_term, k2_term, error_term, line_style); - LOGBLIT("\tFG ROP %02x Color %06x | BG ROP %02x Color %06x\n", m_fg_rop, m_fg_color, m_bg_rop, m_bg_color); + LOGBLIT("\tFG ROP %02x Color %06x | BG ROP %02x Color %06x\n", m_fg_rop, m_fg_color.u, m_bg_rop, m_bg_color.u); // TODO: preliminary, enough for crosshair in Windows Gaming Options and not much else // Standard Bresenham line drawing @@ -563,6 +582,8 @@ void sis6326_pci_device::trigger_2d_command() return; } + // TODO: unverified for lines + color depth >= 16 + shifter = xs % shifter_mask; for (s32 y = 0; y < pixel_count; y++) { const s32 yi = ys - half_count + y * y_dir; @@ -576,10 +597,10 @@ void sis6326_pci_device::trigger_2d_command() const u32 src_base = (yi * m_src_pitch); const u32 dst_base = (yi * m_dst_pitch); - const u8 src = (this->*get_src_table[src_select])(src_base, xi); + const u8 src = (this->*get_src_table[src_select])(src_base, xi, shifter); const u8 dst = m_vga->read_memory(xi + dst_base); const u16 dot = BIT(line_style, (15 - y) & 0xf); - const u8 res = GetROP(dot ? m_fg_rop : m_bg_rop, src, dst, dot ? m_fg_color : m_bg_color) & 0xff; + const u8 res = GetROP(dot ? m_fg_rop : m_bg_rop, src, dst, dot ? m_fg_color.b[shifter] : m_bg_color.b[shifter]) & 0xff; m_vga->write_memory(xi + dst_base, res); } } @@ -605,11 +626,12 @@ void sis6326_pci_device::trigger_2d_command() const u32 src_base = (yi * m_src_pitch); const u32 dst_base = (yi * m_dst_pitch); + shifter = x % shifter_mask; - const u8 src = (this->*get_src_table[src_select])(src_base, xi); + const u8 src = (this->*get_src_table[src_select])(src_base, xi, shifter); const u8 dst = m_vga->read_memory(xi + dst_base); const u16 dot = BIT(line_style, (15 - x) & 0xf); - const u8 res = GetROP(dot ? m_fg_rop : m_bg_rop, src, dst, dot ? m_fg_color : m_bg_color) & 0xff; + const u8 res = GetROP(dot ? m_fg_rop : m_bg_rop, src, dst, dot ? m_fg_color.b[shifter] : m_bg_color.b[shifter]) & 0xff; m_vga->write_memory(xi + dst_base, res); } } diff --git a/src/devices/bus/pci/sis6326.h b/src/devices/bus/pci/sis6326.h index bc3115e3914..13c8c58cb61 100644 --- a/src/devices/bus/pci/sis6326.h +++ b/src/devices/bus/pci/sis6326.h @@ -51,7 +51,13 @@ private: u8 m_draw_sel; u16 m_src_pitch, m_dst_pitch; u16 m_rect_width, m_rect_height; - u32 m_fg_color, m_bg_color; + + union COLOR_DRAW { + u8 b[4]; + u32 u; + }; + + COLOR_DRAW m_fg_color, m_bg_color; u8 m_fg_rop, m_bg_rop; u8 m_mask[8]; u16 m_clip_top, m_clip_left, m_clip_bottom, m_clip_right; @@ -59,19 +65,19 @@ private: u16 m_draw_command; u8 m_pattern_data[128]; - typedef u8 (sis6326_pci_device::*get_src_func)(u32 offset_base, u32 x); + typedef u8 (sis6326_pci_device::*get_src_func)(u32 offset_base, u32 x, u8 shifter); static const get_src_func get_src_table[4]; - u8 get_src_bgcol(u32 offset_base, u32 x); - u8 get_src_fgcol(u32 offset_base, u32 x); - u8 get_src_mem(u32 offset_base, u32 x); - u8 get_src_cpu(u32 offset_base, u32 x); + u8 get_src_bgcol(u32 offset_base, u32 x, u8 shifter); + u8 get_src_fgcol(u32 offset_base, u32 x, u8 shifter); + u8 get_src_mem(u32 offset_base, u32 x, u8 shifter); + u8 get_src_cpu(u32 offset_base, u32 x, u8 shifter); - typedef u8 (sis6326_pci_device::*get_pat_func)(u32 offset_base, u32 x); + typedef u8 (sis6326_pci_device::*get_pat_func)(u32 offset_base, u32 x, u8 shifter); static const get_pat_func get_pat_table[4]; - u8 get_pat_bgcol(u32 y, u32 x); - u8 get_pat_fgcol(u32 y, u32 x); - u8 get_pat_regs(u32 y, u32 x); - u8 get_pat_ddraw(u32 y, u32 x); + u8 get_pat_bgcol(u32 y, u32 x, u8 shifter); + u8 get_pat_fgcol(u32 y, u32 x, u8 shifter); + u8 get_pat_regs(u32 y, u32 x, u8 shifter); + u8 get_pat_ddraw(u32 y, u32 x, u8 shifter); u32 GetROP(u8 rop, u32 src, u32 dst, u32 pat); }; diff --git a/src/devices/cpu/ssp1601/ssp1601.h b/src/devices/cpu/ssp1601/ssp1601.h index 48133cd5790..c846f987a5f 100644 --- a/src/devices/cpu/ssp1601/ssp1601.h +++ b/src/devices/cpu/ssp1601/ssp1601.h @@ -51,7 +51,7 @@ private: PAIR m_gr[8]; /* general regs, some are 16bit, some 32bit */ union { - unsigned char m_r[8]; /* pointer registers, 4 for earch bank */ + unsigned char m_r[8]; /* pointer registers, 4 for each bank */ struct { unsigned char m_r0[4]; unsigned char m_r1[4]; diff --git a/src/devices/machine/sis950_lpc.cpp b/src/devices/machine/sis950_lpc.cpp index b097ac90c89..c45ff3256ae 100644 --- a/src/devices/machine/sis950_lpc.cpp +++ b/src/devices/machine/sis950_lpc.cpp @@ -40,7 +40,7 @@ TODO: #define LOG_TODO (1U << 2) // log unimplemented registers #define LOG_MAP (1U << 3) // log full remaps #define LOG_LPC (1U << 4) // log LPC legacy regs -#define LOG_IRQ (1U << 5) // log IRQ remaps +#define LOG_IRQ (1U << 5) // log IRQ remaps and state #define VERBOSE (LOG_GENERAL | LOG_IO | LOG_TODO | LOG_IRQ) //#define LOG_OUTPUT_FUNC osd_printf_info @@ -934,7 +934,7 @@ void sis950_lpc_device::irq_handler(int line, int state) if(line < 0 || line >= 16) return; - logerror("irq_handler %d %d\n", line, state); + LOGIRQ("irq_handler %d %d\n", line, state); redirect_irq(line, state); } diff --git a/src/devices/machine/vt82c586b_isa.cpp b/src/devices/machine/vt82c586b_isa.cpp index 0361db08b15..289c44bee8e 100644 --- a/src/devices/machine/vt82c586b_isa.cpp +++ b/src/devices/machine/vt82c586b_isa.cpp @@ -12,9 +12,13 @@ VT82C586B PCIC ISA section #include "bus/pc_kbd/keyboards.h" #include "speaker.h" +#define LOG_IRQ (1U << 1) // log line state + #define VERBOSE (LOG_GENERAL) //#define LOG_OUTPUT_FUNC osd_printf_info +#define LOGIRQ(...) LOGMASKED(LOG_IRQ, __VA_ARGS__) + #include "logmacro.h" DEFINE_DEVICE_TYPE(VT82C586B_ISA, vt82c586b_isa_device, "vt82c586b_isa", "VT82C586B \"PIPC\" PCI-to-ISA bridge") @@ -908,7 +912,7 @@ void vt82c586b_isa_device::irq_handler(int line, int state) if(line < 0 || line >= 16) return; - logerror("irq_handler %d %d\n", line, state); + LOGIRQ("irq_handler %d %d\n", line, state); redirect_irq(line, state); } diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index e01a8401804..b093b33f3b7 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -326,7 +326,7 @@ class svga_device : public vga_device public: virtual void zero() override; virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override; - uint8_t get_video_depth(); + virtual uint8_t get_video_depth(); protected: // construction/destruction diff --git a/src/devices/video/pc_vga_sis.cpp b/src/devices/video/pc_vga_sis.cpp index 84af4c8853e..4a62e59fbbb 100644 --- a/src/devices/video/pc_vga_sis.cpp +++ b/src/devices/video/pc_vga_sis.cpp @@ -1160,7 +1160,7 @@ void sis6326_vga_device::sequencer_map(address_map &map) const bool latch_address = offset == 2; const u8 mask = latch_address ? 0x0f : 0xff; m_fast_page_address_latch[offset] = data & mask; - LOG("SR30: Fast Page Flip Starting Address [%d] %02x\n", offset, data); + LOG("SR%02X: Fast Page Flip Starting Address [%d] %02x\n", offset + 0x30, offset, data); // TODO: Direct Draw obviously uses this //if (BIT(m_dram_fb_size, 4) && latch_address) //{ @@ -1424,9 +1424,11 @@ std::tuple<u8, u8> sis6326_vga_device::flush_true_color_mode() if ((m_ramdac_mode & 0x12) != 0x12) return std::make_tuple(0, 0); - const u8 res = !BIT(m_ext_sr07, 2); + // whatever is this doesn't seem related to the actual video format output + // win98se has it enabled, SDD doesn't, both use 24-bit depth anyway +// const u8 res = !BIT(m_ext_sr07, 2); - return std::make_tuple(res, 0); + return std::make_tuple(1, 0); } void sis6326_vga_device::recompute_params() @@ -1480,6 +1482,24 @@ u16 sis6326_vga_device::line_compare_mask() return 0x3ff | (vga.crtc.line_compare & 0xfc00); } +uint8_t sis6326_vga_device::get_video_depth() +{ + switch(pc_vga_choosevideomode()) + { + case VGA_MODE: + case RGB8_MODE: + return 8; + case RGB15_MODE: + case RGB16_MODE: + return 16; + case RGB24_MODE: + return 24; + case RGB32_MODE: + return 32; + } + return 0; +} + uint8_t sis6326_vga_device::mem_r(offs_t offset) { if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en || svga.rgb32_en) diff --git a/src/devices/video/pc_vga_sis.h b/src/devices/video/pc_vga_sis.h index 6aa64095a1f..474f913b2a0 100644 --- a/src/devices/video/pc_vga_sis.h +++ b/src/devices/video/pc_vga_sis.h @@ -43,6 +43,8 @@ public: vga.memory[address % vga.svga_intf.vram_size] = data; } + virtual uint8_t get_video_depth() override; + protected: sis6326_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); |
