Académique Documents
Professionnel Documents
Culture Documents
Programming Registers
prepared by : Maher Al-omari
Flags
D7 D6 D5 D4 D3 D2 D1 D0
AC
CY
since the results are stored in accumulator then the flags reflect the condition of the accumulator
Flags
D7 D6 D5 D4 D3 D2 D1 D0
AC
CY
Sign flag: S 1 if D7 of the auxiliary carry flag: used for Zero flag : if the ALU result =1;means ve number BCD1, and and AC 1 if the carry is operation is 0 then Z passed from D3 to D4 (not used vice Parity flag: P 1 if the number versa in conditions) of 1s in the result is even and vice versa carry : CY 1 if there is a carry result from the ALU operation
Instruction Classification
Instruction: is a binary pattern designed inside p to perform a specific function. Instruction Set: is the entire group of instructions 8085 is upward compatible
1. 2. 3. 4. 5.
Data transfer (copy) operations Arithmetic operations Logical operations Branching operations Machine control operations
prepared by : Maher Al-omari
One word : 1 byte instruction Two word : 2 byte instruction Three word : 3 word instruction
ADD
1000 0000
80H
CMA
----
0010 1111
2FH
opcode JMP
operand 2085H
Opcode format 1
ADD
1000 0000
80H
Opcode format 2
Opcode format 3
DDD reg. Rd
SSS reg.Rs
Write the instruction that Moves the content from A to C move the contents: 01 to Register C : 001 111 from Register A: binary instruction: 01 001 111 IN Assem. Lang. MOV C,A
4FH
Data Format
ASCII Code
7-Bit alphanumeric code
BCD Code
4-bit binary coded decimal
Signed Integer
D7 is used for the sign D0-D6 represent the magnitude 00-7F positive numbers. 80-FF negative numbers. all negative numbers are in 2s complement Unsigned Integers
prepared by : Maher Al-omari
Data Format
The processor processes binary bits ; it is up to the user to interpret the result. 41H (0100 0001)
A IN ASCII
41 in BCD
65 in SIGNED INTEGERS
DATA TRANSFER (COPY) OPERATIONS These instructions transfer data to and from registers and memory. Condition flags are not affected.
Copy Register
Mnemonics Task (r1) (r2) Comment The content of register 2 is copied to register 1.
MOV r1, r2
Example: Mnemonics MOV A, B MOV C, D
Comment The content of register B is copied to register A. The content of register D is copied to register C.
MOV r, M
Example: Assume that (H) = 20, (L) = 50, and (2050) = A6H Hex Code
Copy to Memory
Mnemonics Task Comment The content of register r is copied to the memory location whose address is in registers H and L.
Example: Assume that (H) = 20, (L) = 60, and (B) = 8CH
Mnemonics MOV M, B
Hex Code
Task (2060) (B )
Comment
Mnemonics MVI M, 35
Hex Code
Comment
Example:
Hex Code
Comment
Example: Assume that (2040) = 9FH Mnemonics LDA 2040H Hex Code Task (A) (2040H) Comment 9FH is stored in reg A
Example: Assume that (A) = 69H Mnemonics STA 2060H Hex Code Task
Example: Mnemonics IN 20H Hex Code Task A (20) Comment Data is read in to the accumulator from device # 20
Example: Mnemonics OUT F3H Hex Code Task F3 (A) Comment Data is read from the accumulator to device # F3
HALT
Mnemonics HLT Task Comment
Writing Assembling and Execution of Assembly programs Add two hex. Numbers
PROBLEM STATEMENT Write instruction to load 2 hex no. 32H and 48H in reg. A and B respectively, Add the numbers and display the sum at the led output port1 PROBLEM ANALYSIS Divide the problem into small steps as follows
Load the numbers in the registers Add the numbers Display the sum at the output port PORT1
prepared by : Maher Al-omari
FLOW CHART
Start
ADD B
Add Numbers
OUT 01H
Display Sum
HLT
End
prepared by : Maher Al-omari
Load the Register A with 32H Load the Register B with 48H
Add the 2 bytes and save res in A Display the acc. Contents at port 01H End
Hex Code
3E 32 06
48
80 D3 01 67
prepared by : Maher Al-omari
1. 2. 3. 4. 5.
memory contents 0011 1110 0011 0010 0000 0110 0100 1000 1000 0000 1101 0011 0000 0001 0111 1110
Mem Add 2000 2001 2002 2003 2004 2005 2006 2007
Flow Chart
8085 Mnemonics
Manual Lookup
Binary Code