2012-07-14 92 views
0

我可以运行模拟器(S)(x)的MIPS和火星,但我不知道如何使程序。 MIPS汇编仿真没有“入门”。你能不能给我一个简单的程序,我只是放在箱子里运行?开始使用MIPS仿真

enter image description here

enter image description here

回答

1

这里是代码切换的$t0$1,和$t2$t3值。使用任何编辑器将其粘贴到文件swap.s中,并使用模拟器(mars,pcspim,qtspim)打开文件。

.text 
    .globl main 
main: 
    li $t0, -10 
    li $t1, -31 
    li $t2, -10 
    li $t3, -31 

    #swap 

    xor $t0, $t0, $t1 
    xor $t1, $t0, $t1 
    xor $t0, $t0, $t1 

    addu $t2, $t2, $t3 
    subu $t3, $t2, $t3 
    subu $t2, $t2, $t3 

    li $v0, 10 
    syscall 

你总是写:

.text 
.globl main 
main: 

#code here 

li $v0, 10 
syscall 

,并从那里继续。

+0

谢谢,我可以运行在火星上的代码,但我不知道如何做到这一点的xspim。 – 2012-07-15 06:09:06

+1

我只有PCSPIM的经验,所以我害怕我无法帮助您使用xspim。 – Patrik 2012-07-15 15:36:12