3 ms·
How do you handle time with such small code size? I see a timer interrupt for the music, but what about the animation? Is it dependent on the speed of the under
by haberman 7y ago
How do you handle time with such small code size? I see a timer interrupt for the music, but what about the animation? Is it dependent on the speed of the underlying CPU?
- maggit 7y agoI haven't had a look at the source code for this, but I expect that it syncs with the screen refresh rate.
- HellMood 7y ago(author here) it doesn't. it sets the timer to about 35 FPS and installs a callback routine that is called repeatedly as interrupt. Smoothing is rather done implicitly by "triple diagonal interlacing"
- llarsson 7y agoThere is an OS-provided timer interrupt that you can hook in to, making sure your interrupt handler is called every X time units. I think it was something like 18 times per second by default, but changeable. I used this to slow down my computer so that old games were playable. Hooked into the interrupt, wasted cycles, and could enjoy the game. :)
- pvg 7y agoIt depends on the speed of the CPU - if you look at the archive at https://www.pouet.net/prod.php?which=85227 https://www.pouet.net/prod.php?which=85227, you'll find a DOSBox config specifically for this demo. If you run it in DOSBox you can fiddle with the emulation speed by pressing C-F11 and C-F12 and you'll notice the speed of the animation change. Later: Your question made me wonder what the performance of virtual 'target CPU' is - the 'cycles' setting in the config is 20000 and there's a rough estimate of what these numbers translate to here https://www.dosbox.com/wiki/Performance https://www.dosbox.com/wiki/Performance So it looks like it's something along the lines of 'a 486 in the prime of its life'.
- HellMood 7y ago(author here) "you'll notice the speed of the animation change" that might be, but the demo is designed to run at equal speed on all systems (it hooks into the timer) if you experience animation speed differences, that means your system can not handle what dosbox (on high cycles) demands. It should be noted that DosBox is far slower than people expect it to be, and also, that in actual competitions in the demoscene, real modern hardware is booted to Freedos, but has no sound. So if you want sound (with MIDI) in a competition, you have to stick to the rather slow dosbox, and even optimize against an emulator which can be really really weird. (https://www.pouet.net/topic.php?which=11881 https://www.pouet.net/topic.php?which=11881) I wouldn't claim the demo runs fine on a real 486, but a pentium should do, as a variation of the raycast tunnel part indicates (https://www.youtube.com/watch?v=5_3CU6shKlY https://www.youtube.com/watch?v=5_3CU6shKlY)
- pvg 7y agoInteresting, thanks! I thought I saw it get faster when I turned up the cycles but maybe I'm misremembering or it's some other effect/artifact.
- hannob 7y ago> How do you handle time with such small code size? I see a timer interrupt for the music, but what about the animation? Is it dependent on the speed of the underlying CPU? Usually you don't "handle" it in very small demos of the 256b/64b kind, you just run your effect. And yes this means speed will depend on the CPU speed.