summaryrefslogtreecommitdiff
path: root/warriors/epson.red
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2023-05-30 00:22:29 -0400
committerBenji Dial <benji@benjidial.net>2023-05-30 00:22:29 -0400
commit28e855f5424df395dd1ba98354a53536d4598d47 (patch)
tree21e17429958fedf754ac7aad59377f6fdac2a08f /warriors/epson.red
parente56afe88854d3da8d0d9d5c836da6024b02a9bac (diff)
downloadlib94-28e855f5424df395dd1ba98354a53536d4598d47.tar.gz
fix djn again, and pre-dec / post-inc; few other changes
Diffstat (limited to 'warriors/epson.red')
-rw-r--r--warriors/epson.red42
1 files changed, 42 insertions, 0 deletions
diff --git a/warriors/epson.red b/warriors/epson.red
new file mode 100644
index 0000000..b0409f0
--- /dev/null
+++ b/warriors/epson.red
@@ -0,0 +1,42 @@
+;author Benji Dial
+;name Epson
+
+period equ 10
+
+scan_init equ end - (end - scan) % period + period
+
+scan:
+ seq.i 0 - period, scan_init
+ jmp found
+
+found_ret:
+ add.ab #period, scan
+ seq.ab scan, scan
+ jmp scan
+
+ add.f scan_add, scan
+ jmn.a scan, scan
+
+clear:
+ mov end, 0 - 1
+ sub.ab #2, clear
+
+ seq.ab #end - clear - (end - clear) % 2 + 3, clear
+ jmp clear
+
+ mov.ab #0 - 1, clear
+ jmp clear
+
+scan_add:
+ dat 2, period + scan_init + 2
+
+found:
+ mov bomb, >scan
+ mov bomb + 1, @scan
+ jmp found_ret, <scan
+
+bomb:
+ spl 1
+ jmp bomb
+
+end: