Okay guys.
So now that we have explained all of that stuff about the 8 0 8 6 processor you should now know enough
to be able to understand our hello world program initially.
So I'm gonna go through with you.
Based on what we've learned just to go over it and I'm sure you will also understand now.
So our program first ends up being run and we hit a jump instruction which is to jump to Maine.
Now we can see Maine down here.
Right.
This is a label the address of the labels is that assemble time.
So this jump becomes jump and you know some address.
Right.
That's why it comes once it's assembled now because we jump to Maine we skip over this message without
this Maine jump Maine here the the actual assembler will will assemble code that will that once run
will try and run the hello world message as code.
Right.
So by doing a jump Maine we jump over all of this to our Maine so that it doesn't run any of this.
Right.
Because we jump over it and take a look at the understanding the process of video for more of an understanding
on how this jump works now in our main function.
We move the address of the message into the S.I. register and then cold print.
Why do we put the message in the ASI register.
Because remember the law DSP instruction uses the S.I. register to know where to load a pipe from.
So what happens is we move the address of message into the S.I. register we call print which now jumps
up here.
But as it is a routine so it will always come back.
We move 0 E Hage into a into the H register 0 E Hage is the function code for 1 we call interrupt 10
Hage.
Right.
So it knows which which piece of code to run.
If you remember the interrupt vector table research about that to understand interrupts there is an
interrupts lecture in this course.
Now when we go through here we move 0 E H into the H register then we do a lot SB.
So that will load page into the AOL register.
Right.
We now compare that with zero because if you look here this C row here.
This means that we're done.
We put a null terminated here.
And then when we are printing out we check if it's there.
If it's there then we jump to done which returns from our from our subroutine which puts us back on
line twenty six which then returns control the M S DOS.
Now obviously if a 0 is not 0 then we never jump to that leap to that done label.
So the code carries on running and calls interrupt 10 Hage now interrupt 10 H sees that the function
is zero Hage and it sees the register is whatever character was selected here and it and it shows it
to the screen.
So remember although we use zero hateful here is it's just to represent a function inside this routine
here.
Inside this interrupt here interrupt 10 Hage so interrupt 10 Hage might have a bunch of compares saying
if this is zero Hage then jump to our output to screen routine that's all that's happening here right.
It's just in this case interrupt 10 Hage is is our video routine and this is the function that tells
it to output one character to the screen that that's all you need to worry about and that is how our
hello world works.
So by less press emulate.
So we can just step through it so you can see a little better.
Okay know close the memory view just because it's easier to understand.
Okay.
I press single step that jumps to main.
Yeah.
When I running main single step we move one or two hate each which is the address of message by the
way into the S.I. register.
Now where was I.
Okay.
Yeah.
I single step again.
Now we've called Print and now I single step again.
Zoe hey she goes into a hate register which is the function for our video output one character routine
remember when we called in Europe 10 Hage.
Now we single step this load at speeds we see 48 Hage in the AOL register which is which is basically
a hate character here.
Right.
So we go back and
we then single step which compares Al with zero.
Well I always hate.
So those flags here.
I never said so jump zero.
I'll jump Jump equal we'll never jump.
So we first single step that goes onto our interrupt 10 hate routine single step again and that outputs
hate each to the screen.
Okay.
Now what happens next.
We have our jump by here which jumps back to the loop.
So then we call a lot SB again which loads in the next character.
And remember the S.I. register points to where it is.
If we go to a view in memory and you just type one of three in here you can see the first character
here is E right.
It's E.
So this is going to be the next character this read.
So if you press single step then you can see this has now become 1 0 for the average to now has e.
If you not put 1 of 4 in this memory access you can see the next cactus.
El this is how it works.
Guys load SB takes then increments takes then increments.
Right now we single step again and is not zero single step again a single step again single step again.
Now we put each of the screen.
This goes on and on and on until Lord SB reads are no Terminator here.
In which case compare 0 will set the correct flags which will cause Jay Z or jump equal to actually
leave our program and jump to done.
Okay.
Well done.