Building the Original Commodore 64 KERNAL Source

I just found this post over @pagetable.com, the source code to a bunch of old Commodore 8 bit products have been located and recovered, and place online over on github.  Even better there is detailed instructions on cross assembling from a suitable PET machine for building your own KERNAL ROM.

Other sources include:

  • BASIC_C64 reindented BASIC_C64, KERNAL_C64 and DOS_1540 to approximate the LST
  • BASIC_CBM2_A reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • BASIC_CBM2_B reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • BASIC_PET2001 added BASIC_PET2001
  • DOS_1540 reindented BASIC_C64, KERNAL_C64 and DOS_1540 to approximate the LST
  • DOS_1571 added DOS_1571
  • DOS_1581 added DOS_1581
  • DOS_4040 reindented DOS_4040 to approximate the LST output of the assembler
  • DOS_8070 reindented DOS_8070 to approximate the LST output of the assembler
  • DOS_8250 reindented DOS_8250 to approximate the LST output of the assembler
  • DOS_D9065 reindented DOS_D9065 to approximate the LST output of the assembler
  • EDITOR_CBM2 reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • KERNAL_C64_01 added KERNAL_C64_03 and renamed the existing KERNAL_C64 to KERNAL_C64_01
  • KERNAL_C64_03 fix disclaimer of C64 KERNAL -03 to reflect the LST printout
  • KERNAL_CBM2_A reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro
  • KERNAL_CBM2_B reindented BASIC_CBM2_[AB], KERNAL_CBM2_[AB] and EDITOR_CBM2 to appro

Super late, but pretty cool too!

Of interest is the PET2001 Basic sources.  While there have been reversed efforts dating back for years, this is the actual source code.  Namely the header.


TITLE BASIC M6502 8K VER 1.1 BY MICRO-SOFT
SEARCH M6502
SALL
RADIX 10 ;THROUGHOUT ALL BUT MATH-PAK.

$Z:: ;STARTING POINT FOR M6502 SIMULATOR
ORG 0 ;START OFF AT LOCATION ZERO.
SUBTTL SWITCHES,MACROS.

REALIO=4 ;5=STM
;4=APPLE.
;3=COMMODORE.
;2=OSI
;1=MOS TECH,KIM
;0=PDP-10 SIMULATING 6502

Which is pretty damned interesting. The infamous “WAIT6502,1” feature is also included!

Commodore Lemonade

Simulations before the sims

Lemonade on the PET

Back before there was sim city, the first popular simulation thing I can think of on our ancient basic bound 8 bit machines (and even mainframes running basic!) was Lemonade.  Wikipedia, naturally is full of Apple citations, and of course, is absent of any mention of the most popular selling home computer of all time, as Commodore is usually scrubbed from history in favor of this narrative that Apple was some how popular (it wasn’t).

Oddly enough tracking down these older versions of Lemonade is really hard.  But thankfully others have done the hard work for me!

First from The Sleeping Elephant,  and here is lemonade!.prg for the Pet microcomputer.  It’ll run fine in Vice, although it’ll run best using a Pet 3016 – 3032 and the model 4016 and 4032.  It needs more than 8kb of RAM, so the original models are out, and the ‘graphcis’ don’t display corrrectly on the larger 8000 models, although the game does run.

But what about the Commodore 64?

Commodore Educational Software

By the time the Commodore 64 came out, Commodore had stepped upped their game, and made available a large number of basic programs ported to the Commodore 64. As always the thinking is if you can convince parents that this is educational and it’ll help their kids, they’ll buy one.  Well in this case they were right!  Although lacking the cool animation of the PET, it does include more documentation.  And thanks to vcfed.org, You can download a tape file image here.

Game Play

Unsurprisingly the game play is pretty much the same.  You buy your Lemon concentrate, sugar and cups, try to predict demand based on your price and the weather.  You set a price, and sit back and hope for the best.

Lemonade Stand on the PET

Lemonade Stand on the Commodore 64

Once you figured out that the first few lines (3-5 on the C64) were there to not let you alter it, you were golden.  With the source, you could make summer last 10 years if you wished, or change any of the seemingly arbitrary limits.  If you were really keen on it, you could also print the source code and work out the logic flow with a pencil, something that you really needed back in the days of 40 column screens.

Settings -> Virtual Device Traps

Settings -> Drive Settings -> (Uncheck) True drive emulation

Settings -> Peripheral Settings

And now you can click the printer #4 tab and set it to output a to a file

Assuming you have the program loaded you can then just type in:

OPEN3,4:CMD3
LIST
CLOSE3

*Remember that Vice emulates the Commodore layouts, which means on the PET machines, they use a number pad.

The above commands will open up the printer, print the listing output to the printer, then close the printer device.  If all went well you’ll have the source dumped to viceprnt.out although PETSCII won’t render on ASCII systems, nor will the machine language portion, and a lot of the BASIC may get down shifted but you can always fix that with tr.

tr ‘[:lower:]’ ‘[:upper:]’ < c64_lemonaide.bas > c64_lemonaide_upper.bas

Quad core by Singular Crew / C64 demo

One of the coolest Commodore demos in some time.  Featuring quad Commodore 64’s.

Some details: This is the party version, rendered with VICE. AVSEdit Plus and VirtualDub used to merge videos. Unfortunately we had no four projectors to show it realtime. An idea to start: use rod or board to press space same time.

Credits:
Main code: Scorpy.
Zoomer part and some bugfix by Soci.
12 channel music: Vincenzo
Four screen picture: Leon
Rotator logo and some grafic artwork: Poison.

Note: The rotating logo in the last part originally designed to an Amiga demo 10 years ago which never finished.

I have to say, it not only looks great, but sounds great! Obviously we didn’t need the C65, we just needed a cluster of C64s.

NOS clone datassettes!

New old stock, still in shipping boxes!

327 devices!

327 devices!

I found this eBay auction, and couldn’t believe what they had unearthed!  Boxes and boxes of these clone datassette!

New old stock

New old stock

Obviously the perfect thing for any retro Commodore user!  And as you may know in Europe most people used tapes, while us North Americans all used disk drives, namely the mighty 1541.

As of me writing this there is only ONE left!  It’s not my auction, and I have nothing to do with them, but this is your big chance to get one if you want one!

***EDIT

Well it turns out the last unit has just been sold.  Too late to post it seems.

Scripted Amiga Update & hosting at archive.org

I saw this awesome link over at archive.org’s software Library featuring the Amiga

Behind it all is the Scripted Amiga Emulator.  What is more interesting is that there has just been a MASSIVE update/rewrite to the project and it is now boasting far more features!

Looking at the features page, there has been quite a number of updates since the last version.  The big ones (to me) is that the CPU core has been rewritten, and now supports not only the 68000, but the 68010, 68020, and 68030 (only with fake MMU). OCS, ECS and now AGA as well!  Preset models include the 1000,500,2000,500+,600,3000 and 1200.  IDE disk files can even be mounted for the 600 & 1200!

In addition is support for the Amiga 1000 velvet prototype, and even now has the ability to have an AMAX (Macintosh emulation) cartridge port.

R-Type on SAE

R-Type on SAE

I’d highly recommend the internet archive link, you can jump right into some great Amiga action with nothing to download or install!

The Ultimate Amiga 500 Talk

Amiga Hardware Design And Programming

The Amiga was one of the most powerful and wide srpead computers in the late 80’s. This talk explains its hardware design and programming.

The Amiga 1000 appeared in 1985 and was followed by the Amiga 500 a few years later, which had the same design concept but was a little bit more powerful. The hardware design was highly sophisticated and powerful and was years ahead to other computers at the time then.
Equipped with the Motorola 68000 Microprocessor as the CPU which was internally a full 32 bit processor and several additional co-processors for various complex DMA tasks it was perfect for graphics-intensive software.

This talk explains the hardware in detail, how all those processors interacted and how it was programmed.

──────────
➤Speaker: rahra
➤EventID: 7468
➤Event: 32th Chaos Communication Congress [32c3] of the Chaos Computer Club [CCC]
➤Location: Congress Centrum Hamburg (CCH); Am Dammtor; Marseiller Straße; 20355 Hamburg; Germany
➤Language: english
➤Begin: Sun, 12/27/2015 18:30:00 +01:00
➤License: CC-by

CBM Basic

I found this repository by accident, cbmbasic which is a ‘portable’ version of the old Microsoft Basic for the Commodore 8bit computers in C which can run on any manner of machine.

Really cool, right?

So for the heck of it, I fired up the x68000 toolchain, and in no time after gutting the file open operation as some stuff isn’t defined, and I wanted to see it run, I had a working executable.

C

CBM Basic

All the commands MUST BE IN UPPERCASE… Then again the Commodore did default to upper case, so I guess that isn’t a surprise.  There is no ‘system’ command to take you out of basic, but Control-C works just the same.

The other intersting thing, is that on the authors blog, pagetable.com, the original source code for the 6502 basic has been found.  Notably this version includes portions written by Bill Gates.  It is a very fascinating read.

Belated Merry Christmas!

Sorry things have been busy @ Home & Work.

I had been thinking about doing something special for the holidays but looking around it’s a little too late.

So instead here is something nerdy from my youth, the Commodore Christmas demo diskette..   When I was lucky enough to get a C64 along with a 1541 in 1983, this was one of the bundled diskettes.

At the time I never realized how lucky I was to have the floppy drive, so many poor Europeans with their tape drives.

I hope it’s been a good holiday for everyone!