This is the school homework. I was asked to write a I/O mapping program in assembly.
I am stuck at level 1 where i simply read from keyboard and write to monitor using polling method.
###########################################################
.text 0x00400000
main:
addi $s0, $0, 0 # save address for transmitter data
lui $s0, 0xffff
poll_read:
lw $t0, 0($s0) # read transmitter data word
andi $t0, $t0, 0x1 # keep the 1st bit
beq $t0, $0, poll_read # not ready, go back
lw $t1, 4($s0) # read transmitter control word
andi $t1, $t1, 0xff # keep the 1st 8 bits
addi $t1, $t1, 1
poll_write:
lw $t0, 8($s0) # read receiver data word
andi $t0, $t0, 0x1 # keep the 1st bit
beq $t0, $0, poll_write # not ready, go back
sw $t1, 0xc($s0) # display monitor
j poll_read
The problem is the ready bit for 0xffff 0000 is always 0.
So, I cannot do anything else.
is there some sort of trick for this to work? change some settings?