0% found this document useful (0 votes)
27 views3 pages

Programming 2

Uploaded by

HRITWIK GHOSH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

Programming 2

Uploaded by

HRITWIK GHOSH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

8085 MICROPROCESSOR

Bharat Acharya
Mumbai: 2021

½ 8085 PROGRAMMING

½ ADD 2 8-BIT NUMBERS


Q1) Add 2 8-bit numbers stored at 2000H and 2001H.
Store Sum at 2002H and carry at 2003H.

Solution: Without using M

MVI C, 00H ; Assume Carry = 0

LDA 2000H ; A = 1st number

MOV B, A ; B = 1st number

LDA 2001H ; A = 2nd number

ADD B ; A = Sum

JNC SKIP ; Check for carry

INR C ; Increment C register if Carry Flag = 1

SKIP: STA 2002H ; Store Sum at 2002

MOV A, C ; A = Carry from C Register

STA 2003H ; Store Carry at 2003H

HLT ; End of program

Solution: Using M

MVI C, 00H ; Assume Carry = 0

LXI H, 2000H ; HL = 2000H; M = 1st number

MOV A, M ; A = 1st number

INX H ; HL = 2001H; M = 2nd number

ADD M ; A = Sum

JNC SKIP ; Check for carry

INR C ; Increment C register if Carry Flag = 1

SKIP: INX H ; HL= 2002H

MOV M, A ; Store Sum at 200H

INX H ; HL = 2003H

MOV M, C ; Store Carry at 200H

HLT ; End of program

Special Note:
Please refer our videos for full explanation of the programs and the diagram of the
logic.

www. Bharat AcharyaEducat i on. com


All the best J Page 1
8085 MICROPROCESSOR
Bharat Acharya
Mumbai: 2021

½ BLOCK TRANSFER PROGRAM


Q2) Transfer a Block of 10 bytes form 2000H to 3000H.

Solution:

LXI B, 2000H ; Source pointer at 2000H

LXI D, 3000H ; Destination pointer at 3000H

MVI L, 0AH ; Count of 10d = 0AH

BACK: LDAX B ; A gets Source data

STAX D ; A stored at Destinatiom

INX B ; Increment Source pointer

INX D ; Increment Destination pointer

DCR L ; Decrement Count register

JNZ BACK ; Loop if count is not zero

HLT ; End of program

½ INVERTED BLOCK TRANSFER PROGRAM


Q3) Perform inverted block transfer of 10 bytes form 2000H to 3000H.

Solution:

LXI B, 2000H ; Source pointer at 2000H

LXI D, 3009H ; Destination pointer at 3009H

MVI L, 0AH ; Count of 10d = 0AH

BACK: LDAX B ; A gets Source data

STAX D ; A stored at Destinatiom

INX B ; Increment Source pointer

DCX D ; Decrement Destination pointer

DCR L ; Decrement Count register

JNZ BACK ; Loop if count is not zero

HLT ; End of program

www. Bharat AcharyaEducat i on. com


All the best J Page 2
8085 MICROPROCESSOR
Bharat Acharya
Mumbai: 2021

½ BLOCK EXCHANGE PROGRAM


Q4) Exchange two blocks of 10 bytes stored at 2000H and 3000H

Solution:
LXI B, 2000H ; Pointer to 1st Block at 2000H

LXI D, 3000H ; Pointer to 2nd Block at 3000H

MVI L, 0AH ; Count of 10d = 0AH

BACK: LDAX B ; A = data from Block 1 (Eg: “p” from our video)

MOV H, A ;H=p

LDAX D ; A = data from Block 2 (Eg: “q” from our video)

STAX B ; 1st Block gets q

MOV A, H ;A=p

STAX D ; 2nd Block gets p

INX B ; Increment Source pointer

INX D ; Increment Destination pointer

DCR L ; Decrement Count register

JNZ BACK ; Loop if count is not zero

HLT ; End of program

Bharat Acharya Education


Learn...
8085 | 8086 | 80386 | Pentium | 8051 | ARM7 | COA

Fees: 1199/- | Duration: 6 months | Activation: Immediate | Certification: Yes


Free: PDFs of Theory explanation, VIVA questions and answers, Multiple-Choice Questions

Start Learning... NOW!


Bharat Acharya Education

Order our Books here...

8086 Microprocessor
Link: https://amzn.to/3qHDpJH

8051 Microcontroller
Link: https://amzn.to/3aFQkXc

Official WhatsApp number:


+91 9136428051

www. Bharat AcharyaEducat i on. com


All the best J Page 3

You might also like