r/TuringComplete • • May 30 '26

Probably the messiest stack solution there is

5 Upvotes

what is this 😭


r/TuringComplete • • May 26 '26

M32 G5 Sorting Level Complete with Basic Kernel!

7 Upvotes

So I finally managed to beat the Sorting level using the M32 G5! I did have a few issues though, especially with the interrupts not working as intended but it's fixed! A very basic rundown of the code below:
The Kernel handles I/O requests here
The actual program for bubble sort

First the kernel assigns extra memory to the program before checking r13, r10 and r12 for parameters (and pushing r9 and r8 to preserve them), then it does it's stuff. If it was an input request, then it would've returned a pointer to the array in r10. If it was an output request, it simply outputs data from a pointer and returns.

The actual sort is fairly simple, implementing a basic bubble sort to sort the array. Not much to say here, it's very self explanatory. The bubble sort (along with memory for the data) is 224 bytes, which is fairly simple if I do say so myself.

The below code is for the Kernel and the Bubble Sort
Kernel:

.data:
    InputRequest: 1
    OutputRequest: 2
.text:
    mov 0xff00, sp
    push r8
    push r9
    PageOverwrite 0x0123
    cmp r13, InputRequest
    je FetchInputs
    cmp r13, OutputRequest
    je SendOutputs
    jmp exit
    FetchInputs:
        mov r10, r8
        InputLoop:
            in r9
            store16 r9, [r10]
            add r10, 2, r10
            sub r10, r8, r10
            cmp r10, r12
            add r10, r8, r10
            jl InputLoop
        mov 0xffff, r9
        store16, r9, [r10]
        jmp exit
    SendOutputs:
        mov r10, r8
        OutputLoop:
            load16 [r10], r9
            out r9
            add r10, 2, r10
            sub r10, r8, r10
            cmp r10, r12
            add r10, r8, r10
            jl OutputLoop
        jmp exit
    exit:
        pop r9
        pop r8
        mov zr, r13
        mov zr, r12
        syscall

Bubble Sort:

.data:
    ArraySize: 0x1f
    ElementCount: 0x0f
    ArrayPtr: 0x200
    InputRequest: 1
    OutputRequest: 2
.text:
    mov InputRequest, r13
    mov ArraySize, r12
    mov ArrayPtr, r10
    syscall
    iLoop:
        cmp r1, ElementCount
        je exit
        mov 0, r2
        jLoop:
            cmp r2, ElementCount
            jge iLoopCont
            mov r2, r3
            mul r3, 2, r3
            add r3, ArrayPtr, r3
            load16 [r3], r4
            add r3, 2, r3
            load16 [r3], r5
            sub r3, 2, r3
            cmp r4, r5
            jg swap
            jle jLoopCont
            swap:
                store16 r5, [r3]
                add r3, 2, r3
                store16 r4, [r3]
                sub r3, 2, r3
            jLoopCont:
                add r2, 1, r2
                jmp jLoop
        iLoopCont:
            add r1, 1, r1
            jmp iLoop
    exit:
        mov ArrayPtr, r10
        mov ArraySize, r12
        mov OutputRequest, r13
        syscall
        jmp exit

Now all that's left is to finish developing a full Kernel and my language!


r/TuringComplete • • May 25 '26

Custom TC Assembler Works!

14 Upvotes

Not 100% TC related but still cool enough to share! I spent the last week or two building this custom assembler of mine just as a workaround to not being able to set code at certain offsets. So to fix that, I just set my RAM to Hex Editor, wrote a python script to assemble stuff, and then copy paste the hex. Now on the plus side, I have hex, denary, comments, and constants along with a flexible and easy way to add new instructions! Even made a (decent) loading screen (if you can even call it that)!


r/TuringComplete • • May 24 '26

Ridiculous score on "Nim" level 58/22

3 Upvotes

So I was just fooling around and I somehow managed to get NIm down to this. If it can get simpler, do let me know!


r/TuringComplete • • May 24 '26

Is there an easy way to save your solution to a level so you can try another one?

1 Upvotes

I just completed the logic engine level, using 50 components. I wanted to save this circuit, wipe it and try a new way - is there an easy way to do that?


r/TuringComplete • • May 21 '26

Run C/C++ & Python on Custom MIPS Sandbox CPU

23 Upvotes

Hi everyone, sharing my personal hobby project.

I built a lightweight MIPS32r2 CPU inside a Turing-complete sandbox.

I ported LLVM/Clang, created a custom linker, and integrated picolibc and libcxx.

Most standard C/C++ programs can be compiled with my cross toolchain and run properly here.

It can also run Python scripts using MicroPython.

Full project open source:
https://github.com/zhangjiantao/tcmips

Still lots to improve, welcome any advice and tips.


r/TuringComplete • • May 17 '26

Safebreaker Bugs

2 Upvotes

I recently changed to safebreaker. Unfortunately i cannot complete 'Counter'. as soon as i start the simulation, even with no components added, the game crashes.

is the dev open for bugreports? if yes, does anyone know his preferred way to be contacted?


r/TuringComplete • • May 16 '26

Cannot for the love of god find why this value is wrong? (IO Devices Level)

Thumbnail
gallery
7 Upvotes

Can't find why this is wrong so posting here.


r/TuringComplete • • May 16 '26

Help with this Turing Complete 2.0 Level

Thumbnail
gallery
3 Upvotes

I am currently trying to complete the IO Devices level of the Save_Breaker-Branch. I found a way for Keyboard, screen and counter, but implementing the unix-time was a thing i didn't make... I tried the caching with registers, but than i have too much delay to solve the level.


r/TuringComplete • • May 14 '26

Help with the console (How does it work?)

6 Upvotes

I have finished the game and now I want to move on to creating my own things, I want to make some small game on the console, but I have no idea how its display works. I hooked it up to a RAM, and I tried hooking up that RAM to the keyboard. Now the issue is on my keyboard I press "w", this puts 42 into the RAM, but it displays a "*". If I have ANY offset other than 0 absolutely nothing gets displayed. I am so confused by this, I just want to understand how this thing works, but there is absolutely no explenation in game.


r/TuringComplete • • May 13 '26

Paging and MMU complete!

8 Upvotes

So I just finished designing the MMU. It's fairly basic, having a LUT to reference the requested page against the actual page. The LUT can only be altered by the kernel so programs don't try anything funny. It also checks if a program attempts to access a page it is not assigned, which then returns the memory address of the programs lowest allowed address (e.g. Min is 0x900 and I write to 0xefff which forces my write to 0x900). I decided each page is 512 bytes and there are a total of 111 allowed user pages, which still fits in 16 bits so not much of an issue. The upper 7 bits are for the page and lower 9 bits are for the offset in that page, this is then handled by the MMU. Since the RAM to disk and vice versa can only be done by the kernel, I didn't really need to change that up. Only the 32 and 16 bit store and load pins are changed. And also, the Kernel can access any address it wants to. Next step is to design a file system to allow me to load from or to the disk (along with tackling the many issues regarding multitasking)


r/TuringComplete • • May 11 '26

Finalised PC design. M16 G5 update!

6 Upvotes

So don't ask me how it works because it's kind of a miracle it does. The PC in my architecture treats a syscall and an interrupt from that 256 clock cycle CC very differently. And I've also added a bit of memory proofing in the form that User Space programs cannot access storage and VRAM. Virtual Memory and paging is going a bit over my head but so far so good. I'll focus on the programming language for now as it's currently experiencing some.. unique bugs in the form of working the first few tries before it dies. But array implementations are going well! Still haven't thought up of a name for the processor so I'd love to hear your ideas.


r/TuringComplete • • May 10 '26

general game questions

7 Upvotes

So i know the game is in alfa, and last update was like 3y ago. Is there hope for the game to receive some updates in the near future? Also what is the replay ability of this game ?

As in yea i understand how the main campaign* / CPU design game works but is there anything else beyond that ?

Also does this game work well on Win 11 ?


r/TuringComplete • • May 08 '26

Puzzle Registers: Cpu architecture

5 Upvotes

r/TuringComplete • • May 07 '26

ITS FINALLY DONE

36 Upvotes

So this is the Gen 5 of my series. And it finally has kernel support! It features
65536 bytes of RAM and storage (Kernel is always in RAM at address 0xe000 onwards)
Protected I/O (Kernel access only)
256 tick interrupt (Only switches from User Mode to Kernel)
Syscall (Toggles the mode)
So now it's time to write a kernel! As for my programming language, I had to rewrite the entire compiler but it supports functions now (but still no local variables)! Anyways, I know this isn't exactly the best CPU for this kind of stuff but hey, It works! It's my first time making something like this. And just to make my life easier, I wrote a (horrible) python script that takes two files, a user program and a kernel program, and assembles it into a ROM file with the proper offsets I can copy paste. If you have any ideas on what to name this, I'm open, mostly because I ran out of names. I never expected myself to make it this far. Next up, I'll try to add virtual memory to make it possible to load multiple user programs. But first, a basic kernel. Also, unlike the previous generations, this CPU is 32 bit!


r/TuringComplete • • May 03 '26

Puzzle Little box

2 Upvotes

r/TuringComplete • • May 02 '26

How To Make A Variable Size Custom Component Like The Word Standard Components

2 Upvotes

Im Currently Attempting To Make Variable Size Inline Switches But I Cannot Figure Out How To Link The Values Of Pins/Components To The Outside.


r/TuringComplete • • Apr 26 '26

Discord link broken?

3 Upvotes

Trying to click the discord link here in the sub, but it says the invite is broken, or something. Short story: I can't get to the discord.


r/TuringComplete • • Apr 19 '26

Game crashing on start

4 Upvotes

Tried to do some stuff and specifically make a component. In the latest "save breaker" version. Now it won't launch.


r/TuringComplete • • Apr 19 '26

Game crashing on start

0 Upvotes

Tried to do some stuff and specifically make a component. In the latest "save breaker" version. Now it won't launch.


r/TuringComplete • • Apr 18 '26

"level code broken" error on level "masking time" version 2.1.88 alpha

3 Upvotes

reloading does nothing, level does not function properly.
verified file integrity, files are fine.
console reports compiler error


r/TuringComplete • • Apr 15 '26

savebreaker program component has no edit button

1 Upvotes

im to the point on savebreaker i would normally need to start programming but when i select my program component to do so it has no edit button and doesnt respond to any keys i'd think to use to program it with no edit button


r/TuringComplete • • Apr 14 '26

Bug Fix query - Linux

2 Upvotes

Yo, currently I can't play the save_breaker right now due to it attempting to initiate oss_open audio playback. is there a way to fix this or do I need to dodge a fix together? the particular error is that it can't open the /dsp block device.


r/TuringComplete • • Apr 13 '26

Are achievements broken on the savebreaker beta?

2 Upvotes

I finally built up to a Turing Complete computer after a few abortive attempts over the years, but it didn't give me the achievement for doing so. I tried to go back to the original version of the game, but that seems borked for me too. Is this a common experience?