Sie sind auf Seite 1von 3

Lolex Savio Francis

http://lolexfrancis.wordpress.com/

Lolex Savio Francis 8085 processor programs in mnemonics. 1. Write an assembly language program to generate Fibonacci series http://lolexfrancis.wordpress.com/2010/03/26/8085-programming-part-1-fibonacci-series/ Memory 2000 2003 2004 2006 2008 200B 200C 200D 200E 200F 2010 2011 2014 2. Opcode 21 00 25 56 3E 00 06 01 21 01 25 77 23 4F 80 41 15 C2 0B 20 76 Label Mnemonic LXI H,2500 MOV D,M MVI A,00H MVI B,01H LXI H,2501 MOV M,A INX H MOV C,A ADD B MOV B,C DCR D JNZ BACK HLT Comments Copy address to HL pair Transferring the counter to D Initialize variable to store sum/next in sequence Initialize variable to store addend Passing address to H Passing data from A to memory Incrementing memory position Passing value from A to C A+B and store it in A Pass value from C to B Decrement count if D is not 0 go to BACK Stop

BACK

Write an assembly language program to find the factorial of a number http://lolexfrancis.wordpress.com/2010/03/27/8085-programming-part-2-factorial/ Memory 2000 2003 2004 2005 2006 2007 2008 200B 200C 200D 200E 200F 2012 2013 2014 2017 201A Opcode 3A 00 25 47 48 0D 59 1D CA 17 20 51 15 80 15 C2 0D 20 0D 47 C3 07 20 32 01 25 76 LABEL Mnemonic LDA 2500 MOV B,A MOV C,B DCR C MOV E,C DCR E JZ EXIT MOV D,C DCR D ADD B DCR D JNZ LABEL 2 DCR C MOV B,A JMP LABEL 1 STA 2501 HLT Comments Loading the value in memory to A Passing data from A to B Passing data from B to C Decrement C Passing data from C to E Decrement E If E=0 jump to EXIT Passing data from C to D Decrement D A+B and store it in A Decrement D If D!=0 go to LABEL2 Decrement C Storing data in A to memory location Go to LABEL1 Store content in A to 2501 Stop

LABEL 1

LABEL 2

EXIT

Page | 1
lolex savio francis, 2010.

Lolex Savio Francis

http://lolexfrancis.wordpress.com/

3.

Write an assembly language program to check whether the given string is palindrome or not. String stored from 2100H. If it is a palindrome, store 01H, and else store 00H in the memory location 2500 H (keep a count. String will have that many bytes). http://lolexfrancis.wordpress.com/2010/03/28/8085-programming-part-3-palindrome-check/ Memory 2000 2003 2004 2007 2008 200B 200C 200D 200E 2011 2012 2014 2017 2018 2019 201A 201B 201C 201D 201E 2021 2022 2025 2027 202A Opcode 3A 00 25 3D 21 00 21 EB 21 00 21 4F 13 0D C2 0C 20 4F 3E 01 32 01 25 7E EB 46 EB 23 1B 0D CA 2A 20 B8 D2 12 20 3E 00 32 01 25 76 Label Mnemonic LDA 2500 DCR A LXI H,2100 XCHG LXI H,2100 MOV C,A INX D DCR C JNZ LABEL 1 MOV C,A MVI A,01H STA 2501 MOV A,M XCHG MOV B,M XCHG INX H DCX D DCR C JZ EXIT CMP B JNC LABEL 2 MVI A,00H STA 2501 HLT Comment Load value in memory to A Decrement A Storing the memory address to H Exchanging data b/w DE and HL pair Storing the memory address to H Passing data from A to C Increment DE pair Decrement C If C not equal 0 go to LABEL 1 Passing data from A to C Storing 01 to A Storing the value in A to 2500 Passing data from Memory to A Exchanging data b/w DE and HL pair Passing data from Memory to B Exchanging data b/w DE and HL pair Increment HL pair Decrement DE pair Decrement C If C equals 0 go to EXIT Compare A and B If same go to LABEL 2 Storing 00 to A Storing data in A to 2500 Stop

LABEL 1

LABEL 2

EXIT

4.

Write an assembly language program to sort n-8 bit numbers in ascending and descending order. A. Descending http://lolexfrancis.wordpress.com/2010/03/29/8085-programming-part-4-sort-into-descending-order/ Memory Opcode Label Mnemonic Comments 2000 3A 00 25 DESC LDA 2500 Load data from memory to A 2003 3D DCR A Decrement A 2004 CA 29 20 JZ EXIT If A equals 0 go to EXIT 2007 21 00 25 LXI H,2500 Load address to HL pair 200A 11 01 25 LXI D,2501 Load address to DE pair 200D 32 00 25 STA 2500 Storing data from A to memory 2010 4F MOV C,A Move from A to C 2011 0C INR C Increment C 2012 0C INR C Increment C 2013 0D LABEL DCR C Decrement C 2014 CA 00 20 JZ DESC If C equals 0 jump to DESC 2017 23 INX H Increment HL pair

Page | 2
lolex savio francis, 2010.

Lolex Savio Francis

http://lolexfrancis.wordpress.com/

2018 2019 201A 201B 201C 201D 201E 2021 2022 2023 2024 2025 2026 2029

13 7E EB 46 EB 90 D2 13 20 80 7D EB 77 EB C3 13 20 76

EXIT

INX D MOV A,M XCHG MOV B,M XCHG SUB B JNC LABEL ADD B MOV M,B XCHG MOV M,A XCHG JMP LABEL HLT

Increment DE pair Move data from M to A Exchange between HL and DE pair Move data from M to B Exchange between HL and DE pair Subtract B from A If no carry jump to LABEL Add B to A Move data from B to M Exchange between HL and DE pair Move data from A to M Exchange between HL and DE pair Jump to LABEL Stop

B. Ascending http://lolexfrancis.wordpress.com/2010/03/30/8085-programming-part-5-sort-into-ascending-order/ Memory 2000 2003 2004 2007 200A 200D 2010 2011 2012 2013 2014 2017 2018 2019 201A 201B 201C 201D 201E 2021 2022 2023 2024 2025 2026 2029 Opcode 3A 00 25 3D CA 29 20 21 00 25 11 01 25 32 00 25 4F 0C 0C 0D CA 00 20 23 13 7E EB 46 EB 90 DA 13 20 80 7D EB 77 EB C3 13 20 76 Label ASC Mnemonic LDA 2500 DCR A JZ EXIT LXI H,2500 LXI D,2501 STA 2500 MOV C,A INR C INR C DCR C JZ ASC INX H INX D MOV A,M XCHG MOV B,M XCHG SUB B JC LABEL ADD B MOV M,B XCHG MOV M,A XCHG JMP LABEL HLT Comments Load data from memory to A Decrement A If A equals 0 go to EXIT Load address to HL pair Load address to DE pair Storing data from A to memory Move from A to C Increment C Increment C Decrement C If C equals 0 jump to DESC Increment HL pair Increment DE pair Move data from M to A Exchange between HL and DE pair Move data from M to B Exchange between HL and DE pair Subtract B from A If carry jump to LABEL Add B to A Move data from B to M Exchange between HL and DE pair Move data from A to M Exchange between HL and DE pair Jump to LABEL Stop

LABEL

EXIT

Note: the ascending and descending programs in this file are slightly different from the ones posted on my blog. Both work exactly the same, but the ones on my blog are slightly simpler, and have ~10 less lines of code.

Page | 3
lolex savio francis, 2010.

Das könnte Ihnen auch gefallen