ABNIAC is model. It was designed to show people how computers operate. It is a very simplistic model to emphasize ideas NOT details.
ABNIAC was designed to illustrate some basic computing concepts:
As stated previously, ABNIAC is a very simple simulation of a very simple computer. It has 200 cells called locations. Each location will hold only one byte of information. You will see that information in base 10. It is what we as humans deal with best. It is how we are taught to understand numerical data. ABNIAC can accept only integer values up to 255 in each location. An invalid value will be replaced with a zero (0). ABNIAC has only seven (7) opcodes. It is how these opcodes are combined that makes complex programs. The opcodes manipulate memory addresses only. The only code that allows you to put a value in is the Store command. ABNIAC does not show the register except for the counter in the lower left-hand corner.
To write a program using ABNIAC is quite simple. Think about what you want to do. Then chose the opcode that you need. Depending on the opcode selected, you will be prompted for a value or location (address). As you respond to the prompt, the code will be written in the right side of the grid. Looking at the grid, the first line is always the opcode. If the opcode selected requires additional information, called parameters, you will be prompted for the value and the computer will then place that value in the appropriate cell (location).
STORE is the way ABNIAC handles input. When you select the STORE button, you will be asked for a value to store and where you wish to place the value. This is the only command that deals with actual values. The programs you write will have store commands.
ADD is used to add the value of two cells (locations) together. When you select the ADD command, you will be asked for the location of the first addend, the second addend and the location of the answer. You MUST use the store command first to put the values in a location BEFORE they can be added together. If there is a value already in a location you chosen, it will be overwritten by the second value. Example: Store the value of 10 in Location 100, store the value of 5 in location 101, add location 100 to 101, and place the answer in location 102, halt. Here is how it will look on the screen:
| Loc | Value | Meaning |
|---|---|---|
| 0 | 1 | Store |
| 1 | 10 | ...the value 10 |
| 2 | 100 | ...to location 100 |
| 3 | 1 | Store |
| 4 | 5 | ...the value 5 |
| 5 | 101 | ...to location 101 |
| 6 | 2 | Add |
| 7 | 100 | ...the value in location 100 |
| 8 | 101 | ...to the value in location 101 |
| 9 | 102 | ...and store the answer in location 102 |
| 10 | 5 | Halt |
After you run the program, check the value of location 102. The value of that location should read 15.
The TEST command compares the value of two cells. It changes the program's behavior accordingly. The test command has three parameters: the value of the first location to compare (test), the location of the second value to test, and the location of a command to jump to if the values in those two location are equal. The first two parameters are something we have seen before. The last parameter is unique. If the values are equal, program control jumps to the command in the location given. If the location has no command, then the behavior becomes unpredictable. The TEST command is an example of what is called a condition. It can be used to program concepts called loops and branches.
The JUMP command moves the program control to different parts of the memory. It has only one parameter, which location to jump to. If there is not a valid command in the location given to jump to the behavior of the program becomes very unpredictable. The TEST command has a built-in JUMP command. JUMP and TEST commands are often used in conjunction with each other. This allows the program to repeat parts of itself.
The HALT command has no parameters. When the HALT command is encountered in ABNIAC, it stops looking for commands to execute. With data in the memory besides the program itself, ABNIAC needs to know where the program ends and the data begins. If you forget to place a HALT command in the program, it will look through its memory for more commands to execute, even if there are none. It will try to interpret the data it finds in the higher memory as commands. This will cause extremely unpredictable and unpleasant behavior. If ABNIAC exhaust its memory without finding a HALT command, it returns a RUNAWAY PROGRAM message. Often, when your computer acts really weird, it maybe due to some sort of runaway program. In ABNIAC, the only way to stop the runaway program is to turn off the machine and reboot the computer (turning off the machine disrupts the flow of electricity wiping out the RAM memory). You can accomplish the same task by just hitting the ctrl-alt-del keys at the same time. Select TASK MANAGER, then select the ABNIAC program from the list. Select END TASK and then SELECT END task again. This will stop the runaway program and you can begin a new program. Unfortunately, whatever you were working on is erased.
This command is used to send output to the user. The only parameter the OUTPUT command accepts is the location to output. The location is read and the user sees a pop-up window with the value of that location in it. The information dispalyed in the window will generally be an integer.
This a variant of the OUPUT command. It has only one parameter like the OUTPUT command. It too reads the location and a pop-up window appears with the information in it. But, instead of an integer, a text character will appear. This is the ASCII representation of the value of that location. Here is an example of OUTPUT and ASCII OUTPUT.
| Loc | Value | Meaning |
|---|---|---|
| 0 | 1 | Store |
| 1 | 65 | ...the value 65 |
| 2 | 100 | ...to location 100 |
| 3 | 6 | Output |
| 4 | 100 | ...the value of location 100 |
| 5 | 7 | Output in ASCII |
| 6 | 100 | ...the value in location 100 |
| 7 | 5 | Halt |
The program is storing a value of 65 in location 100. Line 3 is telling the program to output the location value - 100. Line 5 tells the program to output the value in location 100 in ASCII. In ASCII, 65 is numeric representation of the uppercase 'A'.