From: danubius@halcyon.com (Joseph R. Pannon)
Subject: An X386 question ... and the answer
Organization: Northwest Nexus Inc. (206) 455-3505
Date: Wed, 6 Jan 1993 05:06:45 GMT

A few days ago I posted a message here asking help in adjusting some
video parameters for X386.  I stated my problem as follows:

>I noticed that while my 640x480 resolution screen is nicely centered on
>the screen (though the clock could be more circular!), the 800x600
>screen is very much in a right-shifted position. To a lesser degree, so
>is the 1024x768 screen, too.  Since I calculated the Xconfig modes
>figures right "by the book" and even tried to play with the 
>pre-sync and post-sync figures somewhat, I haven't had much luck to
>bring that display to the center of the screen from that right side.
>Can somebody give me a hint what I might still try to accomplish that?
>It seems that the documents on this subject contradict each other on
>which way the horizontal frame is being traced; whether it starts from
>the left or right (when facing the screen), so I am not even sure which
>side of the screen has the horizontal sync pulse.  In case somebody
>might want to be able to help me with this, here is the relavent line
>from the Xconfig file:

> "800x600"   50     800  832 1008 1040    600  609  619  667

>As I mentioned, the window looks OK and proportionate, just shifted
>entirely to the right edge of my screen.

Thanks to Savio Lam's tip, I was able to fix the problem and since this
might be a useful tip for other out there as well, let me share it with you.

As you may see in the above "800x600" example, the sync period is nicely
centered between the end of viewable display (800) and end of horizontal
scan (1040) dot positions, with 32 dots worth of pre-sync and post-sync
periods.  That's how the "book" (the Video.tutorial) recommends it).
Unfortunately, in my case this gave me asymmetric side margins; the picture
was too much to the right!  As it turned out, by sliding the sync period more
to the end of the horizontal scan position (1040) the picture could be
shifted to the left.  In pre- and post-sync terms: as you increase the
pre-sync periods (or decrease the post-sync period!) the picture is shifted
to the left.  After several tries, I was able to center my 800x600 display
in the horizontal dimensions with the following video mode params in the
Xconfig file:  800  856  1032 1040.  As you see from it, the pre-sync period
increased, and the post-sync period decreased by 24 dots worth of time.  (Of
course this translates to BOTH figures between 800 and 1040 EQUALLY
INCREASING by the same number of dots!)  As you may also remember, all
horizontal figures must be in multiples of 8!  From the above also follows,
that if you want to shift your display to the right, instead of left, you
have to adjust the pre-sync figures in the opposite direction.

Even though the following was not the subject of my original post, I did
experiment also with the vertical adjustment of the picture, using the same
principle of sync period shifting.  It so happened, that my 800x600 display
also needed some adjustment verticaly, as it had a noticably smaller lower
margin than upper margin.  So, it needed to be shifted up slightly.
Here is what I found out: by shifting the vertical sync period AWAY from the
viewable dot position (600), i.e., by INCREASING the vertical pre-sync, the
picture MOVES UP.  By decreasing the pre-sync period, the picture drops
lower.  (Remember to adjust the post syncs accordingly!)  So finally, I was
able to attain a "perfect" centering of my "800x600" display with the
following line in my Xconfig file:

 "800x600"   50     856  832 1032 1040    600  616  626  667

(As you recall, the "multiple of 8" rule does not apply in the vertical
video parameter values.)  I successfully used this technique to also center
my 1024x768 res display.

I have not experienced with adjusting the length of the sync period itself,
and it's entirely possible that positioning of display could also be
influenced with that as well.  Somebody just might do that in the future and
report back his or her findings.  I was able to achieve my goal by keeping
the length of sync period constant, and only making identical adjustments in
the pre- and post sync periods.

Sorry for the longer explanation, but as this info was not really covered in
any of the video tutorials that I could find, I and Savio thought that this
information might be useful to the larger audience here.

Now, if I only knew how to handle correctly the fractional clock rates that
the clock.exe program detects and reports, but cannot be used in Xconfig
because it only takes integers...

Regards,
Joe Pannon