Qbasicnews.com
80 Hz refresh rate in DOS & QB!!! :) - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: General (http://qbasicnews.com/newforum/forum-6.html)
+--- Forum: General/Misc (http://qbasicnews.com/newforum/forum-18.html)
+--- Thread: 80 Hz refresh rate in DOS & QB!!! :) (/thread-4085.html)

Pages: 1 2 3


80 Hz refresh rate in DOS & QB!!! :) - Spotted Cheetah - 06-05-2004

Code:
SCREEN 12
OUT &H3C2, &HE7

Code:
Base freq.   OUT Value    New freq.

Screen 12     60Hz         &HE7         67Hz
Screen 13     70Hz         &H67         79Hz
Screen 9      70Hz         &HA7         79Hz

Bit 2 does the magic in the value. VGA has two modes: 25Mhz and 28Mhz. Very few screens use the last so almost all of them can be tweaked up with setting this bit including unchained modes too (For example Mode Q will be 64Hz instead of 57, Mode X will run on 67Hz). The values got by tweaking 70Hz screens are almost perfect (The ideal is said to be at least 85Hz).

I do not know too much on tweaking screens but i think this is safe since it not changes anything other in the behavior of the screen (QBasic did not notice anything!). On the other hand you should include it as an option in your programs to prevent running in problems like when a screen does not support more than 75Hz.


80 Hz refresh rate in DOS & QB!!! :) - Oz - 06-06-2004

When i used that fancey piece of code, it streched the screen to the left, so there were pixels being draw at (estimated) -50, but the last pixels where still 640.........pixel-strecher!! Weeeeee

Alex~


80 Hz refresh rate in DOS & QB!!! :) - barok - 06-06-2004

um.. more explanaition please? i don't really understand on what this does other than it distorts my screen very slightly...


80 Hz refresh rate in DOS & QB!!! :) - Sterling Christensen - 06-06-2004

If it worked, both your monitors probably consider it a different screen mode, one which hasn't been configured. You'll both have to adjust the width/height etc settings on your monitor.

Basically it's just increasing the refresh rate so it flickers less, that's all.


80 Hz refresh rate in DOS & QB!!! :) - barok - 06-06-2004

oh. then i don't need it. Big Grin


80 Hz refresh rate in DOS & QB!!! :) - Spotted Cheetah - 06-06-2004

After tweak(16B)ing a lot, and reading Ralph Brown's and other port lists i found out that the four states of Bit2 and Bit3 sets the following MHzs: 25, 28, 40, and 50 on my screen. The first two applies to any VGA, the third was described as some VGAs can be set to 39MHz with it, but i could find nothing about the fourth. I counted these by pen and paper from the modes included in TWEAK16B (I tried all of them which worked on different refresh rates, or were strange, and tried to set them to all these four values. My screen can work with refresh rates from 50Hz to 75Hz, and could tell me if the refresh rate was between 30Hz and 90Hz, at any other values it did not show anything so i had lots of work with finding out the fourth value).

The values and the results (these are what i counted since i could not try out most of them):

Code:
Value 0     Value 1     Value 2      Value 3
             Refresh     Refresh     Refresh      Refresh

SCREEN 9     A3  70Hz    A7  78Hz    AB  112Hz    AF  140Hz

SCREEN 12    E3  60Hz    E7  67Hz    EB  96Hz     EF  120Hz

SCREEN 13    63  70Hz    67  78Hz    6B  112Hz    6F  140Hz

MODE Q       E3  57Hz    E7  64Hz    EB  92Hz     EF

MODE X       E3  60Hz    E7  67Hz    EB  96Hz     EF  120Hz

360 * 270    E3  50Hz    E7  56Hz    EB  82Hz     EF

Nice, not? Smile
I think value 2 should work on most of the screens (I am not saying that all of the screens will set to 112Hz happily, but they will know that we asked them to set to 112Hz), but value 3 may fail. Of course you should only start with tweaking to value 2 if you want to make your program failing on most of the screens... But it is nice to support these high refresh rates for people having a screen able to display it.

Of course these refresh rates are not built in for the basic VGA modes rather some "extended" modes. For example TWEAK16 has a 800 * 600 mode on 48Hz with value 1. If we tell it to use value 2 instead of that it will be 70Hz.

It is good for very special tweaked modes too. Heights from 175 to 200 or from 350 to 400 can be set with keeping 70Hz. From 200 to 240 or from 400 to 480 it will drop until reaching 60Hz: this is acceptable but it is good to use value 1 with them. Outside these four ranges there are the "bad" heights which make the screen useless because of their low refresh rates: mode Q and the 360 * 270 mode are in this region: they can be used with value 1 to make something around 60Hz, but it is good to offer using value 2 too (Be very careful with that! Value 2 adds much to the refresh rate! The 360 * 270 mode became 82Hz for me with it, and Mode Q jumped over 90Hz: my screen did not display it!).


Your screen: Newer screens usually remember to the adjustments made with a mode. Start it, set it, and at next start it will be placed well. They were set incorrectly because these are wery "strange" modes which your screen never experienced before so it does not know what to do with them at first.


80 Hz refresh rate in DOS & QB!!! :) - Spotted Cheetah - 06-07-2004

So if you asked for that: what is this, and how it works.

(I did not post it before because i have to write most of my remarks in Notepad since internet is expensive in Hungary... I only can stay connected after midnight)

The display is being altered through many ports, 3C2 is one of them. This is a very difficult thing, for example to set up the 320*200*256 color mode from nothing you would need to give approximately 30 bytes to four or five VGA ports. And to not be so easy VGA was developed to be compatible with all the screens before so many of the values overflew (since VGA can display more pixels than those and have more memory) so were broken into small pieces what are all around these registers... And some values are needed to send to two or three places to set a mode correctly. So this was why i think tweaking difficult.

In the case of port 3C2 it holds many values in it's bits, the refresh rate is two of them. This is why most of the screens need different input to this port: to save everything but the refresh rate. So there will not be any problem except the ones what may rise because of the higher refresh rates. If both Bit2 and Bit3 (note: bit2 is the third bit, not the second since i assumed Bit0 as the first so i have got bits from 0 to 7) are set to 0 then the VGA will be at 25MHz what creates the usual refresh rates. If Bit2 is 1 (and Bit3 = 0) then it will be 28MHz. These two modes can be set on any VGA compatible card. If Bit3 is 1 and Bit2 = 0 then the 39MHz mode will be set on the VGAs what can do this (I do not know how spread is this mode). If both of the bits are 1 then my card told the VGA to work somewhere around 50MHz but i think this is a very special case.

What does those MHzs mean? I do not know exactly, but i think this shows the total number of pixels can be displayed per second. On the other hand dividing 25MHz by 640 * 480 results 81Hz, but as i wrote above the screen is not so easy so it might be true.

After tweaking a lot again and triing to set up some special modes, i found that the 28MHz mode is used at all screens 720 pixels wide to generate the same refresh rates as the 640 pixels wide modes. It is being used in the basic text mode too (it is 720 * 400)!
(I knew that the text mode uses value 1 already but it appeared me how it works at all when i tried to set up a 360 * 224 mode what has the same aspect ratio as screen 13, but i could not get more than 60Hz with it)

And at last: Why is this good?
(I could find nobody here who talked about this subject...)
You will know if you write this code:
Code:
SCREEN 12
LINE (0, 0) - (639, 479), 15, BF
SLEEP 3600
and you wait it finishing looking at the screen all the time...
(If you not want to go to the oculist after this hour you may set it to 360 for first try)


Screens and centering...
The picture tube has to be calibrated to every different resolutions and refresh rates what can not be done automatically. Usually the most common modes (640 * 480, 60Hz, 640 * 480, 85Hz, 800 * 600, 60Hz ect.) are being calibrated by the factory so that's why they work immediately after setting up the screen. But most of the modes were not calibrated which have to be done by hand and then the screen saves the settings to calibrate itself well on the next time calling that resolution & refresh rate combination. I think these (640 * 480, 67Hz, 640 * 350, 79Hz ect.) resolutions were never called before so the screen must have not known them.


80 Hz refresh rate in DOS & QB!!! :) - TheBigBasicQ - 06-14-2004

I tried it on an anicent monitor i had and it blew the hell out of it =P. Just be careful that your monitor can take the refresh rate. Obviously mine couldnt =(.


80 Hz refresh rate in DOS & QB!!! :) - Spotted Cheetah - 06-20-2004

Very - very old VGAs might have created somehow to support only 60 or 70 hz. For the picture tube it is not impossible to do the 80Hz if it can do the same 28Mhz on other modes. I think every SVGA compatible will be able to do it (On the other hand try ModeQ which is 56Hz on that old screen... If it works, the 67Hz mode 12 should work too. 80Hz is a bit much for those old screens...)


80 Hz refresh rate in DOS & QB!!! :) - Oz - 06-20-2004

I still can't get any use out of this.....alll i get is a streched screen