a2c
a2c is an AppleSoft BASIC compiler and Apple ][ run-time environment. It is not an Apple ][ emulator - it cannot process 6502 machine language. Instead, it compiles the BASIC program into p-codes and then executes the p-codes. The p-codes are built off a generic Basic class, which is built on top of a Forth interpreter class.
When running a BASIC program, a terminal screen is used. When the program finishes, the terminal screen is cleared. To delay that screen clear, use -confirm to wait for user confirmation to exit.
Graphics mode is not supported. CALL is nominally supported.
filename |
Load the file into the run-time environment. The file may be a .pcx file (see -o), which is ready to execute; or a .bas file, which is ready to compile. For a .bas file, a2c will compile the source code; for a .pcx file, it is ready to run without compiling. |
-c |
Only compile the file; do not run it. See -run. |
-o filename |
Output file for the compiled BASIC program. By convention, the filename exension is .pcx (p-code executable). If -run was also specified, then the dataspace state will be post-execution, which includes allocated variable and array values, but it does not include any values in the dataspace above those. If -run was not specified, then the .pcx file will include just blank allocated variables. |
-run |
After compiling the BASIC file, run it. See -c. Note that the program runs in a terminal window that is cleared upon program completion. If your program simply outputs "Hello, World", you will see no output because it displays too fast. See -confirm to allow you to see the output. |
-confirm |
Future use. Upon program completion, wait for the user to press a key before clearing the terminal window. This allows the user to view the terminal window, especially if the user is not able to select Quit inside the BASIC program. In the case of a "Hello, World" program, this allows the user to see the output before it is cleared. |
-list |
If a .bas or PRG file was provided, this option will output the BASIC source code to stdout. There is a bug where some junk text will be output up to a " >" before the source listing. |
-code |
Display the p-codes of the compiled BASIC program to stderr. The p-codes are based upon a multi-stack environment (integer, floating point, string, and return/system) with separated code and data spaces. Note that each data unit holds 8 bytes, which is large enough to hold a byte, integer, long, float, double float, or 8 characters of a string. Dynamic strings are managed outside the dataspace. |
-slow |
Future use. By default, the BASIC program is run at full speed if the host system. It can regulate delays by watching the TIME variable, which increments every 1/60th of a second. Specify -slow to slow down program execution substantially, so output doesn't flash by so fast. |
-monitor |
Future use. After the p-codes are loaded into the run-time environment (and optionally the program run), the user is placed at the environment monitor prompt, which is a Forth intereter. Note that the BASIC program is not at $800; it is in a separate code space, starting at $0. Instead, allocated variables start at $800. To fetch a variables address, use the keyword var_name, where name is capitalized and appended with type, e.g. var_A (float), var_A% (int), var_A$ (string), var_A() (float array), etc. To resume execution at a specific line, use the keyword LNline# where line# is the line number to execute, e.g. LN1000. |