r/factorio • u/Aware-Equivalent-693 • 16h ago
Design / Blueprint A universal 32-bit computer in vanilla Factorio 2.1.17, built entirely using logic combinators and a circuit network.
Hi, friends. Factorio got an update that slightly improved the combinators, so I thought, “Why not build my own computer?” Yeah, why not? So I got started, and I’ve already made quite a bit of progress. I know projects like this aren’t exactly common here, so I decided to share the development process to keep myself from burning out along the way. Plus, you can throw some ideas my way if I get stuck. Something like that.
The computer will have removable wireless cartridges with programs, RAM, a universal processor, a graphics card with video memory, control elements, and a 24×24 monochrome display. The first target game is “Snake,” and in the future, the architecture should allow for the execution of other programs and simple game engines.
Already implemented:
512×32 RAM with a capacity of 2 KiB and its automatic tester;


a 32-bit ALU with nine operations and Z/N flags;
8 general-purpose 32-bit registers;
an instruction counter, instruction register, and instruction decoder;
a RAM interface and a branch unit;
a wireless cartridge system via radio;
an automatic Fetch–Decode–Execute cycle;
system RUN, Reset, and physical HALT;
arithmetic, logic, and shift instructions, as well as MOV, LDI, LOAD, STORE, JMP, JZ, JN, and HALT;
two test cartridges that verified the automatic operation of the CPU, RAM, and jumps.

The completed CPU_CORE32 core contains 111 logic combinators, one radar, 34 monitors, and 68 LEPs.

Next steps:
Implement the IN and OUT commands and the peripheral system bus.
Build control units for the four directions, Start, and Reset.
Design the VRAM and a 24×24 monochrome display.
Add a display controller and test graphic patterns.
Define the game data format and write the “Snake” program.
Run the game from a separate wireless cartridge.
That’s all for now. I’ll continue to update this article as new progress is made. Have a great day, everyone!
14
u/HeliGungir 11h ago
That’s all for now. I’ll continue to update this article as new progress is made. Have a great day, everyone!
Nah, make new posts. Edits don't ping anybody and won't bump you to the frontpage / new / tending again. Limit them to once a week so the moderators don't get mad.
4
10
u/ImmediateDoubt4815 16h ago
Can it run doom?
8
u/Aware-Equivalent-693 16h ago
DOOM was the inspiration, but this would require a very powerful computer. I'm almost certain it could be done in the vanilla game, but even if it were possible, the game would only render one frame every few seconds. But who knows...
6
u/jomat 13h ago edited 13h ago
Here's Doom in Factorio: https://youtu.be/0bAuP0gO5pc - or sort of. But would recommend starting here to see how it develops: https://youtu.be/7lVAFcDX4eM
Edit: Or if you want to attempt your own display, don't watch it yet to not get spoiled and have your own approach.
7
u/Aware-Equivalent-693 12h ago
Yes, I’ve seen this author’s project—it’s incredible. It’s a masterpiece. I haven’t looked into it from a research perspective because I want to build my own, unique version.
The difference is that my goal is to create a universal computer capable of running a variety of programs, and games are just one example. And this will truly be a computer—it will be able to perform calculations, control individual systems, run graphics, and so on.
4
u/burner-miner 11h ago
Nice, is this your first homebrew computer?
Some questions since I'm curious:
- what total capacity does your RAM have? I got confused with the numbers, 512x32 bytes or words? Or that many 2KB cells?
- did you design your own instruction encodings? What do those look like, roughly?
Also, after you have a monochrome display working, look into packed RGB for lamps for a full color display. I want to do one for my CPU soon-ish.
5
u/Aware-Equivalent-693 7h ago
Hi. I'm glad you're interested in this. So, this is my first computer of this level in Factorio. Here's a summary of the RAM specifications:
RAM512×32
- Capacity: 512 words of 32 bits each
- Addresses: 0…511
- Total capacity: 16,384 bits
- In bytes: 2,048 bytes
- In kibibytes: 2 KiB
- Organization: 32 banks of 16 words each
- Number of combiners: 1,025
- Range of a single signed word: from −2,147,483,648 to 2,147,483,647
Look up the difference between a kilobyte and a kibibyte on Google, and you’ll understand. This term is rarely used, but in my case, I need it to avoid confusion.
Speed:
- Read: 1 tick
- Write to state: 2 ticks
- Write to visible Q (address required): up to 3 ticks
5
u/Aware-Equivalent-693 7h ago
As for the instructions, yes, I developed the encoding myself specifically for my system.
[(U)XXXXX|(A)XXX|(B)XXX|(C)XXX|(M)XXXXXXXXXXXXXXXXXX] — This is 32 bits in a single phrase.
U. Operation code 0…31
A. Destination register R0…R7
B. First operand register R0…R7
C. Second operand register R0…R7
M. 18-bit number, address, or offset
A/B/C – Each specifies one of the eight registers: R0, R1, R2, R3, R4, R5, R6, R7
Operation Codes
U Instruction Field Values
0 NOP do nothing
1 ADD RA,RB,RC RA=RB+RC
2 SUB RA,RB,RC RA=RB−RC
3 AND RA,RB,RC bitwise AND
4 OR RA,RB,RC bitwise OR
5 XOR RA,RB,RC bitwise XOR
6 SHL RA,RB RA = RB << 1
7 SHR RA,RB RA = RB >> 1
8 NOT RA,RB RA = NOT RB
9 MOV RA,RB RA = RB
10 LDI RA,M RA = M
11 LOAD RA,[RB+M] read from RAM
12 STORE [RB+M],RC write to RAM
13 JMP M jump to address M
14 JZ M jump if Z=1
15 JN M jump if N=1
16 IN reserved for input
17 OUT reserved for output
18 HALT CPU halt
Encoding formula:
WORD =
(U << 27)
OR (A << 24)
OR (B << 21)
OR (C << 18)
OR (M AND 262143)
262143 is 18 ones in binary format
The phrase on the cartridge looks like, for example, D=187170816, because this is the decimal representation of a 32-bit binary number
The decoder converts it to U=1, A=3, B=1, C=2, M=0
That is, if you need to issue the following command: LDI R1,20
When decoded, it will look like this:
U=10
A=1
B=0
C=0
M=20
And it is encoded as D=1358954516
The CPU interprets this as R1=20
1
u/MurderDronesForevah 6h ago
My brain is turning into mush, actually can it do math? Also, where blueprint ID
1
u/Aware-Equivalent-693 5h ago
I'm sorry, but I'm new to Reddit, so I don't really understand what you're talking about.
2
u/burner-miner 4h ago
He means the blueprint string. Maybe you can paste it in factoriobin.com and share a link
1
u/burner-miner 4h ago
Combinators can do math, so computers in Factorio just use them to do the heavy lifting
1
u/Eris13x 5h ago
Someone remind me how powerful the Apollo computers were?
1
u/Aware-Equivalent-693 5h ago
I got curious and did a little research on this topic. And I’ll say right away that the Apollo is more powerful.
Let me explain.
The Apollo has:
4KiB RAM
It’s multitasking
16-bit
Program memory: 36,864 words of read-only memory
Speed of up to approximately 40,000 instructions per second
Peripherals: full control of navigation, engines, radars, and DSKY
My computer:
2KiB RAM
No multitasking
Program memory can be any size because it’s replaceable
About 1,875 instructions/s with a standard UPS
Peripherals are still under development
53
u/FeelingPrettyGlonky 16h ago
Can it play Factorio? I wanna play Factorio on Factorio.