我正在使用MARS。是否可以在没有回声的情况下从控制台读取字符?就像 DOS 中的int 21h / 08h
一样。或者有没有办法破解它?
是的,您可以使用 MMIO 在 SPIM/MARS 中轮询键盘:
li $t0,0xffff0000 # ffff0000 = Receiver (keyboard) control
wait_for_key:
lw $t1,($t0)
andi $t1,$t1,0x0001 # Check the "ready" bit
beq $t1,$0,wait_for_key
lw $v0,4($t0) # ffff0004 = Receiver data