Thursday, May 3, 2012

Source Code for Apple 1 BASIC


Eric Smith disassembled Apple 1 BASIC. This is the original Integer BASIC interpreter written by hand by Steve Wozniak for the Apple 1. It originally ran out of RAM and is in ROM in the Replica 1. It is 4K is size.

The disassembly was actually an assembler listing. I ripped out the listing part and made a few changes to get it to assemble with CC65. Then I compared it byte by byte to a dump of the BASIC in the Replica 1 ROM. There were a number of differences which I corrected. I now have source which can be assembled and produces the same code as the original BASIC.

I've only done a limited amount of testing so far but I am able to assemble it at a different address, (e.g. RAM) and it runs. I made a change to make the BASIC prompt a different character, and the new versions reflected that change, so that seemed to confirm that I was indeed running my version of BASIC.

The next step is to clean up the code to add and update some comments, give meaningful names to some variables and routines, and try making some changes.

The source code is here.

No comments: