Overview
This week we will run our first programs on the MITS Altair Simulator, learning to program it with machine code.
Friday, September 6th
Today we will work together in groups to write a new programs for our Altair 8800 that we will present at the beginning of class next Tuesday.
The groups are:
- Group A Luis, Anfal, Isaac, Adonis and Akshay
- Group B Caleb, Johan, Anar, Trostin and Ved?
- Group C Parker, Cody, Jamethiel, Marin and Turner
Group B will add two 16-bit numbers. They will present on Friday, which means we can better distribute the three presentations (with two on Tuesday) to be able to maintain our focus and get the most out of them.
Group A will introduce us to two's complement by substracting two numbers, and Group C will show us how to multiply two 8-bit numbers.
Wednesday, September 4th
Before we start, please remind me to check our student repo page to see who still has not sent me a link to their repo for this course.
Today we will work through Part 3: Operation of the Altair 8800 together, entering and running our first program. Before we begin, download zero_ram.bin. I will show you how to use it.
Process
We are going to perform a modified version of the adding two numbers
program presented in
Part
3: Operation of the Altair 8800 - B: Loading a Sample Program. Our
modifications will be to replace the JMP
instruction at step 12
with a
HLT
instruction, and to change the address locations of the two addends and the
sum.
The version in the manual uses the JMP
to put the program into an
infinite loop so that the sum can been read on the panel display lights while
it is running. Our simulator includes a view of our computer's memory, so we
can read the result directly from there. To make this more visually appealing,
the two addends are placed at addresses 0x30
and 0x40
respectively, and the sum is placed below them on the display at address
0x50
.
Here is the program as we will run it:
STEP | MNEMONIC | BIT PATTERN | HEX |
---|---|---|---|
1 | LDA | 00 111 010 | 3A |
2 | (address) | 00 110 000 | 30 |
3 | (address) | 00 000 000 | 00 |
4 | MOV (A→B) | 01 000 111 | 47 |
5 | LDA | 00 111 010 | 3A |
6 | (address) | 01 000 000 | 40 |
7 | (address) | 00 000 000 | 00 |
8 | ADD (B+A) | 10 000 000 | 80 |
9 | STA | 00 110 010 | 32 |
10 | (address) | 01 010 000 | 50 |
11 | (address) | 00 000 000 | 00 |
12 | HLT | 01 110 110 | 76 |
Here are the step-by-step instructions. First load the program:
STEP | SWITCHES 0-7 | CONTROL SWITCH |
---|---|---|
0 | RESET | |
1 | 00 111 010 | DEPOSIT |
2 | 00 110 000 | DEPOSIT NEXT |
3 | 00 000 000 | DEPOSIT NEXT |
4 | 01 000 111 | DEPOSIT NEXT |
5 | 00 111 010 | DEPOSIT NEXT |
6 | 01 000 000 | DEPOSIT NEXT |
7 | 00 000 000 | DEPOSIT NEXT |
8 | 10 000 000 | DEPOSIT NEXT |
9 | 00 110 010 | DEPOSIT NEXT |
10 | 01 010 000 | DEPOSIT NEXT |
11 | 00 000 000 | DEPOSIT NEXT |
12 | 01 110 110 | DEPOSIT NEXT |
Now load the data to add 4 and 6 together and run the program:
STEP | SWITCHES 0-15 | CONTROL SWITCH |
---|---|---|
13 | 0 000 000 000 110 000 | EXAMINE |
14 | 0 000 000 000 000 100 | DEPOSIT |
15 | 0 000 000 001 000 000 | EXAMINE |
16 | 0 000 000 000 000 110 | DEPOSIT |
17 | RESET | |
18 | RUN | |
19 | STOP |
You will know everything worked as intended if you see 0x0A
(10)
at address 0x50
.
Homework
Run this program several times until you feel confident you know how to do it. Change the values of the two addends and confirm that you get different results. Move the locations of the addends and sum and run the program again. Modify the program so that is computes the sum of three addends instead of two. You may find this last task a lot more challenging than you suspect. Come to class Thursday prepared to show your programs to the class. We'll use a random student selector program to choose who gets to do this.