‫Hello, welcome, everybody.
‫In this lecture, we are going to create our very own show now, this blank program, we're going to
‫just change this because we're still going to keep it.
‫We're going to use this again in the future.
‫But for now, it's pointless.
‫So we're going to just delete all of this and we're just going to keep my age.
‫Is 98 just like that?
‫OK, so.
‫So it's like that.
‫And if we just make clean and just test that, everything should work, OK?
‫And yeah, we can see my age is 98, so everything works fine, great, so what we're going to do is
‫we're going to create a new directory called Shell, OK, in programs.
‫So we're going to go new for the shell.
‫And inside Shell, we're going to have a file called Sheldon Hage.
‫And we're just going to go hashtag if and death shall Hadash to find shall Hawach hashtag.
‫And if we're going to create a new directory and show called Source and we're going to copy and paste
‫sheltered Haitians of that folder.
‫And we're just going to create a new file in the source directory called Shelled Out See and Hear,
‫which is going to include Shelden.
‫So we're going to make our main function.
‫And all this is going to do at the moment is print shall loaded and it's going to just loop forever,
‫just for the time being.
‫OK, so we can test that.
‫So inside the shell directory, not the source directory, the shell directory, we're going to create
‫a new file called Makefile.
‫OK, we're going to go to our blank program and we're going to copy and paste the link script into the
‫shell directory.
‫OK, because the linker script is essentially the same, OK, for all use programs.
‫So inside the make file, then we're going to copy and paste the make file of blanks into shells and
‫we're just going to rename these things.
‫So we're going to go shell a shell out of Shell shelled out.
‫See, and that make sure that's the source directory.
‫That guy's a case source shelled out to see build shelves, auto remove shelves, elf and the output
‫be shelved, although I'm not compiling source Shelden.
‫See.
‫OK, so make sure you just replace that blank stuff and we link with the standard library.
‫That's perfect.
‫OK, so that's all fine guys.
‫OK, so we're now going to do is we're going to go to the colonel's make fall further down here and
‫we're just going to scroll all the way down to our make programs and we're going to copy and paste one
‫of these commands and we're just going to build a show.
‫OK, so we're going to go make a show and we're going to copy and paste clean and we're going to go
‫make clean shell and now just go make clean maikol well, make clean beltless, I should say.
‫And there we go.
‫We can see it tries to compile it as an implicit declaration of print.
‫Just go to shell out see.
‫And we just need to include a studio dot Hajj and we need to include as to be labeled Hajj which is
‫going to include all of them right.
‫For now.
‫And finally, show us start Hajj.
‫Have we now try that again?
‫That should compile fine.
‫There is, however, a problem when it tries to output the file because we need to create a directory
‫in show.
‫So just credible directory, inshallah as well, guys, because that is where the files will be going.
‫OK, we now run to that again.
‫We can see that finally compiles completely fine and we have a shelter.
‫OK, so let's go to Colonel that C because we're going to change the first program, the loads we can
‫see it's currently blanked out.
‫Lf we're going to change it to shelter.
‫Lf OK, and if we now go to the makefile again of the kernel, we need to just copy that file across.
‫So copy and paste pseudo copy command where we copy blanked elf and we're going to copy shelter elf.
‫OK, and one of the thing we just need to put shall here as well for the directory.
‫OK, we're now going to go make clean Bill did I say.
‫CD, Ben Kumu.
‫And we now see shell loaded, so that's perfect.
‫OK, so we're now going to actually start making our shell work properly, go to Shell Out Sea and we're
‫going to start making a nice placeholder here for our shell.
‫So firstly, we're not going to call it a shell.
‫We're going to call it features.
‫So a process version 1.0.
‫And if you really want to be clever about this, guys, you can even go ahead and make some sort of
‫colonel command for getting colonel information.
‫But for now, we'll just use this statically.
‫So what we're now going to do inside our while loop here,
‫we're going to go chop off 1024 Peatross terminal red line, buffer size of buff output while type pentru.
‫OK, so they're going to basically type A line and we're going to read that.
‫OK, but before we do anything, we need to print a just a little right arrow here.
‫OK, and that just basically says to them, go on, stop typing.
‫OK, so once we've then read the line successfully into the buffer, we're then ready to try to run
‫that command.
‫However, that stuff will come later on.
‫So here we are now going to go make clean build that, S.H..
‫And we're going to run kumu.
‫And we see Peatross version 1.0 and just start typing.
‫So what we're going to do is we're going to type calculator and there we go.
‫And if you press enter, you'll see the right arrow appears here.
‫So we do need to do a new line as well, guys.
‫So just after they read the line, we're going to go print it, print newline character just like that,
‫OK?
‫We now try that again.
‫That should fix that problem.
‫It should now put things on new lines and look a bit more like a shell.
‫OK, so make sure you go keep in there and we're going to try that again.
‫OK, so now we're now going to type calculator and there we are.
‫It worked OK.
‫And we can see the backspace is working as well.
‫OK.
‫And just to prove that the backspaces working, because we do want to double check that because although
‫it looks like it's working, is the buffer getting filled correctly?
‫That's the question.
‫So I'm just going to go print Bufferin new line just to double check that.
‫And you guys can do that, too, if you want.
‫You know, it's good to get in in mind that you're going to be debugging quite a bit in kernel development.
‫So we're going to just try that again.
‫So I'm going to go calculator enter and we see calculator good testing and testing.
‫OK, so we can see it works.
‫OK, and now let's try testing backspace, backspace, backspace and we see test so we can see our code,
‫our code, the checks for the backspace by here.
‫Impetuous terminal Abebooks.
‫So here we from lines 33 to 39, we check for the backspace.
‫Right.
‫And that works correctly.
‫So we basically adjust the buffer.
‫We don't have to remove it from the screen itself because we've already program that into the terminal.
‫It already checks for a backspace.
‫And if it sees one, then it will change.
‫It'll remove one byte in the terminal.
‫We've already written all of that stuff.
‫So, yeah, congratulations.
‫So all we need is that one newline character and that is the base for our show.
‫So as the next few lectures come along, we're going to be making it so you can, you know, launch
‫programs so the commands will actually work.
‫So if we want to take, for example, blank, it would actually launch a blank program.
‫OK, and there's a blank program there, blank that c it will actually launch it.
‫OK, well, they would type something like blank thought out and it would load it OK, but for now this
‫is what we have.
‫It's a nice little skeleton for the actual shell.
‫So congratulations.
‫We're are now going to continue implementing this in the next coming lectures.
‫Have a great day.