-
Notifications
You must be signed in to change notification settings - Fork 0
/
SorterBase.ic10
127 lines (114 loc) · 2.14 KB
/
SorterBase.ic10
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#Base Programming for managing up to 6 sorters
alias Sorter0 d0
alias Sorter1 d1
alias Sorter2 d2
alias Sorter3 d3
alias Sorter4 d4
alias Sorter5 d5
define ORECLASS 10
define INGOTClASS 19
define BIOMASS -831480639
define IRONORE 1758427767
define COAL 1724793494
define SILICONORE 1103972403
define LEADORE -190236170
define NICKELORE 1830218956
define GOLDORE -1348105509
define COPPERORE -707307845
define SILVERORE -916518678
define COBALTORE -983091249
define URANIUMORE -1516581844
define VOLATILESICE 1253102035
define OXITEICE -1805394113
define WATERICE 1217489948
define STACKER -2020231820
define STACKER_REVERSE 1585641623
alias itemClass r12
alias itemHash r11
alias occupied r10
Main:
jal Setup
bdseal d0 HandleSorter0
bdseal d1 HandleSorter1
bdseal d2 HandleSorter2
bdseal d3 HandleSorter3
bdseal d4 HandleSorter4
bdseal d5 HandleSorter5
j Main
Setup:
sb STACKER On 1
sb STACKER Setting 500
move r0 0
SetupLoop:
brdns dr0 3
s dr0 Mode 2 # Logic mode
s dr0 On 1
s dr0 Output -1
add r0 r0 1
beq r0 6 ra
j SetupLoop
HandleSorter0: # Sort 0
move r0 0
push ra
jal LoadOccupant
pop ra
beqz occupied ra
# beq itemClass CLASS SortMatch
# beq itemHash HASH SortMatch
j SortNoMatch
HandleSorter1: # Sort 1
move r0 1
push ra
jal LoadOccupant
pop ra
beqz occupied ra
# beq itemClass CLASS SortMatch
# beq itemHash HASH SortMatch
j SortNoMatch
HandleSorter2: # Sort 2
move r0 2
push ra
jal LoadOccupant
pop ra
beqz occupied ra
# beq itemClass CLASS SortMatch
# beq itemHash HASH SortMatch
j SortNoMatch
HandleSorter3: # Sort 3
move r0 3
push ra
jal LoadOccupant
pop ra
beqz occupied ra
# beq itemClass CLASS SortMatch
# beq itemHash HASH SortMatch
j SortNoMatch
HandleSorter4: # Sort 4
move r0 4
push ra
jal LoadOccupant
pop ra
beqz occupied ra
# beq itemClass CLASS SortMatch
# beq itemHash HASH SortMatch
j SortNoMatch
HandleSorter5: # Sort 5
move r0 5
push ra
jal LoadOccupant
pop ra
beqz occupied ra
# beq itemClass CLASS SortMatch
# beq itemHash HASH SortMatch
j SortNoMatch
LoadOccupant:
ls itemClass dr0 0 Class
ls itemHash dr0 0 OccupantHash
ls occupied dr0 0 Occupied
j ra
SortMatch:
s dr0 Output 1 #Right output
j ra
SortNoMatch:
s dr0 Output 0 #Left output
j ra