Ruud's Commodore Site: Source codes Home Email

Source codes

What is it?

This part of my site contains source codes of the Kernals, (EP)ROMs etc. of various Commodore computers, drives and peripherals. It also includes the source codes of binaries created by third parties for the mentioned equipment, for example: JiffyDOS.


- Jim Brain for allowing me to publish the source code for JiffyDOS
- Magnus Nyman, also known as Harlekin/FairLight, for using his comments in the source code for JiffyDOS


Some members of the the Dutch Commodore User Group were interested in connecting a CBM 8250LP to the C64 using an IEEE cartridge. But some cartridges didn't work as they wanted and that triggered me to see if the software could be changed. This meant creating source codes of the EPROMs of the various interfaces. Sources I wanted to edit and to make public.

I then noticed that using an external EPROM always means the loss of memory in some or another way. So I thought about implementing IEEE into the Kernal. But that meant that I needed a good source code of the C64 ROMs in the first place. Lee Davison had written a good one so I tried to contact him to get his permission to use it as base for my own work. But his site had gone and no replies on emails sent to him. After some research I found out that he had passed away in 2013. Not only a loss for his family but also for the programmer's community. Luckily I had a copy of his sources but it seems that some other good things that he created have been lost for ever.

I first created my needed C64 source code (of the V3 Kernal) using my own disassembler and then adding Lee's comments. Next I decided to create the source code for JiffyDOS 6.01. Now is JiffyDOS 6.01 based on the V3 Kernal of the C64. So I created one using my own source code as base. During adding the comment for JD I ran into several errors and things that could have been done better in the original sources. But this meant that I had to edit two sources. And then the thought hit me that this would become worse after creating source codes for the 4064, C64 SX, C64 GS and many other kernals. So I decided to choose for a completely different set up.

First I decided to split my original C64 source up in four parts:
- Header
- Variables
- Kernal
The main file is the header; the assembler is told to assemble the header in the first place. In case of this project the header doesn't contain any opcodes but only tells the assembler which other files have to be assembled as well.

Second I decided to create only one base file for each part and the files for the other versions would only contain the changes. And that can go quite deep. For example, the source file for JiffyDOS is based on verion 3 of the kernal. Version 3 on its turn is based on version 2 which on its turn is based on version 1.
The advantage is clear: in case of a change only one file has to be edited. Unfortunately there is also a disadvantage: the complete set of files for any version made things more or less unreadable for the user. I overcame this problem by creating a program that extracted a file for a given version out of all needed source files. And I made sure that this file could be assembled as well and would produce the same BIN file as the original set of files.

Another advantage of this method: it is quite easy for someone to create his own ROM versions. Instead of having to edit the original file, he starts with choosing a base version, then creates a new header and adds the file to this header that only contains the changes. In case of my IEEE project I created an header that tells the assembler to use version 3 as base and to use a file that only contains the changes for this IEEE-Kernal.

Remark: From all original Commodore C64s the GS is the only one that has a different BASIC ROM. So I decided to create a file that contains this change. But there is also a file containing the changes for the Kernal, just like the other Kernals. In fact one file containing the changes of both files would have done the job as well. But I decided to create two files for clarity.



The sources presented here have all been generated by my own written disassembler. The comments have been added by me by hand; thus no copying from other files. About half of the comments I copied from various Dutch, German and English books so in that case the credit goes to the authors of these books. The other half of the comments are my own.