summaryrefslogtreecommitdiff
path: root/assembly/beacon/beacon.S
diff options
context:
space:
mode:
Diffstat (limited to 'assembly/beacon/beacon.S')
-rw-r--r--assembly/beacon/beacon.S85
1 files changed, 85 insertions, 0 deletions
diff --git a/assembly/beacon/beacon.S b/assembly/beacon/beacon.S
new file mode 100644
index 0000000..26c271e
--- /dev/null
+++ b/assembly/beacon/beacon.S
@@ -0,0 +1,85 @@
+# Initialize timer
+la a0,timerchannel
+la a1,timerinit1
+li a7,129 # Send digilines message
+ecall
+la a1,timerinit2
+ecall
+
+loop:
+
+# Check if the timer has ticked
+li a7,133 # Get digilines buffer level
+ecall
+beqz a0,sleep # Sleep if it hasn't
+li a7,134 # Clear digilines receive buffer
+ecall
+
+# Do the actual flashing
+li a7,129 # Send digilines message
+la a0,lightchannel1
+la a1,lightonmsg
+ecall # Light 1 on
+pause
+la a1,lightoffmsg
+ecall # Light 1 off
+pause
+la a1,lightonmsg
+ecall # Light 1 on
+pause
+la a1,lightoffmsg
+ecall # Light 1 off
+pause
+la a1,lightonmsg
+ecall # Light 1 on
+pause
+la a1,lightoffmsg
+ecall # Light 1 off
+pause
+la a1,lightonmsg
+ecall # Light 1 on
+pause
+la a1,lightoffmsg
+ecall # Light 1 off
+pause
+la a0,lightchannel2
+la a1,lightonmsg
+ecall # Light 2 on
+pause
+la a1,lightoffmsg
+ecall # Light 2 off
+pause
+la a1,lightonmsg
+ecall # Light 2 on
+pause
+la a1,lightoffmsg
+ecall # Light 2 off
+pause
+la a1,lightonmsg
+ecall # Light 2 on
+pause
+la a1,lightoffmsg
+ecall # Light 2 off
+pause
+la a1,lightonmsg
+ecall # Light 2 on
+pause
+la a1,lightoffmsg
+ecall # Light 2 off
+pause
+j loop
+
+sleep:
+csrw 0x800,1 # Lightweight on
+pause
+csrw 0x800,0 # Lightweight off
+j loop
+
+
+timerchannel: .asciz "timer"
+timerinit1: .asciz "loop_on"
+timerinit2: .asciz "1"
+lightchannel1: .asciz "light1"
+lightchannel2: .asciz "light2"
+lightonmsg: .asciz "14"
+lightoffmsg: .asciz "0"