1 00:00:00,640 --> 00:00:03,960 Hello and welcome in today's lesson. 2 00:00:04,010 --> 00:00:11,020 We are going to write our first assembly hello world program back before he did it. 3 00:00:11,830 --> 00:00:15,940 Let's first create a shortcut to our fasten. 4 00:00:16,760 --> 00:00:27,660 So look for the fasten folder and then rightly this EIC file and drag it to the desktop and release 5 00:00:29,170 --> 00:00:35,910 and select create shortcuts here so we know you have a shortcut. 6 00:00:35,990 --> 00:00:41,390 You can use to open this Ed any time you like. 7 00:00:41,390 --> 00:00:45,040 So the next thing you do is go to your seat. 8 00:00:45,090 --> 00:00:45,410 Right. 9 00:00:46,250 --> 00:00:52,700 And we are going to create a project's directory to put all our fun projects. 10 00:00:52,700 --> 00:00:56,810 So to do that just click and you weigh in here 11 00:01:00,240 --> 00:01:02,990 and in select a new photo ID 12 00:01:05,900 --> 00:01:12,910 icon create new photo ID and call it a PSM dish. 13 00:01:13,040 --> 00:01:18,090 Be hero yes for some projects. 14 00:01:18,220 --> 00:01:29,800 Now I was just uh sorting alphabetically and now is Tay so from now onwards every time we create a new 15 00:01:29,890 --> 00:01:34,770 project we will put it in this directory. 16 00:01:35,070 --> 00:01:43,030 Now go ahead and download today's lesson files from the resource section. 17 00:01:43,040 --> 00:01:45,060 So this file is 0 1. 18 00:01:45,070 --> 00:01:46,500 Hello. 19 00:01:46,510 --> 00:01:52,300 So after you have downloaded it cut it and put it in your new directory 20 00:01:56,030 --> 00:01:58,520 pacing here and then unzip it. 21 00:02:05,900 --> 00:02:15,260 Now you can delete the zip file and now you have a new folder the unzip folder so open it and you will 22 00:02:15,260 --> 00:02:20,340 see a new file inside here called Harlow the ESM. 23 00:02:20,600 --> 00:02:32,620 If we don't see the ESM extension you can emulate by going to view and the view look for options change 24 00:02:32,630 --> 00:02:42,060 for the insertion options and the view over here make sure you uncheck this 25 00:02:46,040 --> 00:02:46,750 and reapply. 26 00:02:48,230 --> 00:02:52,500 So wise and checking you will be able to see the file extension. 27 00:02:52,670 --> 00:03:00,650 Now the next thing you want to do is to associate this ESM file which stands for assembly file to this 28 00:03:00,650 --> 00:03:01,680 program. 29 00:03:01,730 --> 00:03:08,760 So to do that we need to delve in those two associated in this file in this program. 30 00:03:08,930 --> 00:03:10,470 So right click on it. 31 00:03:10,550 --> 00:03:21,700 And then over here select open with and then scroll down to choosing the and end over here click on 32 00:03:21,700 --> 00:03:23,200 this checkbox. 33 00:03:23,460 --> 00:03:32,850 Always use this same to open his end files and then scroll down and look for more apps and then you 34 00:03:32,860 --> 00:03:42,190 scroll down for the look for another Edmund busy and then clicking on CGI and go to face them in study 35 00:03:42,310 --> 00:03:54,840 installer for the SO fastens are you and a yes like this for an English open so from now on whenever 36 00:03:54,840 --> 00:04:01,260 you double click this far in those who use this program to open the same file. 37 00:04:02,700 --> 00:04:06,250 So now let's open his file and see what what is inside. 38 00:04:08,490 --> 00:04:14,610 So this is the code for your first assembly which prints a helpful message. 39 00:04:14,610 --> 00:04:18,570 How I spin to you every single line here. 40 00:04:18,570 --> 00:04:22,920 The first line is a common comment starting semicolon. 41 00:04:23,400 --> 00:04:26,320 And comments are not executed. 42 00:04:26,340 --> 00:04:33,810 The ideas for the programmers reference so we can write in the name of the file here and some explanatory 43 00:04:33,810 --> 00:04:35,780 notes. 44 00:04:36,240 --> 00:04:45,650 For example this file this program would print the message Hallowell the next line for my b console 45 00:04:46,280 --> 00:04:48,270 tells the assembler. 46 00:04:48,350 --> 00:04:53,540 This is a B file portable executable and it is a console at 47 00:04:56,290 --> 00:04:58,420 console means run from the command line. 48 00:05:00,110 --> 00:05:03,110 Then you have to entry start. 49 00:05:03,830 --> 00:05:11,550 So this tells assembler that you are going to start here so it is just the entry point for the program 50 00:05:13,460 --> 00:05:14,620 so it is a keyword. 51 00:05:15,350 --> 00:05:23,290 And this is a label so this label can be anything like but normally we used labels stuck to every label 52 00:05:23,380 --> 00:05:27,080 has a name followed by a colon. 53 00:05:27,730 --> 00:05:36,820 The next night include wintery to Ada Isee is to include a helper libraries for Windows programs. 54 00:05:37,060 --> 00:05:44,970 Here we need to use this in all other Windows programs to make sure you include this library and then 55 00:05:45,190 --> 00:05:49,000 this senator comment that we use it as a separator 56 00:05:51,870 --> 00:05:55,410 so he used his line to separate every section. 57 00:05:55,410 --> 00:05:58,950 So here is one section here in another section here. 58 00:06:00,520 --> 00:06:03,610 And the tail section here. 59 00:06:03,610 --> 00:06:07,650 So it is for cosmetic reason to make it look nice and easier to read. 60 00:06:09,190 --> 00:06:11,170 So every session starts with a session. 61 00:06:11,170 --> 00:06:18,000 Keyword is unity session Session session. 62 00:06:18,430 --> 00:06:27,670 So every program must have a session call text and the taxation is. 63 00:06:27,810 --> 00:06:38,670 Is there any direct instructions quote and you also make the session readable and executable. 64 00:06:38,670 --> 00:06:47,450 So these are fine there are no exceptions to be fun and in the your data all variables. 65 00:06:47,500 --> 00:06:51,030 We'll have another section called the details session. 66 00:06:51,330 --> 00:06:58,380 They did that session since he meant his data and it is readable rateable 67 00:07:01,240 --> 00:07:03,720 and this line is how we create strings. 68 00:07:05,370 --> 00:07:09,140 So to clear the strings we give a name for this thing. 69 00:07:09,180 --> 00:07:09,890 In this case. 70 00:07:09,960 --> 00:07:11,430 Hello. 71 00:07:11,430 --> 00:07:14,460 Followed by the directive TB. 72 00:07:14,620 --> 00:07:25,860 TB means to create bytes and data bytes and so create by by string means create a string consisting 73 00:07:25,860 --> 00:07:29,640 of bytes he and O spacebar. 74 00:07:29,870 --> 00:07:31,540 Now meanwhile the. 75 00:07:31,650 --> 00:07:36,010 And then this symbol here is carefully written by New Line. 76 00:07:37,480 --> 00:07:38,440 So you see this. 77 00:07:38,440 --> 00:07:48,850 You can check up for the open your browser and look for hex garish within my feet. 78 00:07:50,290 --> 00:07:55,680 So the symbol for character return is the highest value. 79 00:07:55,800 --> 00:08:01,130 I suggest my 0 D and life it is array together. 80 00:08:01,290 --> 00:08:07,580 They are known as New Line so 0 D is 1 category 10 and 0. 81 00:08:07,840 --> 00:08:09,530 Is your life. 82 00:08:11,140 --> 00:08:18,060 And in the last one is now that we need to terminate the string too. 83 00:08:18,130 --> 00:08:24,760 If you only create a string just happy here maybe convey a message 84 00:08:30,350 --> 00:08:38,200 and then if you don't want to put it in your own character you can just leave it up but you need to 85 00:08:38,200 --> 00:08:44,690 put the altimeter in order to end the string. 86 00:08:44,850 --> 00:08:52,630 Let's go to the text but the code part so every time the program runs it will go to the entry point. 87 00:08:54,160 --> 00:09:00,590 This is here is done label and start executing the code. 88 00:09:00,670 --> 00:09:04,390 Now this he have seen this kind of syntax before. 89 00:09:04,390 --> 00:09:09,450 Whenever you have a call to a function Brighton will call. 90 00:09:09,730 --> 00:09:21,180 He will push the parameter so the print f is a function and the F misuse of this parameter. 91 00:09:21,330 --> 00:09:25,730 So in this case hallow here is pushed it a step forward. 92 00:09:26,000 --> 00:09:32,420 If all you call the function so this is the string. 93 00:09:32,430 --> 00:09:35,950 This is a string and Princeton message. 94 00:09:36,180 --> 00:09:36,880 Hello. 95 00:09:38,620 --> 00:09:42,530 And then after he will clean this take. 96 00:09:42,670 --> 00:09:47,500 So this is necessary in order to clean the state. 97 00:09:47,770 --> 00:09:52,890 Remove this from the state whenever you have a push. 98 00:09:52,990 --> 00:09:54,470 You should also have ADD. 99 00:09:55,210 --> 00:10:02,100 So the air here will remove four bytes from the state to clear four bytes from the state. 100 00:10:03,420 --> 00:10:05,020 So ESB is a staple in the 101 00:10:08,760 --> 00:10:16,520 now it is only necessary if you're using non we know API functions so print f is not in the API function. 102 00:10:16,520 --> 00:10:23,950 It is a C function which comes from this library. 103 00:10:24,420 --> 00:10:35,730 So a massive v RTT means Microsoft v sure C runtime so printf can from the explain to you soon in a 104 00:10:35,780 --> 00:10:46,610 shower session so after you finish printing the message hello to the screen you will then call another 105 00:10:46,620 --> 00:10:59,280 function KYC process as you process is window API function which is coming from this library contrary 106 00:10:59,390 --> 00:11:03,620 to the right. 107 00:11:03,770 --> 00:11:09,930 So now we come to the destination which is the input data section. 108 00:11:10,040 --> 00:11:11,510 So this is very important. 109 00:11:11,510 --> 00:11:22,650 All your libraries so you should have this property in by data readable. 110 00:11:22,650 --> 00:11:30,970 So the first slide here is where you specify what libraries you want to use and what is and use an escape 111 00:11:30,970 --> 00:11:31,940 character. 112 00:11:31,990 --> 00:11:38,750 So this special character means you want to split his into two lines if you do want to use this character 113 00:11:39,590 --> 00:11:46,910 you can delete it but you have to move this up to the first line in this 114 00:11:49,800 --> 00:11:54,420 same if this if you didn't want to use this then you can move this hub here 115 00:11:58,100 --> 00:12:06,180 anomaly you just put it into line so that is easier to read this. 116 00:12:06,310 --> 00:12:13,860 So in this line you see that we are using two libraries country 2 and Microsoft. 117 00:12:13,870 --> 00:12:17,180 We shall see runtime. 118 00:12:17,530 --> 00:12:27,350 So this is a file of the jail and is the symbol that is used in say a program. 119 00:12:27,510 --> 00:12:36,460 Now once you specified a library here we cannot import a library and the function that we need from 120 00:12:36,460 --> 00:12:49,260 the library so we input the Clinton theory to this API AC process and then we import the printer function 121 00:12:50,010 --> 00:12:52,420 from this memory. 122 00:12:52,770 --> 00:12:58,020 So once you have done the imposter like this you are not able to use them in your program up here. 123 00:12:59,550 --> 00:13:03,020 So that is run the program now to run the program. 124 00:13:03,030 --> 00:13:07,850 You click on run and then compile. 125 00:13:07,960 --> 00:13:11,140 Now if you go and look here is what it is. 126 00:13:11,150 --> 00:13:12,320 No EFA. 127 00:13:13,120 --> 00:13:15,420 So we have to compile us. 128 00:13:15,610 --> 00:13:21,420 So let's see what happens when you combine run compile. 129 00:13:22,290 --> 00:13:22,970 Okay. 130 00:13:22,990 --> 00:13:25,090 So there's a mistake here. 131 00:13:25,210 --> 00:13:37,940 So here you forgot to put the comma is not a comedy and then run compile Nice work so you can value 132 00:13:37,940 --> 00:13:43,090 as a new file is created that portable as he will file any extension. 133 00:13:43,090 --> 00:13:47,190 He is he now in order to run this file. 134 00:13:47,690 --> 00:13:52,170 OK go here to open the command from taxi Andy 135 00:13:54,990 --> 00:13:57,850 and never get to this folder. 136 00:13:58,480 --> 00:14:02,710 So you copy the path copy. 137 00:14:04,320 --> 00:14:10,060 Oh here I see teachers directory wrangling based above. 138 00:14:10,590 --> 00:14:19,860 PRESENTER So now we're in this hotel and you can type India the decrease the contents of the diary and 139 00:14:19,870 --> 00:14:25,840 we see the Halloween easier to run it just like hello. 140 00:14:25,920 --> 00:14:36,600 This press has she impressed happy impressed here and you can automatically get auto completion so every 141 00:14:36,600 --> 00:14:39,530 time you present a key you auto complete for you. 142 00:14:39,650 --> 00:14:42,150 You don't have to touch along again. 143 00:14:42,330 --> 00:14:51,220 Here she pressed him key press techie until you get in the ECF are now you press enter and Hallowell 144 00:14:51,240 --> 00:14:52,000 is shown. 145 00:14:53,600 --> 00:14:55,680 OK so now let's see what happens here. 146 00:14:56,940 --> 00:15:05,190 After her is showing he will go to a new line so it is helping equals Greenough will bring this Hallowell 147 00:15:06,210 --> 00:15:14,730 it means he will take this string and print it so when you print this thing at the end of the string 148 00:15:15,300 --> 00:15:17,460 he also prints a new line. 149 00:15:17,460 --> 00:15:24,600 That's why you can see it goes to in your name if I were to delete a new line characters. 150 00:15:27,360 --> 00:15:32,500 And compile it again and rerun it again. 151 00:15:32,870 --> 00:15:39,180 I can press a up arrow key to go back to my previous command and press enter. 152 00:15:39,320 --> 00:15:42,490 Now you see there is no new line character anyway. 153 00:15:44,900 --> 00:15:47,960 So it is hard in your main character works. 154 00:15:48,220 --> 00:15:50,660 Okay so what if he want to do print. 155 00:15:50,780 --> 00:15:55,590 Goodbye if you wanted to print goodbye. 156 00:15:55,590 --> 00:16:00,290 We can just copy it is a basic down here 157 00:16:07,880 --> 00:16:19,170 and take a string to his one goodbye this time and by the credit crunch. 158 00:16:19,540 --> 00:16:27,420 While OK known as Rabbit press up Hiroki to go back to the previous command. 159 00:16:27,530 --> 00:16:29,820 PRESENTER Tonight Prince. 160 00:16:29,840 --> 00:16:34,720 Two things were immediately followed by an odyssey. 161 00:16:34,820 --> 00:16:37,260 The two strings have been there on the same line. 162 00:16:37,330 --> 00:16:40,750 They go a star on your character to go to a new line. 163 00:16:40,940 --> 00:16:48,290 So if you wanted to go to a new line before we print a second string we can reset in your nine criteria. 164 00:16:49,550 --> 00:16:56,710 So just reset Zero G H and zero a hero H. 165 00:16:58,310 --> 00:17:07,180 So you forgot what is new right Curtis go look for it in the browser carriage return in 0 the 9 feet 166 00:17:07,190 --> 00:17:13,100 easily together it is a new line 0 D 0 is your line 167 00:17:16,620 --> 00:17:26,690 0 d You re the hash at back is her hexadecimal it tells the assembler in these two numbers has a decimal. 168 00:17:27,570 --> 00:17:38,000 So now that is combining and that is running programming in and you see now you present in two lines. 169 00:17:38,320 --> 00:17:45,800 So what what happens is when it comes to this printer you will print the first hello message and then 170 00:17:45,800 --> 00:17:54,420 there's a new line here to in your name by going during your time and then it comes to the second print 171 00:17:54,530 --> 00:18:02,340 here and the second print f will print the second string here and you get the second string and after 172 00:18:02,340 --> 00:18:11,070 you finish it goes to the instruction I say process it calls and I see a process function and I see 173 00:18:12,080 --> 00:18:17,190 so with zero means you are pushing zero as a barometer. 174 00:18:17,230 --> 00:18:27,990 See so if you want to know more detail about process you can say shame is the N C process. 175 00:18:28,450 --> 00:18:32,220 Presenter Hinckley only offers his eye for a result. 176 00:18:33,340 --> 00:18:39,480 And you can see so it is a process has a barometer called I see. 177 00:18:39,490 --> 00:18:45,170 Could I see cookies is good for the process. 178 00:18:45,220 --> 00:18:45,880 Contracts 179 00:18:49,430 --> 00:18:49,800 like that. 180 00:18:51,090 --> 00:18:58,500 So normally we will pass a zero for a single to indicate that there are no errors in the execution of 181 00:18:58,500 --> 00:18:59,100 the program. 182 00:19:00,930 --> 00:19:11,370 OK so this is how to write program assembly and we have just finished our first hello and goodbye program 183 00:19:11,840 --> 00:19:13,030 so goodbye. 184 00:19:13,030 --> 00:19:14,940 I'll see you in the next lesson. 185 00:19:14,940 --> 00:19:15,780 Thank you for watching.