A website that serves as a Commodore 64 emulator, where the web content is provided as a C64 program that the emulator loads.
This project creates a web-based C64 emulator where you can:
- Load and run C64 programs (
.prg,.d64,.t64,.crtfiles) - Modify the C64 program files to change the web content
- Provide an authentic retro computing experience in the browser
- Full C64 emulation in the browser
- Load programs from local files or URLs
- Clean, retro-styled UI
- Responsive design
Note: While JSC64 can work when opening the HTML file directly, it's recommended to use a local web server for best results, especially when loading programs.
You can open index.html directly in your browser, though some features may be limited.
python3 -m http.server 8000Then open http://localhost:8000 in your browser.
npx http-server -p 8000php -S localhost:8000After starting a server (or opening directly):
- Navigate to the page in your browser
- Wait for "Emulator ready" message
- Click "Load Program" to load a C64 program file (
.prgformat) - The emulator will start and run your program
Click the "Load Program" button and select a C64 program file from your computer.
You can load a program programmatically using the browser console:
loadProgramFromUrl('https://example.com/path/to/program.prg', 'My Program');To analyze/diff compiled PRGs, use:
python3 tools/prg_decompile.py programs/main.prg
python3 tools/prg_decompile.py programs/main.prg --mode basic
python3 tools/prg_decompile.py programs/main.prg --mode disasm --start 0x1000 --length 256
python3 tools/prg_decompile.py programs/main.prg --mode acme > /tmp/out.asmindex.html- Main HTML file with emulator containerstyles.css- Styling for the retro-themed UIapp.js- JavaScript code for emulator integration and program loadingsrc/- Source code filessrc/*.bas- BASIC source (compiled withpetcat)src/*.asm- 6502 assembly source (compiled withacme)
programs/- Compiled PRG files (generated by CI/CD)programs/main.prg- Compiled program (auto-loaded on startup)programs/programs.d64- Disk image containing all compiled PRGs (auto-attached in VICE.js)
lib/- Local JavaScript libraries (jQuery and JSC64 with all dependencies)lib/assets/- C64 ROM files (kernal, basic, and character ROMs)
compile.sh- Local compilation script.github/workflows/compile.yml- CI/CD workflow for automatic compilation
All dependencies are stored locally - no CDN required! The C64 ROM files are included in lib/assets/.
-
Edit the BASIC source file in
src/main.bas -
Write your C64 BASIC program in plain text format:
10 print "WELCOME TO SYS-64738.COM" 20 for i=1 to 1000:next 30 goto 10
Important: Use lowercase keywords (print, for, goto, next, etc.). The petcat compiler expects lowercase keywords for proper tokenization.
-
The program will be automatically compiled to
programs/main.prgin CI/CD -
The compiled PRG will be auto-loaded when the emulator starts
To compile the BASIC source locally:
# Install VICE (includes petcat compiler)
# On macOS:
brew install vice
# On Linux:
sudo apt-get install vice
# Run the compiler
./compile.shThis will compile src/main.bas to programs/main.prg.
- Add one or more
*.asmfiles undersrc/ - CI/CD compiles each
src/<name>.asmintoprograms/<name>.prgusingacme - In
dev.html, you can also assemble and run ASM in the browser (ASM tab). That mode produces a PRG that auto-runs via a tiny BASICSYSstub.
- Place your
.prgfiles in theprograms/directory - Load them manually using the "Load Program" button
- Or name it
main.prgto have it auto-load on startup
The program you create will be what users see and interact with when they visit your website.
Default emulator is VICE.js (an Emscripten build of VICE) with a JSC64 fallback path kept in place.
-
VICE.js (default): ships locally at
lib/vice/x64.jsand is booted byapp.js. -
JSC64 (fallback): loaded dynamically by
app.jswhen selected. -
GitHub: https://github.com/reggino/jsc64
-
API: Uses
jsc64.loadPrg(url)method to load programs
- Use VICE.js (default): open the site normally.
- Force JSC64: open with
?emu=jsc64(example:debug.html?emu=jsc64). - Force VICE.js: open with
?emu=vice.
The selection is remembered in localStorage (sys64738.emu).
If you need to switch to a different emulator:
-
ty64 - Lightweight, native JavaScript (no jQuery)
- Documentation: https://ty64.krissz.hu/documentation/en/
-
EmulatorJS - More complex setup, supports many systems
- Requires server headers and data directory
- Documentation: https://emulatorjs.org/
To switch emulators, update the script tags in index.html and modify the initialization code in app.js.
- Make sure your C64 programs are compatible with the emulator
- Some programs may require specific C64 configurations
- Test your programs thoroughly before deploying
Check the licenses of the emulator libraries you use.