‫In the last lecture I went through with you about the programmable Interop controller in this lecture,
‫we are going to remap the program to interrupt controller so that Esau's start at interrupt zero 20.
‫So the first thing we're going to do is get rid of this line of code, which was from the last coding
‫lecture.
‫So just delete that and we're going to go to Colonel Diesem.
‫And just after we enable the 20 line, we're going to remap the master pink programmable intrepid controller.
‫So we're going to go move AAO zero zero zero one zero zero zero one, be OK.
‫And this will put the pack into an initialization mode.
‫And we're just going to go out six, 20 A-L and we could do this and see.
‫But because we're only doing this once, I just do it in the Col Diesem.
‫It's quite a low level operation.
‫Anyway, we now go movil zero x 20.
‫Interrupts 20 is where M. ESR should start out six twenty one AAO and now we're going to put the pack
‫in X eighty six mode.
‫So we do that by going movil.
‫One, two, three, four, five, six, seven, eight.
‫Out six 21 a oh, OK, so that will remap.
‫The mass to pick.
‫Awesome.
‫So we now go to the terminal, we're going to make clean and we're going to build a legacy that builds
‫without any problems.
‫So the pick would get remap now as soon as just before our colonel runs.
‫The colonel making the pick would have been remapped at that point.
‫OK, so what we're now going to do is we're going to go to ADT.
‫I see.
‫And we are going to make a interruptive for a saving time.
‫Esau's OK, so if you guys remember, this is the standard Yakutia so I Kizzire is the timer interrupt
‫IQ one is the keyboard interrupt.
‫So if we map IQ one for example, any key presses will cause the interop to invoke.
‫So we're going to do that.
‫So to because we've mapped our IQ to zero twenty, it means that whenever a key is pressed into six,
‫twenty one will be the one that's invoked.
‫So if we map interrupt zero twenty to a function with or without it set that we've made, then we should
‫be able to capture those.
‫So let's let's do that now.
‫OK, now I know previously we have used it set and just set it straight to a function.
‫This isn't good enough because when we leave this function, it doesn't call an irate, which is required
‫if you're returning from an interrupt.
‫So we are going to have to create some RAPPA functions before we go any further.
‫So if we go to it Diesem, we're going to go in it 21 H.
‫OK, so this is this will be our keyboard interrupt and we're just going to do it by here.
‫We're going to do push a D and pop a D by here because it but when we return it expects the state to
‫be the same.
‫Right.
‫And if we briefly look at the documentation push and pushes all the general purpose registers and pop
‫diva stores them all.
‫So that's why we do push the pop.
‫OK, so now here we're also going to clear the entraps.
‫And stop the interrupts again, and then we're going to go call in at twenty one handler.
‫OK, now here at the top.
‫We're going to go extern and it 21 hey, Chandler.
‫OK, and clear interrupt instruction and and start interrupt instruction.
‫We're going to put these at the very top.
‫So Kelly and Steve, OK, because we don't really want to interrupt, so we want to reduce the chances
‫of something like that happening.
‫It's not a huge, big deal in most circumstances as long as we're not relying on any global states.
‫However, yes, it's best to do this.
‫So so when we enter our interrupt handler, when we can't possibly do anything critical and the process
‫will get interrupted because we don't really want that.
‫Right.
‫So by doing Clie, that clears the interest for us and then we start them again before we leave this
‫routine.
‫And we do.
‫And I read because it's an interesting turn and because it's an interpretation.
‫That's exactly why we can't stop pointing things to functions.
‫Right, because it needs to be treated as a interrupt.
‫So when I did it before, I was just an example to show you.
‫Ideally e0 also needs to first be written in an assembly and then jump to that function.
‫Right.
‫However, this is going to be fine for the time being.
‫So we go to see Diesem.
‫We now need to export and at 21 Hajj's so we go global and at twenty one hech and you can use macros
‫to to do this for every possible interrupt.
‫Right.
‫But we won't worry about that yet, but it's much more efficient, but it's more complicated.
‫And this is a building process for you guys.
‫So in a 21 page we will map to this function here, this assembly function, and it will call our C
‫handler, which is in a twenty one Hajaj handler.
‫So I know that says in it twenty one hand, let's just change it.
‫And at twenty one.
‫Hey Chandler.
‫OK, and now if we go back to I'd see that C and at the top here we're going to go extern Lloyd.
‫And at 21, hate.
‫OK, and then just beneath here, we're going to go void in a twenty one.
‫Hey, Chandler Prince.
‫Keyboard pressed.
‫OK, so we scroll down now we're going to go it said zero 21.
‫And then we're going to use our 21 hacia.
‫OK, which will call our handler eventually.
‫So we're not quite done, I want us to include I hate each and remember what I said, we need to send
‫these guys an acknowledgement.
‫So we're going to use magic numbers here for now.
‫We're going to change that soon.
‫Let's just see if this works.
‫So we go make clean build that.
‫S.H., we can see include iodized failed.
‫Yeah, aio forward slash iodized, which is where we're going to read from the IO directory.
‫There we go.
‫I now want you to go to Colonel Dadaism and we just need to re-enable the interrupts and we do that
‫by doing SETI.
‫And the reason for this is because when the probability of control is generating interrupts they will
‫be ignored unless the processor has interests enabled.
‫Right.
‫So we need to enable that.
‫Now, before we go any further, I just want to let you know that we just enabled the introduce a little
‫too early.
‫However, while making this course, I never run into any problems with this.
‫Now, we correct this mistake in the creating the enable interrupts function lecture if you run into
‫mistakes after completing this lecture, such as the system panic's, I want you to check out that lecture
‫before continuing this course.
‫Once you've implemented that lecture, come back here and then we can carry on the costs.
‫However, you won't have to worry about this in most cases, essentially because we in the interest
‫before we set up the script to table, that is a very short time frame where if an interruption occurs,
‫your system will actually panic.
‫You know, if the system is panicked because it will say C by a, C by a C, but it'll keep resetting
‫itself.
‫So in short, all I want you to do is always keep following this lecture all the way through.
‫And the chances are you're not going to have any problems if at the end of this lecture you do have
‫problems, it's resetting like this Chekov lecture I just said and do it early.
‫If you have no problems, keep following this course all the way through.
‫And eventually we will get to that lecture where we then make it.
‫So we enable the interrupts after we set up the script, a table, not a fall.
‫So just keep watching this lecture, guys, and see what happens.
‫So now go back to Editta ASEM and we're going to have to create a assembly function here for one.
‫There is no interrupts.
‫And the reason for that is, is because our program will interrupt controller.
‫It doesn't know if we've implemented the keyboard interrupt.
‫It doesn't know if we implied the time we interrupt.
‫It doesn't know if we've implemented the hard disk interrupts it doesn't know it's going to interrupt
‫us.
‫And if we don't have those interests present, it's going to cause a processor fault.
‫And the processor, what we said, we don't want that.
‫So we need to create a routine here for when there's no interrupt so we can handle that correctly.
‫So we just go no interrupt and we're just going to essentially copy and paste in 21 H.
‫OK, and we're going to call no interrupt handler.
‫And now I just want to export this.
‫So we're going to go global.
‫No interrupt.
‫And we also need to import know interrupt handler.
‫OK, so the next step then is to go to Editta C and we're going to create a no interrupt handler function
‫here.
‫And all that's going to do is just go out Bezier 26, 20, because remember we need to tell the pick
‫the way we're done handling this, otherwise it will not resend any interest to us again.
‫So we scroll down and just puffier, we're going to say four inch equals zero.
‫Apolo Pekoe s total interrupts I plus plus we're just going to go.
‫He said I.
‫No interrupt, handler and sorry, no, it will be no interrupt because we want the assembly function
‫to get called the one that's in here, right?
‫OK, so if we just scroll up now, then we're just going to go extern, void, no interrupts.
‫OK, and if we now go back and we make clean and build.
‫OK, and we now go keep in kumu.
‫And press a key on the keyboard and you can see keyboard pressed.
‫Now you'll notice this only happens once and then never again.
‫This is because we need to read from the keyboard as well for us to keep receiving these.
‫However, that's for another lecture.
‫But that is the reason why we only get interrupted once an hour, multiple times.
‫We can cover the keyboard at a later date.
‫Before we go any further, let's just change this, ITCZ said to Xerox twenty, which is the time to
‫interrupt because I want to quickly show you that we now make clean and build that.
‫And you can see this keyboard press, people see that again, this front that again.
‫There we go.
‫You see, that's the time where I was talking about.
‫So if you hook this, this is Seijiro here or intrinsics 20, because that's where we've mapped it.
‫You can actually constantly switch between processes and while tasks by swapping out the registers.
‫And if you do this really quickly, it gives the illusion of multitasking even on a one call processor.
‫So let's just change that back to the next twenty one.
‫And that is it for the programmable Interop controller for now.