Transcript Document
Detailed Review of the 8085 Instruction Set Prof. Yusuf Leblebici Microelectronic Systems Laboratory (LSM) [email protected] 1 8085 Instruction Set The 8085 instructions can be classified as follows: Data transfer operations • • • • 2 Between registers Between memory location and a register Direct write to a register / memory Between I/O device and accumulator Arithmetic operations (ADD, SUB, INR, DCR) Logic operations Branching operations (JMP, CALL, RET) 8085 Instruction Types 3 8085 Instruction Types 4 8085 Instruction Types 5 Simple Data Transfer Operations Examples: 6 MOV MOV MVI B,A C,D D,47 47 4A 16 47 From ACC to REG Between two REGs Direct-write into REG D Simple Data Transfer Operations Example: OUT 05 D3 05 Contents of ACC sent to output port number 05. 7 Simple Memory Access Operations 8 Simple Memory Access Operations 9 Arithmetic Operations 10 Arithmetic Operations 11 Arithmetic Operations 12 Arithmetic Operations 13 Overview of Logic Operations 14 Logic Operations 15 Logic Operations 16 Logic Operations 17 Branching Operations Note: This is an unconditional jump operation. It will always force the program counter to a fixed memory address continuous loop ! 18 Branching Operations Conditional jump operations are very useful for decision making during the execution of the program. 19 Example Write a 8085 machine code program: 20 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 Example 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 21 LDA 2050 MOV LDA B,A 2051 ADD JNC B XXYY MVI A,FF OUT 02 HLT 3A 50 20 47 3A 51 20 80 D2 YY XX 3E FF D3 02 76 Load contents of memory location 2050 into accumulator Save the first number in B Load contents of memory location 2051 into accumulator Add accumulator with B Jump to YYXX if no carry ! Direct write FF into accumulator Display accumulator contents at output port 02 Stop Updated Code 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 22 LDA 2050 MOV LDA B,A 2051 ADD JNC B 2013 MVI A,FF OUT 02 HLT 3A 50 20 47 3A 51 20 80 D2 13 20 3E FF D3 02 76 Load contents of memory location 2050 into accumulator Save the first number in B Load contents of memory location 2051 into accumulator Add accumulator with B Jump to 2013 if no carry ! Direct write FF into accumulator Display accumulator contents at output port 02 Stop