‫Hello and welcome in in this lecture, we are going to prepare our bootloader for being booted on a
‫real machine.
‫Now, in most cases, this current bootloader will run just fine.
‫However, some biosphere's, including my boss, will tamper with your data if you put your bootloader
‫from a USB stick.
‫Now, the reason this happens is because of the bio's parameter block.
‫Some bosses expect this while most Bias's will not corrupt your data and will work just fine with the
‫code that we have here, some will actually stop filling in information and it's important this doesn't
‫happen.
‫So here you can see things like number of sectors per cluster, number of reserve sectors and so on.
‫My bias actually replaces these numbers in memory with numbers of its own, because when we boot from
‫a USB stick, we're actually doing something known as USB emulation.
‫The bias is treating our USB stick as a hard drive or hard disk and allowing us to talk to it as such.
‫So you don't really need to know too much about the bias parameter block right now.
‫You just need to know that some biases assume it's there and we'll start writing data overwriting your
‫code, which can lead to problems.
‫For example, our little program here will boop for me.
‫However, this jump instruction here is corrupted, so it causes my system to just keep running code
‫and ram.
‫It never stops.
‫So we get around this problem by implementing the bias parameter block, we don't we don't have to have
‫real values.
‫It can just be all zeros and we can just have a fake one just to get around this problem.
‫So the first thing we do is, is we add up the size of the bias parameter block, except these three
‫bytes because these three bytes are short jump and no operation and some biases will look for this as
‫well.
‫So we're actually going to write that in, but the rest will be all fake.
‫So I've added those up and I've come up with the value of 33.
‫So that's the size of it, apart from our shot.
‫Also note, this is Osterberg.
‫It's a fantastic resource for people wanting to develop Col's and operating systems is very detailed.
‫Some stuff's out of date, so make sure you check.
‫So if you ever decide to use this website, make sure you check multiple sources if you run into problems.
‫Right.
‫So we need to actually basically just make 33 bytes.
‫Now, bootloader so that if your bias is like mine when it comes in overwrite stuff, it isn't actually
‫damaging your code.
‫It's just writing into your fake BIOS parameter block.
‫So we go back to Visual Studio Code.
‫What we're going to start by making our.
‫Short jump here that expects this three bites in size, right?
‫So it's a short jump in and no operation.
‫So we're going to start by doing that and we do that by creating another label.
‫We'll just go under scroll start and then we're just going to go jump shot start, OK?
‫And then we're just going to go up by here and this this line of code that we have here.
‫We'll need to be copied.
‫And we'll need to place that here.
‫OK, and we're just going to replace the star with step two, something like that, and then we're just
‫going to put step two by there.
‫So I know that's a mouthful, but then our bias parameter block will go in the middle by here.
‫Right.
‫So just to clarify what we've done here, we've created a new label, Underscore Start, that just jumps
‫to our star label here.
‫And this is also a short term project.
‫And we have a new operation here as required for our bias crime to block as well.
‫So then what happens is the problem comes in here, jumps to our star label here, OK?
‫And then we jump to step two.
‫But we we specify the segment zero seven zero.
‫So the code segment register gets replaced with zero seven zero.
‫Right.
‫And then it'll start executing step two, which will print our message.
‫So in here, then we need to go time's.
‫And the value was, I think it was 33 times 33.
‫DB zero.
‫So all this will do then is it will create 33 bytes just after our short jump here and that is our bias
‫parameter block.
‫So if your bias does stop filling in these values, it doesn't corrupt your code.
‫It just fills in these no bytes.
‫So it's perfectly safe.
‫OK, let's just assemble that and see if that works as expected.
‫So we just go, Nazeem Dasch have been booted, Assem, Das Show, Boot Dobbyn, and then we're going
‫to run Kumu.
‫And we see how global, so that works fine on the emulator.
‫And I think now we're ready to test it on your real machine.