How many times does the NOP instruction execute in the following sequence? MOV C
ID: 3916328 • Letter: H
Question
How many times does the NOP instruction execute in the following sequence?
MOV CX, 20H
XYZ: PUSH CX
MOV CX, 9
ABC: NOP
LOOP ABC
POP CX
LOOP XYZ
I understand the first loop executes 9 times but im torn between whether you multiply 9 by 20 or 32. 20 is in the problem but I have seen other solutions say 32. Is it 20 and 32 and if its 32 please explain why. Thanks
Explanation / Answer
So the problem here is to understand
what is the value of "20H"
"H" here means "Hexadecimal" or "Base 16"
Just like Decimal number system(10) we have other Hexadecimal Number system(16)
Basic mapping from decimal to Hexadecimal
0 - 0
1- 1
2-2
3-3
4-4
5-5
6-6
7-7
8-8
9-9
10-A (Note 10 in decimal is A in Hexa)
11 - B
12 - C
13 - D
14 - E
15 - F
Now for only letters till F is used So to represent the number from decimal now we use two hexadecimal digits.
Just like 675 in decimalis 10*10*6 + 10*70 + 1*5
this example is to convert hexadecimal to decimal
A34 = 16*16*A + 16*3 + 4
SO it GIVEN (20H) that is 2 hexa digits are used
So (20) = 16*2 + 0
which is 32 in decimal
So for practice here are some examples with solutions at the end
Convert following to decimal
1) 45H
2) ABH
3) 3CDH
SOLUTIONS
1) 16*4 + 5
2)16*A + B = 16*10 + 11
3)16*16*3 + 16*C + D = 16*16*3 + 16*12 + 13
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.