abniac the following slide presentation is to acquaint the student with abniac. the version used for...

30
ABNIAC The following slide presentation is to acquaint the student with ABNIAC. The version used for presentation is the Java version, which can be found at http://klingon.cs.iupui.edu/~aharris/abniac/java/ .

Upload: cecelia-arington

Post on 15-Dec-2015

219 views

Category:

Documents


5 download

TRANSCRIPT

ABNIAC

The following slide presentation is to acquaint the student with ABNIAC. The version used for presentation is the Java version, which can be found at http://klingon.cs.iupui.edu/~aharris/abniac/java/.

Click to start ABNIAC

This is ABNIAC. (The Java version)

These are the commands used in ABNIAC -

Store, Add, Compare, Jump, Output, ASCII output, Halt, Run.

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 value, the second value and the location to store the answer.

The COMPARE command compares the value of two cells. 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.

STORE is the way ABNIAC handles input. When you press the STORE button, you will be asked for the value you wish to store and the address (location) you want to store the value to.

The JUMP command moves the program control to different parts of the memory. JUMP and COMPARE commands are often used in conjunction with each other. This allows the program to repeat parts of itself

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 window with the value of that location in it. The information displayed in the window will generally be an integer.

When the HALT command is encountered in ABNIAC, it stops looking for commands to execute

When you activate the RUN command, ABNIAC will attempt to process the commands you placed in memory. The program will run until encounters HALT command or runs out of memory.

ASCII Output is a variant of the OUPUT command. It has only one parameter like the OUTPUT command. It too reads the location and a window appears with the information in it. But, instead of an integer, a text character will appear.

When you click on Store, you will type in the value you want to store and the address (location) you want to store it in.

Then click on OK

Here the value of 65 is being stored in the address (location) of 20.

Click OK

You will see that the computer will store the value of 65 in location 20.

Next click on the output you want.

-Output is for displaying integers (numbers)

-ASCII Output is for displaying text.

Click on Output

Then Click on OK

This will display the value of location 20.

Click on ASCII Output

Now click on OK

This will display the value in location 20 as text

Click on Halt. This is to stop the program from running away.

Click on the Speed menu and select the speed you want the program to run at.

•Medium or Slow is recommended.

Once you have chosen the speed, click on Run. This makes the program run.

Watch the Output box on the right

The program will run.

The first piece of information to appear in the Output box will the value 65.

The next piece to appear is the letter A. The ASCII character with the value of 65 is A

Once the output is done, the program will stop.

Creating a program to display a message.

Look at the ASCII chart to find the ASCII number that corresponds with letters of you name.

Using the STORE command, store the ASCII values.

Using the ASCII OUTPUT command, tell the computer to display each address that was used to store an ASCII value.

When all of the output commands are written, select the HALT command.

Select the speed to run the program (medium or slow is recommended).

Click on Run

Watch the right-hand column for the alpha characters to appear, this is the output of the program.

The values being stored are 72, 101, 108 and 111

The address (location) the selected values will be stored in are 40, 41, 42, 43 and 44.

The desired output will be to ask the computer to display the ASCII character for each individual cell (location).

Click on HALT.

Click on RUN.

Look at the display in the right-side column.

Creating a loop in ABNIAC

To create a loop in ABNIAC you will use four. commands: add, compare (test), jump and halt.

Look at the following slides.

First you will STORE two values that you are going to add together and what location (address) you want to store them in. The third value stored is the one you will use to compare and what location (address) you want to store it in.

You will tell the computer what two locations to go to, ADD whatever the two values are in those locations and then where to put (store) the answer.

The COMPARE (test) command is used to have the computer look at two locations (address) and ask the computer if the values in the two locations are the same. The line “then jump to the instruction in location 30” tells the computer what to do if the two locations ARE the same value.

The JUMP command tells the computer where to go if the to values in the two locations are NOT equal.

ADD is used to add the value of two cells (locations) together. You MUST use the store command first to put the values in a location. You are asking the computer to look in those addresses, take whatever two values are there and add them together.

The first value and location

The second value and location (also called the counter)

The third value and location

The values entered into the locations can change. The location (address) does not.

Compare - This command compares the value of two cells; this command has three parameters: the value of the first location to compare, the location of the second value to compare, and the location of a command to jump to if the values in those two location are equal;

First location

Second location

Location to jump to

Compare command is an example of what is called a condition. It can be used to program concepts called loops.

The JUMP command moves the program control to different parts of the memory

JUMP and COMPARE commands are often used in conjunction with each other. This allows the

program to repeat parts of itself.

This line tells the computer what location to go to if the locations have the same value; what ever the command is in that location, the computer will do.

If those two location do not have same value, this line tells the computer to go to a location; this will enable it to repeat an action.(What action will the computer do again so that the two locations will have the same value?)

Select the speed to run the program.

Tell the computer to run the program

Watch as the computer runs through the program and watch the display to the right.

When the two locations (in this program 50 and 52) have the same value, the program will stop.