Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

CGA Game Timing Question (Developers)

posted by glennmcc Homepage E-mail, North Jackson, Ohio (USA), 21.05.2022, 19:13

> Hello! I've recently fallen down a rabbit hole of playing around with CGA
> graphics with the intent of making a space shooter game that doesn't look
> terrible in CGA, and runs without lag on vintage PCs.
>
> Anyway, it seems like the best method is to do my video writes once
> vertical retrace starts so that the writes occur when the screen isn't
> being drawn, and also has the benefit of being a good timer for the game to
> allow it to be speed-independent.
>
> I have some simple code that works great on DosBox-X, but when I tried to
> run it on FreeDOS running under VirtualBox, it runs at the speed of light
> (clearly the code to wait for vertical retrace doesn't work there).
>
> So, my question is: is this a good way of doing things, and is this code
> the best way to accomplish it?
>
>
> // If a retrace is in progress, wait for it to end.
> // Wait for a new retrace to begin, then exit.
> void wait_vsync() {
> while( inp(0x3DA)&0x08 ) { // Wait for retrace to complete
> }
>
> while( !(inp(0x3DA)&0x08) ) { // Wait for next retrace to start
> }
> }
>

>
> I can also share the source (Open Watcom compiler) and binary if that would
> be helpful, though it doesn't look like I can upload them here. Thanks in
> advance for any advice!

What OS are you booting the machine to ?

What happens if you boot the machine directly into FreeDos
rather than running in VB ?

---
--
http://glennmcc.org/

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 84 users online (0 registered, 84 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum