summaryrefslogtreecommitdiff
path: root/warriors/epson.red
blob: 2bc05adbebcde00f9d785233cc89fc07ad8d3ed1 (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
43
44
45
46
;author Benji Dial
;name Epson

intrascan_period equ 10
interscan_period equ 2

;assert intrascan_period % interscan_period == 0
;assert CORESIZE % intrascan_period == 0

scan_init equ (the_end - scan - (the_end - scan) % intrascan_period + intrascan_period)

scan
  seq.i -intrascan_period, scan_init
  jmp found

found_ret
  add.ab #intrascan_period, scan
  seq.ab scan, scan
  jmp scan

  add.f scan_add, scan
  jmn.a scan, scan

clear
  mov the_end, scan - interscan_period
  sub.ab #interscan_period, clear

  seq.ab #scan_add - 1 - clear - (scan_add - 1 - scan) % interscan_period + interscan_period, clear
  jmp clear

  mov.ab #scan - interscan_period - clear, clear
  jmp clear

scan_add
  dat interscan_period, intrascan_period + scan_init + interscan_period

found
  mov bomb, >scan
  mov bomb + 1, @scan
  jmp found_ret, <scan

bomb
  spl 1
  jmp bomb

the_end