MARS模拟器上的位图显示

时间:2015-01-21 11:51:24

标签: mips mars-simulator

我试图在MARS Simulator的内存中绘制一些彩色方块。问题是,我甚至无法静态地绘制任何东西。

http://tinypic.com/r/503czk/8

基本上,我有一些充满黄色的记忆(我想这就是颜色),但没有任何东西出现。只是黑色。

    .macro Terminate
        li $v0, 10
        syscall
    .end_macro

    .data
what0: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what1: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what2: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what3: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what4: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what5: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what6: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what7: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what8: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what9: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what10: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what11: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what12: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what13: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what14: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what15: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what16: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what17: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what18: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00
what19: .word 0x00FFFF00, 0x00FFFF00, 0x00FFFF00, 0x00FFFF00

    .text   
main:

    Terminate

提前致谢。

1 个答案:

答案 0 :(得分:2)

MARS模拟器中的位图显示工具不会将内存的内容显示为位图,而是绘制写入显示缓冲区所在内存位置的像素。

这意味着您必须使用要绘制的像素来实际写入内存位置;它不会显示"图像"编译代码时存储。

在示例代码中,您可以在其自己的内存位置重写每个像素,例如:

    .text   
main:
    li $t1, 0
    li $t2, 4
    li $t3, 320
loop:
    lw $t4, what0($t1)
    sw $t4, what0($t1)
    addu $t1, $t1, $t2
    bne $t1, $t3, loop  

    Terminate