Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following code, in ASSEMBLY language (MASM x86) add code for multibyte subtraction of sum - decimal_two to get decimal_one DECIMAL OFFSET 5 ;
Given the following code, in ASSEMBLY language (MASM x86) add code for multibyte subtraction of "sum - decimal_two" to get decimal_one
DECIMAL OFFSET 5 ; offset from right of string data decimal_one BYTE "100123456789765" decimal_two BYTE "900402076502015" sum BYTE (SIZEOF decimal_one 1) DUP (0),0 ; 1001234567.89765 9004020765.02015 code main PROC ; Start at the last digit position mov esi,SIZEOF decimal one1 mov edi, SIZEOF decimal_one mov ecx, SIZEOF decimal_one mov bh, 0 set carry value to zero L1 : ah, 0 ; clear AH before addition mov mov al,decimal_oneesi]get the first digit add al,bh ; add the previous carry ; adjust the sum (AH-carry) ; save the carry in carryl ; convert it to ASCII ; add the second digit ; adjust the sum (AH = carry) ; OR the carry with carryl ; convert it to ASCII ; convert AL back to ASCII ;save it in the sum ; back up one digit mov bh, ah or bh, 30h add al,decimal_two [esi] bh, ah or or bh, 30h or mov sum [edi],al dec esi dec edi loop L1 mov sum [edi], bh al, 30h ; save last carry digit exit main ENDP END main DECIMAL OFFSET 5 ; offset from right of string data decimal_one BYTE "100123456789765" decimal_two BYTE "900402076502015" sum BYTE (SIZEOF decimal_one 1) DUP (0),0 ; 1001234567.89765 9004020765.02015 code main PROC ; Start at the last digit position mov esi,SIZEOF decimal one1 mov edi, SIZEOF decimal_one mov ecx, SIZEOF decimal_one mov bh, 0 set carry value to zero L1 : ah, 0 ; clear AH before addition mov mov al,decimal_oneesi]get the first digit add al,bh ; add the previous carry ; adjust the sum (AH-carry) ; save the carry in carryl ; convert it to ASCII ; add the second digit ; adjust the sum (AH = carry) ; OR the carry with carryl ; convert it to ASCII ; convert AL back to ASCII ;save it in the sum ; back up one digit mov bh, ah or bh, 30h add al,decimal_two [esi] bh, ah or or bh, 30h or mov sum [edi],al dec esi dec edi loop L1 mov sum [edi], bh al, 30h ; save last carry digit exit main ENDP END mainStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started