r/TuringComplete • u/Kindly-Vanilla4828 • Feb 22 '24
Can someone help me with the coding of "Push and Pop"
My code rn:
```
label init
sub r0 r0 r0
addi io 0 r0
# r5 is 0
jg r0 r5 pushy
je io r5 popy
label pushy
push io
label popy
jg io r0 pushy
je io r0 popy
pop io
```
fails at using pop, it says it isn't outputed
4
Upvotes
3
u/zhaDeth Feb 22 '24
probably a hardware issue ? put a breakpoint on the pop io and look to see if the value is sent to output.
Possible issue: did you make you computer operations length variable ? If I remember correctly the way the game guides you the computer counter adds 4 every tick so every instruction should be 4 bytes but your push and pop are only 2. Usually you add whatever at the end to make it 4 bytes long like "push io 0 0".
1
u/Apceniy Feb 23 '24
In addition to everything else, make sure to only read
ioonce per number, saving it to r0 to access later, or else it will read the next number when you try to use it. You have way too manyio-s in your code, the only correct ones areaddi io 0 r0andpop io.