Sample Problem:
(HL) =3629
(DE) =4738
Step 1 : 29 + 38 = 61 and auxiliary carry flag = 1
:.add 06
61 + 06 = 67
Step 2 : 36 + 47 + 0 (carry of LSB) = 7D
Lower nibble of addition is greater than 9, so add 6.
7D + 06 = 83
Result = 8367
Source program :
- MOV A, L : Get lower 2 digits of no. 1
- ADD E : Add two lower digits
- DAA : Adjust result to valid BCD
- STA 2300H : Store partial result
- MOV A, H : Get most significant 2 digits of number
- ADC D : Add two most significant digits
- DAA : Adjust result to valid BCD
- STA 2301H : Store partial result
- HLT : Terminate program execution.
|
Flowchart for Program
|
1 Comments
Question 1
ReplyDeleteWrite 8085 Assembly Language Program to classify the numbers into positive, negative, odd and even
numbers. The list of numbers is stored from A001h and the amount of number is stored in A000h. The
result of classification is stored starting from the corresponding memory location:
– Positive number: A011h
– Negative number: A021h
– Odd number: A031h
– Even number: A041h
Note: Assume the amount of number is less than 10 and 2's complement.