如何转换MIPS伪指令

时间:2018-02-09 03:59:44

标签: mips

所以我想转换这些伪指令,这样我的MIPS模拟器就可以在不使用伪指令的情况下进行汇编。我被困在试图转换这些。我知道我也可以将li改为addi / u。我需要转换所有伪指令(li,la,move等)。这里有一个密钥吗?

.data

name: .asciiz "Your name\n\n"

newline: .asciiz "\n"

prompt1: .asciiz "Enter the number of time to test: "

prompt2: .asciiz "\nThe smallest number is: "

prompt3: .asciiz "The largest number is: "

prompt4: .asciiz "\nError: there are no number to test\n"

prompt5: .asciiz "Enter number: "

.text

addi $t1, $s0, 1 #counter
li $t2,0

#$t4 #min
#$t5 #max

la $a0,name #print name
li $v0,4
syscall

la $a0,prompt1 #print Enter the number of times to test:
li $v0,4
syscall

li $v0,5 #input the integer t0 = test run
syscall
la $t0,($v0)

la $a0,newline #prints newline
li $v0,4
syscall

loop1:
bgt $t1,$t0,exit

la $a0,prompt5 #prints Enter numberof:
li $v0,4
syscall

li $v0,5 #inputs the integer
syscall

la $t3,($v0)
addi $t2,$t2,1 #nested counter

beqz $t3,loop2
beq $t2,1,set
bgt $t4,$t3,smaller
blt $t5,$t3,larger

j loop1

set:
move $t4,$t3
move $t5,$t3
j loop1

smaller:
move $t4,$t3
j loop1

exit:

0 个答案:

没有答案