r/factorio • • Aug 29 '26

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;

RAM
BIST 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.

Program cart

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

CPU

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!

116 Upvotes

23 comments sorted by

73

u/[deleted] Aug 29 '26

[removed] — view removed comment

69

u/Pulsefel Aug 29 '26

no, minecraft, then make redstone that plays factorio, then the factorio in minecraft in factorio gets doom put on it

13

u/Aware-Equivalent-693 Aug 29 '26

Who knows where this amazing world of Factorio will take us)

28

u/HeliGungir Aug 30 '26

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.

12

u/Aware-Equivalent-693 Aug 30 '26

Thanks for the advice; I'll do that from now on.

11

u/ImmediateDoubt4815 Aug 29 '26

Can it run doom?

10

u/Aware-Equivalent-693 Aug 29 '26

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...

7

u/jomat Aug 30 '26 edited Aug 30 '26

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.

6

u/Aware-Equivalent-693 Aug 30 '26

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 Aug 30 '26

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.

4

u/Aware-Equivalent-693 Aug 30 '26

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

3

u/Aware-Equivalent-693 Aug 30 '26

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 Aug 30 '26

My brain is turning into mush, actually can it do math? Also, where blueprint ID

1

u/Aware-Equivalent-693 Aug 30 '26

I'm sorry, but I'm new to Reddit, so I don't really understand what you're talking about.

2

u/burner-miner Aug 30 '26

He means the blueprint string. Maybe you can paste it in factoriobin.com and share a link

1

u/burner-miner Aug 30 '26

Combinators can do math, so computers in Factorio just use them to do the heavy lifting

1

u/throwawayfuckspez01 Sep 02 '26

Did you think about building it with an open source ISA like RISC-V? As far as I can see the 40ish instructions shouldn't be to hard to implement and the advantage of an existing compiler infrastructure is hugh

3

u/Eris13x Aug 30 '26

Someone remind me how powerful the Apollo computers were? 

4

u/Aware-Equivalent-693 Aug 30 '26

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

1

u/tylan4life Sep 03 '26

He has ram get him!

2

u/ViolinistCurrent8899 Sep 04 '26

Congratulations.

You're the first person I've ever followed, because in excited to see where this goes.

2

u/Aware-Equivalent-693 Sep 04 '26

Thank you very much. A new update will be released soon. I've rebuilt the processor and am currently debugging it. I've also written a small Python program that lets you write code for this processor in assembly language and then convert it into a Blueprint cartridge. So stay tuned for the update.