© D. Thiebaut

First, you'll have to check the kits. The keyboard can be used to enter hexadecimal value into memory as well as into CPU registers. The table below lists the main commands and the actions they perform.
| Key | Name | Description |
| ? | RESET | Takes you out of trouble! Press this key whenever you want to return to the "main prompt" showing CPU UP. |
| 1 | ACCA | Displays the contents of the A Accumulator. When this key is pressed, the contents of ACCA are shown and can be modified. |
| 2 | ACCB | Displays the contents of the B Accumulator and allows modification of its contents |
| 3 | PC | Displays the program counter. This register can be changed only with the C/CHAN key. |
| 4 | INDEX | Displays the contents of the IX register. It can be changed with the C/CHAN key as well |
| 5 | CC | Displays the Condition Codes Register. The HINZVC letters near the 7-segment displays identify the bits. This register CANNOT be changed with C/CHAN. |
| 6 | SP | Displays the Stack Pointer. This register cannot be modified |
| 7 | RTI | This key allows the user to restart a program stopped by a breakpoint or a single-step operation |
| 8 | SS | Single Step. Press this key to single step through a program. |
| 9 | BR | Break Point. After pressing BR the display will show four spaces to be filled by a hexadecimal address. Enter the address of the instruction you want to stop at |
| A | AUTO | Automatic input of data. "A" followed by a 4-digit address will allow you to enter your program, one byte at a time, in memory |
| B | BACK | (Used during input operations) Go to previous memory address and display its contents. |
| C | CHAN | Change value. This key can be used to change registers and/or memory. |
| D | DO | Should have been called GO. When D is pressed, the kit asks for a 4-digit address where the execution should start. This should be the beginning address of your program. |
| E | EXAM | Examine. Allows you to check the contents of memory by providing a 4-digit hex number. If you want to change the contents of a byte, press C/CHAN. To go forward in memory press F (Forward). B will take you Backward. |
Your next step is to enter a test program in memory. The code of the assembled program is shown in hexadecimal below. The bytes must be stored starting at address 0000 in memory. Do not worry about how this program works for right now. This is simply a test that will energize most of the kit's devices.
BD FC BC 86 01 20 07 D6 F1 CB 10 D7 F1 48 BD FE 3A CE 2F 00 09 26 FD 16 5D 26 EC 86 01 DE F0 8C C1 0F 26 EA 20 DA
To enter the program, follow these steps:
D 0000 (for DO or go to 0000)
Your own test
It is now your turn to write a program and enter it by hand. Create a program similar to what we have done in class, completing the table below.
ADDR DATA OPERAND LABEL MNEMONIC COMMENT
0000 02 ; 2 is stored at 0000
0001 03 ; 3 is stored at 0001
0002 ? ;
(opcode)
0010 _______ 00 LDAA ; Load Mem[0000] into ACCA (direct addressing)
____ _______ 01 LDAB ; Load Mem[0001] into ACCB
____ _______ ABA ; ACCA <- ACCA + ACCB
____ _______ 02 STAA ; Mem[0002] <- ACCA
Assemble your program by hand using the handouts from class. Find the hexadecimal values that must be stored in memory, starting with addresses 0000 and 0010. (Note that it is highly recommended that you leave some unused bytes in RAM between the end of your data section and the beginning of the code section.) You may want to use the table below to store your opcodes.
| Address | Op-Code/Bytes |
| 0000 | 02 |
| 0001 | 03 |
| 0002 | ?? |
| ... | |
| 0010 | |
| 0011 | |
| 0012 | |
| 0013 | |
| 0014 | |
| 0015 | |
| 0016 | |
| 0017 | |
| 0018 | |
| 0019 | |
| 001A | |
| 001B |
Once you are done, enter your program in the kit using the AUTO key.
Running your program
3(PC) C(CHAN) 0010
1(ACCA) C(CHAN) 00
8(SS)
1(ACCA)
8(SS)
1(ACCA)
8(SS)

To compute the offset value that you must put in the second byte of the BRAnch, take the address of the instruction following the branch and see what needs to be added to it to reach your destination address. If the destination address is "down" the code, at a higher address than the branch, then the offset is positive. If the destination is "up" the code, prior to the branch, then the offset is negative.
Compute the offset (in hex!) and add the two new bytes to your program.
Single step it to verify that the branch takes you to the correct location.

To write this program you will need indexing mode. Below are some examples that will help you figure it out:
0000 0 ; reserve 6 bytes and set them to 0
... 0
0005 0
; begin code at ADDR 0010
START: LDX #0000 ; IX = 0
LDAB #1 ; ACCB = 1
LDAA #FF ; ACCA = FF (FF = -1)
LOOP: STAA 0,X ; Mem[IX+0] = ACCA
INCB ; ACCB++
INX ; IX++
CMPB #6 ; ACCB = 6?
BNE LOOP ; if not done, keep looping
JMP FC00 ; Restart the monitor
The instruction "STAA 0,X" is the one of interest here. The "0,X" part
indicates that the addressing mode is indexed and that an offset of 0 is used.
In other words,
"0,X" means "store ACCA at Mem[IX+0]". "1,X" would have meant "at Mem[IX+1]."
Similarily "-1,X" would have meant at Mem[IX-1]. In this case the offset
would have been FF.
Note that to get this to work correctly (to access the correct memory locations) you will need to implement the program by using positive offsets to the Fibonacci sequence, rather than the negative ones shown in the algorithm. Why is this the case?
Assemble your program by hand, enter it in the Kit's RAM, and verify that the program computes correctly the first 5 fibonacci numbers

Write a small program as an endless loop that reads a byte from memory address 0, increments it by 1, and stores the result back at that address. Assemble the program by hand and come back to next lab with its listing.
We will need it to observe in real time how the processor executes your program (we'll use the oscilloscope to capture the signals).