Recently, I started to read "Write Your Own Operating System", Chapter 1 "The Operating System Completed in Ten Minutes", and found that it was implemented with a floppy disk~
It's really hard to find a floppy disk now, so I thought of using a U disk to achieve it.
Searching for information on the Internet, I found that there are already masters who have realized it. For details, please see:
Read and write U disk (FAT32) boot sector
This article discusses how to write MBR on a USB flash drive formatted with FAT32:
So after compiling the above code, how to write the compiled boot.bin into the MBR of the U disk?
I thought of the int 13 interrupt of the BIOS. Use this interrupt to realize the function of reading and writing disk sectors (ah=2 read sectors, ah=3 write sectors).
So, I booted with a U disk, entered pure DOS, and used Debug to execute the following code:
After the execution of the above code is completed, restart the computer and start the U disk. You can see the effect :)