2017-12-07 22:12:50 +00:00
|
|
|
# set baud rate to 9600
|
|
|
|
|
li t0, 0x00020000
|
|
|
|
|
li t1, 3750
|
|
|
|
|
sw t1, 0(t0)
|
2017-12-05 23:12:33 +00:00
|
|
|
|
2017-12-07 22:12:50 +00:00
|
|
|
# read char from the UART
|
|
|
|
|
li t0, 0x00020008
|
|
|
|
|
li t1, 0x00010000
|
|
|
|
|
loop:
|
|
|
|
|
lw t2, 0(t0)
|
|
|
|
|
bltz t2, loop
|
2017-12-05 23:12:33 +00:00
|
|
|
|
2017-12-07 22:12:50 +00:00
|
|
|
# write to the LEDs
|
2017-12-06 08:18:59 +00:00
|
|
|
sw t2, 0(t0)
|
2017-12-07 22:12:50 +00:00
|
|
|
|
|
|
|
|
# echo back to the UART
|
|
|
|
|
sw t2, 0(t1)
|
|
|
|
|
j loop
|