, , , , . , , , , , , . , :
1: MIPS
, - - . . :
.abicalls
.option pic0
.globl main
.set nomips16
.ent main
.type main, @function
, main main.
, - Makefile , MIPS , . , , , (, ):
.abicalls
.option pic0
.globl rng, seed
.set nomips16
.ent rng
.type rng, @function
, .globl rng, seed. , (rng seed) , .
2: , MIPS C
C, , . , MIPS (a, b, c) $a0- $a2. , $v0, C. :
#include<stdio.h>
int main()
{
printf("%d", rng(0));
return 0;
}
rng:
addi $v0, $a0, 1
jr $ra
C 1, rng(), 1 ( $a0, C 0) $v0 . printf rng, 1.
, . .