MIPS: Reading and displaying a character using polling

1.1k Views Asked by At

I am trying to display a single character in Mars MIPS (then eventually an entire string, but I am working on a single character for now).

.data

.text
main:
    jal emitchar
    jal LOOP
    jal LOOP2

emitchar:
    lui $t0, 0xFFFF         # $t0 stores the address of the receiver control

    jr $ra

LOOP:
    lw $t1, 0($t0)          # $t1 stores the entire 32-bits of the receiver control
    andi $t2, $t1, 0x0001       # $t2 stores the last bit (ready-bit) of the control
    beq $t2, $zero, LOOP        # if the ready-bit is 0 (not ready) loop until it is
    lw $s0, 4($t0)          # load the data into $v0

    jr $ra

LOOP2:
    lw $t1, 8($t0)          # $t1 is the address of transmitter control
    andi $t2, $t1, 0x0001       # $t2 is the ready-but of the transmitter control
    beq $t2, $zero, LOOP2       # if the ready-bit is 0 (not ready) loop until it is
    sw $s0, 12($t0)

    jr $ra

When debugging, I noticed that I am stuck in an infinite loop in the LOOP procedure. Any pointers on where to go from here?

0

There are 0 best solutions below