VGA Pixel panning registers

Discussion of development and patch submission.
Post Reply
Mills
Posts: 9
Joined: Thu 28 Sep, 2017 9:29 pm

VGA Pixel panning registers

Post by Mills » Wed 29 Aug, 2018 7:45 pm

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!
Attachments
PGAME.zip
(19.08 KiB) Downloaded 14 times
DOCVIEW.zip
(30.95 KiB) Downloaded 12 times

User avatar
SarahWalker
Site Admin
Posts: 1588
Joined: Thu 24 Apr, 2014 4:18 pm

Re: VGA Pixel panning registers

Post by SarahWalker » Wed 29 Aug, 2018 9:05 pm

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...

User avatar
SarahWalker
Site Admin
Posts: 1588
Joined: Thu 24 Apr, 2014 4:18 pm

Re: VGA Pixel panning registers

Post by SarahWalker » Wed 29 Aug, 2018 9:07 pm

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...

User avatar
leilei
Posts: 599
Joined: Fri 25 Apr, 2014 4:47 pm

Re: VGA Pixel panning registers

Post by leilei » Wed 29 Aug, 2018 10:57 pm

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

User avatar
SarahWalker
Site Admin
Posts: 1588
Joined: Thu 24 Apr, 2014 4:18 pm

Re: VGA Pixel panning registers

Post by SarahWalker » Fri 31 Aug, 2018 7:51 am

Revs 1191-1193 fix the issues in Mills's post, as well as REN-93.EXE.

Mills
Posts: 9
Joined: Thu 28 Sep, 2017 9:29 pm

Re: VGA Pixel panning registers

Post by Mills » Sun 02 Sep, 2018 8:43 am

Thanks! :D

User avatar
leilei
Posts: 599
Joined: Fri 25 Apr, 2014 4:47 pm

Re: VGA Pixel panning registers

Post by leilei » Fri 14 Sep, 2018 10:24 pm

I see some stutter - in Tseng's VDIAG with a ET4000aX the horizontal scroll in the panning/split scrn test stutters.

Post Reply