This is a video covering the programming

of my relay computer and it forms part of the 2020 update series of videos

and this is a fourth in the series. So far we’ve covered off the architecture

of the relay computer, the instruction set it uses, an assembly

language which makes it easier to program a computer and then we have this

video. Later on we’ll do a tour of the computer and then finish off with a demo

of a program running on that computer. So if we cast our minds back to the first

video of the series that’s where we found the architecture diagram and

that’s shown on the left there, and in the video following that we looked at

the set of opcodes that allow us to control the computer. Now as we as we

noted it’s not straightforward to program a computer in a load of ones and

zeros … something the computer understands well but it’s very hard for us to work

with that and so in the third video we introduced our assembly mnemonics and

this gives us a much easier way of coding the computer in a way that’s easy

for to us remember but all of these have a direct one-to-one relationship

with an opcode … so what we’re going to do in this video is start with a

programming task and then we’re going to take that and build an assembly program

out of it once they’ve got that will convert into a list of opcodes … effectively

hand assembling it and then we can try running the program on the relay

computer simulator. So what is the programming task then … well actually it

has come up in comments or previous videos and some of these been mentioned

as something you’d like to see is calculating the Fibonacci numbers on the

relay computer and now actually this works out quite a nice task as it it’s going to need an

element of branching which is great because the computer can now do that but

it’s also a nice simple example to understand as well so that’s one we’ll

go with. If you’re not familiar with this series so you can see the numbers here

so we start with 0 1 1 and then each number goes up from there now if you’re

not spotted a pattern here each number is the sum of the previous

two numbers. Now we can write that as a formula as follows

so starting with 0 the next term being 1 … any term could be found

out by adding the previous term and term before that together. Now Fibonacci

numbers are pretty cool and if you’ve not played with them much or you are new

to them definitely have a look at this link below because these numbers appear

all over the place: they appear in nature, they sound quite nice in music, if you’re

in the UK you’re a piece of A4 is also related to these numbers so if you want

a quick diversion – an interesting read this is a good place to start but

anyway this is the programming task we’re going to set ourselves for this video.

Okay then so let’s crack on with this programming task then so you can see in

the bottom left here then we’ve got our challenge to create the Fibonacci

numbers on the relay computer and over on the right there I’ve got the usual

architecture diagram which will just helped us when making this program

specifically work on the relay computer so I guess a good place to start would

be to look at that general formula so well that’s just quickly write it up

here in our text document start off with so effectively we have for F0 will be 0

F1 is 1 and then from that point onwards Fn is always Fn minus 1 plus Fn

minus 2 where n is greater than 1 so that’s the general formulas but how

would that look as a computer program so what we need to do is

actually write this as a series of instructions series of tasks that need

to be performed at the moment that last one doesn’t make much sense. So that’s

one of the ways of writing this so we could say that we’re gonna call this a

and we’re going to call this b just fine so then c in the first instance

would be a plus b and that gives us our very first result of 1. and all we

need to do after that is we then need to reassign what a and b are so we could

say well a now becomes one and b now becomes the result of that addition and

then can go round through another iteration so we could there say well

let’s do all this so what we can do that is just iterate

on this forever because the sequence just carries on going all the way to

infinity so let’s do the same here for the example and now what we’ve created

here basically is a pseudo code so this is not any language in particular it’s

just a made-up language but enough for us to get the logic flow of this and

what we can do those we can sort of try this out and see if if we’re hitting the

right markers so if we said let’s do a b and c we know that begin with we start

off with that and c will then be one we then set a to b, b to c and then c is

then 2 and the pattern follows so that becomes 1 that becomes 2 and that

becomes 3 and that looks like that’s working absolutely fine so effectively

that is a pseudo program for calculating the Fibonacci numbers. Right ok so let’s

see if we can make this specific to our computer so straight away if we imagine

that these letters are used to for the registers we can see a problem because

we can’t do C equals A plus B that’s simply not the way the ALU works

so what we actually need to do here is it would need to be A=B + C if

anything because you can see here that B and C going to the ALU and then we can

feed back onto the data bus and then we could go into A or go into D

these are good choices any that’s fine for this.

So that gives us that part but I can see now basically I will have to rearrange this a

little bit and now also we want to think about how we want to move these values

around so we still the same problem that you need to copy a value over before

overwriting it otherwise it’s lost forever that makes perfect sense

so what we could say is if we did A equals 0 and B equals 1 and then another

way of writing this would be to come in here and say let’s move C to equal B and

then B to equals A and I think that should give us the same effectively the

same logic just a slightly different order so the thinking here then is that

you’ll have the largest number calculated so far in A then the next largest number

in B and the smallest number in C so therfore I

can see that actually this is probably the wrong way around actually that

should be one that should be zero so that means then we start with one there

is zero there zero moves to C the one moves down we do go to one the one on

one move down that gives us two two one move down that gives us that so on

so let’s that you quickly just test that theory so if we start here so our starting

position is to have A of one a B of zero and a C of nothing in our first

iteration it will be zero it will just say it’s unknown at that point and so

after the first iteration going in here we say C equals B sets to zero B equals

A sets to one there … we do the addition and that puts one there. So on the next

iteration we then say C equals B, B equals A We do the calculation and now put two

into A … and that should then follow again so next iteration C equals B, B equals A and

then A equals B plus C which gives us a three so you can see the sequence

starting up there so that’s given exactly what we want so I think we we

have the basis of that now something that will work for our relay computer so

that’s … that is the basic program I think cool right considerations we need before

moving on to we’re trying to this to assembly and so we’ve got the registers

we need they’re all good we’ve used the right registers to get at the ALU so

that’s all fine and the only thing that strikes me is of course because we’re

using 8-bit registers we’re going to be limited on the maximum value it

calculates and so of course out of the eight bits the most we can go up to is

255 so I guess question is where does this sequence go to next … so if we did a

calculation of that so if we’re doing 89 plus 144

the total next number will be … 233 … that’s fine that’s still within

the within the limit so if we did 144 plus 233 377 … so we can see at that point

we’re bust … we’ve basically gone over the 255 so what’s going

to happen there because there no point looping after that because if we do this

addition we’re only going to retain the lower eight part a lower eight bits of

it and now we could do sixteen bit addition but to do that we’re going to

need to go to store the upper and lower part in either the M register or the

XY register … at the moment the move command doesn’t go to those so we know

that’s just not possible so realistically for the moment we’re going

to stick with 8-bit now be nice later on to do a 16-bit version of this but for

the moment there’s just nowhere to go with this so we just have to sit tight

and just satisfied the they’ve all just got to the 233 … right so what

we really want to do that on this loop is a loop until we’re over 255 basically

and that’s probably the best we can do or each point just want to stop so how will

we know when we’re over 255 so let’s have a look at the binary representation

of these so let’s get our trusty calculator out and if I look at 233 we

can see the binary value for that is 1 1 1 0 1 0 0 1 so that’s actually fine if

we come in for this next results 377 we can see then that we’re 1 bit over

so if I line these up for you and so yes if we do 1 0 1 1 1 1 0 0 1 so we can see

there that yes it would set the carry bit and that’s basically because that’s the

bit you would add to the upper 8 bits of the 16-bit result if you were going to continue

on now the problem is what would happen is if we did carry on it effectively add

this to this and you’re just not getting nonsense numbers because effectively at

this point now we’ve lost 256 of the value

so really it would be for thinking right be 377 minus 256 so actually be adding

121 to the previous result and if we did that 121 plus 144 it would actually come out at 265 so

you start getting some really weird results so it’s really important that we stop at the

point we go 255 otherwise I’m just gonna get nonsense numbers so yeah the

way we can do this is because we know that carry flag will be set basically if

we carry on going until the carry is set and at that point we just stop … now it

does mean the last value of put in A will be a nonsense value but I think we

just got to go with that in this case just to make this loop work nicely now

ideally as well what would do is we would copy these values somewhere into

memory so what we could do is every time we get a useful result we could put it

into memory so we could so say if carry set then go to end or something and

then could be down here otherwise just carry on looping forever again so we

could say is if the carry isn’t set then we must have got a good number and this is

where we could actually then copy let’s say A into memory … like so and what we want to

do is then keep moving the address on so I could do is put into an array in

memory this is actually where the XY register would be good so you could say

put it into memory pointed to by XY and then increase XY and go to the next

location so again we’ve got the ability to store things in memory this is quite a

nice thing to do because then what we’ll end up doing is writing the results of

going along into memory and as soon as we get a result that then is any good

we’ve blown the 8-bit range we can then stop at that point

so unfortunately we don’t have that at the moment so we’ll just leave it as this. So I

think we’re now done with the pseudocode I’m happy that I should do the trick so

what we’ll do now is convert this into assembly language for the relay computer

so let’s take what we’ve got here and copy that and we’ll get rid of this and

we’ll get rid of this so what we have here now is the relay computer IDE so

this is available at editor.relaycomputer.co.uk so you can have a go

at this yourself and this will basically allow to do some programming – will give you

syntax highlighting, it will tell you if there’s any syntax

errors as well so you’ll see that as we go along

well let’s paste this in then and straight away we’re getting lots of

squiggly lines because this is a load of nonsense as far as this is concerned

that’s okay we can use this as inspiration so what we’ll do is we will

stick a semicolon in front of it and that makes them all into comments and that get’s rid of that for the moment … I think I’ll just quickly zoom this up a little bit for you as well

so it’s a bit easier to see so I’ll need to do now basically is a convert this into

assembly language so to do that we’ll get rid of the diagram there and we can

look at our railway diagrams here which will show us the various commands we’ve

got so we want to set the registers with an immediate value that should be quite

easy to do we just want to load an immediate value so our mnemonic is LDI

and then we need a destination in this case A and then we’re gonna set a value

of 1 next up then we’ll do the same thing to the B register and set that to 0 and that’s

the first two lines of our program complete and so we’ll come back to the

loop in a second but let’s get some of these moves

put in so again if we’ve got register register copy here

there we go it’s the MOV instruction so we’re going to move B into C and then

we’re going to move A into B and then we need to do some addition so then we’ve

got our arithmetic operations here so we’re going to do an ADD now again we

could specifically say that it’s going to go to the A register or the D

register if we don’t specify it all it just goes to A so that’s that done so

that would work for one iteration of the the program but we need to also do

looping so this is were we bring in our new

branching functions … so first of all let’s get the the loop to have another

go at this so we would need to jump unconditionally but we need some where to

jump to so that basically is we need a label

so if we call that ‘again’ and what we’ll do is we’ll pop these over to the right

slightly and then we’ll say here is where we’ll go again

so I’ll say again it’s yeah this is basically a label since place it says

when you get here just jump back to that ‘again’ line and just carry on as before

so that’s doing our perfect do loop here so a thing we need then is to stop

if we’ve got the carry flag so here now we’re going to do a conditional branch

and we’re going to brunch if the carry is set after that so bcs and we’ll

branch to label called done that goes down here and now again we need to do

something down here so you can see I’m getting a squiggle because it says will

the label needs an opcode after it or a mnemonic in this case so in this case we

could just jump straight back to that line so we could say just jump back to

done again and that will give you an infinite loop now ideally this is where

we should halt so we’d say well when you’re done just halt the computer

but we don’t have a halt function yet that’s something we need to implement

later on so for the moment we’ll just keep jumping in an infinite loop which is a

bit dirty but it will do so we should have an equivalent program there now

which is doing exactly the same as what our pseudo code is doing at the top and so what

we can do now is just look for some optimizations so straightaway here I can

see that actually once the carry flag is set it’s always going to be set unless

we do another addition so what I could do is move the label here instead … I’ll get

rid of that line down there so what this’ll do now is once it does get to the

point where the carry bits set it’ll just keep looping and checking the carry

bit again and you’ll just basically keep on looping through this section here so

I just saves me an extra well in this case three bytes later on and just as a

slight optimisation again if you’re going to do the halt

you would have to break out to later on in the program and then do a halt down

there so another thing I just want to consider here is actually this branching

if the carry is set now what would be nicer is if we could have a branch if carry

isn’t set so what we could do is say let’s imagine there’s an instruction called

branch not carry the goes to ‘again’ and that would

completely get rid of the need to check to see if you want to branch if it’s a

carry and then jump back to the again and that’ll just flow through but we don’t

have that as we know that we can we check that the carry is set we can’t

check when the carry isn’t set so well that’s an

optimization we can’t make but it’s worth considering and the other one as

well might be here actually could we get away with not having to set this

to zero we know that when we power the computer on all the registers will start

off being zero now I might be tempted to say well let’s not have that but

actually if you do a run of this and then reset the program counter that B is

going to contain some unknown value so it’s very important to make sure you

reset these registers that you’re going to use to a known value never never

depend on the fact that they you know at your power on they’re going to contain

zero because that might not be the case next time you’re in the program so it’s

always best practice to to reset those Right-o so I think we’ve got our assembly

program done so you see it’s quite short but it should do the trick

last thing we probably want to do here is just at the top let’s give it a name

so we just say our lovely Fibonacci program just so we know what it is without

having to try understand the code each time … as well as putting a comment at

the top of the program it’s also a good practice to explain anything that’s not

immediately obvious so you could actually have pop in some comments on

each line as well it’s the last thing that will be on the line and of course

everything from that point onwards would just be treated as a comment but

we could say here that we want to slide the values … add together and then keep going

until greater than 8-bits … something like that none of not the best comments in the world but you

get the idea I’ll get rid of those though I think

those comments are terrible enough not to bother keeping but what I’m going to

do is I’m going to keep some comment lines in here because now we’re about to

hand compile this language because of course

at the moment and this is understandable to us but it means nothing to the

computer what the computer needs is a series of opcodes so if I drop

that away … this is what the computers after so again this is on my blog relaycomputer.co.uk and this where you can find the opcodes for the computer so I need to

do is convert each of these individual instructions to the opcode equivalent

well that’s just cases just working through them one at a time and just

basically encoding them into this 8 bit instruction code … now eventually this IDE

will have a feature where it can do this for you so what I’d liketo do is add

on the right-hand side here a live preview of what the

assembled code would look like and then you can take that and put it into the

real computer or in your cases if you like to you can put it into the

simulator which we’ll see shortly and but let’s now have a go at hand assembling for

the moment just to show that actually it’s not all that difficult it’s just to

tad tedious so let’s start with the first one so let’s sort out these load

immediates so we know that the load immediate needs to start with a 0 1 we

then need the destination A or B as this going to A which is a 0 and then we need

the value which is that in binary … our next one is SETAB to the destination of B and

then we’re going to load in 0 which is all the bits 0 so that’s

the load immediate done So next we’ve got the MOV

instruction so we know that’s an 8 bit move so let’s convert those … so 8-bit

moves start with a 0 0 … then we need a destination so we’re going to C and then

a source is coming from B and that’s that one done and then the next one

we’re going into B and we’re coming from A and you can see I’m doing each time

he’s just looking up these parameters just to see what the value should be now

eventually you’ll be able to do M1 and 2, X or Y but the moment that’s

not implemented in the relay computer so we’ll we’ll add those later on … right

next I’ve got an ALU instruction so this starts with a 1000

we’re going into A which is 0 and then we just need the function code for add

which is 0 0 1… alright now we’re going to the more interesting

ones we’ve now got the branch instructions so we have a 1-1 we need to

load the J register if we’re gonna do a jump and then we’re saying we’re not

interested in sign we are interested in the carry flag and not interested in

zero or not zero we’re also not bothered about copying into the XY register

because we’re not doing a subroutine for the unconditional jump that would be

a 1-1 so we want to load the J register … no sign no carry but we will jump if it’s

zero or not zero in other words we’ll always take a jump and again we’re not

bothered then about the copying the PC to XY there now there’s something

missing here because we know that a go to instruction requires three bytes to

describe it so we need a value here we need a value here and say for this one

this one needs a value here and the value there so what is that value though

so this is where these labels come in because really these labels are

referring to a point in the code but what point is it … well to do that we need

to think about where these instruction going to be loaded to in memory so while

did I’ll load this into the relay computer starting in memory location

zero but of course you could load this anywhere but we do have to be specific when you’re

assembling this you need to tell it where the program’s starting because

that’s how it’s going to work out where all those labels are.

Let’s work through a quick example of this so if I start giving these line numbers

so we’ll start here this is line number zero zero zero zero so remember it’s a

16-bit address what I’ll do is I’ll write these in hexadecimal that’s often more more

compact way of writing these so our next location will be 0 0 1 this one even

though it’s a space here there’s no instruction this there is no space taken

in memory and we can go straight to the next location so this would be location

2 this will be 3 and the next one be 4 so you get the idea so here this would

be 5 I have to be careful now because the next the high 8 bits of the target

location will go in the next byte then the lower 8-bits so this llll here will go

in the next location and then we’re on to the next

instruction which is instruction 8 then we would have the upper 8-bits

and then we’d have the low 8-bits and that’s where to get to a on there of

course that’s the 10th location and then if we have more parts of the program

that will carry on BCDEF and then we move on to 10, 11, 12 and so on. So we now know that the

done label sits at location in memory 5 and the ‘again’ label sits at location in

memory 2 – so that means if we want to branch to the again one

down here we go to zero zero zero zero zero not sure how many zeros that was but eight

zeros for the upper eight bits and then we need to go to 2 for the lower 8 bits so 2

in binary is one zero and now that goes back to the again line … next we want to do

the done line so here we’re just going back to ourselves so we’re going back to

line five … so again nothing in the upper 8-bits but the lower 8-bits need

to be five which is one in the four, zero in the two, one in the one column which

would give us a binary of five … cool so that is our hand-assembled

program and now what I’ll do as well it’s just to make easier when we’re

viewing it in the simulator I’ll convert each of these op codes to a hex so well

let’s have a go at this now and I’ll try not to make a mistake or if I do I’ll try and spot it before

loading the computer but it’ll just help that when we load these into the

relay simulator we can see the values that we’ve loaded in and we basically

just check that our program is what we thought it was and do any debugging so

let’s have a go at this first one so we have one in the four column for the

first thing so all I’m doing here is looking at the first four bits and then

just working out what the hex digit is for that so in this case is one in the

four column so that’s a value of four … for the next four columns we have a value of one

so that is an opcode of 41 in hex and next up we have

a four and two so six and zero so that’s the 60 we then have a 1 and a 1, 0 and 8 we

have 8 1 next one is one away from 15 so that will be E then 8, 0 0 that we

definitely know to be 5 and then we have a an E and 6 and then 0 0 and then 0 and a 2 so

they should all be the correct opcodes now … right so well let’s get this

loaded into the relay simulator so what I’ll do is I will move this over to the

slide slightly let’s just keep everything visible … so what we’re going to do here

is just load this program in exactly the way it would be loaded into the computer

itself … so what I’ll do I’ll just make this a little bit easier to see I’ll zoom this in yeah that’ll do and basically this is

this is exact replica of my real relay computer so again you can get to

this at simulator.relaycomputer.co.uk if you want to have a go yourself and

base what I’ll do is now load these op codes in so just as with the real

computer it’s just case of setting the opcode and then depositing next and you

can see down here there the program counter moves on to the next location in

memory and then we’ll just quickly pop the switches for the next instruction and

deposit next we’ll then go for the next one and then we just keep on repeating

now eventually I’ll have a nice quicker way of loading values into the relay

computer cuz for a very very long program this would be really really

annoying and so I do have a trick up my sleeve for later to be able to read a

printed tape or something along those lines base to make it much easier to the

load values into the computer but for now hand cranking is the only way we can

do this say let’s do that and then we want a one

to ones their deposits then some zeros no I’m doing one intentionally make a

mistake here so I’m supposed to put two all the zeros in here that let’s say I

forgot because I’m going to show you how you can correct a value and and the last

five you were going to want is a one zero down there so if I scroll over to

the right here we have a display that shows us what the hex codes are and if I

squeeze this over slightly we’re looking for a 41, a 60, 11, 08, 81, E8, 00,

05, E6 … whoops 06 and then an 02 and that should be zero there

we know that’s wrong and so what we can do here is see if I make this a little

bit bigger again and we will go for this for the thing so you might need to I get

a bit close to your screen to see this going on but I now need to alter this

value here I also know from my chart here that location nine is where I need

to change that so what I can do is I can manually update the program counter to

point it to that position and what happening at the moment is the bit

highlighted in orange here is where the program counter’s currently pointing to and

you see down here basically on the program counter the LEDs showing the value so I

know I need to go to position nine so that should be an eight and one and then if I load address you can see now that set the program counter to that

value and we’re now hovering over this instruction and what I want to do is set

that value to zero so I can either I could just deposit and next if you want

to deposit and then move the program counter on or

just do a straight deposit and that’ll just update the value

and this is exactly same for the real relay computer if you want to edit

values or you want to debug the program and change your value you could look at

your original assembly over here make some changes and then just push those

changes through to the computer so you can do things like that so that’d be an

easier way to do it right okay so what we’ll do is I will leave the assembly

visible just over there but what we need to do now is actually give this

program a try and step through it so just with the real computer we need

to load zero back into the program counter so it’s pointed to the first

instruction what we’ll do is we’ll prime the sequencer and what we’ll do now is

clock through the instructions one at time so if I now where step through we

can see that it’s picked up the first instruction which is a SETAB which is

exactly what we expected and if we clock through this we’re expecting to see that

the register A is loaded with the value of one which it is just down there so

good that’s our first instruction as we wanted our next instruction then is

another SETAB at this time though we’re going to load the value of 0 into

B which again seems a bit pointless for the moment but that will become useful if

we run it again it will just ensure that register B is set to nothing okay so

we’re now into the rounds of our loop so we’re now down over here we want to do

a move from B to C so that’s the opcode coming up here and we can clock

step through that there we go that’s done nothing what you see in a moment

now then we’re going to move A to B which you can see down there that’s now

taking place so B now contains 1 as well and then we’re into the to the ALU

operation so and see that’s being loaded up there we can see it’s now performing

the add so the result now has gone back into the register A … 1 plus 0 is 1 and then we’ve got the point of the first go

to instruction so now we’re considering whether the carry has been set or not so

we can see from last ALU the carry hasn’t been set so what should happen here is

it will load the 0 into the J1 register it’ll load the 5 into the J2

register down here so we’ve now got a location we will jump to if the value is

set but it’s not so what will happen is we’ll carry on and we’ll get to the end

of the go to and we’ll see we’ve selected the value on to the

address bus which is there so that’s where we could jump to do but we’re not

loading the program counter and therefore we’re not taking the jump

so if we carry on a step further we’re then into the next go to instruction now the

next goto instruction is the one down here where we’re good to jump again

regardless so if we step through that again we load the zero into the J1

register we load the 02 into the J2 register and we get to the point of

taking the jump just there and you can see that we selected the J and it did

load the PC and if you look at the program counter down there now it’s gone back to

two which we see up here in our region it’s gone right back to that instruction

on the move B to C so we can step through that very quickly there’s a move here comes our add and by the end of it now

you can now see that we’ve got 2 – sorry wrong register – 2 in the A register, 1 in

B, 1 in C and one and one plus one equals two

I think we’ll let the computer take over now so what we can do now is watching

going through the go-to instruction you can see the carry it’s not set so

we’ll carry on and now it’s going to jump regardless back to line two and there it goes so now it’ll do the next bit

of addition so now you’ll see this value from here pop down to here so now we

have two plus one and now we get the result of three there and then we go

back into our loops again and now what I can do is I can speed this up now so what I

expect is to do is keep on going to the point we get to the to the carry now I’m

going to do is I’m going to quickly jump forward here and what I’ll do is pause it

just before it’s about to get to that that point so we can just step that

through okay right so we’re back so I’ve paused this now just as it’s

going into the add instruction so it’s not quite completed it yet just step

four of this instruction so it’s loading the instruction code each just about to

take the add what we’ll do now is if I look at the B and C register here I

think we’ve got 233 in that first register so let’s get the calculator up

so I think that’s 233 so here we’re looking at 1 1 1 0 1 0 0 1 so that’s

true I’ve got 233 in that register and I think I’ve got 144 in the other register

so we go 1 0 0 1 and then all the zeros so I expect to happen here is we got 233

plus 144 looking for a result of 377 and we see here this time is we’ll get

a result in register A of 0 1 1 1 1 0 0 1 and there will be a carry bit

there so let’s see if I’m right so I should put that down the side and we’ll

just step through this a little bit further so there we go it’s done the

calculations I’ve just bring this back over here again you can now see we’ve

got the 0, 4 x 1s, 0 0 1 so now actually that isn’t 377 its 377

minus 256 so it’s actually 121 0 1 1 1 1 0 0 1 so this is now where

actually the value is meaningless now it’s the lower 8 bits of what should be

a 16 bit result and what we’ve done is we carried the 1 bit over here so what

should happen now is we should go into the loop over here and this time we will

take the jump because now the carry flags there so let’s try that so if we

go through we coming to the go to we load the 0 into J1, we load the 5 into J2

now the key thing is now are we going to take that jump or not

well the C bit set so we there we go we selected J we loaded the program

counter and now the program counter’s gone back to line 5 as we see up here

and this now means we’re in an endless loop so if I run this we’re just going

to keep on going even if I go at high speed you can see there we’re just

looping through the same line so that’s it so the program works as we expected

so if I wanted to start this going again what I need to do is the best way to do

this is to advance the program counter on to sorry advance the sequencer on to

the first stage which I’ll do there fine and then if we clear down the

program counter to point back to position 0 again then what we can do is

just set the program going and we should see that will start counting through

so here’s the program at full pelt and you can see it basically going

through the adding moving the values down adding moving the values down

adding moving the values down so if we go for maximum so the most my

computer can do you can see it basically going for the full program and there we go

it gets stuck at the end and that’s where it gets stuck on the on the carry.

So that’s it that is the that’s a program from pseudocode through to

assembly language through to a hand assembling into a machine code and then

entering that machine code into the simulator and running it so my next video I’ll

give a tour of the relay computer and just show you around and then in my

final video in this series I’ll actually run the program you seen here on the

real computer and then we’ll take a look what’s next the relay computer after

this alright so if you’ve been watching the way to the end thank you very much

and yeah see you on the next video

Be kind of lit if you made a compiler and then had that communicate over usb to an arduino or something that was programmed to program the computer for you.