a) What does the following code do: a>b, a-b or a <-b? asm volatile( X "Idi %B0, 0 \n\t" //set the high byte of the result, always 0 "cp %A2%A1 \n\t" //compare the low byte of b against a "cpc %B2%BI \n\t" //compare the high bytes with the carry "brge then%\n\t" "Idi %A0, 0 \n\t" //pass back true "rimp over%\n\t" //jump over the then "then%: Idi %A0,1 \n\t" //pass back false "over%: Idi %B0, 0 \n\t" "d" (result) //output list : "d" (a), "d" (b) //input list //clobber list b) Complete the code to do ab, but you must use brne branch command! asm volatile( "Idi %B0, 0 \n\t" //set the high byte of the result, always 0 "cp %A2%A1 \n\t" //compare the low byte of b against a "cpc %B2,%B1 \n\t" //compare the high bytes with the carry "brne : "d" (result) //output list : "d" (a), "d" (b) //input list //clobber list

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.5: Variables And Declaration Statements
Problem 11E
icon
Related questions
Question

I need help with this parts a and b please.

a) What does the following code do: a>b, a<b, a=b, al-b,a>-b or a <-b?
asm volatile(
X
"Idi %B0, 0 \n\t" //set the high byte of the result, always 0
"cp %A2%A1 \n\t" //compare the low byte of b against a
"cpc %B2%BI \n\t" //compare the high bytes with the carry
"brge then%\n\t"
"Idi %A0, 0 \n\t" //pass back true
"rimp over%\n\t" //jump over the then
"then%: Idi %A0,1 \n\t" //pass back false
"over%: Idi %B0, 0 \n\t"
"d" (result) //output list
: "d" (a), "d" (b) //input list
//clobber list
b) Complete the code to do ab, but you must use brne branch command!
asm volatile(
"Idi %B0, 0 \n\t" //set the high byte of the result, always 0
"cp %A2%A1 \n\t" //compare the low byte of b against a
"cpc %B2,%B1 \n\t" //compare the high bytes with the carry
"brne
: "d" (result) //output list
: "d" (a), "d" (b) //input list
//clobber list
Transcribed Image Text:a) What does the following code do: a>b, a<b, a=b, al-b,a>-b or a <-b? asm volatile( X "Idi %B0, 0 \n\t" //set the high byte of the result, always 0 "cp %A2%A1 \n\t" //compare the low byte of b against a "cpc %B2%BI \n\t" //compare the high bytes with the carry "brge then%\n\t" "Idi %A0, 0 \n\t" //pass back true "rimp over%\n\t" //jump over the then "then%: Idi %A0,1 \n\t" //pass back false "over%: Idi %B0, 0 \n\t" "d" (result) //output list : "d" (a), "d" (b) //input list //clobber list b) Complete the code to do ab, but you must use brne branch command! asm volatile( "Idi %B0, 0 \n\t" //set the high byte of the result, always 0 "cp %A2%A1 \n\t" //compare the low byte of b against a "cpc %B2,%B1 \n\t" //compare the high bytes with the carry "brne : "d" (result) //output list : "d" (a), "d" (b) //input list //clobber list
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

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
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A+ Guide to Hardware (Standalone Book) (MindTap C…
A+ Guide to Hardware (Standalone Book) (MindTap C…
Computer Science
ISBN:
9781305266452
Author:
Jean Andrews
Publisher:
Cengage Learning