Assembly language programming help!!

Status
Not open for further replies.

Sonia123

New Member
Hello Friends,

I have a very fundamental question, from the code in the attachment, how many times do you think is SCASW executed? Well, the correct answer is two, but I just don't understand why. Any logical explanation would be much appreciated .
Thanks all
 
Sonia123,

how many times do you think is SCASW executed? Well, the correct answer is two, but I just don't understand why.

It would have been nice of you to tell us what CPU the code is for so we can look up the instruction in the manual or the internet. Fortunately, I recognize it as Intel 16-bit code. The internet says the instruction will execute until it finds a word in memory pointed to by ES;DI, equal to the word in AX, or until it it scans the number of times in CX. It increments the DI register by 2 after each scan and decrements CX by 1. Since you did not provide a dump of the memory pointed to by ES;DI, there is no way to tell how many times the scan will go on.

Ratch
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…