Post on 31-Dec-2015
description
transcript
2
8085 Instruction Set
The 8085 instructions can be classified as follows:
Data transfer operations
Arithmetic operations (ADD, SUB, INR, DCR)
Logic operations
Branching operations (JMP, CALL, RET)
• Between registers• Between memory location and a register• Direct write to a register / memory• Between I/O device and accumulator
6
Simple Data Transfer Operations
Examples:
MOV B,A 47 From ACC to REG MOV C,D 4A Between two REGs MVI D,47 16 Direct-write into REG D
47
7
Simple Data Transfer Operations
Example:
OUT 05 D305
Contents of ACC sent to output port number 05.
18
Branching Operations
Note: This is an unconditional jump operation. It will always force the program counter to a fixed memory address continuous loop !
19
Branching Operations
Conditional jump operations are very useful for decision making during the execution of the program.
20
Example
Write a 8085 machine code program:
Read two different memory locations
Add the contents
Send the result to output port 02 (display) if there is no overflow
Display “FF” if there is an overflow
Stop
21
Example
2000 LDA 2050 3A2001 502002 202003 MOV B,A 472004 LDA 2051 3A2005 512006 202007 ADD B 802008 JNC XXYY D22009 YY2010 XX2011 MVI A,FF 3E2012 FF2013 OUT 02 D32014 022015 HLT 76
Load contents of memory location 2050 into accumulator
Load contents of memory location 2051 into accumulator
Save the first number in B
Add accumulator with B
Jump to YYXX if no carry !
Direct write FF into accumulator
Display accumulator contents at output port 02
Stop
22
Updated Code
2000 LDA 2050 3A2001 502002 202003 MOV B,A 472004 LDA 2051 3A2005 512006 202007 ADD B 802008 JNC 2013 D22009 132010 202011 MVI A,FF 3E2012 FF2013 OUT 02 D32014 022015 HLT 76
Load contents of memory location 2050 into accumulator
Load contents of memory location 2051 into accumulator
Save the first number in B
Add accumulator with B
Jump to 2013 if no carry !
Direct write FF into accumulator
Display accumulator contents at output port 02
Stop