Transcription
So, today I will tell you how to write this bootloader in assembler, without going into details about how the processor, memory, and so on work. The only important assumption that will have to be made is that for virtualization I am using, and the dialect of assembler through which I will write everything and through which everything will be compiled is Netf assembler, it will also take us to the home output directory, the root directory of our project. Also, for compilation, I will personally use a script that I will post either in the description or on GitHub, because I don't have too much desire to explain how it works and why it works. We create, in fact, the bootloader file. As an editor, I will use. You use whatever is convenient. Now, enter insert mode and specify where our script will be loaded in the compiler. This, if I'm not mistaken, is address 0x700. Next, we tell the assembler to generate 16-bit code for the processor in real mode. And then I will add a few labels. This is the start label, the boot label, and the print label, so that we can print something on the screen. Start. I will immediately proceed to start executing the boot program. And then we move to the DS register and to the register, and we move it too. You can read about the designation of registers later. Then, into the registers, we load our future message, which we will output, and call the subroutine PR. Well, and, accordingly, so that the processor does not process unnecessary functions and garbage, V print V. I will pass the BIOS function and then designate the point, that is, a loop, because assembler cannot output strings, it can only output them character by character. Therefore, using the following manipulation, and here we transfer control in case the register A is zero, that is, we end our loop. interrupt 0x10, if and we loop our loop in this case, we will simply return everything through return. Next, we specify our message MSG define by message. Let it be too. And, accordingly, we finish it. Further, the bootloader should weigh something around 512 KB, otherwise the disk will simply not find it. Ah, by the way, an important clarification. We will compile to a floppy disk. Therefore, accordingly, we increase the size of our file to 512 KB. I don't remember anymore. And we write the boot signature. It is already 0x aa55. We save the file change mode. In order for us to be able to run our script. And, accordingly, we run the script itself. Somewhere I made a mistake. So, Uh-huh. I missed that sign. And ideally, after this it should work, but let's apply the same manipulations. was not specified Restro, Understood. Well, that's basically it. We can output any string. And it will output it. Well, that's basically it.