Area 5150

Support and general discussion.
Post Reply
User avatar
Posts: 1039
Joined: Fri 25 Apr, 2014 4:47 pm

Area 5150

Post by leilei »
Hardware capture (for reference/awe)

Tried it on v17 and noticed these bugs on a stock XT 4.77MHz+CGA(RGB) configuration

Intro- the emulated CGA overscan border not being large enough to make the smooth screen transition
Elephant - melts down when electrocuted, rather than just dropping off from the top
Tetra3D - there's a bad line in there and the screen flickers to smaller resolutions every bounce.
Picture (8:00) - flickers heavily as it renders one line with an overscan border
Credits - no music and the same kind of flickering as the picture that preceded it

Haven't tested it in the latest tree (which doesn't have critical CGA changes as far as I'm aware)

I think a lot of this could be resolved (IMO theoretically) by emulating CGA at a fixed high resolution (including loads of overscan area)?
User avatar
Posts: 10
Joined: Sun 23 Dec, 2018 6:18 pm

Re: Area 5150

Post by VileR »

Hi (one of the authors here), might be able to help out with some info if there's any interest.
leilei wrote: Mon 15 Aug, 2022 12:23 pmI think a lot of this could be resolved (IMO theoretically) by emulating CGA at a fixed high resolution (including loads of overscan area)?
Bingo. I think the key to getting a lot of these things correctly is to treat CGA as a fixed-frequency standard, and render the image like some other emulators do in similar cases (say C64, 8-bit Atari, Amstrad CPC): the frame always reflects the full area displayed by the monitor, including a decent chunk of overscan. The width/height of the active raster may change, but the H/V sync pulses "anchor" it to specific positions within the larger viewport, depending on registers 02 and 07 respectively in the emulated MC8645 CRTC.

That would fix the issues mentioned with the intro and elephant parts, and various other places in the demo where the frame size keeps changing. i.e. after the "CRTC+Hornet" scroller (1:25 in the video) or after the rotating gears when it morphs into the twister (2:10).
A more subtle symptom of the same thing is during the tall multi-screen image (2:53) and the Marble Madness part (6:10), where the vertical frame size keeps "flickering" a bit. This can be seen when running in a window and makes the scrolling not quite smooth.

There's also some usage of "improper" CGA modes... meaning certain bit combinations in the Mode Select register (3D8h) which shouldn't "make sense" on CGA. UtterChaos AKA PCRetroTech has explained some of these (youtube), although Area 5150 only ever uses one of them. So at the cost of giving away a minor "secret" ( ;)), the relevant info is that whenever GRPH (bit 1) is set, disabling VIDEO (bit 3) should always display the background/border color regardless of HRES (bit 0).

Not sure about the glitches/errors during the tetra 3D part. There are a couple of hacks there which insert NOPs to make IRQ handler execution times more consistent, so I suspect cycle-accuracy would be needed.

The end credits (and the 'ripply' picture at 8:00) would need cycle-accuracy, as well as a model of certain undocumented CRTC behavior, but that's reenigne's turf. The music at the end is PC-speaker PWM with timer 2 in mode 0, one sample per scanline (15.7 KHz).

PCem has helped me quite a bit with my own parts in this dem - often enough I could quickly test the code's general behavior without having to move things to the real hardware at first. Hope this helps a bit in return.
Post Reply