Jump to content
IGNORED

Boot sector question...


dwhyte

Recommended Posts

Format of the boot sector...

 

OK... I've remembered this much on my own, but I'm having trouble finding information of the subject...

 

The first byte is pretty much scratch... I've seen some disks with this byte nulled and others with a $01 there... I'm just assuming this is the start sector placeholding byte...

 

The second byte is the number of sectors to be loaded

 

The next 2 bytes are the starting address of the data being loaded, now the 2 after that are what I'm wondering... Is it the ending address or the run address?

 

Just curious, because I'm trying to design one of those 3 (or more possibly) sector boot menus that I used back in the day...

 

And another question... If my menu does run over the 3 sector limit, how would I modify the VTOC (Assuming DOS2.5 or MyDOS DD) into taking those used sectors off the free sector list?

Link to comment
Share on other sites

as far remember (very long time ago i coded boot stuff)

 

first 6 bytes of sector 1

 

00

xx ;how many sectors to load

lo

hi ;loading adress where data is moved to while loading

lo

hi; init adress when all sectors xx are loaded OS jumps here

 

what i am not 100% sure is that the OS is moving sector 0 data to the loading adress including the 6 byte header...

Link to comment
Share on other sites

IIRC, the boot sector is loaded to $400 then copied to it's specified destination.

 

<LoadAddr + 4> is the DOSINI address and will be copied to locations $C,$D upon successful completion of the disk boot.

 

Once <LoadAddr>+1 sectors have been loaded into memory, the OS does a JSR to <LoadAddr+6>

 

That is the "boot continuation" address. The boot header is copied to memory along with the boot code. The boot continuation code can either continue to load sectors, or just return. It should CLC to indicate a successful boot (SEC for error).

 

It is entirely up to the boot loader to set the DOS vector ($A, $B).

 

During a warm start, the OS will:

 

- If a runnable cartridge is installed, JSR through it's INIT vector ($BFFE). Return is expected (although many carts don't return). If the cart is marked as a "Diagnostic Cart" then the OS will just JMP through this address (many games e.g. Star Raiders run as diag carts).

- JSR through CASINI (2,3) if the BOOTFLAG warrants it. Return is expected.

- JSR through DOSINI (C,D) if the BOOTFLAG warrants it. Return is expected.

- If a runnable cartridge is installed, JMP through it's RUN vector ($BFFA). Return is not expected or possible.

 

- If no cartridge is installed, the OS will JMP through the DOS vector (A,B). If the boot code has not changed this, then the Memo Pad or Self Test will be executed.

 

Modifying the VTOC map: I used to just read in sector 360 and set the relevant bits at the start of the VTOC. That is sufficient to ensure no overwriting occurs of your boot sectors. But, doing that alone will screw up the Free Sectors count.

 

Possibly an easier way: Format a disk, then write a file that reserves the sectors you want. ie - if you have a 10 sector boot, then you'll need to reserve 7 sectors.

Remember that 125 bytes is the data portion of the sector, so use increments of that amount.

 

Once the file is created, just edit the Directory sector, and mark the file as deleted. Then, the file won't exist but the sectors will be reserved and the free sector information will be correct.

Edited by Rybags
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...