Instructions (identical to x86)
||Move data between registers, load immediate data into registers, move data between registers and memory.
||mov $4,%eax # Load constant into eax
mov %eax,%ebx # Copy eax into ebx
mov %ebx,123 # Copy ebx to memory address 123
||Insert a value onto the stack. Useful for passing arguments, saving registers, etc.
||Remove topmost value from the stack. Equivalent to "mov (%esp),dest; add $4,%esp"
||Push the address of the next instruction and start executing func.
||Pop the return program counter, and jump there. Ends a subroutine.
||add %ebx,%eax # Add ebx to eax
||Multiply eax and src as unsigned integers, and put the result in eax. High 32 bits of product go into eax.
||mul %ebx #Multiply eax by ebx
|jmp label||Goto the instruction label:. Skips anything else in the way.||jmp post_mem
mov %eax,0 # Write to NULL!
post_mem: # OK here...
||Compare two values. Sets
flags that are used by the conditional jumps (below). WARNING:
compare is relative to *last* argument, so "jl" jumps if b<a!
|jl label||Goto label if previous comparison came out as less-than. Other conditionals available are: jle (<=), jeq (==), jge (>=), jg (>), jne (!=), and many others.||jl loop_start # Jump if eax<10