Assembly Language for Beginners

(Jeff_L) #1

.3 MIPS..


Conditional codes table


Code Description Flags
EQ Equal Z == 1
NE Not equal Z == 0
CSAKAHS (Higher or Same) Carry set / Unsigned, Greater than, equal C == 1
CCAKALO (LOwer) Carry clear / Unsigned, Less than C == 0
MI Minus, negative / Less than N == 1
PL Plus, positive or zero / Greater than, equal N == 0
VS Overflow V == 1
VC No overflow V == 0
HI Unsigned higher / Greater than C == 1 and
Z == 0
LS Unsigned lower or same / Less than or equal C == 0 or
Z == 1
GE Signed greater than or equal / Greater than or equal N == V
LT Signed less than / Less than N != V
GT Signed greater than / Greater than Z == 0 and
N == V
LE Signed less than or equal / Less than, equal Z == 1 or
N != V
None / AL Always Any

.3 MIPS


.3.1 Registers..


( O32 calling convention )


General purpose registersGPR


Number Pseudoname Description
$0 $ZERO Always zero. Writing to this register is likeNOP.
$1 $AT Used as a temporary register
for assembly macros and pseudo instructions.
$2 ...$3 $V0 ...$V1 Function result is returned here.
$4 ...$7 $A0 ...$A3 Function arguments.
$8 ...$15 $T0 ...$T7 Used for temporary data.
$16 ...$23 $S0 ...$S7 Used for temporary data∗.
$24 ...$25 $T8 ...$T9 Used for temporary data.
$26 ...$27 $K0 ...$K1 Reserved forOSkernel.
$28 $GP Global Pointer∗∗.
$29 $SP SP∗.
$30 $FP FP∗.
$31 $RA RA.
n/a PC PC.
n/a HI high 32 bit of multiplication or division remainder∗∗∗.
n/a LO low 32 bit of multiplication and division remainder∗∗∗.

Floating-point registers


Name Description
$F0..$F1 Function result returned here.
$F2..$F3 Not used.
$F4..$F11 Used for temporary data.
$F12..$F15 First two function arguments.
$F16..$F19 Used for temporary data.
$F20..$F31 Used for temporary data∗.

∗—Calleemust preserve the value.
∗∗—Calleemust preserve the value ( except inPICcode).

Free download pdf