diff options
| author | cheapie <cheapiephp@gmail.com> | 2026-06-06 12:42:38 -0500 |
|---|---|---|
| committer | cheapie <cheapiephp@gmail.com> | 2026-06-06 12:42:38 -0500 |
| commit | 95311ab84fb8ea6a5509aaa909be825c74e691ca (patch) | |
| tree | 35f4753c0961fe223a352f07662244e548bea059 /assembly/meseconsio/meseconsio.S | |
| parent | 2b1c27b2b6ae78a043ecae25603939c76d63956e (diff) | |
| download | rvcontroller-95311ab84fb8ea6a5509aaa909be825c74e691ca.tar rvcontroller-95311ab84fb8ea6a5509aaa909be825c74e691ca.tar.gz rvcontroller-95311ab84fb8ea6a5509aaa909be825c74e691ca.tar.bz2 rvcontroller-95311ab84fb8ea6a5509aaa909be825c74e691ca.tar.xz rvcontroller-95311ab84fb8ea6a5509aaa909be825c74e691ca.zip | |
Add (experimental for now) mesecons I/O support
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 |
