diff options
Diffstat (limited to 'assembly/meseconsio/meseconsio.S')
| -rw-r--r-- | assembly/meseconsio/meseconsio.S | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/assembly/meseconsio/meseconsio.S b/assembly/meseconsio/meseconsio.S new file mode 100644 index 0000000..f2a441f --- /dev/null +++ b/assembly/meseconsio/meseconsio.S @@ -0,0 +1,30 @@ + li s0,0xffff0000 + csrw 0x801,s0 # Set MMIO base address + + li t0,0x7 # Pin D input, others output + sb t0,0(s0) # Write to mesecons I/O direction register + +start: lr.w x0,0(s0) # Establish a reservation set on the mesecons I/O region + wrs.nto # Wait for it to become invalid + lb t0,1(s0) # Read the mesecons I/O data + andi t1,t0,0x8 # Is pin D on? + beqz t1,start # If not, go wait again + + li t0,1 # only A on + sb t0,1(s0) + pause + pause + pause + li t0,2 # only B on + sb t0,1(s0) + pause + pause + pause + li t0,4 # only C on + sb t0,1(s0) + pause + pause + pause + li t0,0 # all off + sb t0,1(s0) + j start |
