Page 1 of 1

VGA Pixel panning registers

Posted: Wed 29 Aug, 2018 7:45 pm
by Mills
Hi everybody!.

Testing some turbo C programs on PCEM, I discovered everything works great. But I think I found a "bug" in the VGA emulation, so I'll post my tests here.

I made a simple program to scroll the screen using VGA hardware registers, based on this: ega-and-vga-smooth-scrolling-and-panning.

I got a nice smooth per pixel scrolling (never thought it was possible) working well on dosbox, and according to the info in the link, and other sources, this should also work on original hardware.

The VGA emulation on PCEM worked perfect with the vertical scroolling which I changed using these in my test:

Code: Select all

	/*change scroll registers: HIGH_ADDRESS = 0x0C; LOW_ADDRESS = 0x0D */
	outport(0x03d4, 0x0C | (x+y & 0xff00));
	outport(0x03d4, 0x0D | (x+y << 8));	
you can do horizontal scrolling with these, But it moves 4 pixels at a time.

To move the screen 1 pixel to the left or right, I used this:

Code: Select all

	inp(0x3da);
	outp(0x3c0, 0x33);		
	outp(0x3c0, value);	/* "value" can take an int, from 0 to 3 */
PCEM seems to skip that code, resulting in a choppy horizontal scrolling (CPU does not make a difference), it looks like the screen moves 2 pixels at a time, or something like that.


Here I leave two test programs with source.

DOCVIEW: A doc viewer taken from the fisrt link (www.drdobbs.com), It should work on EGA and VGA, even on a 8088 PC. Testing on pcem, scrolling is not smooth at all.

PGAME: A little program I made, it first scrolls down, and then it scrolls to the right to see the difference. Sometimes you will see some little "jumps" when using X and Y scroll at the same time (even in dosbox), but they are probably caused by the code itself. This demo works even on an emulated 8088 with VGA. (Can a real 8088 be used with a VGA card?).

Hope somebody is interested.
Thanks!

Re: VGA Pixel panning registers

Posted: Wed 29 Aug, 2018 9:05 pm
by SarahWalker
Yep, there's a bug. PCem isn't forcing a screen refresh on writes to the per-pixel scroll register (0x3c0 index 0x13/0x33), which is only obvious if the start address isn't changed and there are no writes to video memory that frame. The fix should be fairly trivial...

Re: VGA Pixel panning registers

Posted: Wed 29 Aug, 2018 9:07 pm
by SarahWalker
DOCVIEW is a different bug btw, relating to scrolling & split screen not being properly implemented in text mode. Again, fixes shouldn't be too difficult...

Re: VGA Pixel panning registers

Posted: Wed 29 Aug, 2018 10:57 pm
by leilei
I'm assuming the latter bug involves the kefren bars overlapping the text area in REN-93.EXE (Zone66) where it should be black and not stuttering

Re: VGA Pixel panning registers

Posted: Fri 31 Aug, 2018 7:51 am
by SarahWalker
Revs 1191-1193 fix the issues in Mills's post, as well as REN-93.EXE.

Re: VGA Pixel panning registers

Posted: Sun 02 Sep, 2018 8:43 am
by Mills
Thanks! :D

Re: VGA Pixel panning registers

Posted: Fri 14 Sep, 2018 10:24 pm
by leilei
I see some stutter - in Tseng's VDIAG with a ET4000aX the horizontal scroll in the panning/split scrn test stutters.