APPLE BASIC PACKAGE FOR PAL-1 6502 COMPUTER Includes: Apple BASIC, eWOZ monitor, Tape Save/Load, FRE function assembled by Dave Hassler, 2022 CREDITS * Apple BASIC by Steve Wozniak, 1976 * eWOZ monitor by F. Saftstrom, 2007, which "enhances" the original Apple I monitor by Steve Wozniak * PAL-1/KIM-1 patches to Apple BASIC and the eWOZ monitor by Jim McClanahan, 2021 * Tape SAVE/LOAD and Free Memory, plus a few mods to the above, by Dave Hassler, 2022 USAGE Apple BASIC - start address $8000, warm start $82B3 It is initially set up with LOMEM=768 and HIMEM=5120, to take advantage of all available "lower RAM" in the PAL-1 or microKIM, 4.25 kb. Of course, one can change these variables to point to any available RAM. E.g., LOMEM=8192 and HIMEM=32767 creates 24 kb for user programs, and I'm pretty sure no original Apple 1 program from the '70s was bigger than 16 kb. eWOZ - start address $9220 [CALL-28128] This version does not have the Intel Hex save and load function of the original, but retains the backspace and JSR fixes. The input buffer was placed at $0200, to have it match Apple BASIC. From within BASIC, CALL-28128 to use it, and the monitor will behave *exactly* as if you'd typed CALL-151 on a real Apple computer. Free Memory - start address $937F [CALL-27777] This routine adds a very crude FRE(0)-type function (ala MS BASIC) to Apple BASIC. When CALLed, the result comes back as a 16-bit hexidecimal number. For decimal: PRINT PEEK(16)+PEEK(17)*256 in immediate mode. Tape SAVE and LOAD - start address $9400 [CALL-27654] This routine accesses Hypertape (located at $9100) to save, and the regular KIM-1 LOADT to load, Apple BASIC programs. After it's CALLed, choose Save, Load, or Return to BASIC. Apple BASIC programs have to be saved in two parts: a Zero Page part from $4A to $FF, then the BASIC program itself. Follow the prompts, typing a 'G' at $0000 after a successful save (or load). Loading a program is similar to the above. If you choose Return, you simply go back to BASIC. Unlike the method described in the Apple BASIC manual, this routine does not save all available memory; it uses BASIC's zero page pointers to End-of-Program and HIMEM to store only the relevant portion of the user program for part two of the save. The File ID coded into this program is 'AA': S=$53 + W=$57 -- Steve Wozniak. It seems appropriate to me, but it can be changed by altering locations $9436, $946E, $9492, and $94B6. Finally, I'm aware that the code is a) brute-force ugly and b) redundant in places, but it works fine. I'll leave it to more able hands to streamline this for some derivative work. NOTES Often referred to as "A1B", this language is *not* Apple Integer BASIC; Integer BASIC is a second-generation of the original written for the Apple II. In fact, Woz originally called this "Game BASIC" while he developed it -- from an HP BASIC manual and a copy of "101 BASIC Computer Games"! -- because he wanted the Apple 1 to be able to play a Star Trek game. Here's what original Apple BASIC does *not* have that Integer BASIC does: HLIN, VLIN, PLOT, COLOR TEXT, GR, DSP CON, MAN, TRACE, NOTRACE, POP Functions: ASC, PDL, SCRN (info gleaned from the Integer BASIC wikipedia page.) When translating Integer BASIC programs for use on the PAL-1 or microKIM running Apple BASIC, this needs to be taken into account; programs that rely heavily on the above commands (especially the graphics commands) will have to be rewritten, perhaps with user-written commands to access a serial terminal emulator's ANSI "escape codes," which will require machine language to make them reasonably fast enough. One of the weird things about Apple BASIC is that the user program is stored backwards: line 10 is *higher* in memory than line 100. The program grows downward from HIMEM, while the variables and arrays grow upward from LOMEM. That doesn't matter to a memory dump, of course, and the original Apple Cassette Interface is quite similar to the KIM-1 monitor's DUMPT and LOADT, functionally. ACKNOWLEDGEMENTS I hope users find this "package" of programs useful. Jim McClanahan is gratefully acknowledged for his work in patching both Apple BASIC and eWOZ for the PAL-1 - without his efforts, we'd have fewer options to explore our machines and learn just what was really possible all the way back in 1975 and '76. In putting this package together, I consulted a commented disassembly of Apple BASIC made by Eric Smith in 2003, and updated by him and Jeff Tranter in 2019. Hans Otten's retro computing website was also an indispensible source of information. And certainly not least, Liu Ganning, for creating the PAL-1 in the first place. LICENSE Only the software elements herein written by David H. Hassler are presented under The MIT License and copyright © 2022 David H. Hassler. This documentation and license notice should accompany the software. See https://mit-license.org/ for details.