Thursday, March 13, 2014

Building Apple II DOS From Source Code

I am currently reading the book Sophistication & Simplicity: The Life and Times of the Apple II Computer by Steven Weyhrich. It is a fascinating history of the Apple II series of computers, from the beginnings with the Apple I up to the present time.

Many of the books and historical articles about Apple do not give enough credit to the Apple II for getting the company started and generating the revenue and size of company that was need to develop later products like the Lisa, Macintosh, and iPhone.

Reading about Apple DOS reminded me that, recently, the original Apple II DOS source code was publicly released. It has quite an interesting  history, which is covered both in the Steven Weyrich book as well as the Computer History Museum site where the materials can be downloaded.

There is both PDF format scans of the original assembler listing as well as a Microsoft Word file with the source code. I thought it would be fun to try to get the code to build using the CC65 assembler.

An evening's work was enough to get both the low-level disk routines source file as well as the full DOS source cross-compiled on a Linux system using CC65. Since I do not own an Apple II I am not able to test it. but the files assemble and appear to be correct.

I did not check every instruction in detail against the PDF source listing but the length of the code is correct and I checked a good number of the addresses. The Microsoft Word version was very helpful and was used as a starting point, but it did contain a number of errors which were resolved by looking at the scan of the assembly listing. Interestingly enough, the original source code assembler listing reports one assembly error in the code, which I believe I fixed correctly.

If you are interested in the ported code, it can be found here.

After doing the port, I found out that Scott LaBombard had also got the code built and even running on an Apple II. I plan to compare my binaries to his and see if there are any errors in my version that I missed.

I don't plan to do more with this, at least not unless I get my hands on an Apple II (I had an Apple //e and an Apple ][+ in the past but they were damaged a number of years ago in a basement flood).


No comments: