Skip to content

an emulator of the Commodore 64 home computer (C64) that runs on UNIX machines and executes programs intended for the old 8-bit computer

Notifications You must be signed in to change notification settings

beddinao/commodore_64_emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

136 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

commodore_64_emulator

a work-in-progress emulator that aims to run BASIC programs, not cycle-accurate.

implemented components:

  • 6510 CPU a bit modified version of 6502 (instruction accurate independant emulator)
  • VIC-II (Video Interface Chip)
      • 16 KB address space for screen, character, and sprite memory
      • 320 × 200 pixels video resolution (160 × 200 in multicolor mode)
      • 40 × 25 characters text resolution
      • 8 hardware sprites, each 24 × 21 pixels (12 × 21 in multicolor mode)
      • 16 colors
      • Raster interrupts for advanced effects and timing control
      • Smooth scrolling
      • Three character display modes and two bitmap modes:
        - Standard Character Mode
        - Multicolor Character Mode
        - Extended Background Color Mode
        - Standard Bitmap Mode
        - Multicolor Bitmap Mode
    
  • CIA-1 & CIA-2 (Complex Interface Adapters)
      • keyboard input scanning for detecting key presses
      • timer A & Timer B in each chip for generating delays and timing events
      • memory management registers for I/O mapping and bank switching
      • time of Day (TOD) clock
    

basic functionality test

some one line BASIC programs at ./programs/bas/10_print.bas

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

10 PRINT CHR$(32+(INT(RND(1)+.5)*81)); : GOTO 10

shell interface

it has a small shell that runs in a separate thread for debugging
and general hardware behaviour observation:

command description
LDP [path] Load a BASIC program (.prg) into memory.
LDD [path] Load a (.d64) D64 disk image.
- -
DMP $st $en Dump memory from address $st to $en.
SCR Show CPU status/registers.
SVR Show VIC-II status/registers.
SC1 Show CIA#1 status/registers.
SC2 Show CIA#2 status/registers.
- -
BRD [1-16] Change the border color.
BGR [1-16] Change the background color.
TXT [1-16] Change the text color.
- -
CLR Clear the loaded program from memory and perform a hard reset.
EXT Exit the emulator.

graphic libraries:

uses SDL3 as the main library.
however the v1.0 branch still uses MLX42, a lightweight library on top of GLFW.

requirements

  • Linux or MacOS
  • readline (libreadline-dev)
  • cmake >= 3.18
  • if trying to compile the v1.0 branch mlx42 needs glfw (libglfw3-dev)

installation

  • install dependencies linux
apt update -y && apt install -y libdreadline-dev cmake

or macos

brew install cmake readline
  • clone this repository and cd to it
git clone https://github.com/beddinao/commodore_64_emulator.git && cd commodore_64_emulator 
  • compile and run
make && ./c64_emu

screenshots

animated demos





basic games



some art brought from the C64 demoScene

upcoming features:

  • Full hardware sprite support (partial-progress)
  • SID sound emulation (partial-progress)

useful-resources

About

an emulator of the Commodore 64 home computer (C64) that runs on UNIX machines and executes programs intended for the old 8-bit computer

Resources

Stars

Watchers

Forks

Contributors