V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yksoft1
V2EX  ›  程序员

跟风,能用 Emscripten 编译成 WebAssembly 的 DOSBox

  •  
  •   yksoft1 · 2018-09-09 16:30:02 +08:00 · 3265 次点击
    这是一个创建于 2027 天前的主题,其中的信息可能已经有所发展或是发生改变。
    看了一下 em-dosbox ( https://github.com/dreamlayers/em-dosbox ),根据他最初的改动,自己下了个 DOSBox 8 月 30 日刚出的 release 版 DOSBox 0.74-2 代码包( DOSBox 官方还在用 sourceforge 和 SVN...),改了一下在自己手上的怪物环境( MSYS1+emsdk1.38.12 )里,用 Emscripten 编译成了 js+webassembly。很容易搞。

    repo:
    https://github.com/yksoft1/dosbox-0.74-2-em
    demo:
    https://yksoft1.github.io/

    本来还在想移植 DOSBox-X 的,可惜怎么编译感觉 SDL 都没有初始化,明明在 console 里看日志游戏已经在运行了,浏览器却处于卡死状态。
    8 条回复    2018-09-18 18:36:21 +08:00
    mytry
        1
    mytry  
       2018-09-13 14:34:28 +08:00
    顶一个。
    mytry
        2
    mytry  
       2018-09-13 14:35:33 +08:00
    要是未来 qemu 能支持 WebAssembly 就好了,运行时动态把 X86 指令 JIT 成 wa 虚拟机字节码,性能估计还能提高一个量级,估计浏览器里跑 WinXP 都没问题了~
    yksoft1
        3
    yksoft1  
    OP
       2018-09-13 14:56:35 +08:00
    @mytry 其实 DOSBox 本来就有 JIT 的,但是只支持输出 x86 x86-64 arm 三种,WebAssembly 要出来还要很长时间。
    mytry
        4
    mytry  
       2018-09-13 15:13:19 +08:00
    WebAssembly 支持原生 64 bit 整数( asm.js 不支持),性能应该会有很大提升。
    yksoft1
        5
    yksoft1  
    OP
       2018-09-13 15:59:26 +08:00
    @mytry 记得 DOSBox 基本上没有使用 long long。
    mytry
        6
    mytry  
       2018-09-13 16:08:56 +08:00
    @yksoft1 刚刚看了下 DOSBox 官网上最近的更新:

    DOSBox 0.74-2 has been released!

    A maintenance release for DOSBox 0.74, which solves the following problems:
    Windows: Fix auto/max cycles algorithm on Windows 7, which helps with stuttering audio.
    Mac OS X: Bring a 64 bit version and improve performance.
    Linux: Fix the 64bit dynrec cpu core and a lot of compilation problems. Add patches for the WINE Team.

    Mac OS X 版本有 64bit 的性能提升,不知道同样的优化能不能应用到 emscripten 里。。。
    yksoft1
        7
    yksoft1  
    OP
       2018-09-13 16:27:06 +08:00
    @mytry 只是编译出了带 dynrec 的 x64 版。在 DOSBox 里面,dynrec 就是指 CPU JIT,而 CPU JIT 的代码是不能跨平台的。
    yksoft1
        8
    yksoft1  
    OP
       2018-09-18 18:36:21 +08:00
    继续研究 Emscripten 移植的统合贴。
    https://www.v2ex.com/t/489374
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1460 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:50 · PVG 07:50 · LAX 16:50 · JFK 19:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.