‫Hello, everybody, and welcome.
‫And in the last lecture, as you know, we made a get chaar function in assembly that would ask the
‫colonel for a contact from the processes kebob baffo.
‫In this lecture, we're going to create a PUSHKA function, which will write one character to the screen.
‫So you can see that we've done the prints, we've implemented prints and stuff like that.
‫So you can print characters.
‫Well, strings, I should say, strings of characters.
‫However, we have no command for pushing one individual character, so we're going to create that today.
‫So if we look at terminal ritcher, we can create a command that calls this function much like we did
‫with keyboard pop.
‫So we just copy and paste this into the header file to give access to it outside.
‫And that's internal down the hatch, by the way, and cannot see.
‫So that will allow us to call terminal right outside.
‫And I do need to know, guys, this printing functionality ideally should be abstracted out from Colonel
‫Dot.
‫See, now our project's matured enough and it shouldn't really be in here.
‫It's clutter, right?
‫Should be in a separate file.
‫But we don't have to worry about that right now.
‫So if we just go to iodized see and we're going to start creating this command now, so we're going
‫to go voit ISI d.H Command three pucher.
‫So that's in iodized C guys in the ISI, the directory struct in SREP frame frame and now we're just
‫going to go chaussy equals char in it.
‫So we're casting to a character here guys and we're just going to go tarsa get stack idam tasc current
‫zero.
‫So you know they push onto the stack the character they want us to output to the terminal.
‫OK, so we pop that off and store it in variable C here.
‫OK, and remember we have Casta Integer first before we cast Toucha because of the size difference.
‫So what we're going to do now is, is we're just going to go terminal.
‫Right char C and the color will be 15.
‫OK, and just return zero.
‫OK, and that's that for that function copy and paste this prototype into iodized.
‫OK, go to Isaw ADHD and we're going to add a new enumeration system.
‫Command three percha.
‫OK, now in ISI, the Hajjaj C, we're going to read the commands so we're going to go iso 8h register
‫command, make sure you don't do register commands.
‫So easy to do.
‫System Command three percha Isaw 8H.
‫Come on, three.
‫OK, now, once you've done all that, we've now registered the command in the system and we can use
‫command three in our userspace application.
‫So we're just going to go to programs blank Dadaism and we're going to get rid of this pushing of the
‫message.
‫We no longer want to output the message down here.
‫I can talk with the colonel.
‫We don't care about that anymore, OK?
‫Instead, what we want to do is we want to call the get key function and then we just want to push the
‫register because remember, the expression contains the result.
‫That's the one that's got the key that was pressed in.
‫So push that to the stack and we're going to change this command code to three.
‫And command three is pucher, as you as you know.
‫And if we now compile and run that make clean build that S.H..
‫And we're going to run it CDPR in Kumu, Jamie Dash systemis 386, ágúst up in.
‫It's going to be a black screen press, a key, and now we can see the key, we pressed I pressed a
‫and now I can see a that's press another key.
‫We'll have to restart the program, though, because we haven't made it go back on itself.
‫So now we're going to press see.
‫And now.
‫So you can see we're now having some sort of input output going on.
‫So this is this is the start of a some sort of shell.
‫So it's really good.
‫Really, really good.
‫So what we're going to do now is we're going to create a new label by here called Kickett Loop.
‫It's a really stupid name, actually.
‫Let's just call it loop, OK?
‫And scroll loop.
‫And just by here, we're going to jump to loop rather than do an infinite jump on ourselves.
‫OK, and now if we try that again, make clean bill that S.H..
‫And we do see Ben Kumu, I remember you compress control ah and then type Q and it'll give you the command
‫and then you can just present guys in the terminal.
‫I'll just start typing.
‫Hello world.
‫I have keys.
‫This is awesome.
‫Now you'll notice backspace doesn't work.
‫The enter key doesn't work, stuff like that.
‫However that stuff can come later.
‫You don't have to worry about that right now.
‫The important thing is we have keyboard access now.
‫So as you can see, it's a little more tricky than doing it with the BIOS.
‫You know, we're in charge of doing everything from scratch, talking with the hardware, writing the
‫keyboard driver.
‫We've done all of that ourself, OK?
‫And you can see it works perfectly.
‫You can type any key you like and it will work.
‫We we don't have any case in sensitivity at the moment.
‫It's all uppercase.
‫That's because the keyboard doesn't know the difference between a lowercase A and an uppercase A, it
‫just knows about schang codes.
‫OK, so what we need to do is in the future we'll need to implement the caps lock to allow us to go
‫from lowercase to uppercase.
‫We probably won't implement shift because once once you know how to do the caps lock, you'll be capable
‫of doing a shift yourself is the same thing basically.
‫Well, almost the same thing.
‫So yeah, you can see that this is working absolutely fine.
‫So you've now got keyboard access and ah and this is control completely without use a program.
‫Blankfort I assume we get the key and then we output the key.
‫So amazing.
‫Now this is how it should be done.
‫We shouldn't be pausing in kernel land.
‫Right.
‫We shouldn't be doing that.
‫That's a very bad idea.
‫That's why we loop here until we get a key and we don't just block in the kernel space.
‫This makes much more sense.
‫OK, so yeah, that's all working.
‫So congratulations on that.
‫You now have Eyo in protected mode.
‫Congratulations.