Question

9) Choose the correct Assembly Language code that will do the following: If dog is equal...

9) Choose the correct Assembly Language code that will do the following: If dog is equal to cat THEN go to LOOP_A ELSE go to LOOP_B if(dog == cat) goto LOOP_A else goto LOOP_B Question 9 options:

cmp cat,dog

jnz LOOP_A

jmp LOOP_B

mov AX,cat

cmp AX,dog

jz LOOP_A

jmp LOOP_B

mov AX,dog

cmp AX,cat

js LOOP_A

jmp LOOP_B

mov AX,cat

cmp AX,dog
js LOOP_A

jmp LOOP_B

Homework Answers

Answer #1

the cmp instruction compares the two values by subtracting them and sets the zero flag if both are equal

using this property we will make a jump to Loop_A using the JZ instruction which jumps to the given location if zero flag is set.

hence the correct option should be

mov AX,cat

cmp AX,dog

jz LOOP_A

jmp LOOP_B

here , we 1st move the value of cat to accumulator and then compare the accumulator with dog.

if they are equal the zero flag will be set and control will move to LOOP_A else it will do an unconditional jump to LOOP_B.

Know the answer?
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
Similar Questions
Write an assembly language program that will implement the following: If ( (AX >=BX) || (CX...
Write an assembly language program that will implement the following: If ( (AX >=BX) || (CX < DX) ) goto LoopA Else go to LoopB..
Write an assembly language program that will implement the following:       If ( (AX >=BX) AND (CX...
Write an assembly language program that will implement the following:       If ( (AX >=BX) AND (CX < DX) ) goto LoopA Else go to LoopB (Here I want you to write the whole assembly program that could run in CMD. THANK YOU
Machine Language - 1. Which of the following assembly code represents the high-level Java code below?...
Machine Language - 1. Which of the following assembly code represents the high-level Java code below? int x; int i = 5; if (i < 0) x = -1; else x = 1; @5 D=M @i M=D @BRANCH M;JLT @x M=1 @END 0;JMP (BRANCH) @x M=-1 (END) @END 0;JMP @5 D=M @i M=D @BRANCH M;JGE @x M=1 @END 0;JMP (BRANCH) @x M=-1 (END) @END 0;JMP @5 D=M @i M=D @BRANCH M;JLT @x M=1 @END 0;JMP (BRANCH) @x M=-1 (END) @END...
Write the following code segment in MARIE's assembly language: if x <= y then Y =...
Write the following code segment in MARIE's assembly language: if x <= y then Y = Y+1; else if x! =x then Y= Y -1; else z=z+1
Assembly Code & debug the following program in VS, then answer these questions at the end...
Assembly Code & debug the following program in VS, then answer these questions at the end of the code using comments: a) To which label the program jumped? b) Why did the program jump to this label? c) Why the program didn’t jump to the other label, since ‘80h > 7Fh’ is correct? mov al,+127 ;hex value is 7Fh (+127) cmp al,-128 ;hex value is 80h (-128) ja IsAbove jg IsGreater IsAbove: exit IsGreater: exit
Implement the following C++ code in assembly language. Substitute calls to WriteString for the printf() function...
Implement the following C++ code in assembly language. Substitute calls to WriteString for the printf() function calls: double X; double Y; if(x<Y) printf("X is lower\n"); else printf("X is not lower\n");
Implement the following expression in assembly language:                                  &nb
Implement the following expression in assembly language:                                                 BX = –val2 + 7 - (- val3 + val1) * 2 Assume that val1, val2, and val3 are 8-bit integer variables Initialize val1 with 12, val2 with 9, and val3 with 2 You are only allowed to use 16-bit registers to hold intermediate results, whenever needed. Use ONLY mov, add, sub, movzx, movzx, or neg instructions whenever needed. Use the debugger to verify your answer. Please answer using this format for...
Please use loop and branch instructions to write an assembly code segment to do the following:...
Please use loop and branch instructions to write an assembly code segment to do the following: Read DIP switch. If DIP switch has the setting: b7 = b0 = 1, then, load A with number $11, load B with number $22, and do A+B; save the result to memory location $1000; if DIP switch has the setting: b4= b3 = 1, then, load A with number $55, load B with number $33, and do A-B; save the result to memory...
Take the following program and translate it into PEP/9 assembly language: #include <iostream> using namespace std;...
Take the following program and translate it into PEP/9 assembly language: #include <iostream> using namespace std; int theArray[] = { 5, 11, -29, 45, 9, -1}; void sumPos(int ary[], int len, int &sum) {    sum = 0;    for (int i = 0; i < len; i++)            if (ary[i] > 0)                sum = sum + ary[i]; } int main() {    int total;    sumPos(theArray, 6, total);    for (int k=0; k < 6; k++)      cout...
Question 5: Choose only one of the following hypothesis tests Seriously, you only need to do...
Question 5: Choose only one of the following hypothesis tests Seriously, you only need to do #5a or #5b. Do not do both. 5a. Let’s go back to the information about the age of the mothers of the students at the time of their births. Suppose we conduct a hypothesis test of whether the sample data provide strong evidence that the population mean mother’s age is less than 30 years. a. What are the observational units in this study? b....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT