Check this little assignment...
Dear Gurus!
I'm just begginner level student of assembly and I found the following question in my assignment. However, I've solved it but I want confirmation about its correctness, and if it isn't correct, please do it. (These results have been achieved by using NASM assembler).
Problem: Fill out the corresponding values in HEX in the register table after the execution of each instruction.
Code:
Instructions AL Carry Flag
mov al, 5dh
shr al, 3
mov al, 3ch
sar al, 6
mov ax, 12d4h
rol ax, 7
rcr ax, 2
sar ax, 1
Solution:
Instructions AL Carry Flag
mov al, 5dh 5d 0
shr al, 3 0b 1
mov al, 3ch 3c 1
sar al, 6 00 1
mov ax, 12d4h 12d4 1
rol ax, 7 00 0
rcr ax, 2 00 0
sar ax, 1 00 0
Highly thanx.
Mood.
Re: Check this little assignment...
Unfortunately, starting with line 'rol ax, 7' your results appear to be incorrect. I will not write you correct results here, jus will let you rethink this problem again :D. You can complete this task with writing program and debugging it with some debugger (TD, Visual Studio inline assembly, or maybe there is some debugger coming with NASM?).
Regards,
Hob
Re: Check this little assignment...
Dear Hobson!
I've checked again this assignment and the solution with some changes is here. Now please check it critically. Actually, I want to get full marks in this assignment.
Code:
Instructions AL Carry Flag
mov al, 5dh
shr al, 3
mov al, 3ch
sar al, 6
mov ax, 12d4h
rol ax, 7
rcr ax, 2
sar ax, 1
Solution:
Instructions AL Carry Flag
mov al, 5dh 5d 0
shr al, 3 0b 1
mov al, 3ch 3c 1
sar al, 6 00 1
mov ax, 12d4h d4 1
rol ax, 7 09 1
rcr ax, 2 82 0
sar ax, 1 41 0
Thanx a lot.
Mood
Re: Check this little assignment...
Now your solution seems to be OK. I wish you full marks for this assignment, but I think that it would be really good if you learn how to check this by yourself using debugger.
Regards,
Hob :wave:
Re: Check this little assignment...
Dear Hobson!
Being student of very beginner level, I'm trying to understanding the debugger's usage, but I'm not confirmed about the results, so I drop a request for check.
However, thanx a lot for guiding.
Mood.