MICROPROCESSOR: Simulate the program and find the final answer. Identify the purpose of the Program. a. Program No. 1 1. LXI H, 6000H :"Initialize pointer l to first number" 2. LXI D, 6l00H :"Initialize pointer2 to second number" 3. LXI B, 6200H   :"Initialize pointer3 to result" 4. STC 5. CMC :"Carry = 0" 6. BACK: LDAX D :"Get the digit" 7. ADD M :"Add two digits" 8. DAA :"Adjust for decimal" 9. STAX.B :"Store the result" 10. INX H :" Increment pointer 1" 11. INX D :"Increment pointer2" 12. INX B :"Increment result pointer" 13. MOV A, L 14. CPI 06H :"Check for last digit" 15. JNZ BACK :"If not last digit repeat" 16. HLT :"Terminate program execution" a. Program No. 2 1. LXI H, 2200H :"Initialize memory pointer l" 2. LXI D, 2300H :"Initialize memory pointer2" 3. MVI C, 32H :"Initialize counter" 4. BACK:MOV A, M :"Get the number" 5. ANI 0lH :"Check for even number" 6. J NZ SKIP :"If ODD, don't store" 7. MOV A, M :"Get the number" 8. STAX D :"Store the number in result list" 9. INX D :"Increment pointer 2" 10. SKIP: INX H :"Increment pointer l" 11. DCR C :"Decrement counter" 12. JNZ BACK :"If not zero, repeat" 13. HLT :"Stop a. Program No. 3 2. LDA 2200H 3. MOV C, A :"Initialize counter" 4. LXI H, 2201H :"Initialize pointer" 5. MVI E, 00 :"Sum low = 0" 6. MOV D, E : "Sum high = 0" 7. BACK: MOV A, M :"Get the number" 8. ANI 0lH :"Mask Bit 1 to Bit7" 9. JZ SKIP :"Don't add if number is even" 10. MOV A, E :"Get the lower byte of sum" 11. ADD M :"Sum = sum + data" 12. MOV E, A :"St ore result in E register" 13. JNC SKIP 14. INR D :"Add carry to MSB of SUM" 15. SKIP: INX H :"Increment pointer"

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.3: Pointer Arithmetic
Problem 5E
icon
Related questions
Question

MICROPROCESSOR:

Simulate the program and find the final answer. Identify the purpose of the Program.

a. Program No. 1

1.

LXI H, 6000H :"Initialize pointer l to first number"

2.

LXI D, 6l00H :"Initialize pointer2 to second number"

3.

LXI B,

6200H   :"Initialize pointer3 to result"

4.

STC

5.

CMC :"Carry = 0"

6.

BACK: LDAX D :"Get the digit"

7.

ADD M :"Add two digits"

8.

DAA :"Adjust for decimal"

9.

STAX.B :"Store the result"

10.

INX H :"

Increment pointer 1"

11.

INX D :"Increment pointer2"

12.

INX B :"Increment result pointer"

13.

MOV A, L

14.

CPI 06H :"Check for last digit"

15.

JNZ BACK :"If not last digit repeat"

16.

HLT :"Terminate program

execution"

a.

Program No. 2

1.

LXI H, 2200H :"Initialize memory pointer l"

2.

LXI D, 2300H :"Initialize memory pointer2"

3.

MVI C, 32H :"Initialize counter"

4.

BACK:MOV A, M :"Get the number"

5.

ANI 0lH :"Check for even number"

6.

J

NZ SKIP :"If ODD, don't store"

7.

MOV A, M :"Get the number"

8.

STAX D :"Store the number in result list"

9.

INX D :"Increment pointer 2"

10.

SKIP: INX H :"Increment pointer l"

11.

DCR C

:"Decrement counter"

12.

JNZ BACK :"If not zero, repeat"

13.

HLT :"Stop

a.

Program No. 3

2.

LDA 2200H

3.

MOV C, A :"Initialize counter"

4.

LXI H, 2201H :"Initialize pointer"

5.

MVI E, 00 :"Sum low = 0"

6.

MOV D, E :

"Sum high = 0"

7.

BACK: MOV A, M :"Get the number"

8.

ANI 0lH :"Mask Bit 1 to Bit7"

9.

JZ SKIP :"Don't add if number is even"

10.

MOV A, E :"Get the lower byte of sum"

11.

ADD M :"Sum = sum + data"

12.

MOV E, A :"St

ore result in E register"

13.

JNC SKIP

14.

INR D :"Add carry to MSB of SUM"

15.

SKIP: INX H :"Increment pointer"

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning