Hi all,

I had a few minutes of free time lately and felt the inexplicable need 
to write a Nibbles clone (remember this game that was shipped with 
QBasic ages ago?).

I called it 'Zmiy'. It's written in C89, compiled with Turbo C, and, as 
usual, released under GNU GPL 3 (yes Rugxulo, I *am* aware that the 
license file is twice as big as the whole source code) ;-)

Here it is - I hope it will provide some 5-minutes fun to other 
oldish-oriented geeks like me.

  http://sourceforge.net/projects/zmiy



---- Boring LONG tech stuff below // you might want to ignore this -----

During the development, I encountered an interesting problem: timing. 
It's probably obvious stuff to most people here, but I actually never 
really played with game-oriented timing in DOS. I implemented inside 
zmyi 3 different timing mechanisms (configurable via command line).

The first (best so far) is checking the time in a loop (at 18,2Hz), and 
performing an int15h AX=5305h at every iteration to notify APM about 
available CPU. This works very well on a real machine, as well as on 
VirtualBox (with and without FDAPM). The CPU usage is very low. 
Surprisingly, under both DOSEmu and DOSBox the CPU usage is very high. I 
guess they don't support the APM v1.0 interface...

The second is about calling the BIOS function int15h AH=86h. This works 
okay on a real machine, but makes keyboard controls under DOSemy laggy, 
and don't work at all with DOSBox. DOSBox keeps crying this:

  Illegal read from 5820585e, CS:IP     f000:    11c4

The third one is about using the Turbo C 'delay' function (supposed to 
provide a millisecond-grade sleep). I don't know what is behind this, 
but it makes CPU usage very high. It works fine under DOSBox (apart form 
the burning CPU), but not under DOSemu (don't sleep at all, which makes 
it impossible to play, unless your name is Barry Allen).

I was also wondering about issuing HLT instructions, but it doesn't look 
like a nice solution to me, since it would require to add some asm into 
my C project, and it wouldn't work on many platforms (Windows...), and I 
feel it's not the application's job to issue HLT, this should be taken 
care of by APM, or the BIOS, or whatever.. But not the application.


Anybody had such problems too? Is there a 'silver bullet' for such 
timekeeping gaming needs under DOS *and* keeping 8086 compatibility?

Another issue I had (still have, in fact) is the timer resolution. The 
resolution of my APM-aware sleeping routines is of ~55ms (18,2Hz). This 
makes the game not as smooth as I'd like.

Any suggestion about some neat (and simple, if possible) usleep()-like 
mechanism that I could use? My int15h AH=86h method is sleeping very 
nicely (with high resolution), but it makes the keyboard laggy, so I 
wonder if it's the best path.. I've read a bit about reprogramming the 
PIT, but it sounds a bit scary, and probably not allowed by Windows 
anyway (I'd like to keep zmyi 8086-compatible, but still playable on 
other platforms).

BTW, if you test Zmiy on DOSBox, you will notice that the palette is 
wrong. I have no idea why - seems that DOSBox initializes a different 
palette on 80x50 than what a real PC do.

Mateusz

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to