Domanda

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?

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top