Question

Write an assembly 32 bit program that adds two numbers (other than 5 and 6) and stores the value to a variable called sum. Also, use a block COMMENT to depict the name and description of the program, author of the program, and date. Code in assembly language please
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ESI & EDI points to the two integers

EBX points to an address that will hold sum

clc                                               ; clear carry flag

L1 :

mov      a1 , [esi]                    ; get the first integer

adc      a1 , [edi]                     ; add the second integer

pushfd                                   ; save the carry flag

mov [ebx] , a1                      ; store partial sum

add   esi , 1                           ;points to next byte

add edi , 1

add ebx , 1                         ; point to next sum byte

popfd                                     ; restore the carry flag

loop         L 1                         ;repeat the loop

mov    dword ptr [ebx] , 0 ; clear high dword of sum

adc     dword ptr [ebx] , 0 ; add any left over carry

ret

ESI & EDI points to the two integers

EBX points to an address that will hold sum

clc                                               ; clear carry flag

L1 :

mov      a1 , [esi]                    ; get the first integer

adc      a1 , [edi]                     ; add the second integer

pushfd                                   ; save the carry flag

mov [ebx] , a1                      ; store partial sum

add   esi , 1                           ;points to next byte

add edi , 1

add ebx , 1                         ; point to next sum byte

popfd                                     ; restore the carry flag

loop         L 1                         ;repeat the loop

mov    dword ptr [ebx] , 0 ; clear high dword of sum

adc     dword ptr [ebx] , 0 ; add any left over carry

ret

ESI & EDI points to the two integers

EBX points to an address that will hold sum

clc                                               ; clear carry flag

L1 :

mov      a1 , [esi]                    ; get the first integer

adc      a1 , [edi]                     ; add the second integer

pushfd                                   ; save the carry flag

mov [ebx] , a1                      ; store partial sum

add   esi , 1                           ;points to next byte

add edi , 1

add ebx , 1                         ; point to next sum byte

popfd                                     ; restore the carry flag

loop         L 1                         ;repeat the loop

mov    dword ptr [ebx] , 0 ; clear high dword of sum

adc     dword ptr [ebx] , 0 ; add any left over carry

ret

ESI & EDI points to the two integers

EBX points to an address that will hold sum

clc                                               ; clear carry flag

L1 :

mov      a1 , [esi]                    ; get the first integer

adc      a1 , [edi]                     ; add the second integer

pushfd                                   ; save the carry flag

mov [ebx] , a1                      ; store partial sum

add   esi , 1                           ;points to next byte

add edi , 1

add ebx , 1                         ; point to next sum byte

popfd                                     ; restore the carry flag

loop         L 1                         ;repeat the loop

mov    dword ptr [ebx] , 0 ; clear high dword of sum

adc     dword ptr [ebx] , 0 ; add any left over carry

ret

ESI & EDI points to the two integers

EBX points to an address that will hold sum

clc                                               ; clear carry flag

L1 :

mov      a1 , [esi]                    ; get the first integer

adc      a1 , [edi]                     ; add the second integer

pushfd                                   ; save the carry flag

mov [ebx] , a1                      ; store partial sum

add   esi , 1                           ;points to next byte

add edi , 1

add ebx , 1                         ; point to next sum byte

popfd                                     ; restore the carry flag

loop         L 1                         ;repeat the loop

mov    dword ptr [ebx] , 0 ; clear high dword of sum

adc     dword ptr [ebx] , 0 ; add any left over carry

ret

Add a comment
Know the answer?
Add Answer to:
Code in assembly language please "Write an assembly 32 bit program that adds two numbers (other...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT