DOS VGA Tricks

Discussion of development of software for any "obsolete" computer or video game system.
lidnariq
Posts: 10707
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: DOS VGA Tricks

Post by lidnariq »

I wouldn't have expected 3d4/C and D to have worked - after all, there'd be less point in 3d4/18h if so. But it does sound like, based on what you're saying, that 3c0/13h is working... if not particularly interesting.
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: DOS VGA Tricks

Post by Mills »

lidnariq wrote: Wed Jan 12, 2022 1:24 pm I wouldn't have expected 3d4/C and D to have worked - after all, there'd be less point in 3d4/18h if so. But it does sound like, based on what you're saying, that 3c0/13h is working... if not particularly interesting.
So, I got this in dosbox:
game_013.png
game_013.png (56.21 KiB) Viewed 224 times
This program displaces some lines at the top part of the image.
Real VGA and PCem show black lines interlaced with displaced ones. 3c0 register works very strange, I think I understand it, but I can't move the lines the amount I want, only 0 or 4 pixels.

I just found more info:
Port-Index: 08h Port: 03d4h, 03b4h
bits 6 5 = Byte panning control

is used to control byte panning. This register together with attribute controller register 13h, allows for up to 31 pixels of panning in double word modes
lidnariq
Posts: 10707
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: DOS VGA Tricks

Post by lidnariq »

According to VGA.TXT, you should be able to get fine X scrolls from 0 to 3 by writing 0/2/4/6 to 3c0h/13h, not 4...
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: DOS VGA Tricks

Post by Mills »

lidnariq wrote: Fri Jan 14, 2022 12:44 pm According to VGA.TXT, you should be able to get fine X scrolls from 0 to 3 by writing 0/2/4/6 to 3c0h/13h, not 4...
I know, I wrote it wrong.

So I understand 3c0 register works like this, I used assembly for the tests, but it will look better in C here:

Code: Select all

//this resets a flip flop in VGA card, and sets 3C0 to write index mode
inp(0x03DA); 

//write index 13 to 3c0 port, also activate bit 5 to keep screen on. Port flips to write data mode
outportb(0x03C0,0x13 + 0x20);

//write panning (6 = 3 pixel displacement), also activate bit 3 (+0x08), I noticed it was there, it looks like it does not matter.
outportb(0x03C0,0x02 + 0x08);
I did a lot of tests, and panning is set to any value the card reads from the register when it reaches a vertical blank. The only thing I can do in the middle of a frame, is disable bit 5 of 3c0 register, to turn off colors resulting in black lines (real hardware and pcem). Dosbox shows the lines with 0 panning, no matter what value I try to write, producing that picture I posted.

I read about other registers modifying panning behaviour, but none of them worked in the middle of a frame.
User avatar
Nikku4211
Posts: 427
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, New York
Contact:

Re: DOS VGA Tricks

Post by Nikku4211 »

Mills wrote: Tue Jan 11, 2022 6:43 am Sorry for posting on an old thread, but I just loved it.
I never knew you were on NESDev forums. Probably because you're using a different name from what you use in YouTube.
lidnariq wrote: Tue Jan 11, 2022 11:10 am At best, it might be possible to update the fine X scroll register (3C0h/13h) each scanline, but I don't have the hardware to check against.
Hardware to check against meaning you don't have an MS-DOS computer with VGA, or meaning you don't have a VGA CRT?

Because I happen to have an MS-DOS laptop, and though its screen is a terrible STN LCD with ghosting, it supports SVGA and has a VGA port, though I sadly don't have a CRT that supports VGA, only LCDs that support VGA. I'm still willing to test it, though.
lidnariq wrote: Tue Jan 11, 2022 11:10 am The hsync pulses can be moved around with 4px precision (3d4h index 4), while index 13h is 8px precision... but at least index 13h will work at all on a flat panel, or in a VM.
So most of these cool VGA tricks only work on CRTs and not on LCDs? I'm sure it's always a YMMV thing, but still.
Mills wrote: Wed Jan 12, 2022 6:08 am I have a real VGA to test, I might try later.
As in a real VGA MS-DOS computer, or a real VGA CRT, or a real VGA monitor in general?
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
Mills
Posts: 43
Joined: Tue Jul 01, 2014 3:30 am

Re: DOS VGA Tricks

Post by Mills »

Nikku4211 wrote:
lidnariq wrote: Tue Jan 11, 2022 11:10 am The hsync pulses can be moved around with 4px precision (3d4h index 4), while index 13h is 8px precision... but at least index 13h will work at all on a flat panel, or in a VM.
So most of these cool VGA tricks only work on CRTs and not on LCDs? I'm sure it's always a YMMV thing, but still.
3d4h index 4 only works on CRT, 3d4h index 13 works on all monitors, it is an internal VGA VRAM thing, not related to hsync or anything.
Nikku4211 wrote: As in a real VGA MS-DOS computer, or a real VGA CRT, or a real VGA monitor in general?
A real 286 with VGA (not SVGA) card, and I have no CRT, only LCD. Anyway, PCem is so precise, you can test weird things there and they will be the same on real machines most of the time.
User avatar
Nikku4211
Posts: 427
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, New York
Contact:

Re: DOS VGA Tricks

Post by Nikku4211 »

Mills wrote: Sat Jan 15, 2022 3:18 am
Nikku4211 wrote:
lidnariq wrote: Tue Jan 11, 2022 11:10 am The hsync pulses can be moved around with 4px precision (3d4h index 4), while index 13h is 8px precision... but at least index 13h will work at all on a flat panel, or in a VM.
So most of these cool VGA tricks only work on CRTs and not on LCDs? I'm sure it's always a YMMV thing, but still.
3d4h index 4 only works on CRT, 3d4h index 13 works on all monitors, it is an internal VGA VRAM thing, not related to hsync or anything.
Alright then, guess I'll try to find a small VGA CRT that I can more easily carry around my apartment for a good price.
Mills wrote: Sat Jan 15, 2022 3:18 am
Nikku4211 wrote: As in a real VGA MS-DOS computer, or a real VGA CRT, or a real VGA monitor in general?
A real 286 with VGA (not SVGA) card, and I have no CRT, only LCD. Anyway, PCem is so precise, you can test weird things there and they will be the same on real machines most of the time.
Oh cool, I'm thinking of trying PCem then.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
Post Reply