Skip to content

Latest commit

 

History

History
80 lines (66 loc) · 2.49 KB

README.md

File metadata and controls

80 lines (66 loc) · 2.49 KB

VICE.js

Versatile Commodore Emulator for JavaScript

JavaScript port of VICE 2.4 using Emscripten.

Demo
VICE
Emscripten

Browser Version Status Note
Firefox 25, 26 ok -o3 (--llvm-lto 3) -> 100 second asm.js compile time
28, 29 sad sound clicks
Chrome 31 sad slow
33, 34 ok tiny sound clicks
IE 11 broken did you expect something different? Typed array constructor argument is invalid

Tasks

  • 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