Skip to content

Commit 094624b

Browse files
committed
Update to 0.5.8
1 parent a7c9db5 commit 094624b

File tree

8 files changed

+516
-170
lines changed

8 files changed

+516
-170
lines changed

FAL_REFERENCE.docx

-805 Bytes
Binary file not shown.

FAL_REFERENCE.pdf

-948 Bytes
Binary file not shown.

changelog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
---------------------------------------------------------------------------------------------------
2+
Version: 0.5.8
3+
Date: 15. 12. 2019
4+
Features:
5+
- Added compact FAL's wiki
6+
Changes:
7+
- Changed FAL REFERENCE
8+
Notes:
9+
- This update for Factorio 0.17 and updated by ZwerOxotnik
10+
- I need much more tests, fix UI style etc
11+
---------------------------------------------------------------------------------------------------
212
Version: 0.5.7
313
Date: 14. 12. 2019
414
Features:

constants.lua

Lines changed: 272 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,275 @@ STEP_SIGNAL = {signal = { type = "virtual", name = "signal-mc-step"}, count = 1}
55
SLEEP_SIGNAL = {signal = { type = "virtual", name = "signal-mc-sleep"}, count = 1}
66
JUMP_SIGNAL = {signal = { type = "virtual", name = "signal-mc-jump"}, count = 1}
77
OP_NOP = {type = 'nop'}
8-
MC_LINES = 32
8+
MC_LINES = 32
9+
10+
-- {type = "instruction", name = ""}
11+
-- {type = "description", name = "", with_example = true}
12+
-- with_note = true
13+
14+
local OLD_HELP_TEXT = [[
15+
-- Registers (Read/Write):
16+
mem1 mem2 mem3 mem4 out
17+
-- Registers (Read Only):
18+
mem5/ipt : Instruction pointer index
19+
mem6/cnr : Number of signals on the red wire
20+
mem7/cng : Number of signals on the green wire
21+
mem8/clk : Clock (monotonic, always runnning)
22+
-- Modules:
23+
You can connect RAM Modules or other MicroControllers by placing
24+
them above or below this MicroController.
25+
External memory is mapped to:
26+
mem11-14 (North Port 1)
27+
mem21-24 (South Port 1)
28+
mem31-34 (North Port 2)
29+
mem41-44 (South Port 2)
30+
MicroControllers can only connect to North and South port 1.
31+
--- Wires:
32+
red1 red2 redN...
33+
green1 green2 greenN...
34+
--- Pointers:
35+
mem@N : Access memN where X is the value at memN
36+
red@N : Access redX where X is the value at memN
37+
green@N : Access greenX where X is the value at memN
38+
--- Glossary:
39+
Signal : A type and integer value.
40+
Value : The integer value part of a signal.
41+
Move : Copy a signal from one source to another.
42+
Set : Set the Value of a register.
43+
Register : A place that can store a signal.
44+
Clear : Reset a register back to Black 0 (the NULL signal).
45+
Find signal : Looks for a signal that has the same type
46+
as the type stored in a register.
47+
Label : A text identifier used for jumps.
48+
--- Key:
49+
W = Wire, I = Integer
50+
M = Memory, O = Output
51+
R = Register (Memory or Output)
52+
L = Label (:id)
53+
------- OP CODES ---------
54+
OP A B : DESCRIPTION
55+
------------:-------------
56+
MOV W/R R...: Move signal from [A] to register(s).
57+
SET M/I R : Set [B] signal count to [A].
58+
SWP R R : Swap [A] with [B].
59+
CLR R... : Clear register(s). Clears all if none specified.
60+
FIR R : Find signal R from the red wire and move to mem1.
61+
FIG R : Find signal R from the green wire and move to mem1.
62+
JMP M/I/L : Jump to line [A] or label.
63+
HLT : Halt the program.
64+
NOP : No Operation.
65+
--- Arithmetic Op Codes:
66+
All arithmetic ops ignore type, type in mem1 is preserved.
67+
ADD M/I M/I : Add [A] + [B], store result in mem1.
68+
SUB M/I M/I : Subtract [A] - [B], store result in mem1.
69+
MUL M/I M/I : Multiply [A] * [B], store result in mem1.
70+
DIV M/I M/I : Divide [A] / [B], store result in mem1.
71+
MOD M/I M/I : Modulo [A] % [B], store result in mem1.
72+
POW M/I M/I : Raise [A] to power of [B], store result in mem1.
73+
DIG M/I : Gets the [A]th digit from mem1, store result in mem1.
74+
DIS M/I M/I : Sets the [A]th digit from mem1 to the 1st digit from [B].
75+
BND M/I M/I : Bitwise [A] AND [B]
76+
BOR M/I M/I : Bitwise [A] OR [B]
77+
BXR M/I M/I : Bitwise [A] XOR [B]
78+
BNO M/I : Bitwise NOT [A]
79+
BLS M/I M/I : Bitwise LEFT SHIFT [A] by [B]
80+
BRS M/I M/I : Bitwise RIGHT SHIFT [A] by [B]
81+
BLR M/I M/I : Bitwise LEFT ROTATE [A] by [B]
82+
BRR M/I M/I : Bitwise RIGHT ROTATE [A] by [B]
83+
--- Test Op Codes:
84+
Test Ops will skip the next line if the test is successful.
85+
TGT M/I M/I : Tests if [A] value greater than [B] value.
86+
TLT M/I M/I : Tests if [A] value less than [B] value.
87+
TEQ M/I M/I : Tests if [A] value equals [B] value.
88+
TNQ M/I M/I : Tests if [A] value does not equal [B] value.
89+
TTE M M : Tests if [A] type equals [B] type.
90+
TTN M M : Tests if [A] type does not equal [B] type.
91+
--- Blocking Op Codes:
92+
Blocking Ops will pause the program until the operation is complete.
93+
SLP M/I : Sleep for [A] ticks.
94+
BKR M/I : Block until there's [a]+ signals on the red wire.
95+
BKG M/I : Block until there's [a]+ signals on the green wire.
96+
SYN : Blocks until all other connected microcontrollers SYN.
97+
--- Interrupts:
98+
You can send interrupting signals to a microcontroller.
99+
There are: HLT (halt), RUN (run), STP (step), SLP (sleep) and JMP (jump).
100+
If a microcontroller receives any one of these signals it will
101+
execute them immediately.
102+
-------------------------------------------------------------------------
103+
-------------------------------------------------------------------------
104+
-- Example 1:
105+
# Outputs the first signal
106+
# from red multiplied by 2.
107+
mov red1 mem1
108+
mul mem1 2
109+
mov mem1 out
110+
jmp 2
111+
-- Example 2:
112+
# accumulates first 4
113+
# signals on the red wire.
114+
:SETUP
115+
clr
116+
set 11 mem2
117+
set 1 mem3
118+
:LOOP
119+
mov red@3 mem1
120+
add mem1 mem@2
121+
mov mem1 mem@2
122+
:NEXT
123+
add mem2 1
124+
tlt mem1 15
125+
set 11 mem1
126+
mov mem1 mem2
127+
add mem3 1
128+
tlt mem1 5
129+
set 1 mem1
130+
mov mem1 mem3
131+
jmp :LOOP
132+
]]
133+
134+
local BIS_DESCRIPTION = [[
135+
local BIS_DESCRIPTION = [[
136+
<:I> specifies a parameter that takes a literal integer.
137+
<:R> specifies a parameter that takes a register address.
138+
<:W> specifies a parameter that takes a register address.
139+
<:L> specifies a parameter that takes a register address.
140+
]]
141+
142+
local EXAMPLE1 = ":LOOP\njmp :LOOP"
143+
local EXAMPLE2 = "fig mem21\nmul mem1 2\nmov mem1 out"
144+
local EXAMPLE3 = ":60 second clock.\nadd mem1 1\nmod mem1 60\njmp 1"
145+
local EXAMPLE4 = [[
146+
mov red1 mem1
147+
mul mem1 2
148+
mov mem1 out
149+
]]
150+
local EXAMPLE5 = [[
151+
clr
152+
set 11 mem2
153+
set 3 mem2
154+
:loop
155+
mov red@3 mem1
156+
add mem1 mem@2
157+
mov mem1 mem@2
158+
add mem2 1
159+
tlt mem1 15
160+
set 11 mem1
161+
mov mem1 mem2
162+
add mem3 1
163+
tlt mem1 5
164+
set 1 mem1
165+
mov mem1 mem3
166+
]]
167+
168+
DOCS = {
169+
{
170+
name = "overview",
171+
content = {
172+
{name = "registers"},
173+
{name = "mapped-memory"}
174+
}
175+
},
176+
{
177+
name = "glossary",
178+
content = {
179+
{name = "signal_glossary"},
180+
{name = "type_glossary"},
181+
{name = "value_glossary"},
182+
{name = "move_glossary"},
183+
{name = "set_glossary"},
184+
{name = "register_glossary"},
185+
{name = "clear_glossary"},
186+
{name = "null_glossary"},
187+
{name = "label_glossary"}
188+
}
189+
},
190+
{
191+
name = "basic_instructions_set",
192+
content = {
193+
{example = BIS_DESCRIPTION},
194+
{name = "description_BIS"},
195+
{name = "comments_BIS", syntax = "#<comment>"},
196+
{name = "labels_BIS", syntax = "#<label>", example = EXAMPLE1},
197+
{name = "NOP_BIS", syntax = "nop"},
198+
{name = "MOV_BIS", syntax = "mov <SRC:W/R> <DST:R>"},
199+
{name = "SET_BIS", syntax = "set <SRC:I> <DST:R>"},
200+
{name = "SWP_BIS", syntax = "swp <SRC:R> <DST:R>"},
201+
{name = "CLR_BIS", syntax = "clr <DST:R>…"},
202+
{name = "FIG_BIS", syntax = "fig <SRC:R>", example = EXAMPLE2},
203+
{name = "FIR_BIS", syntax = "fir <SRC:R>"},
204+
{name = "JMP_BIS", syntax = "jmp <SRC:I/R/L>", example = EXAMPLE1},
205+
{name = "HLT_BIS", syntax = "hlt <SRC:R>"}
206+
}
207+
},
208+
{
209+
name = "arithmetic_instructions",
210+
content = {
211+
{name = "ADD_AI", syntax = "add <SRC:I/R> <DST:I/R>"},
212+
{name = "SUB_AI", syntax = "sub <SRC:I/R> <DST:I/R>"},
213+
{name = "MUL_AI", syntax = "mul <SRC:I/R> <DST:I/R>"},
214+
{name = "DIV_AI", syntax = "div <SRC:I/R> <DST:I/R>"},
215+
{name = "MOD_AI", syntax = "mod <SRC:I/R> <DST:I/R>", example = EXAMPLE3},
216+
{name = "POW_AI", syntax = "pow <SRC:I/R> <DST:I/R>"},
217+
{name = "DIG_AI", syntax = "swp <SRC:I/R>"},
218+
{name = "DIS_AI", syntax = "dis <SRC:I/R> <DST:I/R>"},
219+
{name = "BND_AI", syntax = "bnd <SRC:I/R> <DST:I/R"},
220+
{name = "BOR_AI", syntax = "bor <SRC:I/R> <DST:I/R>"},
221+
{name = "BXR_AI", syntax = "bxr <SRC:I/R> <DST:I/R>"},
222+
{name = "BND2_AI", syntax = "bnd <SRC:I/R>"},
223+
{name = "BLS_AI", syntax = "bls <SRC:I/R> <DST:I/R>"},
224+
{name = "BRS_AI", syntax = "brs <SRC:I/R> <DST:I/R>"},
225+
{name = "BLR_AI", syntax = "blr <SRC:I/R> <DST:I/R>"},
226+
{name = "BRR_AI", syntax = "brr <SRC:I/R> <DST:I/R>"}
227+
}
228+
},
229+
{
230+
name = "test_instructions",
231+
content = {
232+
{name = "TGT_TI", syntax = "tgt <SRC:I/R> <DST:I/R>"},
233+
{name = "TLT_TI", syntax = "tlt <SRC:I/R> <DST:I/R>"},
234+
{name = "TEQ_TI", syntax = "teq <SRC:I/R> <DST:I/R>"},
235+
{name = "TTE_TI", syntax = "tte <SRC:R> <DST:R>"},
236+
{name = "TTN_TI", syntax = "ttn <SRC:R> <DST:R>"}
237+
}
238+
},
239+
{
240+
name = "blocking_instructions",
241+
content = {
242+
{name = "SLP_BI", syntax = "slp <SRC:I/R>"},
243+
{name = "BKR_BI", syntax = "bkr <SRC:I/R>"},
244+
{name = "BKG_BI", syntax = "bkg <SRC:I/R>"},
245+
{name = "SYN_BI", syntax = "SYN"}
246+
}
247+
},
248+
{
249+
name = "interrupt_signals",
250+
content = {
251+
{name = "HLT_IS"},
252+
{name = "RUN_IS"},
253+
{name = "STP_IS"},
254+
{name = "SLP_IS"},
255+
{name = "JMP_IS"}
256+
}
257+
},
258+
{
259+
name = "pointers",
260+
content = {
261+
{name = "MEM_pointer"},
262+
{name = "RED_pointer"},
263+
{name = "GREEN_pointer"}
264+
}
265+
},
266+
{
267+
name = "example_programs",
268+
content = {
269+
{name = "MULTIPLY_INPUT_EP", example = EXAMPLE4},
270+
{name = "ACCUMULATE_INPUT_EP", example = EXAMPLE5},
271+
}
272+
},
273+
{
274+
name = "old-help-text",
275+
content = {
276+
{example = OLD_HELP_TEXT}
277+
}
278+
}
279+
}

0 commit comments

Comments
 (0)