pouët.net

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.
added on the 2014-02-18 14:19:31 by visy visy
Well done! Hope more people will follow your example!
added on the 2014-02-18 15:17:08 by Adok Adok
i always end up feeling like using emscripten is cheating. but i reckon i should really take a look at it.
added on the 2014-02-18 16:10:10 by psenough psenough
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.
added on the 2014-02-18 16:12:28 by psenough psenough
great work!
added on the 2014-02-18 17:37:59 by nosfe nosfe
Awesome. I am gonna try it!
added on the 2014-02-18 17:51:23 by Optimus Optimus
Looks promising!
added on the 2014-02-18 18:07:49 by sim sim
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.
added on the 2014-02-18 21:07:03 by p01 p01
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?
added on the 2014-02-18 21:37:00 by Gargaj Gargaj
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.
added on the 2014-02-18 21:39:15 by p01 p01
DosBox emulation is *sight* far to be really perfect... Tested it while uploading recents productions...
Disses to m$ for lack of retrocompatibility... losers....
added on the 2014-02-18 23:16:13 by sim sim
Quote:
Disses to m$ for lack of retrocompatibility... losers....

Do you have a GUS?
added on the 2014-02-18 23:45:12 by Gargaj Gargaj
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!
added on the 2014-02-19 00:54:54 by wysiwtf wysiwtf
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.
added on the 2014-02-19 09:28:12 by Optimus Optimus
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 ;)
added on the 2014-02-20 15:56:18 by sol_hsa sol_hsa
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.
added on the 2014-02-21 13:40:54 by Kabuto Kabuto
Kabuto: well sure. But you must still go through all that trouble, and not just ignore the lgpl =)
added on the 2014-02-21 14:48:29 by sol_hsa sol_hsa

login