summaryrefslogtreecommitdiff
path: root/warriors/epson.red
blob: b0409f03b7fdbcc2edf40def62866aa53520c668 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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: