Skip to content

Conversation

@iamgreaser
Copy link
Contributor

Summary

This replaces the generic (S)VGA 2bpp, 4bpp, and 8bpp renderers with a single renderer which supports more of what the VGA at least theoretically does.

I am aware that this almost certainly will break a lot of things. I've tried to not break things, but, well... a lot of stuff depends on the (S)VGA renderer.

Features:

  • Loading (Sequencer) and address incrementing (CRTC) are now independent
    • You can read the same value twice or four times and it does what you'd think it would
  • Planes are chained in a ring
    • No idea if it's actually a ring or if it needs to shift in some 0s or some 1s, so this will need testing on quite a few pieces of hardware.
  • Byte/Word/Doubleword mode are now handled theoretically properly
  • The CGA 2bpp flag no longer ignores the 2 upper bit planes (fixes Potential misemulation of upper bits in CGA 2bpp compatibility mode on VGA #3836)
    • I would go as far to say that if something doesn't support this properly, it's an emulator.
  • 8bpp rendering is now based on the 4bpp renderer, and the 8bpp shift mode is implemented
    • The normal way of implementing the 8bpp shift mode is non-universal, and probably worth researching on a per-chipset level. (Neither of my two tested laptops implement it in the way it's implemented here, and one implements it in a way which is useless for 4bpp graphics.)
  • Blink is implemented in graphics mode (worth testing this for Blink VGA function in IBM PS/2 does not work #3447)
    • I can confirm that an Intel GMA 4500MHD (2008) can even do this in Mode 13h and it works in the most obvious way, which is how I've implemented it here... but this isn't universal and an AMD Stoney Ridge (2016) ignores blink in Mode 13h.

I will need to go back through the EGA renderer and get a lot of this stuff backported to it as, after scratching my head throughout this, bugs and missing features have been revealed.

The main thing I've learnt from all this? Odd/Even mode is a configuration nightmare, and VGA makes it even worse.

Checklist

References

The Chips & Technologies 82C451 datasheet was the most valuable authoritative reference.
I ensured that Pinball Fantasies still worked on IBM VGA and a VLB S3 Trio64. (The virtual machine I was using, a MR BIOS SX495, does not use PCI so I was unable to compare a V+ card, but I could get something set up for that.)
I also ensured that all QBASIC graphics modes usable on a VGA in MS-DOS 6.20 still worked on both as well - that is, 1,2,7,8,9,10,11,12,13.

About half of it was taken from the EGA renderer.

Also, the "force_old_addr" hack is kept here for now.
It appears that the S3 Trio does something weird with its 8bpp modes.
Specifically, it seems to ignore some of the flags needed for dword mode.

I will keep looking into that and see if I can find a good solution.
Outside of that, we're now using the remappers properly.
This gives more likely behaviour when one loads more often than the address is incremented.
The behaviour matches an Intel GMA 4500MHD (2008) which is the earliest hardware I'm able to test right now.
Easy test case in QBASIC:

    SCREEN 10
    PSET (2,0),2

There should be a blinking pixel in the top-left.
I was going to use the existing 8bpp renderers as-is for the S3 stuff but then found out how to make it work on the new generic renderer.
@OBattler OBattler merged commit b90a353 into 86Box:master Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential misemulation of upper bits in CGA 2bpp compatibility mode on VGA

2 participants