Jump to content
Sign in to follow this  
Thelen

making a boot loader for the atari 8 bit

Recommended Posts

I'm using the Xasm Xboot loader now, but was wondering how to program my own ? is there somepage with some explenation of it ? or can someone explain a bit ?

 

Thanks, Thelen

Share this post


Link to post
Share on other sites

the simplest bootloader is loading sectors into ram and then execute the code without directory etc stuff... so a custom bootloader which works just for your game...

 

as far as i can remember you can put your bootloader into sectors 1-4 so max. 512 bytes of code... there you can set up the parameters to load the other stuff into ram... and atari has a sector read routine built in rom... you just need to take care of the handling...

 

f.e.

 

sectors 1-4 bootloader loaded to $0600 by rom & bootup sequenze

(check the bytes 0-5 for the start adress + init adresses, read docs about that)

 

then load the code

 

f.e. (simplified)

 

jsr setup_io ; sets all relevant informations like bufferadress, sector number, etc

 

repeat

jsr read_sector ; somewhere in ROM

jsr add_parameters ; inc sector number, add buffers, etc...

until max_sector

jmp code

 

i can not imagine a simpler bootloader... but if you want to have a

more generic bootloader like in the game loaders or menus for discs then you need routines for directory, sector handling, TOC-tables, etc...

 

hve

Share this post


Link to post
Share on other sites

Well, you really need to have two pieces of code 'standing by'. Somewhere in the boot sector header bytes there are two addresses that are loaded into memory.

 

The first is the initialisation address. This can point to a simple RTS instruction if you don't want to do anything with it. I once used it to point to a piece of code which loaded and displayed a loading screen, which then continued to load the main program.

 

Once an RTS instruction is found, it stops the initialisation routine and goes to the second address which is basically the main program vector. In the above program I wrote, once the initialisation program had loaded the main program into memory, it ended with an RTS which then caused the main program vector to be jumped to ... of course, I had set this to point to the address at which the main program started.

 

Got that?

 

Probably not ... you'll find a more coherent explanation on the web somewhere. ;)

Share this post


Link to post
Share on other sites

Attached is the disassembled source for a 3 sector bootloader.

I don't know the original source of this but it is used to load DOS

style executables which can contain multi-parts. I've used this on

'Colours' (see the 'Sprite Priorities' thread). This way I can simply

take a resulting exe from CC65/CA65/LD65 and then tack the

3 sector loader+exe+padding to make an ATR image that can then

be used to make an actual disk for the Atari.

 

The only thing that needs to change is the value of 'Length'.

This Low-to-High byte value is the length of your exe file, typically I

just copy the 3 sectors in a hex editor and alter these bytes.

Nothing else needs to changed.

 

Hope it helps,

 

Mark

loader3.zip

Share this post


Link to post
Share on other sites

Huh? I thought that the boot program can be up to almost 32k in length (128 bytes per sector * 255 sectors)? The first byte on sector 1 needs to be zero (to signify that it is a boot program), the 2nd byte is how many sectors to load, followed by the start and init addresses, and then the program data stored in the sectors sequentually from the 6th byte onward.

Share this post


Link to post
Share on other sites

nukey.... you migh right.... :) it's so long time ago since i wrote boot code... as xasm takes care about it now... byte 1 in sector 1 defines the length of the bootcode...

 

i mixed it up as most of the time on game discs the bootloader is hidden in sectors 1-4 as dos 2.x starts to fill discs on sector 4 onwards....

 

hve

Share this post


Link to post
Share on other sites

You could also use the standard Dos directory on the disk if you want...so you can store files on the same disk, as long as you check off all the sectors used by your boot program as "used" in the VTOC (which resides on sectors 360-361 I think). In Dos, the boot program can be invisible if you don't make a directory listing for it...and Dos itself won't write data to the sectors you marked in the volume table. Keep in mind that Dos uses the last 3 bytes in each sector to link to the next one in the file. I believe that Dos will not use sectors 720 and ones above 1020 (I think). By using a sector copier and a hex editor (to change the link info), you can squeeze another 20 or so out of the disk :)

 

Hey! Floppy disks were expensive to an 80's kid :D

Share this post


Link to post
Share on other sites

Thanks guy's ! it seems to be more easy than i thought, but still difficult :wink: . Thanks for that source, Wrathchild !

 

Thelen

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...