Code Monkey home page Code Monkey logo

c64rom's Introduction

Commodore 64 BASIC and KERNAL Source

This repository contains the Commodore 64 BASIC and KERNAL source in a format that is easy to edit and can be built using modern tools on modern systems. It is derived from the original sources, with all original symbols and comments intact.

Building

  • Requires
    • cc65.
    • make, Python, crc32
  • Use make to build.
  • The resulting files are
    • basic.bin ($A000-$BFFF): identical with basic.901226-01.bin
    • kernal.bin ($E000-$FFFF): identical with kernal.901227-03.bin

Modifying

The major parts of KERNAL reside in their own segments that will always be linked to their original addresses, so if you want to remove tape or RS232 support, for example, the other sections will still remain where they should be in the image.

Checksums

Commodore built all ROMs so that the 8 bit checksum matches the upper 8 bits of the location in the address space, e.g. BASIC is located at $A000, so its checksum has to be $A0. There is one "checksum adjust byte" at a dedicated location in every ROM that is updated after the build to cause the correct checksum. In BASIC, this is at $BF52 (CKSMA0) and in KERNAL, it's at $E4AC.

The algorithm looks like this:

10 A=0:C=0
20 FOR I=16384 TO 24575
30 B=PEEK(I)
40 A=A+B+C:C=0
50 IF A>255 THEN A=A-256:C=1
60 NEXT
70 PRINTA

Starting in 1983 though, they started using a slightly different algorithm (that adds the final carry) with most ROMs:

65 A=A+C

The only version of C64 BASIC is from 1982 and uses the old checksum. The -03 version of the KERNAL is from 1983 and uses the new checksum.

Any ROMs after 1983 (so also all ROMs we create today) should be checksummed using the new algorithm. The Makefile will use the old algorithm on BASIC if it's unchanged from the 901226-01 version, otherwise it will use the new algorithm. The KERNAL checksum will always use the new algorithm.

Credits

This version is maintained by Michael Steil [email protected], www.pagetable.com

c64rom's People

Contributors

mist64 avatar hartkopp avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.