From b9a7dacb6aa1797697b2e0c97436531f77dade10 Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 11 Aug 2023 00:48:46 +0200 Subject: video/pc_vga.cpp: implement line_compare_mask getter, fixes 1600x1200x8 in mga2064w video/mga2064w.cpp: implement vcount --- src/devices/video/mga2064w.cpp | 2 +- src/devices/video/pc_vga.cpp | 10 ++++--- src/devices/video/pc_vga.h | 1 + src/devices/video/pc_vga_matrox.cpp | 51 +++++++++++++++++++---------------- src/devices/video/pc_vga_matrox.h | 4 ++- src/devices/video/pc_vga_paradise.cpp | 5 ++++ src/devices/video/pc_vga_paradise.h | 1 + src/devices/video/pc_vga_s3.cpp | 6 +++++ src/devices/video/pc_vga_s3.h | 2 ++ src/devices/video/pc_vga_tseng.cpp | 16 +++++------ 10 files changed, 61 insertions(+), 37 deletions(-) diff --git a/src/devices/video/mga2064w.cpp b/src/devices/video/mga2064w.cpp index 3a6e2f86896..aeffa8c80bb 100644 --- a/src/devices/video/mga2064w.cpp +++ b/src/devices/video/mga2064w.cpp @@ -132,7 +132,7 @@ void mga2064w_device::mgabase1_map(address_map &map) map(0x1e14, 0x1e17).r(FUNC(mga2064w_device::status_r)); // map(0x1e18, 0x1e1b) ICLEAR // map(0x1e1c, 0x1e1f) IEN -// map(0x1e20, 0x1e23) VCOUNT (r/o) + map(0x1e20, 0x1e23).r(m_svga, FUNC(matrox_vga_device::vcount_r)); // map(0x1e40, 0x1e43) Reset // map(0x1e54, 0x1e57) OPMODE // map(0x1f00, 0x1fff) VGA CRTC linear I/O diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index d583f25be66..430ce1004ae 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -1336,7 +1336,6 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) int addrmask = vga.crtc.no_wrap ? -1 : 0xffff; /* line compare is screen sensitive */ - // FIXME: some clients extends line compare with bit 10 uint16_t mask_comp = 0x3ff; //| (LINES & 0x300); // popmessage("%02x %02x",vga.attribute.pel_shift,vga.sequencer.data[4] & 0x08); @@ -1803,13 +1802,16 @@ void svga_device::device_start() save_item(NAME(svga.id)); } +u16 svga_device::line_compare_mask() +{ + return 0x3ff; +} + void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - /* line compare is screen sensitive */ - // FIXME: some clients extends line compare with bit 10 - uint16_t mask_comp = 0x3ff; + uint16_t mask_comp = line_compare_mask(); int curr_addr = 0; // uint16_t line_length; // if(vga.crtc.dw) diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index 2c37ec3e3b3..f314032d193 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -321,6 +321,7 @@ protected: void svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect); virtual uint8_t pc_vga_choosevideomode() override; virtual void device_start() override; + virtual u16 line_compare_mask(); struct { uint8_t bank_r, bank_w; diff --git a/src/devices/video/pc_vga_matrox.cpp b/src/devices/video/pc_vga_matrox.cpp index 42709c4add6..6756ab79a0b 100644 --- a/src/devices/video/pc_vga_matrox.cpp +++ b/src/devices/video/pc_vga_matrox.cpp @@ -239,35 +239,35 @@ void matrox_vga_device::ramdac_indexed_map(address_map &map) map(0x01, 0x01).lr8( NAME([] (offs_t offset) { return 0x00; }) ); -// map(0x06, 0x06) CCR indirect cursor control -// map(0x0f, 0x0f) LCR latch control +// map(0x06, 0x06) CCR indirect cursor control +// map(0x0f, 0x0f) LCR latch control map(0x18, 0x18).rw(FUNC(matrox_vga_device::truecolor_ctrl_r), FUNC(matrox_vga_device::truecolor_ctrl_w)); map(0x19, 0x19).rw(FUNC(matrox_vga_device::multiplex_ctrl_r), FUNC(matrox_vga_device::multiplex_ctrl_w)); -// map(0x1a, 0x1a) CSR clock selection -// map(0x1c, 0x1c) palette page -// map(0x1d, 0x1d) GCR general control -// map(0x1e, 0x1e) MSC misc control - -// map(0x2a, 0x2a) IOC GPIO control (bits 4-0, 1 = data bit as output, 0 = data bit as input) -// map(0x2b, 0x2b) GPIO data (bits 4-0) -// map(0x2d, 0x2d) pixel clock PLL -// map(0x2e, 0x2e) memory clock PLL -// map(0x2f, 0x2f) loop clock PLL -// map(0x30, 0x31) color key overlay -// map(0x32, 0x37) color key r/g/b -// map(0x38, 0x38) CKC color key control -// map(0x39, 0x39) MKC MCLK & loop clock control -// map(0x3a, 0x3a) sense test -// map(0x3b, 0x3b) Test mode data (r/o) -// map(0x3c, 0x3d) CRC signal test (r/o) -// map(0x3e, 0x3e) BSR CRC bit select +// map(0x1a, 0x1a) CSR clock selection +// map(0x1c, 0x1c) palette page +// map(0x1d, 0x1d) GCR general control +// map(0x1e, 0x1e) MSC misc control + +// map(0x2a, 0x2a) IOC GPIO control (bits 4-0, 1 = data bit as output, 0 = data bit as input) +// map(0x2b, 0x2b) GPIO data (bits 4-0) +// map(0x2d, 0x2d) pixel clock PLL +// map(0x2e, 0x2e) memory clock PLL +// map(0x2f, 0x2f) loop clock PLL +// map(0x30, 0x31) color key overlay +// map(0x32, 0x37) color key r/g/b +// map(0x38, 0x38) CKC color key control +// map(0x39, 0x39) MKC MCLK & loop clock control +// map(0x3a, 0x3a) sense test +// map(0x3b, 0x3b) Test mode data (r/o) +// map(0x3c, 0x3d) CRC signal test (r/o) +// map(0x3e, 0x3e) BSR CRC bit select // chip ID map(0x3f, 0x3f).lr8( NAME([] (offs_t offset) { return 0x26; }) ); -// map(0xff, 0xff) software reset (w/o) +// map(0xff, 0xff) software reset (w/o) } u8 matrox_vga_device::truecolor_ctrl_r() @@ -433,8 +433,13 @@ uint16_t matrox_vga_device::offset() uint32_t matrox_vga_device::start_addr() { // TODO: fails VBEtest scrolling tests -// if (m_mgamode) -// return (vga.crtc.start_addr << 4); +// if (m_mgamode) +// return (vga.crtc.start_addr << 4); return svga_device::start_addr(); } + +u16 matrox_vga_device::line_compare_mask() +{ + return m_mgamode ? 0x7ff : 0x3ff; +} diff --git a/src/devices/video/pc_vga_matrox.h b/src/devices/video/pc_vga_matrox.h index cd30731b754..c12847b342f 100644 --- a/src/devices/video/pc_vga_matrox.h +++ b/src/devices/video/pc_vga_matrox.h @@ -20,8 +20,9 @@ public: virtual uint8_t mem_r(offs_t offset) override; virtual void mem_w(offs_t offset, uint8_t data) override; - // TODO: polarity + // TODO: polarity select bool vsync_status() { return vga_vblank(); } + u32 vcount_r() { return screen().vpos() & 0xfff; } protected: virtual void io_3bx_3dx_map(address_map &map) override; @@ -37,6 +38,7 @@ protected: void flush_true_color_mode(); private: virtual space_config_vector memory_space_config() const override; + virtual u16 line_compare_mask() override; address_space_config m_crtcext_space_config; address_space_config m_ramdac_indexed_space_config; diff --git a/src/devices/video/pc_vga_paradise.cpp b/src/devices/video/pc_vga_paradise.cpp index 3cd534de6a5..006eb812944 100644 --- a/src/devices/video/pc_vga_paradise.cpp +++ b/src/devices/video/pc_vga_paradise.cpp @@ -679,6 +679,11 @@ void wd90c30_vga_device::vert_timing_overflow_w(offs_t offset, u8 data) recompute_params(); } +u16 wd90c30_vga_device::line_compare_mask() +{ + return svga.rgb8_en ? 0x7ff : 0x3ff; +} + /************************************** * * Western Digital WD90C31 diff --git a/src/devices/video/pc_vga_paradise.h b/src/devices/video/pc_vga_paradise.h index e0a727697b2..27993e99ada 100644 --- a/src/devices/video/pc_vga_paradise.h +++ b/src/devices/video/pc_vga_paradise.h @@ -121,6 +121,7 @@ protected: virtual void sequencer_map(address_map &map) override; virtual void device_reset() override; + virtual u16 line_compare_mask() override; private: u8 vert_timing_overflow_r(offs_t offset); void vert_timing_overflow_w(offs_t offset, u8 data); diff --git a/src/devices/video/pc_vga_s3.cpp b/src/devices/video/pc_vga_s3.cpp index 140a6b493fa..e32f9260b13 100644 --- a/src/devices/video/pc_vga_s3.cpp +++ b/src/devices/video/pc_vga_s3.cpp @@ -82,6 +82,12 @@ void s3_vga_device::device_reset() s3.sr11 = 0x41; } +u16 s3_vga_device::line_compare_mask() +{ + // TODO: pinpoint condition + return svga.rgb8_en ? 0x7ff : 0x3ff; +} + uint16_t s3_vga_device::offset() { //popmessage("Offset: %04x %s %s %s",vga.crtc.offset,vga.crtc.dw?"DW":"--",vga.crtc.word_mode?"BYTE":"WORD",(s3.memory_config & 0x08)?"31":"--"); diff --git a/src/devices/video/pc_vga_s3.h b/src/devices/video/pc_vga_s3.h index 700077fef05..88c2da0da25 100644 --- a/src/devices/video/pc_vga_s3.h +++ b/src/devices/video/pc_vga_s3.h @@ -37,6 +37,8 @@ protected: virtual void crtc_map(address_map &map) override; virtual void sequencer_map(address_map &map) override; + virtual u16 line_compare_mask() override; + // TODO: remove this leaky abstraction struct { diff --git a/src/devices/video/pc_vga_tseng.cpp b/src/devices/video/pc_vga_tseng.cpp index 9c492b9b49f..9d85a96c37e 100644 --- a/src/devices/video/pc_vga_tseng.cpp +++ b/src/devices/video/pc_vga_tseng.cpp @@ -116,10 +116,10 @@ u8 tseng_vga_device::ramdac_hidden_windex_r(offs_t offset) void tseng_vga_device::crtc_map(address_map &map) { svga_device::crtc_map(map); -// map(0x30, 0x30) System Segment Map Comparator -// map(0x31, 0x31) General Purpose (& Clock Select 3/4) -// map(0x32, 0x32) RAS/CAS Configuration (RCCONF) -// map(0x33, 0x33) Extended Start Address +// map(0x30, 0x30) System Segment Map Comparator +// map(0x31, 0x31) General Purpose (& Clock Select 3/4) +// map(0x32, 0x32) RAS/CAS Configuration (RCCONF) +// map(0x33, 0x33) Extended Start Address // Auxiliary Control map(0x34, 0x34).lrw8( NAME([this] (offs_t offset) { @@ -130,8 +130,8 @@ void tseng_vga_device::crtc_map(address_map &map) recompute_params(); }) ); -// map(0x35, 0x35) Overflow High -// map(0x36, 0x36) Video System Configuration 1 (VSCONF1) +// map(0x35, 0x35) Overflow High +// map(0x36, 0x36) Video System Configuration 1 (VSCONF1) // Video System Configuration 2 (VSCONF2) // NOTE: reads memory installed from here map(0x37, 0x37).ram(); @@ -153,8 +153,8 @@ void tseng_vga_device::sequencer_map(address_map &map) svga_device::sequencer_map(map); // TODO: preseve legacy hookup, to be investigated map(0x05, 0xff).unmaprw(); -// map(0x06, 0x06) TS State Control -// map(0x07, 0x07) TS Auxiliary Mode +// map(0x06, 0x06) TS State Control +// map(0x07, 0x07) TS Auxiliary Mode } void tseng_vga_device::attribute_map(address_map &map) -- cgit v1.2.3