0

I was wondering how to take a line of Assembly code written in synthetic instructions and converting it by hand into .word assembly directives. For instance how do you go from something simple like

    add %i0, %i0, %i0

to

    .word 0xB0060018

A good, thorough explanation of the process would be greatly appreciated. Thank you.

Dillon Burton
  • 363
  • 6
  • 16
  • 1
    You need to get a copy of the programmer's manual for the CPU and see instruction encodings, which can be either in separate tables or right in the description of each instruction. That'll give you an idea of how to put together the various items consisting of a number of bits together into a 32-bit word. The process is trivial, but may not look so when done for the first time. – Alexey Frunze Jan 30 '13 at 20:02
  • I am using my schools SPARC machines, I have no idea where to begin to find that. I believe that the processor is AMD Opteron Dual Core 2.6GHz. Do you know where I could possibly find the manual? – Dillon Burton Jan 30 '13 at 20:06
  • 2
    `add %i0, %i0, %i0` and `SPARC` don't quite associate with AMD Opteron. Ask whoever supervises your computer class to help find out what those machines are and what CPU is in them. – Alexey Frunze Jan 30 '13 at 20:10

1 Answers1

0

Since you are assuming you are on a sparc box I will assume it is at least a unix box ;-).

From a command line run

uname -a

to determine the architecture your system is running on. Chances are its x86_64 these days.

The offical heavy duty Sparcv9 manual

Also the Sparc v8 manual which is still 100% relevant as all sparc processors are backwards compatible and for plain old integer code 32bit is acutally faster. Now if you do multimedia type operations 64bit might help specifically the VIS extensions.

Sparc ASM reference manual

That said, the manuals are VERY heavy reading material and you would be much better off getting a book I suggested in your other question. "Fundamentals of Computer Organization and Design" or maybe "SPARC Architecture, Assembly Language Programming, and C" which would have even more info specfic to Sparc.

cb88
  • 447
  • 3
  • 18