JavaScript porting of MS/DOS demos
category: general [glöplog]
http://low.fi/~visy/turha
"Turha on ovea avata" was originally made for MS/DOS using the MIDAS sound library and common "mode 13" rendering in standard 320x200x256 VGA resolution.
Porting the graphics rendering from the original C++ code was trivial, just a matter of mapping the VGA-sized buffer on a SDL_Surface and rewriting the assembly code for manipulating the VGA palette registers for the corresponding SDL palette function calls.
The sound system, MIDAS, had to be replaced with libxmp for proper SDL audio output and demo synchronization, because the visuals are synced to the current playing position number in the Impulse Tracker-formatted soundtrack.
This was then all compiled using Emscripten, which is a LLVM-based compiler system that compiles C and C++ into JavaScript, including support for libSDL out of the box.
You can find a well-written tutorial for Emscripten porting on Jari Komppa's website.
"Turha on ovea avata" was originally made for MS/DOS using the MIDAS sound library and common "mode 13" rendering in standard 320x200x256 VGA resolution.
Porting the graphics rendering from the original C++ code was trivial, just a matter of mapping the VGA-sized buffer on a SDL_Surface and rewriting the assembly code for manipulating the VGA palette registers for the corresponding SDL palette function calls.
The sound system, MIDAS, had to be replaced with libxmp for proper SDL audio output and demo synchronization, because the visuals are synced to the current playing position number in the Impulse Tracker-formatted soundtrack.
This was then all compiled using Emscripten, which is a LLVM-based compiler system that compiles C and C++ into JavaScript, including support for libSDL out of the box.
You can find a well-written tutorial for Emscripten porting on Jari Komppa's website.
Well done! Hope more people will follow your example!
i always end up feeling like using emscripten is cheating. but i reckon i should really take a look at it.
that being said, i remember state of mind also having been ported in similar fashion. and vip2, although probably different toolchain for opengl instead of sdl.
great work!
Awesome. I am gonna try it!
Looks promising!
What I'd love to see is a JS port of DOSBox ( or similar ) that can be used to watch old demos, intros, and even test/develop new ones.
There's an emscripten version of DOSBox, but I guess we might have to wait another 10 years for it to be usable for demos. :D
So the new fad is taking something, putting it in a VM, then putting that VM through a code-converter, and running the result through another VM?
Make that 2 years, most likely less.
Virtual x86 works pretty well. I used it to watch a couple of bytetros incl. some heavy ones and to make my version of thread.
Virtual x86 works pretty well. I used it to watch a couple of bytetros incl. some heavy ones and to make my version of thread.
DosBox emulation is *sight* far to be really perfect... Tested it while uploading recents productions...
Disses to m$ for lack of retrocompatibility... losers....
Disses to m$ for lack of retrocompatibility... losers....
Quote:
Disses to m$ for lack of retrocompatibility... losers....
Do you have a GUS?
let's diss m$ for not supporting nintendo, c64 and amiga as well! losers! now i bloody need an emulator for that!
so we need an completely virtual, fully documented low-resource demoplatform that can be emulated pretty easy 100% accurate on almost any target machine - problem solved!
Sounds like http://pelulamu.net/ibniz/ ? Or Javascript maybe?
Quote:
Virtual x86 works pretty well. I used it to watch a couple of bytetros incl. some heavy ones and to make my version of thread.
I don't see that with my I7. Everything seems so slow here.
Btw, libxmp is lgpl, so linking statically (which you do via emscripten) forces you to license your code under lgpl too.
Thanks for the kind words regarding the tutorial, I should finish it one of these years ;)
Thanks for the kind words regarding the tutorial, I should finish it one of these years ;)
sol_hsa: not really. In this case LGPL just requires you to make sure that any end user can modify the LGPLed parts of your software, so in case of static linking this means that it's sufficient to release either source code of the demo or linkable object files (dunno if the latter is an viable option for Emscripten). No need to put the demo itself under LGPL.
Kabuto: well sure. But you must still go through all that trouble, and not just ignore the lgpl =)