vice.js/README.md
2013-12-04 19:55:12 -05:00

2.4 KiB

VICE.js

Versatile Commodore Emulator for JavaScript

JavaScript port of VICE 2.4 using Emscripten.

Website -> http://vice.janicek.co
VICE -> http://sourceforge.net/projects/vice-emu/
Emscripten -> https://github.com/kripken/emscripten

Status

  • Firefox 25 - ok
    • -o3 -> 100 second asm.js compile time
  • Firefox 28 - sound clicks
  • Chrome 31 - slow
  • Chrome 33 - ok
  • IE 11 - broken
    • Typed array constructor argument is invalid

Tasks

  • fix joystick
  • Gamepad API
  • try using worker thread (emcc --proxy-to-worker)
  • add other computers
    • VIC-20
  • fix vice menu ui (F12)
  • fix IE

Example

<!doctype html>
<html lang="en-us">
    <head></head>
    <body>
        <!-- the canvas *must not* have any border or padding, or mouse coords will be wrong -->
        <canvas  id="canvas" style="border: 0px none;"></canvas>
        <script type="text/javascript" >
            var Module = {
                arguments: ['+sound'],
                canvas: document.getElementById('canvas'),
            };
        </script>
        <script type="text/javascript" src="js/x64.js"></script>
    </body>
</html>

Best Configuration Options

async mode:

  • soundfragsize 2 -soundrate 22050 -soundsync 0

sync mode:

  • soundfragsize 2 -soundrate 22050 -soundsync 0 -ntsc
  • ntsc is important because browser requestAnimationFame is going to deliver 60 fps which means less cpu time is wasted during vsync delay

Development

###How to find key codes

  • in /vice/src/arch/sdl/kbd.c # sdlkbd_press()
  • this line prints key codes to console when key is pressed
fprintf(stderr, "%s: %i (%s),%i\n",__func__,key,SDL_GetKeyName(key),mod);
  • activate by compiling vice with SDL_DEBUG flag

Resources

C64 Wiki
Commodore 64 keyboard matrix layout
COMMODORE 64 ROGRAMMER'S REFERENCE GUIDE
Commodore Manuals
Coroutines in C
requestAnimationFrame setting fps
SDL 1.2 to 2.0 Migration Guide
VICE Manual