Hello and welcome in today's lesson.
We are going to write our first assembly hello world program back before he did it.
Let's first create a shortcut to our fasten.
So look for the fasten folder and then rightly this EIC file and drag it to the desktop and release
and select create shortcuts here so we know you have a shortcut.
You can use to open this Ed any time you like.
So the next thing you do is go to your seat.
Right.
And we are going to create a project's directory to put all our fun projects.
So to do that just click and you weigh in here
and in select a new photo ID
icon create new photo ID and call it a PSM dish.
Be hero yes for some projects.
Now I was just uh sorting alphabetically and now is Tay so from now onwards every time we create a new
project we will put it in this directory.
Now go ahead and download today's lesson files from the resource section.
So this file is 0 1.
Hello.
So after you have downloaded it cut it and put it in your new directory
pacing here and then unzip it.
Now you can delete the zip file and now you have a new folder the unzip folder so open it and you will
see a new file inside here called Harlow the ESM.
If we don't see the ESM extension you can emulate by going to view and the view look for options change
for the insertion options and the view over here make sure you uncheck this
and reapply.
So wise and checking you will be able to see the file extension.
Now the next thing you want to do is to associate this ESM file which stands for assembly file to this
program.
So to do that we need to delve in those two associated in this file in this program.
So right click on it.
And then over here select open with and then scroll down to choosing the and end over here click on
this checkbox.
Always use this same to open his end files and then scroll down and look for more apps and then you
scroll down for the look for another Edmund busy and then clicking on CGI and go to face them in study
installer for the SO fastens are you and a yes like this for an English open so from now on whenever
you double click this far in those who use this program to open the same file.
So now let's open his file and see what what is inside.
So this is the code for your first assembly which prints a helpful message.
How I spin to you every single line here.
The first line is a common comment starting semicolon.
And comments are not executed.
The ideas for the programmers reference so we can write in the name of the file here and some explanatory
notes.
For example this file this program would print the message Hallowell the next line for my b console
tells the assembler.
This is a B file portable executable and it is a console at
console means run from the command line.
Then you have to entry start.
So this tells assembler that you are going to start here so it is just the entry point for the program
so it is a keyword.
And this is a label so this label can be anything like but normally we used labels stuck to every label
has a name followed by a colon.
The next night include wintery to Ada Isee is to include a helper libraries for Windows programs.
Here we need to use this in all other Windows programs to make sure you include this library and then
this senator comment that we use it as a separator
so he used his line to separate every section.
So here is one section here in another section here.
And the tail section here.
So it is for cosmetic reason to make it look nice and easier to read.
So every session starts with a session.
Keyword is unity session Session session.
So every program must have a session call text and the taxation is.
Is there any direct instructions quote and you also make the session readable and executable.
So these are fine there are no exceptions to be fun and in the your data all variables.
We'll have another section called the details session.
They did that session since he meant his data and it is readable rateable
and this line is how we create strings.
So to clear the strings we give a name for this thing.
In this case.
Hello.
Followed by the directive TB.
TB means to create bytes and data bytes and so create by by string means create a string consisting
of bytes he and O spacebar.
Now meanwhile the.
And then this symbol here is carefully written by New Line.
So you see this.
You can check up for the open your browser and look for hex garish within my feet.
So the symbol for character return is the highest value.
I suggest my 0 D and life it is array together.
They are known as New Line so 0 D is 1 category 10 and 0.
Is your life.
And in the last one is now that we need to terminate the string too.
If you only create a string just happy here maybe convey a message
and then if you don't want to put it in your own character you can just leave it up but you need to
put the altimeter in order to end the string.
Let's go to the text but the code part so every time the program runs it will go to the entry point.
This is here is done label and start executing the code.
Now this he have seen this kind of syntax before.
Whenever you have a call to a function Brighton will call.
He will push the parameter so the print f is a function and the F misuse of this parameter.
So in this case hallow here is pushed it a step forward.
If all you call the function so this is the string.
This is a string and Princeton message.
Hello.
And then after he will clean this take.
So this is necessary in order to clean the state.
Remove this from the state whenever you have a push.
You should also have ADD.
So the air here will remove four bytes from the state to clear four bytes from the state.
So ESB is a staple in the
now it is only necessary if you're using non we know API functions so print f is not in the API function.
It is a C function which comes from this library.
So a massive v RTT means Microsoft v sure C runtime so printf can from the explain to you soon in a
shower session so after you finish printing the message hello to the screen you will then call another
function KYC process as you process is window API function which is coming from this library contrary
to the right.
So now we come to the destination which is the input data section.
So this is very important.
All your libraries so you should have this property in by data readable.
So the first slide here is where you specify what libraries you want to use and what is and use an escape
character.
So this special character means you want to split his into two lines if you do want to use this character
you can delete it but you have to move this up to the first line in this
same if this if you didn't want to use this then you can move this hub here
anomaly you just put it into line so that is easier to read this.
So in this line you see that we are using two libraries country 2 and Microsoft.
We shall see runtime.
So this is a file of the jail and is the symbol that is used in say a program.
Now once you specified a library here we cannot import a library and the function that we need from
the library so we input the Clinton theory to this API AC process and then we import the printer function
from this memory.
So once you have done the imposter like this you are not able to use them in your program up here.
So that is run the program now to run the program.
You click on run and then compile.
Now if you go and look here is what it is.
No EFA.
So we have to compile us.
So let's see what happens when you combine run compile.
Okay.
So there's a mistake here.
So here you forgot to put the comma is not a comedy and then run compile Nice work so you can value
as a new file is created that portable as he will file any extension.
He is he now in order to run this file.
OK go here to open the command from taxi Andy
and never get to this folder.
So you copy the path copy.
Oh here I see teachers directory wrangling based above.
PRESENTER So now we're in this hotel and you can type India the decrease the contents of the diary and
we see the Halloween easier to run it just like hello.
This press has she impressed happy impressed here and you can automatically get auto completion so every
time you present a key you auto complete for you.
You don't have to touch along again.
Here she pressed him key press techie until you get in the ECF are now you press enter and Hallowell
is shown.
OK so now let's see what happens here.
After her is showing he will go to a new line so it is helping equals Greenough will bring this Hallowell
it means he will take this string and print it so when you print this thing at the end of the string
he also prints a new line.
That's why you can see it goes to in your name if I were to delete a new line characters.
And compile it again and rerun it again.
I can press a up arrow key to go back to my previous command and press enter.
Now you see there is no new line character anyway.
So it is hard in your main character works.
Okay so what if he want to do print.
Goodbye if you wanted to print goodbye.
We can just copy it is a basic down here
and take a string to his one goodbye this time and by the credit crunch.
While OK known as Rabbit press up Hiroki to go back to the previous command.
PRESENTER Tonight Prince.
Two things were immediately followed by an odyssey.
The two strings have been there on the same line.
They go a star on your character to go to a new line.
So if you wanted to go to a new line before we print a second string we can reset in your nine criteria.
So just reset Zero G H and zero a hero H.
So you forgot what is new right Curtis go look for it in the browser carriage return in 0 the 9 feet
easily together it is a new line 0 D 0 is your line
0 d You re the hash at back is her hexadecimal it tells the assembler in these two numbers has a decimal.
So now that is combining and that is running programming in and you see now you present in two lines.
So what what happens is when it comes to this printer you will print the first hello message and then
there's a new line here to in your name by going during your time and then it comes to the second print
here and the second print f will print the second string here and you get the second string and after
you finish it goes to the instruction I say process it calls and I see a process function and I see
so with zero means you are pushing zero as a barometer.
See so if you want to know more detail about process you can say shame is the N C process.
Presenter Hinckley only offers his eye for a result.
And you can see so it is a process has a barometer called I see.
Could I see cookies is good for the process.
Contracts
like that.
So normally we will pass a zero for a single to indicate that there are no errors in the execution of
the program.
OK so this is how to write program assembly and we have just finished our first hello and goodbye program
so goodbye.
I'll see you in the next lesson.
Thank you for watching.