This is a guide to using the apple 1 emulator installed on smc.cs.maryvillecollege.edu. This could also be used as a general guide to using napple1, but some of the information contained in here is specific to our installation. The emulator that we have installed is napple1. This is a port of the pom1 emulator (which is available for linux, windows, and android. Pom1 uses SDL to paint a graphical window which it uses to simulate the terminal screen of the Apple 1 computer. napple1, on the other hand, uses ncurses, which allows it to be executed from a linux terminal. Or, more importantly for our installation, it can be executed from within sage math cloud.
By default napple1 is meant to be installed in a user's home directory. We have a patched version which is installed system wide. What this means is that you don't have to copy the executable or roms to your home directory to use napple1.
You do need to do just a little bit of setup in your account to use napple1. Basically, all you need to do is create a directory called "core" in your home directory (or in whatever directory you wish to execute napple1 from.) To do this, simply execute the command:
This directory is used to store dumps of the napple1 memory, and without this you won't be able to store and retrieve your programs.
To invoke the emulator, simply run the command:
This will start the emulated apple 1 environment. One thing you may notice right away is that you can only type upper case letters. This is because the original apple 1 only allowed upper case input. Because you have no need of your shift key while typing, shift is napple1's special command character. So when you type without the shift key, you are providing input to the virtual apple 1 computer, and when you type a shifted character you are giving a command to the emulator.
The emulator commands allow you to do things like reset the emulator, and save and run RAM images. These aren't apple 1 commands, and really there for your convenience. The commands are:
|Shift + B||Basic Load||Load the BASIC ROM into RAM|
|Shift + D||Dump Core||Saves an image of the RAM/ROM to core/filename|
|Shift + L||Load Core||Loads an image of the RAM/ROM from core/filename|
|Shift + R||Reset||Resets the emulated CPU|
|Shift + Q||Quit||Quits the emulator|
|Shift + M||Mode||Change between 8KB and 32KB RAM Mode|
Using the ROM Monitor
When napple1 loads, it will start the Apple 1's original ROM monitor, also known as WOZMON. This is a very rudimentary program which allows you to insert bytes into memory, examine memory, and jump to a specified address. All of the communications with wozmon are done in hexadecimal.
To view a byte of memory, simply type its address. For instance, typing "4F" and pressing enter will display what is in memory location "004F". Note that addresses are 16 bits on the 6502 processor, and so a full address is 4 hexadecimal digits. A two digit address is called a zero page address because its leading digits are both zero.
You can also view a range of memory. This is done bye typing start.end. For instance, consider the following listing, starting with the command to display the memory:
FF00.FF1A FF00: D8 58 A0 7F 8C 12 D0 A9 FF08: A7 8D 11 D0 8D 13 D0 C9 FF10: DF F0 13 C9 9B F0 03 C8 FF18: 10 0F A9
This lists the first few bytes of the ROM, which begins at address FF00. Notice how each line has a nice listing of the address of the first byte of the line.
To edit memory, simply type the starting address of the region you would like to edit, followed by a colon and then the bytes you want to write there. For instance, suppose we want to write a 2A to address 0000. We could do this as follows:
00: 2A 0000: 00
Notice that the ROM monitor responds with 0000: 00. What this is a listing of the beginning of where we wrote, and what used to be at that address. We can write several bytes by entering more than one before pressing enter:
00: 01 02 03 04 2A 0000: 2A
And we can see the bytes we wrote as follows:
00.04 0000: 01 02 03 04 2A
Jumping to an Address
The main idea of the ROM monitor is that it lets you enter a program in machine code. Once you do this, you will want to run your program. To do this, you just type the address followed by the letter R. For instance, we can jump to the beginning of the ROM monitor by typing:
FF00R FF00: D8\
Notice that the monitor responds with the first byte that is about to be executed, followed by \ which is the first character the ROM monitor prints when it runs.
Using Integer BASIC
Steve Wozniak wrote a BASIC interpreter for the Apple 1, which he originally called "Game BASIC". The official release name was "integer BASIC", because it only does integer arithmetic. It is an interesting implementation of BASIC because it is largely based on Wozniak's memory of what BASIC is like.
To run basic, do the following:
- Press Shift+B to load BASIC
- Press Y and then Enter
- Run the command: E000R
Happy BASIC hacking!
This little guide has just scratched the surface of Apple 1 usage. To learn more, see the following links: