在一定范围内移动图形 - MIPS

时间:2018-03-18 02:15:08

标签: assembly mips mips32

图表应该向右,向下,向左,向上,连续移动,然后再次循环此过程 - >无限地直到程序结束。当我按照以下方式尝试我的mips代码时,图像可以向右移动,然后向下移动,但卡在move_left部分中。

 move:
push ra
lw      t7, frame_counter           
li      t4, 10                  
rem     t3, t7, t4                   
bne     t3, 0, _move_image_exit 

_move_image_right:
    lw  t1, image_x                 
    inc t1                  
    bgt t1, 17, _move_image_down            
    sw  t1, image_x
    j   _move_image_exit

_move_image_down:
    lw  t0, image_y
    inc t0
    bgt     t0, 5, _move_image_left
    sw  t0, image_y
    j   _move_image_exit

_move_image_left:
    lw  t1, image_x
    dec t1
    blt     t1, 5, _move_image_up
    sw  t1, image_x
    b   _move_image_exit

_move_image_up:
    lw  t0, image_y
    dec t0
    blt t0, 2, _move_image_right
    sw  t0, image_y
    b   _move_image_exit

#_store_image_coordinates:
    #sw     t1, image_x
    #sw     t0, image_y
_move_image_exit:   
 pop ra
 jr ra

1 个答案:

答案 0 :(得分:0)

这不是答案,但我没有足够的声誉来发表评论......

如果我理解正确,当你到达_move_image_left image_x时,_move_image_exit中的值大于17,否则你不会到达该区块,所以blt不分支你去直接到a b apple 3 orang 4 aple 1 orange 10 banana 5