About the RFP Simulator

The AltairRFP simulator allows you to simulate an Altair 8800 on your PC using the Briel Computers Altair 8800 Micro as a front panel. This is different from the normal mode of the Altair 8800 Micro as the computations are performed on the PC and the 8800 Micro is simply the control panel. Because the simulator communicates with the front panel via RS232, the AltairRFP simulator can be rather slow, although with proper options, it is possible to run programs at a reasonable speed.

 

Setting up the Hardware

To enable front panel mode on the Altair 8800 Micro, put all the sense switches (A8-A15) down and then flip up A8. You also need to turn on the AUX switch. Either cycle the Altair’s power or reset it and the device will enter remote front panel mode. Remember, if a keyboard is connected the internal terminal will drive the serial port and you should not connect an external serial port until you disable the internal one. If you remove the keyboard before the device reboots, the internal serial terminal will be disabled and you can use the external serial port. You can also disable the terminal by pressing Control+F7 on the attached keyboard.

 

By default the serial port is set to 9600 baud. The ! command accepts a 4 digit hex number that sets the baud rate factor, so you can use other speeds. The last character of this command will not echo (because of the baud rate change). The actual factor depends on your clock frequency (usually 16MHz). You may wish to increase the speed before disabling the internal terminal (or connect with a terminal program first at 9600 baud and increase the serial port speed). To compute the correct factor use:

 

 

Where F is the clock frequency in Hz and B is the baud rate. Round X to the nearest integer and convert to hex. For example, with a 16MHz clock and a desired 57600 baud rate, the equation becomes:

Therefore, the command for switching the device to 57600 baud is:

        !0010

 

Building the Simulator

You can build the simulator for Linux using g++ and gcc or you can build for Windows using MINGW. In either case you need the make utility. You can also build for Windows using Cygwin.

 

To build the simulator, enter the directory of your choice (linux, cygwin, or mingw) and issue the make command. Note that when building with mingw, all telnet-related functions will become inoperative (see Running the Simulator, below).

 

Running the Simulator

Here’s the help text from the simulator:

 

Usage: altairrfp [-l skipupdates] [-m memorysize] [-r] [-t] [-u][a]

[-f load_file]  [-p port_name]  [-b baudcode] [-k char] [-C port] [-X port]

[-E outspec] [-T outspec] [-D outspec]

 

Command line switches:

  1. -p port_name: set front panel serial port
  2. -b baudcodes: 0=>9600, 1=>19200, 2=>57k, 3=>115k (default is 0 or 9600 baud)
  3. -l skipupdates: Skips updating LEDs in run mode to speed execution
  4. -m memorysize: RAM size in decimal (default=65536)
  5. -r: forces the CPU to run and ignores front panel switches (faster execution); if no port selected, -r is forced on and no front panel is used
  6. -t: forces tracing on regardless of the state of the protect switch
  7. -u: forces input to uppercase
  8. -k char: sets a “kill” character. Typing this character twice will send the character once to the simulated Altair; typing this character with any other character will cause the emulator to exit.  
  9. -C port: Redirects console to specified telnet port (simulator will wait for connection)
  10. -X port: Sets control port to specified telnet port (default none; simulator will wait for connection if specified)
  11. -E outspec: Sets the error stream. If outspec is numeric it is taken as a telnet port. If it is not numeric, then outspec refers to a file that will be created or overwritten. Default is to use the system console.
  12. -T outspec: Sets the trace stream. If outspec is numeric it is taken as a telnet port. If it is not numeric, then outspec refers to a file that will be created or overwritten. Default is to use the system console.
  13. -D outspec: Sets the debug stream. If outspec is numeric it is taken as a telnet port. If it is not numeric, then outspec refers to a file that will be created or overwritten. Default is to use the system console.

 

Because the front panel slows the simulator down considerably, you may wish to skip many LED updates when running. That’s what the -l switch is for. In addition, you can stop polling the switches by using the -r option. This gives excellent speed, but it means you can’t stop or reset from the front panel. You also can’t save memory when using this option since there is no way to signal the program to save.

 

When running you may use the protect switch to request a trace output of each instruction. In addition, if you switch AUX on  the program will ask if you want to reset or save memory. Saving memory causes it to be placed in a temporary file. If you want to keep the saved memory, you should copy or move it (the program will tell you the name and location of the file).

 

For example, here is a run of a 32K machine running 16K BASIC:

./altairrfp -l 65535 -m 32768 -r -f 16KBAS.BIN -u -p /dev/ttyUSB8

 

Note that for Basic to load properly, A11 must be set on the front panel. Also, the AUX switch is used for reset so it must be down to run.

 

To stop the emulator, throw the AUX switch up and select exit. If you have used the -r option you’ll need to kill the emulator from a task manager or other external means. The AUX switch also allows you to save memory or reset the running program.

 

Here are a few example command lines and what they will do:

altairrfp -m 32768 -u -k \~ -p /dev/ttyS0 -f trek8800.bin -T 4100 -t -l 100000 -X 4101

This command runs with 32K of RAM, forced uppercase input, and an escape key of ~ (note the Linux shell requires the backslash to prevent ~ from being interpreted). The file trek8800.bin is loaded. Tracing is on (-t) and the trace output will be on telnet port 4100. The control port will be on telnet port 4101. Note the emulator will not start until the control port connects. The remote front panel is on /dev/ttyS0 and will be updated every 100000 cycles when running.

 

altairrfp -u -k \~ -r -f trek8800.bin

This command immediately runs (-r) the trek8800.bin file with no remote front panel. Input is forced to uppercase and the escape character is again ~.

 

Simulated Hardware

Currently the simulator provides an SIO port at ports 20 and 21 (octal). The port currently maps to the console on the PC (e.g., the shell window where you started the simulator).

Using the Control Terminal

This section will be expanded. For now, its just a copy of the internal help.

 

bp a_z command - Breakpoint commands (bp help for more)

display address [count] - Show memory

exit - End simulator

help [keyword] - Get help

hex - Set default radix to hex (override # -decimal, & - octal, $ - hex)

load file - Load RAM with file

n - step + regs command

oct - Set default radix to octal (override # -decimal, & - octal, $ - hex)

reg register [value] - Display/set register (AF, BC, DE, HL, SP, PC for 8080

regs - Show all registers

release - Release all control switches to front panel or default

reset - Reset CPU

resume - Continue after breakpoint

run - Run/resume program

save filename - Save RAM to file

set address - Set RAM (Esc to quit)

step - Single step program

stop - Stop program execution

 

Breakpoints range from A-Z (not case sensitive; X in the list below represents any breakpoint letter)

bp X set target value [mask] - set regular breakpoint

  (for target use @address or register name)

bp X onchange target [mask] - set a break on change

bp X action (stop|trace|enable X|disable X) - set breakpoint action

  Enable and disable allow you to change state of any breakpoint

bp X count n - set the breakpoint counter (0=immediate)

bp X (on|off) - enable or disable a breakpoint

bp X once [(on|off)] - set oneshot mode; default is on

bp X resume - allow execution to continue after breakpoint

bp list [X] - show all breakpoints or one particular breakpoint

bp help - this message

 

License and Source Code

The simulator is open source licensed under GPL v3. The source code and some binary releases are available at: http://code.google.com/p/altair-rfp/.

 

Contacting the Author

You can reach Al Williams at al-williams@awce.com. Among other things, Al is currently the embedded systems blogger for Dr. Dobb’s Journal (http://www.ddj.com/embedded) and you can find Al on the Web at several other places as well including http://www.awce.com and http://www.hotsolder.com.

 

Acknowledgements

Thanks to Vince Briel for making such a great toy and his openness and assistance during development. Also thanks to Garry Jordan for his work on the firmware and his great changes to the Altair Micro8800 terminal. I’ve also enjoyed diving into op code semantics with Rich Cini of Altair32 fame. And a final thanks to Kelly Johnson for his 8080 test code, where ever he is.

 

 

 

 

 

[a]I know this  needs to be cleaned up. —al.williams