fCPU


Factorio Customizable Processing Unit. Allow to write any logic on low level machine code. The fCPU acts like a programmable microcontroller with a vector coprocessor that supports many useful instructions.

Content
3 months ago
0.18 - 1.1
8.51K
Logistic network Circuit network

i Separate output into Red and Green

3 years ago

Hi,

To combine fCPU with LTN mod and create a powerful automaton, I tried to create a program that iterates through the content of inputs to do some check and control the program from the outside.

Still, I didn't see any option to iterate through red or green I have to write red1, could it be interesting to add the option of red@1 and allow threat it as an array? It'll make more powerful also the cnr, cng registries.

Thanks!

3 years ago

You may use this code as example. It iterate through all signals in red wire and copy them to r1...r7 registers, register r8 is used as index.

clr
:loop
mod r8 cnr ; this line limits input signals count
mod r8 7 ; this line limits the destination registers count
inc r8 ; increment counter
mov r@8 red@8 ; copy signal from red[r8] to r[r8]
sst r8 r@8 ; copy signal type from  r[r8]
emit r8 ; just output last value
jmp :loop

And you already could use red@1 (in example I used r8 for this, but this syntaxis work with any register).

3 years ago

F##### awesome, thank you very much for your help. One last question, maybe not very much related but, would it be possible to have outr for red, outg for green or it's that a factorio limitation with the outputs?

3 years ago
(updated 3 years ago)

This is a really handy feature. I will try to implement this in one of the following versions.
For now, you can use auxiliary combinators to split the outputs. By adding two comparison combinators, the first will pass all signals greater than 0, and the second lesser than 0.

3 years ago
(updated 3 years ago)

Or you could do somthing with buffering the output after selecting a channel

positive: you can have much more outputs, as many as signals you don't need for anything
negative: short refresh times where the output of the logics are not stable

here an example setup:
0eNrtW1GPIjcM/i/zWqjixE5iHiq1/Ql9rE6IhbnbkZYBDcOpqxP/vR5YkSzL3sE4uutJfVntwPCNY3+f7eDwpXp42tfbrmn7avalapabdlfN/v5S7ZpP7eJpeK1/3tbVrGr6el1NqnaxHq5W9bJZ1d10uVk/NO2i33TVYVI17ar+p5rB4cOkqtu+6Zv6hHa8eJ63+/VD3ckNZ5xmvd3segH6uNzuBV6u5FObdniwIE0xmkn1LP94MPKAVdPVy9P7dlKJsX23eZo/1I+Lz42YIB/62DwJ3Dtr+Nx0/V5eOT/+d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0cyrJnjFJnsRZd0z+u675ZzuXt1RFsdzqk1e36+c2LGeyZdvt2WNOuHqAGvF2/GFYnNm22dbc4WVL9Uh2OK2/bk3HH59nhz6eurtv8NFqzkgZB7m265b7pj5cwuOaKb9zXDr5d8dRwUuvFU7/STb56wdU56o9T1DPXiJnbRXc0c1b9Jh/Y7Pvt/g7I+nPdPfePTfvphL19nh9pNf/YbdbzphWwatZ3+/qK2+Fdt+Ol2yffisrkFMSuXl1i0W0hxNEhhO8Zwt9/lhC6e2Lkb4sR3Rsj+iEy++s/GKNvC8NeiMxdvn2fyCbXaRHeCa0fHVr4P7Tf0tNlaPGe0PpbQxvfCW04r3hdr5r9elo/yRK6Zjndbp7qq8GVmL5W7s1ph94u7ZpNUWUT3GeTv80mHluBDH9PCfz501ag1yKw94hgGPDfUqGG+8blse8bxJ8kj1263X69Ebw7hu9kMng3vKDJGy8hvpnAb1c/WCVGH39rM8t+mjOpxPm7E2siYEDZDAcwsiE+HP4FEcx8Hg==

example uses A, B, C as memory selectors, but you could also use just A and use the value of it for discriminating betweeen memory cells

New response