please anything is helpful. this is in assembly. Write MASM code to implement th
ID: 3794086 • Letter: P
Question
please anything is helpful. this is in assembly.
Write MASM code to implement the following pseudo-code:
if (x < 100) {
if (x >= 50) {
print 'M';
}
else {
print 'L';
}
} else {
print 'H';
}
Assume that x has already been declared as SDWORD (signed 32-bit) in the data segment, and x has been assigned a signed integer value.
Don?t write a complete procedure or program ? just implement the decision structure and printing.
Preserve and restore any changed registers.
Don't use reserved words (e.g. end).
I'm going to plug this right into Visual Studio to test functionality.
Explanation / Answer
cmp SDWORD 100
jl L1
printf("H")
invoke ExitProcess, 0
L1:
cmp SDWORD 50
jge L2
printf("L")
invoke ExitProcess, 0
L2:
printf("M")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.