{"id":42,"date":"2019-10-19T21:21:57","date_gmt":"2019-10-20T02:21:57","guid":{"rendered":"http:\/\/www.project4fun.com\/?p=42"},"modified":"2019-10-19T21:21:59","modified_gmt":"2019-10-20T02:21:59","slug":"resurrection-of-my-old-dos-program","status":"publish","type":"post","link":"http:\/\/www.project4fun.com\/index.php\/2019\/10\/19\/resurrection-of-my-old-dos-program\/","title":{"rendered":"Resurrection of my old DOS Program"},"content":{"rendered":"\n<p>Install emscripten<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> git clone https:\/\/github.com\/emscripten-core\/emsdk.git\n cd emsdk\n git pull\n .\/emsdk install latest\n .\/emsdk activate latest\n source .\/emsdk_env.sh<\/code><\/pre>\n\n\n\n<p>Due to some browser such as Chrome and Safari will mute the sound when start. We can fixed the problem by go to emsdk directory, modify &#8220;.\/fastcomp\/emscripten\/src\/shell.html&#8221; as shown below:-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>        Module.setStatus('Exception thrown, see JavaScript console');\n        spinnerElement.style.display = 'none';\n        Module.setStatus = function(text) {\n          if (text) Module.printErr('[post-exception status] ' + text);\n        };\n      };\n    &lt;\/script>\n    &lt;!-- REF: https:\/\/developers.google.com\/web\/updates\/2018\/11\/web-audio-autoplay -->\n    &lt;script type='text\/javascript'>\n        function resumeAudio() {\n          if (typeof Module === 'undefined'\n              || typeof Module.SDL2 == 'undefined'\n              || typeof Module.SDL2.audioContext == 'undefined')\n              return;\n          if (Module.SDL2.audioContext.state == 'suspended') {\n              Module.SDL2.audioContext.resume();\n          }\n          if (Module.SDL2.audioContext.state == 'running') {\n              document.getElementById('canvas').removeEventListener('click', resumeAudio);\n              document.removeEventListener('keydown', resumeAudio);\n          }\n        }\n      document.getElementById('canvas').addEventListener('click', resumeAudio);\n      document.addEventListener('keydown', resumeAudio);\n    &lt;\/script>\n\n    {{{ SCRIPT }}}\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n<p>Check out em-dosbox<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/dreamlayers\/em-dosbox.git\ncd em-dosbox<\/code><\/pre>\n\n\n\n<p>Add &#8220;-s FORCE_FILESYSTEM=1&#8221; to src\/Makefile.am since we also required filesystem support.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXTRA_DIST = winres.rc dosbox.ico\n\nif EMSCRIPTEN_BUILD\ndosbox_LDFLAGS=-s TOTAL_MEMORY=134217728 -s ALLOW_MEMORY_GROWTH=0 -s FORCE_FILESYSTEM=1\nCLEANFILES=dosbox.js dosbox.html.mem dosbox.js.orig.js dosbox.js.tmp.js\n<\/code><\/pre>\n\n\n\n<p>Configure and build em-dosbox.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/emsdk\nsource .\/emsdk_env.sh\ncd ~\/em-dosbox\nemconfigure .\/configure\nmake<\/code><\/pre>\n\n\n\n<p>Put all DOS files inside a directory under em-dosbox\/src, in this case &#8220;praditww&#8221; and start creating dosbox application. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/em-dosbox\/src\n.\/packager.py pradit praditww PRADITWW.EXE<\/code><\/pre>\n\n\n\n<p>This will create files that will be use to run dosbox with browser ie:- pradit.html and pradit.data. To test it, issue the following command &#8220;python -m SimpleHTTPServer&#8221; and access this URL &#8220;http:\/\/localhost:8000\/pradit.html&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install emscripten Due to some browser such as Chrome and Safari will mute the sound when start. We can fixed the problem by go to emsdk directory, modify &#8220;.\/fastcomp\/emscripten\/src\/shell.html&#8221; as shown below:- Check out em-dosbox Add &#8220;-s FORCE_FILESYSTEM=1&#8221; to src\/Makefile.am since we also required filesystem support. Configure and build em-dosbox. Put all DOS files inside &#8230; <a title=\"Resurrection of my old DOS Program\" class=\"read-more\" href=\"http:\/\/www.project4fun.com\/index.php\/2019\/10\/19\/resurrection-of-my-old-dos-program\/\" aria-label=\"More on Resurrection of my old DOS Program\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/posts\/42"}],"collection":[{"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":9,"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":51,"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions\/51"}],"wp:attachment":[{"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.project4fun.com\/index.php\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}