Files
2026-05-07 10:07:49 +12:00

3.4 KiB

Forked by retrotechinsanity, blasted in some wozmon, savagely ripped out tape and rs232 support. There may still be some little pieces of tape and rs232 in there, need to clean up some more. Passed diag cart test, ccgms seems to run with the swiftlink driver and run a few demos. Initial version was 0.2.

Iterated through 0.3, 0.4 and currently calling this thing 0.5. There some free space being padded after some of the modules that could be broken out into smaller files.

wozmon.asm

Originally from Apple-1 Operation Manual, Steve Wozniak, 1976 Revised 2024 May 8 for Commodore 64/VIC/128 by David R. Van Wagner davevw.com Imported to integrated KERNAL segment by retrotechinsanity youtube.com/@retrotechinsanity

  • Using C64 KERNAL (instead of MC6520 and KBD/CRT)
  • extra processing for expected mark parity, software caps lock, and revised newline/carriage return processing
  • revised to expect terminal line edit mode instead of echo off character processing
  • revised to acme syntax
  • different zero page usage
  • changed l/h to wl/wh because vice didn't like that symbol
  • reverse toggle instead of spaces only on vic-20 (like HESMON) because too few columns

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

Linux:

  • 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

Windows:

I've added batch files for building and cleaning the build environment. You'll need to install cc65 onto your system and have it available in your PATH. See https://cc65.github.io/getting-started.html for more info.

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 mist64@mac.com, www.pagetable.com