OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:38 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Boot Sector Size Competition
PostPosted: Sat Nov 22, 2014 4:37 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
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


Last edited by alexfru on Sun Nov 23, 2014 6:02 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Boot Sector Size Competition
PostPosted: Sat Nov 22, 2014 5:20 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
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

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Boot Sector Size Competition
PostPosted: Sat Nov 22, 2014 5:56 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
I think you should ask Ben to clarify.


Top
 Profile  
 
 Post subject: Re: Boot Sector Size Competition
PostPosted: Sun Nov 23, 2014 6:43 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
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."

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Boot Sector Size Competition
PostPosted: Mon Nov 24, 2014 5:50 am 
Offline
Member
Member

Joined: Thu May 28, 2009 2:41 pm
Posts: 70
Location: Germany
Quote:
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?


Top
 Profile  
 
 Post subject: Re: Boot Sector Size Competition
PostPosted: Mon Nov 24, 2014 8:41 am 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 923
Location: Finland
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.

_________________
Undefined behavior since 2012


Top
 Profile  
 
 Post subject: Re: Boot Sector Size Competition
PostPosted: Mon Nov 24, 2014 10:02 am 
Offline
Member
Member

Joined: Thu May 28, 2009 2:41 pm
Posts: 70
Location: Germany
@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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group