MARS 模拟器上的位图显示
Bitmap Display on MARS Simulator
我正在尝试将一些彩色方块绘制到 MARS 模拟器的内存中。问题是,我什至无法静态绘制任何东西。
基本上,我有一些充满黄色的记忆(我想就是那个颜色),但什么也没有出现。只是黑色。
.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
提前致谢。
MARS 模拟器中的位图显示工具不会将内存的内容显示为位图,而是绘制写入显示缓冲区所在内存位置的像素。
这意味着您必须将要绘制的像素实际写入内存位置;它不会向您显示编译代码时存储的 "image"。
在您的示例代码中,您可以在自己的内存位置重写每个像素,例如:
.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
我正在尝试将一些彩色方块绘制到 MARS 模拟器的内存中。问题是,我什至无法静态绘制任何东西。
基本上,我有一些充满黄色的记忆(我想就是那个颜色),但什么也没有出现。只是黑色。
.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
提前致谢。
MARS 模拟器中的位图显示工具不会将内存的内容显示为位图,而是绘制写入显示缓冲区所在内存位置的像素。
这意味着您必须将要绘制的像素实际写入内存位置;它不会向您显示编译代码时存储的 "image"。
在您的示例代码中,您可以在自己的内存位置重写每个像素,例如:
.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