Here's example code (the code I was using to test the class):
Code: Select all
builder = Fat12Builder("Fat12BootDisk.dsk", "temp/Fat12BootSector.bin")
from fat12builder import *
builder.AddFile("media/README.TXT", 0)
builder.AddFile("media/ED.EXE", 0)
builder.AddFile("media/HELLO.TXT", 0)
builder.AddFile("media/EDIT.COM", 0)
builder.AddFile("media/LICENSE.TXT", 0)
builder.AddFile("media/CHANGES.TXT", 0)
builder.DeleteFile("README.TXT")
builder.DeleteFile("media/EDIT.COM")
builder.AddFile("media/EDIT.COM", 0)
builder.AddFile("media/README.TXT", 0)
builder.CloseDisk()
The ", 0" is for the file attribute, which can be any combination of the following (replace "builder" with your object of course):
Code: Select all
builder.ATTR_READ_ONLY
builder.ATTR_HIDDEN
builder.ATTR_SYSTEM
builder.ATTR_VOLUME_ID
builder.ATTR_ARCHIVE
Code: Select all
builder.OEMName (defaults to "JFOS". Maximum of 8 characters. less chars are padded with spaces, more are truncated)
builder.VolumeID (any 32-bit number, defaults to 0xB007DA7A)
builder.BootLabel (defaults to "JFOSBOOTDSK", same rules as OEMName except that this field is 11 characters)
builder.RootEntriesCount (defaults to 224, this field basically determines the maximum number of file entries allowed)
builder.NumberOfFATs (defaults to 2, this field specifies how many copies of FAT are on the disk. 2 is default because most
disks have 2 FATs)
I plan on getting a solid, well commented boot loader and second stage bootloader COM file written soon, which I'll release, along with this utility as a full bootloader example.
Let me know what you guys think!