Computer Organization Fall 2000

Homework 4
Frequently Asked Questions

Questions:
Booth's Algorithm negative multiplier 80x86 Assembly Server what is '%' Which way does mov move?

Q: My C implementation of Booth's algorithm doesn't seem to work whenever the multiplier is negative, any suggestions?

A: You are probably not initializing the product to 0. You are probably trying to stuff both the multiplier and the product in to the same C variable (even though I suggested you did not try to do this!), but you never consider the value of the bits that make up the initial partial product (must all be 0!).

Q: The code produced by your web based compiler doesn't look like the stuff in the 80x86 assembly language faq - what's up?

A: Oops! The link I provided was to a Sun machine, so the code sent back was Sparc assembly language (not 80x86).

I've fixed it - try again...

Q: What does the % do? I've found no explanation for it anywhere, and almost all of the code I see elsewhere doesn't even have it.

A: '%' is the register prefix (like '$' for MIPS registers) for one of the 2 well known 80x86 Assembly language syntaxs (yes, there are 2 of them!). The instruction set is always 80x86, but there are two different Assembly Languages. If you get assembly language from gcc (If you got it from my server you are getting it from gcc), you are looking at the AT&T 08x86 Assembly Language syntax.

Here is a link that explains the difference between this Assembly Language syntax and the other one (Intel's):

http://qslinux.org/docs/cross/gas/as.html#SEC214

Q: What does this do:

 movl %esp,%ebp

Most references say that this will copy from ebp to esp, but then I found this:

movw 6836, %AX

with the comment that this will move whatever's at address 6836 to ax.

A: This is again a difference in Assembler syntax. The above link describes the differences.