Instruction code and optional operand |
Meaning for the programmer | Actions taken by the processor |
---|---|---|
INSTRUCTIONS FOR ARITHMETIC AND MOVING OPERATIONS | ||
11H VVH | "add value to register A" | The value VVH, the operand of this instruction, will be added to the content of register A. The content of register A will thus be incremented by the given value. For example, if the content of register A is 34H and VVH is 05H, the content of register A is 39H after the execution of this instruction. |
12H | "add register B to A" | The content of register B is added to the content of register A and the result (the sum of the two registers) is placed in register A. The old content of register A is lost while the content of register B remains untouched. |
13H VVH | "subtract value from register A" | The value VVH, the operand of this instruction, will be subtracted from register A. The content of register A will thus be decremented by the given value. For example, if the content of register A is 34H and VVH is 05H, the content of register A is 2FH after this instruction is executed. |
14H | "subtract register B from A" | The content of register B is subtracted from the content of register A. The result (A minus B) is placed in register A, while the content of register B remains untouched. For example, if register A has value 34H and register B is 12H, register A contains 22H and register B contains 12H after this instruction is executed. |
15H VVH | "load register A with value" | The value VVH, the operand byte, will be copied to register A. The old content of register A will be lost. For example, if the value VVH is 05H, the content of register A will be 05H regardless of its previous value. |
16H | "increment register A" | The content of register A will be incremented by 1. For example, if the content of register A is 34H, its content will be 35H after the execution of this instruction. |
17H VVH | "load register B with value" | The value VVH will be copied to register B. The old content of register B will be written over and lost. This instruction is similar to 15H but this one affects register B. |
18H | "increment register B" | The content of register B will be incremented by 1. For example, if the content of register B is 12H, its content will be 13H when this instruction is executed. |
1AH | "decrement register A" | The content of register A will be decremented by 1. For example, if the content of register A is 34H, it will change to 33H as a result of this instruction. |
1CH | "decrement register B" | The content of register B will be decremented by 1. For example, if the content of register B is 12H, it will be 11H after the execution of this instruction. |
1EH | "move content of register A to B" | The content of register A is copied to register B. The old content of register B is written over. After this instruction has been executed, both registers have the same content. |
MEMORY-RELATED INSTRUCTIONS | ||
21H MMH | "set memory pointer" | The memory address MMH that is given as the operand for this machine instruction is copied to register MEMORY POINTER. With this instruction, it is possible to start manipulating new areas of the computer's main memory. The content of MEMORY POINTER determines which memory address is affected by instructions "store register A to memory", "load register A from memory", "store register B to memory", and "load register B from memory". |
22H | "increment memory pointer" | The content of MEMORY POINTER is incremented by 1. For example, if the old content of MEMORY POINTER is 9BH, its new content will be 9CH. |
24H | "decrement memory pointer" | The content of MEMORY POINTER is decremented by 1. For example, if the content of MEMORY POINTER is B3H, its content will change to B2H. |
26H | "store register A to memory" | The content of register A will be written to that memory location which is currently the content of MEMORY POINTER. For example, if the content of register A is 34H and the content of MEMORY POINTER is 9BH, the memory location in address 9BH will contain value 34H after this instruction has been executed. |
28H | "load register A from memory" | This is the opposite of instruction "store register A to memory". This instruction copies one byte from the main memory to register A. The byte that will be copied will be determined by the content of MEMORY POINTER. For example, if the content of MEMORY POINTER is B3H, this instruction loads register A with the byte that is in memory location B3H. |
2AH | "store register B to memory" | This is similar to the instruction with code 26H, but this copies the contents of register B to a location in the main memory. |
2CH | "load register B from memory" | This is similar to the instruction with code 28H, but this instruction modifies the content of register B. |
INSTRUCTIONS RELATED TO JUMPING IN PROGRAMS | These instructions modify the content of PROGRAM POINTER. "jump to address" modifies it always. Other instructions modify the content of PROGRAM POINTER only if certain conditions are valid. All these instructions are two-byte instructions. Instruction operand MMH is a possible new value for PROGRAM POINTER. | |
41H MMH | "jump to address" | This instruction performs an unconditional jump in the program by modifying the content of register PROGRAM POINTER. The next instruction that will be executed after this instruction is the one that resides in the address given in MMH, the operand of this instruction. For example, if the value of MMH is 08H, the value of PROGRAM POINTER is 08H after this instruction has been executed. |
43H MMH | "jump if registers equal" | This instruction is a conditional jump within the program. If the contents of register A and register B are the same, MMH is copied to PROGRAM POINTER, and the next instruction to be executed is the one in the address that is given in the operand of this instruction. |
45H MMH | "jump if register A zero" | This is another conditional jump. If the content of register A is zero, PROGRAM POINTER is loaded with the value MMH. If register A is not equal to zero, the program execution continues in the normal way from the instruction that follows this instruction. |
47H MMH | "jump if register A smaller than B" | A jump to memory location MMH occurs if the content of register A is smaller than the content of register B. If register A is larger than or equal to register A, no jump takes place, and the program execution continues from the instruction that follows this instruction. |
49H MMH | "jump if register A greater than B" | This is a kind of opposite instruction to the previous one. A jump occurs when the content of register A is greater than the content of register B. For example, if register A is 34H, register B is 12H, and the operand byte MMH is 08H, the value of PROGRAM POINTER is changed to 08H because 34H is greater than 12H. |
4BH MMH | "jump if input not ready" | This instruction tests whether a byte is ready to be read from the input port. This instruction causes a jump if the input is not ready, i.e., INPUT READY signal has value 0, which means logically FALSE. This instruction is used when a program is waiting for a human to give it a byte of data. Because humans tend to be slower than computers, a computer program usually has to jump and wait until the user of the computer has entered his/her input. |
INSTRUCTIONS TO HANDLE SUBROUTINE CALLS | ||
81H MMH | "call subroutine" | The execution of this instruction causes a jump to address MMH but the execution will
eventually return to the instruction that follows this instruction. This kind of behavior
is accomplished by storing the current value of PROGRAM POINTER to the stack. Three separate
actions take places when this instruction is executed. First the content of register
PROGRAM POINTER is stored to that memory address which is the content of register STACK POINTER.
Then the content of register STACK POINTER is decremented by one. Finally,
value MMH is copied to register PROGRAM POINTER. This way the program execution continues from address MMH. PROGRAM POINTER is stored on the stack to be used by the subroutine which starts in address MMH. Instruction "call subroutine" can be explained with the phrase "go and execute the machine instructions starting from address MMH, but come back when you encounter the instruction code 82H". |
82H | "return to calling program" | This instruction is a kind of counterpart to the instruction "call subroutine".
"return to calling program" must be the last instruction in a subroutine. It marks the end
of a called subroutine and causes a return to the calling program. This instruction loads
PROGRAM POINTER with the memory address that was put to the stack by instruction "call subroutine".
This causes a return to the instruction that immediately follows the "call subroutine" instruction
in the calling program. The following two actions take place when this instruction is executed: First the value in register STACK POINTER is incremented by one, and then register PROGRAM POINTER is loaded from the memory address which is the content of register STACK POINTER. |
INPUT/OUTPUT INSTRUCTIONS | ||
92H | "output byte from register A" | This instruction is used when a program wants to output a character to the screen. The instruction copies the content of register A to OUTPUT PORT. A character code must be present in register A before this instruction can be successfully executed. The result of the execution is that the character corresponding to the character code in register A is displayed on the screen. The OUTPUT PORT works so that always when a character code is written to it, the corresponding character appears on the screen. |
94H | "output byte from register B" | This is similar to the previous instruction, but this one outputs the content of register B. |
96H | "input byte to register A" | This instruction is used when a program wants to input a character code from the keyboard to register A. The instruction copies a byte from the INPUT PORT to register A. Signal INPUT READY indicates whether a character code of a character has been received from the keyboard to INPUT PORT. INPUT READY must have value 1 (i.e. TRUE) before this instruction can be executed. After the input character code has been copied to register A, INPUT READY is set back to zero. |
STACK INSTRUCTIONS | ||
A1H MMH | "set stack pointer" | This instruction is rarely needed because register STACK POINTER is set to value FFH when the imaginary computer is switched on. The last bytes of the main memory are thus used as stack. With this instruction it is possible to select a new memory area to be used as stack memory. Value MMH is copied to register STACK POINTER when this instruction is executed. |
A2H | "push register A to stack" | This instruction stores (pushes) register A to the top of the stack. Register STACK POINTER always contains a value that "points" to the first free memory location on the stack. This instruction causes two separate actions: first the content of register A is stored to that memory address which is the content of register STACK POINTER, and then the memory address in STACK POINTER is decremented by one. The stack thus grows towards the smaller memory addresses. After this instruction has been executed, the topmost element on the stack and register A contain the same information. |
A4H | "pop register A from stack" | This instruction performs an opposite operation compared to the actions caused by the previous instruction. First, the memory address in register STACK POINTER is incremented by one, and then register A is loaded from the memory address that is in register STACK POINTER. This instruction takes away that byte that was the last one pushed to the stack. The stack gets smaller when this instruction is executed. |
INSTRUCTION TO HALT THE PROCESSOR AT THE END OF A PROGRAM | ||
B2H | "stop processing" | This is a special kind of instruction which stops the imaginary processor entirely. This instruction marks the end of the program. No more instructions will be executed after this one until imaginary 'electricity' is switched off and on again. In the IC8 simulator, the Reset button can be used to switch 'electricity' off and on. |