Professional Documents
Culture Documents
y Too limited to run anything as complex as personal computer. y It has about the right level of complexity to control a microwave oven or other consumer appliance. y Instruction Set Architecture (ISA) Memory Model Registers Set Instruction Set y Memory Model This microprocessor is a complete 8-bit parallel Central Processing Unit (CPU). Each byte has 8 bits Isolated I/O, input and output devices are treated as being separate from memory. Different instructions access memory and I/O devices. y Register Set y y y y y y y y Accumulator A, is an 8-bit register. Register B, C, D, E, H, and L, are six 8-bit general purpose register. These registers can be accessed individually, or can be accessed in pairs. Pairs are not arbitrary; BC are a pair (16- bit), as are DE, and HL Register HL is used to point to a memory location. Stack pointer, SP, is an 16-bit register, which contains the address of the top of the stack. The sign flag, S, indicates the sign of a value calculated by an arithmetic or logical instruction. The zero flag, Z, is set to 1 if an arithmetic or logical operation produces a result of 0; otherwise set to 0. The parity flag, P, is set to 1 if the result of an arithmetic or logical operation has an even number of 1s; otherwise it is set to 0.
y y y
The carry flag, CY, is set when an arithmetic operation generates a carry out. The auxiliary carry flag, AC, very similar to CY, but it denotes a carry from the lower half of the result to the upper half. The interrupt mask, IM, used to enable and disable interrupts, and to check for pending interrupts Instruction Set
y y y
Data movement instructions Data operation instructions Program control instructions Data movement instruction for the 8085 microprocessor Instruction MOV r1, r2 LDA + STA + PUSH rp PUSH PSW POP rp POP PSW Operation r1 = r2 A = M[+] M[+] = A Stack = rp (rp { SP) Stack = A, flag register rp = Stack (rp { SP) A, flag register = Stack
rp register pair BC, DE, HL, SP(Stack pointer) n 8-bit address or data value Data operation instruction for the 8085 microprocessor Instruction Operation Flags
ADD r ADD M INR r IN M DCR n DCR M XRA M CMP r CMA CY carry flag
A=A+r A = A + M[HL] r=r+1 M[HL] = M[HL] + 1 r=r-1 M[HL] = M[HL] - 1 A = A M[HL] Compare A and r A = Ad
Operation GOTO + If condition is true then GOTO + Call subroutine at + If condition is true then call subroutine at + Return from subroutine If condition is true then return from subroutine
PO (P = 0) PE (P = 1) NC (CY = 0)
Z zero flag, S sign flag, P parity flag, C carry flag Note: Each instruction is having an 8-bit instruction code. Some instructions have fields to specify registers, while others are fixed. Example program using 8085 microprocessor coding The Algorithm of the program 1: total = 0, i = 0
2: 3: 4:
n + (n - 1) + + 1 The 8085 coding of the program LDA n MOV B, A XRA A Loop:ADD B DCR B JNZ Loop STA total sum = A A = 0 sum = sum + i i=i-1 IF i { 0 THEN GOTO Loop total = sum i=n