CBM 5/6/700 - Basic 4+ Source Code
Back in the late 1980s I was given a copy of Commodore's original assembler source code that was used to compile the 8-bit BASIC and KERNEL operating systems ROMs for the 6/700 series. I came across it again back in 2005 and have now zipped it up so that anyone interested can download it and look to see how it was all done.
The first file you should probably look at is basic as this contains the version information (reproduced below). It confirms that the source was a gradual modification of the Microsoft release for the original PET in 1977 up until January 1982 when the final (for this source) modifications for Basic 4.0 Plus were added. It is interesting to note that, while there was controversy over the naming of the various different PET versions of BASIC prior to 4.0, this source is probably puts that to rest. The arguments over whether or not there was ever a version 3.0 can be seen here - yes, there was - but, as far as I know, it was never released in ROM. 1.0 was the original version for the Old ROM PET, 2.0 was the debugged version, 3.0 added the faster string garbage collection routines and got combined into 4.0 when the extra disk commands were added.
When processed by an assembler the initial basic file would have included all of the others that made up the Basic ROM via the .LIB command. Following these (plus the RAM/ROM charts on the previous pages) will give you an idea of how the whole ROM was assembled. Note where some of the .LIB includes have been commented out such as the renumber or the tape routine modules. The source includes the unused renumber module but I was never given the ones for tape operation.
Please note that, while I am making this source available, I'm not really sure if I have the authority to do so. If anyone knows for certain one way or the other then please let me know - I have no intention of treading on anyone's toes!
Here's a copy of part of what was in that initial source file:
; VERSION 1 - AUGUST 1977 ; ORIGINAL MICROSOFT RELEASE ; ; VERSION 2 - AUGUST 1978 ; FIXED MANY BUGS SOME ARE ; 1) ARRAYS LIMITED TO 255 ; 2) NON-INTERRUPTABLE CODE ; 3) GARBAGE COLLECT STRINGS ; ; VERSION 3 - MAY 1979 ; FASTER GARBAGE COLLECT ; ; VERSION 4 - JULY 1979 ; 1) EXPAND RESERVED WORDS ; 2) ADD DISK COMMANDS ; 3) ADD DISK STATUS VARS. ; ; VERSION 4X - MAY, 1980 ; 1) SEPARATE OUT KERNAL ; 2) SET-UP KERNAL INTERFACE ; 3) REMOVE ALL KERNAL DIRECT CELL USAGE ; ; VERSION 4.7 - OCTOBER, 1981 ; 1) BANK RELATED COMMANDS ; 2) COPY LITERAL STRINGS TO STRING SPACE ; 3) INDIRECT INPUT BUFFER ; 4) COPY FBUFFR TO STRINGS ; 5) CHRGOT BY INDIRECT ; 6) PRINT MESSAGES DIRECT ; ; ; VERSION 4.73 - NOVEMBER, 1981 ; 64K VERSION ; 1) FLOATING POINT MOVE & BANK MAPPING ROUTINES ; 2) TEMP STRING DESCRIPTOR POINTERS MOVED TO ; TOP OF "USER" MEMORY. ; 3) DS$ STRING AREA ALLOCATED PERMANENTLY AT ; TOP OF "USER" MEMORY. ; 4) THREE BYTE POINTERS (THIRD BYTE IS BANK#) ; FOR: ; STRING DESCRIPTOR POINTERS(BACK LINKS TOO) ; STRING POINTERS ; VARIABLE POINTERS ; STRING DESCRIPTOR POINTERS. ; 5) USER MEMORY COPY OF "ZERO" OCCUPIES 4 NULL ; BYTES PRECEDING USER TEXT AREA. ; ; VERSION 4.74 - DECEMBER, 1981 ; 1) USER-DEFINED FUNCTIONS: FORMAL PARAM. ; PTR USES 3 BYTES ; 2) TI$,TI WITH NEW KERNAL INTERFACE ; ; VERSION 4.75 - JANUARY 7,1982 ; 1) EXTENSIONS FOR 64K,128K,192K,256K