Turing Complete

Turing Complete

View Stats:
Tandem Apr 9, 2024 @ 7:13pm
Code wont jump to 'label'
In the level "spacial invasion" I use the following code, but it never jumps back to the labels and instead runs through all the blank bytes in memory before restarting. What am I missing?

#Opcodes const reg0_to_out 0b10000110 const in_to_reg3 0b10110011 const if_zero 0b11000001 const always 0b11000100 const up 1 const wait 3 const shoot 5 shoot reg0_to_out up reg0_to_out reg0_to_out reg0_to_out reg0_to_out reg0_to_out label checkForRats in_to_reg3 doNothing if_zero shoot reg0_to_out checkForRats always label doNothing wait reg0_to_out checkForRats always
< >
Showing 1-3 of 3 comments
uNiels 💗 Apr 10, 2024 @ 12:35am 
Your code certainly looks like it should loop back.

So maybe your condition component doesn't handle the "always" condition correctly?

To debug it, set a breakpoint at one (or both) of the "checkForRats always" lines (click at the very beginning of the line and a red dot should appear), then click Run / F6 and it will run up to that line and pause there.

As it will have paused on the register loading with the label value (i.e. on "checkForRats"), click Next / F5 once so it advances forward to the "always" branch instruction.

(alternatively, you could also move your "always" instruction onto a separate line; that way you could set a breakpoint directly at the "always")

In that state, check the output of your condition component. It ought to output a 1 / On. It's possible that it doesn't, which would mean it ignores the branch.

If it is indeed 1 / On, though, it might be that your branching circuitry fails to load a new value into the counter in another way. So also check that your Counter's "Overwrite" input receives a 1 / On signal.
Last edited by uNiels 💗; Apr 10, 2024 @ 12:41am
Tandem Apr 10, 2024 @ 8:18pm 
yep my condition component turned out to be the culprit. Thanks for the help!
uNiels 💗 Apr 11, 2024 @ 6:06am 
My pleasure

I also played around a bit with "The Lab" (don't remember when it unlocks), but I only came up with a convoluted way to test jumps/branches and wasn't able to use expect with the program counter. So I guess the usefulness of "The Lab" for testing jumps and branches is currently limited.
Last edited by uNiels 💗; Apr 11, 2024 @ 6:06am
< >
Showing 1-3 of 3 comments
Per page: 1530 50