Jump to content



2

Most efficient way to wrap an XEX for self-booting?


7 replies to this topic

#1 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Mon Jan 23, 2012 6:03 PM

I'd like to add XEX/COM support to SIO2Arduino and am unsure of the best way to wrap one so it can boot like a disk?

There's very limited space on the device so I can't store much in memory.

Any ideas?

#2 Rybags ONLINE  

Rybags

    Quadrunner

  • 10,315 posts
  • Location:Australia

Posted Mon Jan 23, 2012 8:00 PM

Unsure of the best case situation but you're probably looking at 160 bytes minimum, probably more.

Fairly sure there's 3 and 4 sector menu binloaders around, I did one based on an existing one and it was 5 although it had some bloat due to extra features like refresh file list and it had blocks that got relocated to minimize the chance of clashing with files it was to load.

You could easily enough have a look at the XEX loaders used by APE, Aspeqt and SIO2SD.

To get at them (not 100% on this but should be close) :

APE - mount a directory as PC-Mirror on D1: then from the Atari read the first several sectors of that drive.
Aspeqt - select "boot executable" then do the same. Aspeqt is different from the others in that it loads entire segments as a single record.
SIO2SD - mount an XEX on D1: then read the first few sectors from that drive.


Attached File  Games Disk 16a.ATR   130.02K   13 downloads

That image has my 5 sector menu on it. Stuff gets relocated but you should be able to work it out. Stripping it down to the bare essentials would slim it down a lot.

#3 fox OFFLINE  

fox

    Chopper Commander

  • 189 posts
  • Location:Poland

Posted Tue Jan 24, 2012 4:00 PM

The loader would fit in one sector. Then put the executable in the next sectors. That's what I did in X-BOOT and X-LOAD: http://ftp.pigwa.net...X-Asm 2.51/doc/ (source code of loaders is included). I also stripped $FF/$FF (to simplify the loader) and rewrote the run address in the executable (so that the loader doesn't need any EOF detection).

Alternatively load the executable directly with special SIO commands as Aspeqt does. This solution is more elegant.

#4 kenfused OFFLINE  

kenfused

    Stargunner

  • 1,192 posts
  • Location:Columbus, Ohio

Posted Tue Jan 24, 2012 7:09 PM

KBoot header (first 3 sectors) Replace LL HH with the low byte and high byte of the executable file size. Append the executable. Pad as desired.


00 03 00 07 14 07 4c 14  07 LL HH 00 00 a9 46 8d
c6 02 d0 fe a0 00 a9 6b  91 58 20 d9 07 b0 ee 20
c4 07 ad 7a 08 0d 76 08  d0 e3 a5 80 8d e0 02 a5
81 8d e1 02 a9 00 8d e2  02 8d e3 02 20 eb 07 b0
cc a0 00 91 80 a5 80 c5  82 d0 06 a5 81 c5 83 f0
08 e6 80 d0 02 e6 81 d0  e3 ad 76 08 d0 af ad e2
02 8d 70 07 0d e3 02 f0  0e ad e3 02 8d 71 07 20
ff ff ad 7a 08 d0 13 a9  00 8d e2 02 8d e3 02 20
ae 07 ad 7a 08 d0 03 4c  3c 07 a9 00 85 80 85 81
85 82 85 83 ad e0 02 85  0a 85 0c ad e1 02 85 0b
85 0d a9 01 85 09 a9 00  8d 44 02 6c e0 02 20 eb
07 85 80 20 eb 07 85 81  a5 80 c9 ff d0 10 a5 81
c9 ff d0 0a 20 eb 07 85  80 20 eb 07 85 81 20 eb
07 85 82 20 eb 07 85 83  60 20 eb 07 c9 ff d0 09
20 eb 07 c9 ff d0 02 18  60 38 60 ad 09 07 0d 0a
07 0d 0b 07 f0 79 ac 79  08 10 50 ee 77 08 d0 03
ee 78 08 a9 31 8d 00 03  a9 01 8d 01 03 a9 52 8d
02 03 a9 40 8d 03 03 a9  80 8d 04 03 a9 08 8d 05
03 a9 1f 8d 06 03 a9 80  8d 08 03 a9 00 8d 09 03
ad 77 08 8d 0a 03 ad 78  08 8d 0b 03 20 59 e4 ad
03 03 c9 02 b0 22 a0 00  8c 79 08 b9 80 08 aa ad
09 07 d0 0b ad 0a 07 d0  03 ce 0b 07 ce 0a 07 ce
09 07 ee 79 08 8a 18 60  a0 01 8c 76 08 38 60 a0
01 8c 7a 08 38 60 00 03  00 80 00 00 00 00 00 00


#5 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Tue Jan 24, 2012 8:55 PM

Thanks for all your suggestions!

I tried both fox's and kenfused's suggestions. I've decided to go with the KBoot header since it was easy to implement and reminds me of when I used to download ATR images from the Internet many years ago and wonder why there was a 'k' in the upper-corner of the screen during the boot ;)

#6 fox OFFLINE  

fox

    Chopper Commander

  • 189 posts
  • Location:Poland

Posted Thu Jan 26, 2012 5:01 PM

View Postkenfused, on Tue Jan 24, 2012 7:09 PM, said:

Replace LL HH with the low byte and high byte of the executable file size.
Atari executables longer than 64k are very rare, but do exist.

#7 kenfused OFFLINE  

kenfused

    Stargunner

  • 1,192 posts
  • Location:Columbus, Ohio

Posted Thu Jan 26, 2012 8:23 PM

View Postfox, on Thu Jan 26, 2012 5:01 PM, said:

Atari executables longer than 64k are very rare, but do exist.
Doh you are right! I am pretty sure the next byte after the HH (a 00 in the hex dump) holds the next higher byte. There is one more byte after that one but it is not used.

#8 Farb OFFLINE  

Farb

    Chopper Commander

  • 112 posts
  • Location:Colorado, USA

Posted Fri Jan 27, 2012 10:07 AM

View Postkenfused, on Thu Jan 26, 2012 8:23 PM, said:

I am pretty sure the next byte after the HH (a 00 in the hex dump) holds the next higher byte. There is one more byte after that one but it is not used.

That's what it looks like: ftp://ftp.pigwa.net/stuff/collections/nir_dary_cds/Tech%2520Info/DOS.HTM




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users