VOGONS


First post, by v!rus

User metadata
Rank Newbie
Rank
Newbie

This one is should go to DOS box developers:

I think you should implement refresh-rate choice in dosbox.conf, because many of the games rely on monitor sync in VGA mode to time it's drawing routine, and many of the VGA games have somewhat mildly unsmooth scrolling, not because of DOS Box engine, but because of the refresh rate of user's monitor...

Even if the game has it's own internal timer, old game developers synced their redraws with VGA's standard 60, and with dosbox users's refresh set to 85 or 100 somewhat unsmooth scrolling occurs, indepentantly of the CPU cycles chosen. And even if you emulate a 60Hz interupt for VBlank, the refresh of the user's monitor is still not in sync with drawing.

To cut the long story short, just one more entry in DosBox.conf besides screenRes, refreshRate!
😉

"Why would God think in binary?"
"...unless..."

Reply 2 of 15, by v!rus

User metadata
Rank Newbie
Rank
Newbie

@ykhwong:
Read the first line of the post 😉

To clarify, the point is not to use driver tweaks and/or external utils (I could've used DX override for that), but to use dosBox config..
What would you do on another OS, or with different app than dosBox (always change it?)...

PS. I tried with forcing DX refresh (in DXDiag, WinXP) to 60Hz, and the result is MUCH smoother scrolling and fading in VGA modes.

"Why would God think in binary?"
"...unless..."

Reply 4 of 15, by `Moe`

User metadata
Rank Oldbie
Rank
Oldbie

QBix, I think he means a different effect: Even when double buffering, the exact time when a buffer swap occurs varies. With 60Hz, for example, it is exactly like it was on DOS,frames appeared at
1/60s, 2/60s, 3/60s, 4/60s, ...
(0.017s, 0.033s, 0.05s, 0.067s, ...)
on 85Hz, possible times for a frame are:
1/85s, 2/85s, 3/85s, 4/85s, 5/85s, 6/85s, ...
(0.012s, 0.024s, 0.035s, 0.047s, 0.059s, 0.071s, ...)
Which means that the first 4 frames actually appear at:
0.024s, 0.035s, 0.059s, 0.071s
That means some frames are 50% late, some are mostly on time, and some are in between - animations lose their timing, and the eye is quite sensitive to that.

(v!rus, please correct me if I got you wrong)

Reply 5 of 15, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

Well...there's no way to control a refresh rate in a window and I don't think SDL provides an interface to specify refresh rate for fullscreen. So I guess there's no way to do it using current code 😀

Reply 6 of 15, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

gulikoza is right. So the best we can do is double buffer.
So you get smooth scrolling.

Water flows down the stream
How to ask questions the smart way!

Reply 7 of 15, by v!rus

User metadata
Rank Newbie
Rank
Newbie

@Moe:
you're absolutely right, only I couldn't explain it that way. 😉

I had the sam problem with the game I'm currently developing (Win32/DX) and for a while I couldn't figure out why the scrolling is somewhat jumpy, then I saw the light 😉, even tried to explain it to others (unsuccesfully) on a forum about Asphyre gfx lib for win...

Anyway, if you're relying on windowed viewports, there is no way to overcome this without modifications to the games themselves (actually, only drawing loop's frequency has to be modified), but that is, of course, out of the question... 😉
Another way would be speeding up the game itself, but that too, is out of the question.

Again I say, Lost Vikings' (sidescroller @ XMode 320x240) scrolling and fading looked identical to original, after overridng DirectX refresh rate to 60 (in DXDiag on Win32). I know that DosBox is about a lot more than perfect gfx emulation, but a refresh option for fullscreen modes would be nice, if supported by the hardware.

Best regards & shine on

"Why would God think in binary?"
"...unless..."

Reply 8 of 15, by `Moe`

User metadata
Rank Oldbie
Rank
Oldbie

As Qbix/gulikoza say, there's no way to do it portably. And even if there were, screen timings are very system dependent - it will always depend on what your CRT and graphics card allow. It's less work if you tweak your driver's settings by hand (many drivers allow you to force a certain refresh rate on a certain resolution, while leaving the rest of the system untouched).

Reply 9 of 15, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

How about the other way around, synching virtual vga card to users refresh rate? I know I had a tsr for my card that allowed me to set higher refresh rates in dos (never could live with 60Hz 😀 ). Would the game synch to higher refresh rate or do most have 1/60s hardcoded? But then again...I guess there isn't a reliable way to detect a display mode portably...

Reply 10 of 15, by `Moe`

User metadata
Rank Oldbie
Rank
Oldbie

Well, as far as portability goes, we could write an SDL addon for that. Nothing else does SDL: it has one version for each supported platform. I'd probably contribute the X11/Linux part of such a thing, whatever that may be.

Yet I fear it's still problematic. I know that my system does 60Hz (after all, it's an LCD), but I also had systems where the screen went blank when programs tried to do the mode switching we are discussing. Do we want that? If windows/linux claim it's possible to switch resolutions, it's still (quite) possible that the screen can't manage the resolution.

I am guessing, but if a game synchronizes to the vertical blanking of the graphics card (did DOS games really do that?), it might play animations too fast if we increase the refresh rate. If they don't sync, shouldn't "doublebuffer=false" be exactly what could be seen back on a real DOS PC?

Reply 11 of 15, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Yes, DOS games had access to the vertical blanking interrupt (and everything else since we're talking about DOS). I remember using it to eliminate tearing in an asteroids game I was writing in the early days of DJGPP+Allegro.

Forcing nonstandard refresh rates for standard modes in emulated DOS is a bad idea.

SDL doesn't have a way to specify a specific refresh rate when setting modes? Are you sure?

Reply 13 of 15, by v!rus

User metadata
Rank Newbie
Rank
Newbie

@Moe "(did DOS games really do that?)"
Yes, it was the only way to make to game run at the same speed independantly of the CPU speed. A game I wrote (VGA Snake) 8 years ago runs at the same speed on a 286 and on my PIV 2.8. Come to think of it, it was the most precise timer on PC since it is purely hardware, like having an external clock which trigers at *exactly* the same intervals, and those intervals are indeed small. The common code for vblank in DOS was:

void waitRetrace(void)
{
asm mov dx, 0x03DA
l1:asm
{
in al, dx
and al, 0x08
jnz l1
}
l2:asm
{
in al, dx
and al, 0x08
jnz l1
}
}

This was what most of the DOS games used to sync the game, those games that use this metod don't need moslo, speedbrake or other utils to control the game's speed.

@robertmo
Indeed, 320x200 (linear VGA mode 13h) is @75Hz, but the game I used for testing (Lost Vikings) uses XMode @60Hz...

"Why would God think in binary?"
"...unless..."

Reply 15 of 15, by Great Hierophant

User metadata
Rank l33t
Rank
l33t

All low and medium resolution VGA BIOS modes use a frame rate of 70Hz. Earlier cards used 60Hz. VGA uses the 60Hz for its 480 line modes. I would guess that a Mode-X resolution of 320x240 would likely use a 60Hz frame rate because VGA double scans all resolutions that use under 350 lines.