Solve each of the following problems. To receive full marks on your documentatio
ID: 3709700 • Letter: S
Question
Solve each of the following problems. To receive full marks on your documentation, you should have excellent internal documentation (i.e., appropriate comments, but also choice of variable names), as well as excellent external documentation (i.e., in the readme.txt file as described previously). [30 points] Code instructions that implement the following pseudocode using conditional jump instructions. Do not use the .IF directive. Assume that integers are unsigned: 1. else [30 points] Code instructions that implement the following pseudocode using conditional jump instructions. Do not use .WHILE or .IF directives. Assume that integers are unsigned: 2. while( int2 -intl ) ebx +2; if ebx > int2) ebx0; else ebx = int1; 3. [40 points] Suppose EAX, EBX, and ECX contained three unsigned integers. Write a program that displays the largest of the three integers using conditional jump instructions.Explanation / Answer
#cmp can change the value of destination register that's why I move the data again the register
(cmp destination, source)
1. #I am writing only the code.Initialize eax and ebx with the data as required
If you are using and operator in a condition, if the first one is false then it doesn't check the second condition but that's not the case with or operator. That's why I have first checked the first condition of first expression and if that's false then I haven't checked the 2nd condition but I have checked the other expression of "or" operator and in that too first I have checked the 1st one and then the 2nd one.
#LET DATA IN EAX BE DAT1;
CMP EAX,EBX
JLE L2
MOV EAX,DAT1
CMP EAX,EBX
JNE L3
L2: CMP EBX,0
JNE L4
CMP EAX,0;
JNE L4
L3: MOV DL,5
JMP L5
L4: MOV DL,6
L5: NOP
.EXIT
2.
#LET CONTENTS OF INT2 BE DAT1
L5: MOV INT2,DAT1
CMP INT2,INT1;
JL L2
ADD EBX,2
CMP EBX,INT2
JLE L3
MOV EBX,0
JMP L5
L3: MOV EBX,INT1
JMP L5
L2: NOP
.EXIT
3.
#LET DX STORE THE LARGEST VALUE
#and the data of eax ,ebx , ecx be dat1,dat2,dat3 respectivel
cmp eax,ebx
jl L2
mov eax, dat1
cmp eax,ecx
jl L2
mov eax,dat1
mov dx, eax
jmp L3
L2:
cmp ebx,eax
jl L4
mov ebx, dat2
cmp ebx, ecx
jl L4
mov ebx,dat2
mov dx, ebx
jmp L3
L4:
cmp ecx,eax
jl L3
mov ecx, dat3
cmp ecx,ebx
jl L3
mov ecx,dat3
mov dx, ecx
L3:
nop
.exit
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.