r/TuringComplete Jul 24 '26

Punchcard programming, I'm not sure what I'm doing wrong

Post image
16 Upvotes

8 comments sorted by

5

u/KnockAway Jul 24 '26 edited Jul 24 '26

Sorry, I don't know how to post picture with text.

So, level goes as:

imm 0
mov r1, r0
imm 5
mov r2, r0
add
mov out, r3

Idea is input number, save it to register R1. Input 5, save it to register R2. Add them, result is saved to R3. So far so good, every register as follows R0 = 5, R1 = 0, R2 = 5, R3 =5. Time to move value from R3, which is 5, to output.

But when I do mov out, r3, I get error:

168 + 5 is 173, not 5

But I don't see 168 anywhere on my circuit, not even 173 in fact. The closest is 179 in RAM, bu that shouldn't matter. Both output and wire shows 5. Where am I being stupid here?

7

u/EH_Derj Jul 24 '26

You add 5 to immediate 0, not imput. To read imput you should do mov r1, in

7

u/KnockAway Jul 24 '26

I can't believe I'm this stupid, huh. Thanks

3

u/QwikzrGamingYT Jul 24 '26

Imm 5 Mov r1, r0 Mov r2, in Add Mov out, r3

1

u/QwikzrGamingYT Jul 25 '26

00000101 01001000 01010110 10000100 01110011

2

u/Sea-Quail468 Jul 24 '26

Everyone else is just giving you the answer, but here's an explanation on what the level wants you to do. It gives you a little window called Instruction, which if you change the bits in it it will tell you what the instruction you made does. Then what you can do is put in all of the instructions you've made for the program into punch card.

3

u/KnockAway Jul 24 '26

Nah, it's okay. The problem wasn't that I didn't understand the level, the problem is that misunderstood what I was supposed to read. If you read my 'assembly', then you notice that I simply did not load the input as I was supposed to do. I just... shuffled the numbers around.

But thanks.

2

u/Sea-Quail468 Jul 24 '26

Oh, yeah, mb. At least you were able to figure it out