Page 1 of 1

Boot Sector Size Competition

Posted: Sat Nov 22, 2014 4:37 pm
by alexfru
It looks like this hasn't been shared over here yet and there's plenty of time until the deadline (2014/12/31 "at the stroke of midnight MST"), so here goes.

Overview:

To create a boot sector, occupying no more than the first 512 bytes of the disk, to find, load, then execute a specified loader file, while completing specified tasks within this code, as well as following the rules given.

Combuster suggests a bit more detailed but still short definition of the task:
Given a disk with up to four partitions of which exactly one is active and points to a FAT12/16 filesystem, load LOADER.SYS from that filesystem to 0x30000 and jump to it.

Rules and tools.

Discussion @ alt.os.development

Re: Boot Sector Size Competition

Posted: Sat Nov 22, 2014 5:20 pm
by Brendan
Hi,
alexfru wrote:To create a boot sector, occupying no more than the first 512 bytes of the disk, to find, load, then execute a specified loader file, while completing specified tasks within this code, as well as following the rules given.
Is it supposed to be:

a) an MBR, where the partition table describes primary partitions, and where it makes no sense to load anything from any file system whatsoever (e.g. where it should only load the first sector of the active partition and jump to it); or..

b) a boot sector (the first sector of a partition and not the first sector of the disk), where the partition table probably doesn't exist and would describe extended partitions (not primary partitions) if it did exist?

For the latter case; I think the testing should be more realistic. E.g. a dual boot system with some sort of boot manager installed in the MBR (e.g. GRUB, GAG, Plop, etc); with 2 primary partitions that both contain the boot sector being tested and a FAT file system, where the boot sector must only use files from its own partition (e.g. and the boot sector on partition 1 can't accidentally boot the loader on partition 2; regardless of whatever tricks the boot manager does to allow dual boot).


Cheers,

Brendan

Re: Boot Sector Size Competition

Posted: Sat Nov 22, 2014 5:56 pm
by alexfru
I think you should ask Ben to clarify.

Re: Boot Sector Size Competition

Posted: Sun Nov 23, 2014 6:43 am
by Combuster
A better summary would be "Given a disk with up to four partitions of which exactly one is active and points to a FAT12/16 filesystem, load LOADER.SYS from that filesystem to 0x30000 and jump to it."

Re: Boot Sector Size Competition

Posted: Mon Nov 24, 2014 5:50 am
by Cjreek
It will be your job to write a boot sector that will check to see which partition is set as the active partition[...]
"active" means bootable in this context, doesn't it? so byte 0 of the partition table entry = 0x80?

Re: Boot Sector Size Competition

Posted: Mon Nov 24, 2014 8:41 am
by Antti
General problems with "do-far-too-many-things-without-space-doing-them-correctly" boot sectors:
  • Obfuscation.
  • Hard-wired constants.
  • Lack of validity checks.
  • Using possibly unsupported instructions.
  • Using possibly unsupported BIOS calls.
  • Short error messages (if any).
  • Hacks like self-modifying code.
  • Other hacks.
This competition could favor bad code. Anyway, good luck.

Re: Boot Sector Size Competition

Posted: Mon Nov 24, 2014 10:02 am
by Cjreek
@Antti: That's not the point of those competitions.
I should be clear that you can't write code which does one thing with as few/small instructions as possible and doesn't miss any of your points at the same time.

It's just a challenge to squeeze a given code in as few bytes as possible.
I don't think that those competitions really favor bad code. Sure the code which results from this competitions will be bad but I don't think anybody will code like this in one of his real projects.