how to write custom boot sector to disk code example

Example: how to write custom boot sector to disk

Writing an El-Torito Boot Sector
At the start of your El-Torito boot sector, you simply need to set segment registers to known values (as usual) and use the BIOS to load files from the CD as per ISO 9660. As with a normal floppy or hard disk, DL contains the BIOS drive number.
Using Mkisofs, you can write your boot sector to a CD image (.iso) as follows:

mkisofs -R -b path/to/loader.sys -no-emul-boot -boot-load-size 4 -o [IsoFile.iso] [IsoDirectory]