The following program is supposed to subtract val2 from val1. Find and correct all logicerrors (CLC clears the Carry flag):.dataval1 QWORD 20403004362047A1hval2 QWORD 055210304A2630B2hresult QWORD 0.codemov cx,8 ; loop countermov esi,val1 ; set index to startmov edi,val2clc ; clear Carry flagtop:mov al,BYTE PTR[esi] ; get first numbersbb al,BYTE PTR[edi] ; subtract secondmov BYTE PTR[esi],al ; store the resultdec esidec ediloop top

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 11SA
icon
Related questions
Question

The following program is supposed to subtract val2 from val1. Find and correct all logic
errors (CLC clears the Carry flag):
.data
val1 QWORD 20403004362047A1h
val2 QWORD 055210304A2630B2h
result QWORD 0
.code
mov cx,8 ; loop counter
mov esi,val1 ; set index to start
mov edi,val2
clc ; clear Carry flag
top:
mov al,BYTE PTR[esi] ; get first number
sbb al,BYTE PTR[edi] ; subtract second
mov BYTE PTR[esi],al ; store the result
dec esi
dec edi
loop top

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Single source shortest path
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT