Pergunta

I'm using MARS. Is it possible to read a character from console without echo? Like int 21h / 08h in DOS. Or is there a way to hack it?

Foi útil?

Solução

Yes, you can use MMIO to poll the keyboard in 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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top