Skip to content

davervw/simple-emu-c64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-emu-c64

Here is a simple Commodore (64, 128, PET 2001, VIC-20, Commodore 16, Plus/4, ...) and 6502 Emulator I wrote from scratch. Runs in a text console window.

Machines

Notable features

  • Emulates MOS6502/6510 series processors as appropriate
  • Runs as a Windows Console Program (or in Mac/Linux terminal, source is C#)
  • Note that there is a separate cross-platform port to C++ is available at c-simple-emu6502-cbm and has graphical options specifically for Windows, ESP32, M5Stack, Teensy, ...)
  • Text based Commodore BASIC and 6502 Assembly/Machine Code programs supported
  • only a few hooks: CHRIN-$FFCF/CHROUT-$FFD2/COLOR-$D021/199/646 (COLOR background/inverse $9001 on VIC-20) (also hooked READY, GETIN, STOP, SETLFS, SETNAM, LOAD, SAVE for better simulation) *see limitations
  • reverse/inverse characters implemented for most systems
  • ESC is STOP key
  • C64 RAM/ROM/IO/CHARSET banking is implemented!
  • Plus/4 implementation has banking enabled, can access almost 60K RAM for BASIC!
  • C128 MMU implemented, with two banks of 64K memory, almost 120K for BASIC programs (57K) and variables (63K).
  • VIC-20 memory is configurable, can access almost 28K RAM for BASIC! Plus 11K more for machine code. Valid memory configurations include 5, 8, 13, 16, 21, 24, 29, 32, 37, 40 covering combinations building up from 1K LOW + OPTIONAL 3K EXPANSION + 4K BASE + 8/16/24/32K EXPANSION. Note not all expansion memory is always accessible to BASIC.
  • See release for third-party Commodore look-alike font, and color customization instructions.

Sample.bas

BUILD/INSTALL:

  1. Install ROMs in subdirectories c64, c128, pet, ted, vic20 (copy from VICE or distribution or similar)
  2. Dependency: .NET 7.0
  3. Build from Visual Studio (simple-emu-c64.sln), or from command line or Visual Code (recommend delete simple-emu-c64.csproj): dotnet build
  4. Either run the executable, or use: dotnet run

USAGE:

simple-emu-c64
simple-emu-c64 help
simple-emu-c64 c128
simple-emu-c64 c64 ram 4
simple-emu-c64 c64
simple-emu-c64 c64 startup.prg
simple-emu-c64 c64 walk
simple-emu-c64 c64 walk FFD2
simple-emu-c64 vic20
simple-emu-c64 vic20 ram 7
simple-emu-c64 vic20 ram 28
simple-emu-c64 vic20 ram 39
simple-emu-c64 vic20 walk
simple-emu-c64 vic20 walk FFD2 FFCF
simple-emu-c64 pet
simple-emu-c64 pet ram 32
simple-emu-c64 pet walk
simple-emu-c64 c16
simple-emu-c64 plus4
simple-emu-c64 ted ram 32
simple-emu-c64 ted walk

LIMITATIONS:

  • Only keyboard/console I/O. No text pokes, no graphics. Just stdio. Asynchronous input GET K$ is implemented, and INPUT S$ works. No special Commodore keys, e.g. function keys, cursor keys, color keys, STOP/RESTORE, RUN, PETSCII graphics characters, etc.
  • No keyboard color switching. No border or border color on most.
  • Reverse/inverse characters not yet supported on PET.
  • Hooks on PET limited to version 1 ROMs.
  • LOAD/SAVE/STOP(ESC) not working on PET.
  • No screen editing (gasp!) Just short and sweet for running Commodore BASIC in terminal/console window via 6502 chip emulation in software. Uses Windows Console line editor features instead.
  • No PETSCII graphic characters, only supports printables CHR$(32) to CHR$(126). But does support CHR$(147) for clear screen and Home/Left/Right/Up/Down characters too (output only).
  • No timers. No interrupts except BRK. No NMI or RESTORE key.
  • Loading and saving of files not currently implemented for PET (but Windows clipboard works!)
  • No cartridge, no joystick, no paddles, no light pen, no IEC, no serial port, no cassette, no sound, no sprites.
  • No Z80 support. Only 6502 compatible.
  • Lightly tested. Bugs are lurking!
  • No undocumented opcodes.

CREDITS:

Read the blog entries at davevw.com

And Slide Presentation is also available