VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Are there other x86/PC emulators that emulate a video display(CRTC and rendering) literally on the cycle-level? I know UniPCemu does(using a precalculated horizontal and vertical decision table for determining specific states, like when to time a half-clock(in the case of VGA, essentially a group of four pixels instead of the official eight, required for e.g. 8BPP modes and up), whole clock, when to increase the various video card's counters, different retraces etc.) and most-known emulators Dosbox/PCem only run at a line-rendering level instead of pixel-rendering level.

In UniPCemu's case, the different precalculated values in the horizontal and vertical timings are OR-ed together to make a decision on the signal level(done first) and plotting/blanking/retrace level(done after the signal level).

UniPCemu's bits from the precalculated horizontal and vertical signals:

#define VGA_SIGNAL_VTOTAL 0x1
#define VGA_SIGNAL_HTOTAL 0x2
#define VGA_SIGNAL_VRETRACESTART 0x4
#define VGA_SIGNAL_HRETRACESTART 0x8
#define VGA_SIGNAL_VRETRACEEND 0x10
#define VGA_SIGNAL_HRETRACEEND 0x20
#define VGA_SIGNAL_VBLANKSTART 0x40
#define VGA_SIGNAL_HBLANKSTART 0x80
#define VGA_SIGNAL_VBLANKEND 0x100
#define VGA_SIGNAL_HBLANKEND 0x200
#define VGA_SIGNAL_VSYNCRESET 0x400
#define VGA_SIGNAL_HSYNCRESET 0x800
#define VGA_VACTIVEDISPLAY 0x1000
#define VGA_HACTIVEDISPLAY 0x2000
#define VGA_OVERSCAN 0x4000
//Extra information to apply globally and periodically!
#define VGA_DISPLAYGRAPHICSMODE 0x8000
#define VGA_SIGNAL_BLANKING 0x10000

The current state of the renderer at any point in time is a combination of all those 1-bit flags(taken from a dword in the horizontal and vertical entry tables, OR-ed together for the active 'signal'). Said signal is inputted into two precalculated tables(first one for the signal(e.g. retrace, blanking and related logic), next one for the display logic(e.g. rendering a pixel to the CRTC from buffers&VRAM accordingly)). Those two (tables and actions) are used for each pixel clock that's executed(e.g. 25M or 28M times a second(or 14.31818M for CGA)).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io