Home

Awesome

Commodore Source Code

This repository collects the original source code of various Commodore Business Machines (CBM) computers converted to a modern encoding (ASCII, LF, indentation).

Using kernalemu and cbm6502asm, almost all source in this repo can be built from the UNIX command line. To build everything, run build.sh from the Unix command line, on a case-insensitive filesystem.

KIM-1/AIM-65

DirectoryYearComments
MONITOR_KIM1975KIM-1 ROM (6530-002, 6530-003)
MONITOR_AIM651978AIM-65 monitor
TIM1976TIM ROM (6530-004)

PET

DirectoryYearComments
BASIC_PET_V1_REC1977
BASIC_PET_V1R_REC1977
BASIC_PET_V2_MICROSOFT1978Microsoft BASIC V2 (MACRO-11)
BASIC_PET_V2_REC1978
BASIC_PET_V4_1979-07-231979
BASIC_PET_V4_REC1980
BASIC_PET_V4R_REC1980
KERNAL_PET_1.0_REC1977
KERNAL_PET_2.0_REC1978
KERNAL_PET_4.0_1979-10-231979
KERNAL_PET_4.0_REC1980
EDITOR_PET_EURO1981European editor for CBM 8032

CBM2

DirectoryYearComments
BASIC_CBM2_1982-11-191982
BASIC_CBM2_1983-05-311983
BASIC_CBM2_1984-01-041984
EDITOR_CBM2_1982-11-191982
EDITOR_CBM2_1983-05-311983
KERNAL_CBM2_1982-11-191982
KERNAL_CBM2_1983-05-311983
KERNAL_CBM2_1983-07-071983

VIC-20

DirectoryYearComments
BASIC_VIC1980901486-01
KERNAL_VIC_041980901486-04

C64

DirectoryYearComments
BASIC_C641982901226-01
BASIC_C64_BSO1982901226-01, BSO syntax
BASIC_C64GS1990390852-01
KERNAL_C64_011982901227-01
KERNAL_C64_021982901227-02
KERNAL_C64_031983901227-03
KERNAL_C64_03_BSO1983901227-03, BSO syntax
KERNAL_C64GS1990390852-01

Ultimax

DirectoryYearComments
BASIC_MAX_REC1982901230-01
KERNAL_MAX_REC1982901231-01
BASIC_MAX_MINI_REC1982901233-01 (MAX3101)

TED (C16, C116, Plus/4)

DirectoryYearComments
BASIC_TED1984318006-01
KERNAL_TED_041984318004-04 (PAL), 318005-04 (NTSC)
KERNAL_TED_051984318004-05 (PAL), 318005-05 (NTSC)
CHARSET_TED1984

C128

DirectoryYearComments
BASIC_C128_031985318018-03, 318019-03
BASIC_C128_041986318018-04, 318019-04
EDITOR_C1281985318020-05
EDITOR_C128_DIN1985315078-03, German
EDITOR_C128_NATIONAL1987
KERNAL_C128_031985318020-03
KERNAL_C128_051985318020-05
KERNAL_C128_061988318020-06
MONITOR_C1281985
CHARSET_C128_NATIONAL1985

C65

DirectoryYearComments
BASIC_C651991C65 BASIC (911115)
GRAPHICS_C651991C65 BASIC Graphics lib (911119)
KERNAL_C651991C65 KERNAL, EDITOR, MONITOR (911119)
DOS_C651991C65 DOS (911119)
BASIC_C64_C651991C64 mode BASIC V2 (900531)
KERNAL_C64_C651991C64 mode KERNAL (910117)

Disk Drives

DirectoryYearComments
DOS_40401980DOS V2.0; IEEE-488; 2x SS DD 5.25"
DOS_8060_REC1980DOS V7.0; IEEE-488; 2x SS/DS DD 8"
DOS_80701980DOS V3.0; IEEE-488; SS/DS DD 8" + HD
DOS_82501981DOS V2.7; IEEE-488; 2x SS/DS QD 5.25"
DOS_82801981DOS V3.0; IEEE-488; 2x DS QD 8"
DOS_D90651981DOS V3.0; IEEE-488; HD
DOS_15401981DOS V2.6; Serial; SS DD 5.25"
DOS_1541_01_REC1982DOS V2.6; Serial; SS DD 5.25"
DOS_1541_02_REC198?DOS V2.6; Serial; SS DD 5.25"
DOS_1541_03_REC198?DOS V2.6; Serial; SS DD 5.25"
DOS_1541_051984DOS V2.6; Serial; SS DD 5.25"
DOS_1541_05_REC198?DOS V2.6; Serial; SS DD 5.25"
DOS_1541_06_REC198?DOS V2.6; Serial; SS DD 5.25"
DOS_1541C_01_REC198?DOS V2.6; Serial; SS DD 5.25"
DOS_1541C_021985DOS V2.6; Serial; SS DD 5.25"
DOS_1541C_02_REC1985DOS V2.6; Serial; SS DD 5.25"
DOS_1541C_031987DOS V2.6; Serial; SS DD 5.25"
DOS_1541C_03_REC1987DOS V2.6; Serial; SS DD 5.25"
DOS_15511984DOS V2.6; TCBM; SS DD 5.25"
DOS_15701985DOS V3.0; Serial; SS DD 5.25"
DOS_1571_031986DOS V3.0; Serial; DS DD 5.25"
DOS_1571_051986DOS V3.0; Serial; DS DD 5.25"
DOS_1571CR1986DOS V3.1; Serial; DS DD 5.25"
DOS_15811987DOS V10; Serial; DS DD 3.5"
DOS_1581_1987-03-121987DOS V10; Serial; DS DD 3.5"
DOS_1581_1987-03-191987DOS V10; Serial; DS DD 3.5"
RAMDOS1986REU 1764/1750 RAM disk
CONTROLLER_10011983Controller; DS QD 5.25"
CONTROLLER_82501981Controller; 2x DS QD 5.25"

Printer ROM

DirectoryYearComments
PRINTER_8023P1980IEEE-488; based on Brother M82

Software

DirectoryYearComments
KIMATH1976KIM-1 Math Package
MATHPACK1979CBM2 Math Package
MONITOR_PET_ADDON1981RAM-based monitor for PET 8x92
MONITOR_C641982RAM-based monitor for C64
DISK_MONITOR1980Monitor extension for PET
DOS_SHELL1985DOS SHELL tool (1571 Test/Demo disk)
FIG1980fig-FORTH

Software: Resident Assembler & HCD65

DirectoryYearComments
ASSEMBLER_AIM65_REC19784 KB, heavily optimized
ASSEMBLER_PET_REC197?ROM 2 only (undated)
ASSEMBLER_PET_V112779_REC1979ROM 2 only, adds mul/div, error messages
ASSEMBLER_PET_V121579_REC1979ROM 2/4, adds .IFN/.IFE
ASSEMBLER_PET_V090580_A_REC1980adds XREF support
ASSEMBLER_PET_V090580_B_REC1980optimizations
ASSEMBLER_PET_V102780_REC1980bugfixes, ROM auto-detect
ASSEMBLER_PET_V26MAR82RR_REC1982based on V090580_B, LST output changes, non-mainline
ASSEMBLER_C64_REC1982"C64 Macro Assembler", adds .MAC
ASSEMBLER_TED1984TED version, adds .OPT LON, .OPT MLI
ASSEMBLER_C1281986C128 version, heavily commented
HCD65_3.51986BSO-compatible rewrite
HCD65_65CE02_0.1198865CE02/4510 opcode support
HCD65_65CE02_0.21990update
EDT_C1281986
LOADER_PET1979OBJ Loader
LOADER_C641986OBJ Loader
LOADER_C1281986rewrite
LOADER_C651990
LOADER_C65_RS2321990RS-232

Software: Games

DirectoryYearComments
KICKMAN1982Kickman Ultimax Game
OMEGA1982Omega Race Ultimax Game
WIZARD1982Wizard of Wor Ultimax Game

Other

DirectoryYearComments
A22321991Amiga A2232 Serial Port Card

Cross-Platform

DirectoryYearComments
6502ASM1989VAX/MS-DOS C 65CE02 cross assembler

Descriptions

BASIC_PET_*, KERNAL_PET_*

The PET BASIC and KERNAL sources in different versions (197-1980). Reconstructed by Martin Hoffmann-Vetter.

Note that BASIC V1, V1R and V2 were built by Microsoft (see BASIC_PET_V2_MICROSOFT), and the binary was sent to Commodore. After that, Commodore moved BASIC development in-house and converted Microsoft's V2 source into MDT650 Resident Assembler format. These reconstructed versions of V1 and V1R in "Resident Assembler" format therefore never existed and have only been produced to allow for comparisons against BASIC V2, V4 and V4R (which were built by Commodore with the Resident Assembler).

BASIC_VIC

The Commodore VIC-20 BASIC source (901486-01). Extracted from basic.src from vic_src.tar.gz and formatted the same as the C64 BASIC source.

KERNAL_VIC_04

The Commodore VIC-20 KERNAL source, unreleased version (901486-04). Extracted from kernal.src from vic_src.tar.gz and formatted the same as the C64 KERNAL source.

BASIC_C64

The Commodore 64 BASIC source (901226-01). Extracted from c64-basic.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

The source contains the ranges

The checksum byte at $BF52 is 0 and will have to be calculated in a later step.

BASIC_MAX_REC, KERNAL_MAX_REC

The Ultimax BASIC cartridge (MAX3102, 901230-01/901231-01). Contains an adapted version of the C64 KERNAL (-01) and a slightly patched version of BASIC. Reconstructed from BASIC_C64 and KERNAL_C64_01.

BASIC_MAX_MINI_REC

The Ultimax MINI BASIC cartridge (MAX3101, 901233-01). Contains a stripped-down version of the C64 BASIC (no arrays, no trigonometry etc.) and a tiny 1.5 KB KERNAL-like OS. Reconstructed from BASIC_C64 and KERNAL_C64_01.

KERNAL_C64_01

The Commodore 64 KERNAL source, original version (901227-01). Extracted from c64kernal.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

The source contains the ranges

It does not contain the version byte at $FF80 (which is $AA in the binary) or the "RRBY" signature at $FFF6.

KERNAL_C64_02

The Commodore 64 KERNAL source, universal (PAL/NTSC) version (901227-02).

It contains the version byte (0) at $FF80, but it does not contain the "RRBY" signature at $FFF6.

KERNAL_C64_03

The Commodore 64 KERNAL source, final version (901227-03). Based on KERNAL_C64_02 and manually patched using

There are two differences though:

The sources have been verified to build the correct -03 KERNAL binary.

It contains the version byte (3) at $FF80, but it does not contain the "RRBY" signature at $FFF6.

BASIC_C64_BSO, KERNAL_C64_BSO

This is the C64 BASIC and KERNAL source, converted from PET Resident Assembler syntax to the BSO CR6502/11 assembler by Fred Bowen in 1987, and with updated comments. Source: c64_kernal_bas_src.tar.gz.

This produces the same binaries as BASIC_C64 and KERNAL_C64_03, except for the pre-03 PIOKEY patch (see above).

BASIC_C64GS, KERNAL_C64GS

The Commodore 64GS BASIC and KERNAL (390852-01) source (1990). Source: c64_kernal_bas_src.tar.gz.

The source files are in BSO assembler format and derived from BASIC_C64_BSO and KERNAL_C64_BSO.

The KERNAL source contains the version byte (3) at $FF80 as well as the "RRBY" signature at $FFF6.

BASIC_TED, KERNAL_TED_0{4|5}

The Commodore Plus/4, C16 and C116 BASIC 3.5 and KERNAL source (1984). Source: ted_kernal_basic_src.tar.gz

BASIC_C128_0{3|4}, KERNAL_C128_0{3|5|6}, EDITOR_C128[_DIN], MONITOR_C128

The Commodore 128 BASIC 7.0, KERNAL, EDITOR and MONITOR sources (1985/1986). Source: c128_dev_pack.tar.gz

BASIC_PET_V2_MICROSOFT

The PET BASIC V2 source (1978) as built by Microsoft.

BASIC_C65

The final version of C65 BASIC V10 (911115, 1991-11-15). Source: folder system/9 in c65_src.tar.gz

GRAPHICS_C65

The final version of the C65 GRAPHICS BASIC (911119, 1991-11-19), the graphics library that is part of BASIC 10. Source: folder system/9 in c65_src.tar.gz

KERNAL_C65

The final version of the C65 KERNAL (called "KERNEL"; 911119, 1991-11-19). Source: folder system/9 in c65_src.tar.gz

DOS_C65

The final version of the C65 CBDOS (Computer-Based DOS; 911119, 1991-11-19). Source: folder system/9 in c65_src.tar.gz

BASIC_CBM2_*, KERNAL_CBM2_*, EDITOR_CBM2_*

The CBM2 BASIC, EDITOR and KERNAL sources in different versions (1982-1984).

The files have been converted to LF line breaks and LST-style indenting.

EDITOR_PET_EURO

The "CBM 8032 EURO SCREEN EDITOR 4V2E (E-901474-03)" ROM. Extracted from UNKN008.D80 from Ruud Baltissen's ICPUG disks and converted to LF line breaks and LST-style indenting.

CHARSET_TED

The Character ROM for the TED series (Plus/4, C16 and C116; 1984). Extracted from ted_kernal_basic_src.tar.gz.

CHARSET_C128_NATIONAL

The set of national Character ROMs for the C128 (1985): Denmark (325175-01), Finland/Sweden (325181-01), France/Belgium/Italy (325167-01), Germany/Belgium (315079-01), Norway (325178-01), Spain (325171-01), Switzerland (325173-01).

MONITOR_PET_ADDON

The PET 8096/80196 memory expansion addon monitor (1981). Corrected and fixed-up from the OCRed version, which is based on the LST printout

MONITOR_C64

The C64 monitor program. Extracted from ml-monitor-source.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting. The symbol WALKON in the file micii4 was changed from 1 to 0 so the source builds.

DOS_4040

The CBM 4040/2040 DOS V2.1 source (1980). Extracted from 4040-source.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks.

DOS_8250

The CBM 8250/8050/1001/4040 DOS V2.7 source (1981). Extracted from old-dos-sources.d81 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

DOS_8280

The CBM 8280 V3.1 source (1981). Extracted from Ruud Baltissen's ICPUG disks and converted to LF line breaks and LST-style indenting.

DOS_8060_REC

The reconstructed source for the CBM 8061/8062 (1980). The source is based on DOS_8070 and modified by Martin Hoffmann-Vetter to build into the DOS portion of the 901488-01/-02 ROMs.

The CBM 8061 (single side) and 8062 (dual side) are a pair of dual 8" disk drives. They were announced, but only a few were made and never sold publicly, but instead used internally at Commodore.

DOS_8070

The CBM 8070 DOS V3.0 source (1981). Extracted from old-dos-sources.d81 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

The CBM 8070 is an unreleased device with one 8" hard drive (#0) and one 8" double-sided floppy drive (#1). It is derived from the dual 8" drive CBM 8061/8062 (1980).

DOS_D9065

The CBM D9065 DOS V3.0 source (1981). Extracted from old-dos-sources.d81 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

DOS_1540

The Commodore 1540 DOS V2.6 source (1980), 325302-01/325303-01. Extracted from 1541-2031-copy-1-original-side1.d64/1541-2031-num1.d64 and 1541-2031-source-disk-copy-num2-side1.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

DOS_1541[C]_0{1|2|3|5|6}[_REC]

The Commodore 1541/1541C/1541-II DOS V2.6 source.

These are the respective directories:

(Commodore used the PET Resident Assembler to build the 1541 DOS until "_03", and switched to the BSO assembler afterwards. All original source that has been preserved is in BSO format. To allow for better comparisons, all "_REC" source has been formatted in the PET Resident Assembler format. So note that the "_REC" source after "_03" never existed in this format.)

DOS_1551

The Commodore 1551 DOS 2.6 TDISK source (1984), 318008-01. Source: all_new_dos.tar.gz

DOS_1570

The Commodore 1570 DOS 3.0 source (1985), 315090-01. Source: all_new_dos.tar.gz

DOS_1571{_03|_05|CR}

The Commodore 1571 DOS sources:

Source: all_new_dos.tar.gz; the -03 version was reconstructed from 1571/310654_03/serlib.lst in the dump.

DOS_1581

DOS_1581_1987-03-12

RAMDOS

The C64/C128 RAMDISK DOS V4.3 source (1987). Extracted from ramdos.zip. This is a version of Commodore DOS running on the C64/C128 for using a REU (RAM Expansion Unit) as a RAM disk.

CONTROLLER_8250

The CBM 8250/8050/4040 controller source (1981). Extracted from 4040-8050-8250-controller-code-tandon.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

CONTROLLER_1001

The SFD-1001 controller source (1981). Extracted from old-dos-sources.d81 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting.

PRINTER_8023P

The CBM 8023P printer source code (1980). Extracted from 8023p-printer-source.d64 from Steve Gray's Dennis Jarvis Page and converted to LF line breaks and LST-style indenting. The .NOLIST directive was commented out in us.ptr.src, so building would create a useful LST file.

The CBM 8023P is a dot matrix printer with an IEEE-488 connection, a 6502/6532/6522-based controller, and a Brother M82 mechanism. The source contains references to Epson Model 3110/3210 mechanisms which seem to have been used in earlier printers.

The source contains a 90 degree rotated 6x8 pixel variant of the PETSCII character/graphics set.

DISK_MONITOR

"DISK MONITOR 2040 V1.0", an extension to the PET monitor for disk commands (see mon.cmd). Extracted from UNKN008.D80 from Ruud Baltissen's ICPUG disks and converted to LF line breaks and LST-style indenting.

DOS_SHELL

The DOS Shell tool from the 1571 Test/Demo disk, autoboot for C128. Source: c128_dev_pack.tar.gz

MATHPACK

A variant of the "BCD Math Package" printed in the Commodore 700 Reference Manual. Extracted from UNKN008.D80 from Ruud Baltissen's ICPUG disks and converted to LF line breaks and LST-style indenting.

ASSEMBLER_AIM65_REC

The AIM-65 version of the Resident Assembler (ROM R3224; 1978). Reconstructed from ASSEMBLER_TED.

This is a reconstruction of the oldest known version of the Resident Assembler. It's a 4 KB ROM that interfaces with the AIM-65 monitor. It is heavily optimized and outputs to RAM instead of OBJ files. It is probably based on the (lost) 6 KB KIM-1 resident assembler ("KIM-5"). The later PET versions are not based on this (optimizations did not carry over), but the original (also lost) MDT650 version.

ASSEMBLER_PET_*_REC

Different versions of the PET Resident Assembler. Reconstructed from ASSEMBLER_TED, based on work by Martin Hoffmann-Vetter.

ASSEMBLER_C64_REC

The C64 Macro Assembler (a version of the Commodore Resident Assembler). Reconstructed from ASSEMBLER_TED to build a binary that is identical with the V080282 version, modulo the leftover garage in the original binary between $081A and $0990, which is filled with $AA.

ASSEMBLER_TED

A version of the Commodore Resident Assembler for the TED series (Plus/4, C16 and C116; 1984). Extracted from ted_kernal_basic_src.tar.gz.

ASSEMBLER_C128

The final version of the Commodore Resident Assembler, for the C128 (V022086; 1986).

HCD65_3.5

The release version of the C128 HCD65 assembler. Source: c128_dev_pack.tar.gz

HCD65_65CE02_*

The internal updated version of the C128 HCD65 assembler with 65CE02/4510 support. Source: c128_dev_pack.tar.gz

The 0.1 version was reconstructed from an LST file.

LOADER_PET

The PET OBJ Loader, version V121379. Extracted from ted_kernal_basic_src.tar.gz and converted to uppercase and LST-style indenting. File loload.4 added.

LOADER_C64

The OBJ Loader of the C64 Macro Assembler, version V072882. Extracted from c64_kernal_bas_src.tar.gz and converted to uppercase and LST-style indenting.

LOADER_C128, LOADER_C65, LOADER_C65_RS232

The OBJ Loader of the HCD65 assembler.

EDT_C128

The editor for the HCD65 assembler for the C128 (1986). Source: c128_dev_pack.tar.gz

MONITOR_KIM

The KIM-1 "monitor" ROM (1975), i.e. 6530-002 and 6530-003. From the Hans Otten reconstructed source from the KIM-1 users manual.

MONITOR_AIM65

The AIM-65 "monitor" ROM (1978), i.e. R3222 and R3223-11. From the reconstructed source from the monitor listing printout. Corrected and fixed up to match the LST.

KIMATH

The KIM-1 "KIMATH" math package (1976). Generated from the original LST printout, and the .asm reconstruction by C. Bond from the same package.

TIM

The TIM (Terminal Interface Monitor) ROM (6530-004). Reconstructed from the manual by Martin Hoffmann-Vetter.

FIG

fig-FORTH for 6502, Rel 1.1 (1980) for various platforms. Converted from the LST.

This is not MOS/Commodore source code, but it was developed with some version of the Resident Assembler.

KICKMAN

The game "Kickman" (1982) for the Ultimax. Reconstructed from the BSO-format source.

OMEGA

The game "Omega Race" (1982) for the Ultimax. Reconstructed from the BSO-format source.

WIZARD

The game "Wizard of Wor" (1982) for the Ultimax. Reconstructed from the BSO-format source.

A2232

The 65CE02 source of the firmware of the Amiga A2232 7-port serial card.

6502ASM

The "6502ASM" cross-assembler, V1.0 (1989-08-23) for VAX and MS-DOS. Reconstructed from the V1.0 LIS/LST files in c65_src.tar.gz and the B0.0 C files in 4502-asm-for-pc.img from Steve Gray's Dennis Jarvis Page.

Credits

This repository is maintained by Michael Steil, mist64@mac.com