Experiments On 8085 Microprocessor
Experiments On 8085 Microprocessor
zBlock Data Transfer z8 Bit Addition z16 Bit addition zSubtraction zMultiplication zDivision
1 10/14/2010
Introduction
z
Ten bytes of Hexadecimal numbers are stored in consecutive memory locations starting from 2000H. Write an assembly language program to move data to a new memory location starting from 2800H. Registers used B,C,D,E,H,L Flags affected S,Z,P Data in 2000H-200AH Data to be sent to 2880H-288AH
2 10/14/2010
z z z z
Start
Flow Chart
Set up Index for source (HL reg pair) Set up index for destination ( DE reg pair) Make a counter (reg B)
* MOV A, M
STAX D
No
Is count (B) = 0 ?
Yes
END
3 10/14/2010
Program
Memory Location Mnemonics 2000 2001 200A 2010 LXI H,2000H 2011 2012 2013 LXI D,2880H 2014 2015 2016 MVI B,0A 2017 2018 MOV A,M* 2019 STAX D 201A INX H 201B INX D Hex. Codes Remark Data bytes loaded from 2000H 200AH Set up HL as an index for source memory Set up DE as an index for destination use B as a counter for 10 bytes get data from memory store at new location point HL to next location point DE to next location
21 00 20 11 80 28 06 0A 7E 12 23 13
4 10/14/2010
Program
Memory Location 201C 201D 201E 201F 2020 Mnemonics DCR B JNZ * Hex. Codes 05 C2 18 20 EF,76 Remark one transfer is complete if transfer is incomplete go back to * End of program
RST or HALT
DATA: 4A,62,7F,8A,BD,AD,AE,1A,2B,14
5 10/14/2010
Assume 4 bytes of data are stored in consecutive memory locations starting from 2000H. Write a program to shift this data to a new location starting from 2800H using both direct and indirect addressing modes. DATA: 24,9A,1C,20
Memory Location 2000 2001 2002 2003 2010 2011 2012 2013 2014 2015
Mnemonics
Remarks input data in memory location 2000-2003H load contents of mem loc 2000H to accumulator. store contents of accu. in mem loc 2800H
6 10/14/2010
Memory Location 2016 2017 2018 2019 201A 201B 201C 201D 201E 201F 2020 2021 2022 2023 2024 2025 2026 2027 2028
Mnemonics LDA 2001 STA 2801 LDA 2002 STA 2802 LDA 2003 STA 2803 RST,HALT
Remarks data in mem loc 2001H is copied in accu. data in accu stored in mem loc 2801H data in mem loc 2002H is copied in accu. store the contents of the accu in mem loc 2802H data in mem loc 2003H is copied in accu data in accu is stored in mem loc 2803H end of program
7 10/14/2010
Assume 4 bytes of data are stored in consecutive memory locations starting from 2000H. Write a program to shift this data to a new location starting from 2800H using both direct and indirect addressing modes. DATA: 24,9A,1C,20
Mnemonics
MVI D,04
16 04
Memory Location 2012 2013 2014 2015 2016 2017 2018 2019 201A 201B 201C 201D 201E 201F 2020
Remarks mem add 2000H is in HL,used as a memory pointer memory address 2800H is loaded in BC reg pair used as destination move 1st data to accu. store in new location inc mem loc to 2001H inc 2800H to 2801H decr counter by 1 check for counter if 0 end else go to mem loc 2018 end of program
RST,HALT
9 10/14/2010
10 10/14/2010
MNEMONICS MVI A, data (1) MVI B, data(2) ADD B MOV C,A RST5 or HALT STA 2009
HEX. CODES
REMARKS load 1st number in the accumulator immediately load 2nd number in register B immediately add the two numbers see the result in reg C end of program see the result in memory location 2009H end of program result
11 10/14/2010
2000 2001 2002 2003 2004 2005 2006 2005 2006 2007 2008 2009
3E N1 06 N2 80 79 EF,76 32 09 20
RST5
EF N1+N2
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200A 200B MOV A,M INX H ADD M INX H MOV M,A RST5 or HALT LXI H,2000H
N1 N2 N1+N2 21 00 20 7E 23 86 23 77 EF,76
1st Number 2nd Number Sum load the address of N1 in HL pair, used as a memory index or pointer move 1st number to accu. point to the 2nd number add the two numbers point to the next location shift accu contents 2002 end of program
12 10/14/2010
1+ 2 + ...+ n, ori
i =1
i= n sum=A
A=0
14 10/14/2010
Start Bring contents of memory to A Copy contents of A to B (Make a counter showing n = i) LDA 2000H MOV B, A
XRA A
INX H DCR B
No
Is register content (B) =0?
Yes
Store sum in new memory location STA 2001 H
END
15 10/14/2010
Summary
State what has been learned z Define ways to apply this training session z Request feedback of training session
z
16 10/14/2010
17 10/14/2010
Resources
z
Brey, Barry B. Intel Microprocessors: Architecture, Programming and Interfacing. Prentice Hall, 2000. ISBN 0-13-995408-2 Gaonkar, Ramesh S. Microprocessor Architecture, Programming, and Applications with the 8085. Toronto: Collier Macmillan Canada Inc., 1999. ISBN 0-13901257-5 Haskell, Richard E. Introduction to Computer Engineering: Logic Design and the 8086 Microprocessor. Prentice Hall, 1993. ISBN 0-13-489436-7 Smyth, Graham and Christine Stephenson. Computer Engineering: An Activity-Based Approach. Toronto: Holt Software Associates, 2000. ISBN 0-921598-36-X
18 10/14/2010