Computer Architecture Chapter 6
Computer Architecture Chapter 6
CCEE 313
6-1 Introduction
A computer system includes: Hardware: physical components and all associated equipment Software: programs that are written for the computer
6-1 Introduction
25 Instruction Set of the basic computer
Register Reference Instruction 16-bit operation code First digit of a register reference instruction is always 7
Input-output Instruction First digit is always F
3
Comment field Comment filed must be preceded by a slash(recognized by assembler as comment) Translation to Binary
Assembler = the translation of the symbolic(= assembly) program into binary Address Symbol Table = Hexadecimal address of symbolic address MIN = 106, SUB = 107, DIF = 108
6
o An input program is scanned by the assembler twice to produce the equivalent binary program o Two Pass Assembler 1) 1st pass : Generate user defined address symbol table with their binary equivalent symbol
- Binary translation is done during the 2nd pass - To track the location of instructions, the assembler uses location counter (LC) - LC stores the value of the memory location assigned to the instruction or operand presently being processed - ORG pseudoinstruction initializes LC to the value of first location
2)
10
6-7 Subroutines
A set of common instruction that can be used in a program many times Each time that a subroutine is used in the main part of the program, a branch is executed to the beginning of the subroutine After the subroutine has been executed, a branch is made back to the main program A branch can be made to the subroutine from any part of the main program Problem: how the subroutine knows which location to return to? All computer provide special instructions to facilitate subroutine entry and return In basic computer, the link between the main program and a subroutine is the BSA instruction (Branch and Save return Address)
11
- Subroutine SH4 must return to location 102 after finishes its task
- When BSA executed, control unit stores the return address 102 into the location defined by the symbolic address SH4 (which is 109) - And value of SH4 + 1 is transferred into the program counter
- After execution of instruction SH4, HEX 0 the memory location 109 contains the binary equivalent of 102
12
Computation in the subroutine circulates the content of AC four times to the left To accomplish a logical shift operation, the four low-order bits must be set to zero => this is done by masking FFF0 with the content of AC BUN SH4 I returns the computer to the main program (to the address stored in location SH4 == location 102) STA X store the result in the accumulator AC into X
- The first memory location of each subroutine serves as a link between the main program and the subroutine - The procedure for branching to a subroutine and returning to the main program is referred to as a subroutine linkage
13
14
SKI instructions the input flag to see if a character is available for transfer INP transfers the binary-coded character into AC(0-7) OUT instruction print out the character to the terminal
15
Interrupt Program
16