-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path37-us-government.asm
193 lines (140 loc) · 1.72 KB
/
37-us-government.asm
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
;XA
;GO TO FILE 200, DRIVE 1
;INDEX FILE
GRAB 300
COPY F X;SRC ID
DROP
LINK 800
LINK 801
GRAB 200
;FIND SRC ID
MARK SEEKSRC
TEST X = F
FJMP SEEKSRC
COPY 10 T
MARK COPYSRCFILEIDS
COPY F M
SUBI T 1 T
FJMP GRABDEST
JUMP COPYSRCFILEIDS
MARK GRABDEST
DROP
LINK -1
LINK -1
GRAB 300
SEEK 1
COPY F X;DEST ID
DROP
LINK 800
LINK 801
GRAB 200
;FIND DEST ID
MARK SEEKDEST
TEST X = F
FJMP SEEKDEST
COPY 10 T
MARK COPYDESTFILEIDS
COPY F M
SUBI T 1 T
FJMP DONEINDEXING
JUMP COPYDESTFILEIDS
MARK DONEINDEXING
;WE HAVE 10 SRC AND 10
;DEST IDS NOW IN FILE
;400 IN BASE.
;HAND OVER TO XB.
;XB
MAKE
@REP 20
COPY M F
@END
SEEK -9999
;COPY 10 T
MARK NEXTPAIR
;SUBI T 1 T
;FJMP DONE
;TODO - THE CASE WHEN
;THEYRE IN SAME FILE
COPY F X
SEEK 9
SUBI F X X
SEEK -11
MULI X X X
TEST X < 100
FJMP SRCNOTDEST
;X<100 MEANS DIFFERENCE
;BETWEEN OFFSETS WAS <10
;- IT IS THE SAME FILE
;CAN'T USE TWO AGENTS
COPY F X
REPL READER
SEEK 9
COPY F X
REPL PROXYTOWER
SEEK -10
COPY 50 T
JUMP AWAITCOPY
;ELSE DEPLOY TWO AGENTS
;ONE TO SRC ONE TO DEST
MARK SRCNOTDEST
COPY F X
REPL READER
SEEK 9
COPY F X
REPL WRITER
SEEK -10
COPY 40 T
MARK AWAITCOPY
SUBI T 1 T
TJMP AWAITCOPY
JUMP NEXTPAIR
MARK READER
LINK 800
SWIZ X 0003 T
ADDI 800 T T
LINK T;DRIVE
SWIZ X 0002 T
ADDI 200 T T
GRAB T;FILE
SWIZ X 0001 T
MULI T 10 T
SEEK T
@REP 10
COPY F M
@END
JUMP DONE
;AND WE'RE HERE!
MARK WRITER
LINK 800
SWIZ X 0003 T
ADDI 800 T T
LINK T;DRIVE
SWIZ X 0002 T
ADDI 200 T T
GRAB T;FILE
SWIZ X 0001 T
MULI T 10 T
SEEK T
@REP 10
COPY M F
@END
JUMP DONE
;AND WE'RE HERE!
MARK PROXYTOWER
MAKE
COPY 10 T
MARK PROXYSTORE
COPY M F
SUBI T 1 T
TJMP PROXYSTORE
SEEK -9999
REPL WRITER
COPY 10 T
MARK PROXYREAD
COPY F M
SUBI T 1 T
TJMP PROXYREAD
WIPE
JUMP DONE
MARK DONE
HALT