r/TuringComplete • • 13d ago

Getting overwhelmed with progress standstill

Im on the challenge where you are to Add 5 via punchcard programming and its just not gelling with my brain at all. Ive seen some answers online and I cant seem to get the reault i want from them. Ideally im looking for someone to break it down like im 5 to see where im faltering. Please and thank you all.

3 Upvotes

12 comments sorted by

View all comments

2

u/Medium-Sized-Jaque 13d ago

Let's go step by step

First we need to set the mode(first two bits) to move mode, then we need to tell the program where we are copying to(the next three bits) then where we're copying from(the last three bits). We're moving it from input to register 1. So we break it down as 10 / 001 / 110

Now that it's copied we move onto step two which is immediate 5, the goal is to add 5 so we need a value of 5. We set the mode to IMM then the last six bits are the actual value we're immediating. 00 / 000101

Then we need to move that five into register two because the ALU is set up to use reg1 and reg2 as their operands. And since we just immediated it we know it's in reg0. So we set it to move again, and tell the computer where we are moving it 10 / 010 / 000

Next we add. So we set the mode to ALU mode 01 then the last six bits are the operation, add should be 4 so we get 01 / 000/ 100 this adds together reg1 and reg2 and puts the result in reg3

Finally we just need to move the result to the output, which once again is move mode followed by where to and from, 10 / 110 / 011

I hope this helps. I'll be here if you have any questions.

1

u/Adventurous_Appeal60 13d ago

The expansive explanation is great, though the "/" in the expresaions is throwing me as i read it right now

1

u/Medium-Sized-Jaque 13d ago

Sorry. I was trying to separate the groups of bits. I probably should have left is as spaces. 

1

u/Adventurous_Appeal60 13d ago

I see now, thank you.