Mike Shaver wrote:
>
> If I were, say, a total newbie when it comes to assembly, what would
> be a good place to start? I've always meant to learn assembly, and
> this would seem an ideal opportunity -- and to do it on real hardware!
> =)
>
> Any good references? Anything MIPS-specific?
For general references on assembly programming, I'm not sure.
Is there a need for such a thing ?
But for MIPS specific, if you've go an SGI with a proper
development toolkit on it, it should come with an online
book entitled "MIPS Assembly Programming Guide".
That's quite a complete reference, but not a tutorial.
The hacker way of looking at things (the one I like) is
to write tiny C programs, compile them with cc -S,
look at the output, and try to understand what happens.
Even better, compile your c program and use dis (the sgi disassembler)
to look at the result (cc -S output something that's not really the
final
thing the CPU groks)
Also, dbx has quite a few command that allow you
to follow a program step by step at assembly level:
ni (next instruction, don't follow subroutine calls)
si (next instruction, follow)
stopi at (add an asm level breakpoint)
syscall catch call xx (stop on system call xx)
$pc-20/50i (list asm fragment around current PC)
pr (dump registers)
assign $pc=xxxx (change value of register pc to xxxx)
etc ...
Finally, beware of pipelining weirdies.
A most striking example is:
[ 4] 0x40092c: 03 e0 00 08 jr ra // Return from
subroutine
[ 4] 0x400930: 24 02 00 03 li v0,3 // Load return
value in v0
At first reading, it seems like the routine returns
before loading the return value in v0.
Actually, both instructions are executed at the same time.
- Mgix
|