Jump to content
IGNORED

Coming in Jan...


Wrathchild

Recommended Posts

Here's a little C program I made today:

 

#include <stdio.h>

#include <string.h>



#define ATR_HDR_LEN 16

#define SECTOR_LEN 128L



#define atrsector(fp,x) fseek(fp,SECTOR_LEN*((x)-1)+ATR_HDR_LEN,SEEK_SET)



struct entry {

char type;

unsigned char len_lo;

unsigned char len_hi;

unsigned char sec_lo;

unsigned char sec_hi;

char fname[8];

char f_ext[3];

};



typedef struct entry ENTRY;



unsigned char directory[SECTOR_LEN*4];

unsigned char secbuf[SECTOR_LEN];



int main(int argc, char *argv[])

{

FILE *fp = fopen("Eidolon.atr","rb");

FILE *fo;

char *dp;

ENTRY *ep;

int togo, sector,l;

char f_out[12], *p;

atrsector(fp,0x16A);

fread(directory, SECTOR_LEN, 4, fp);

dp = directory;

while (1)

{

 ep = (ENTRY*)dp;

 if (ep->type != 'B') break;

 togo = (ep->len_hi&3) * 256 + ep->len_lo;

 sector = ep->sec_hi * 256 + ep->sec_lo;

 memcpy(f_out, ep->fname, 8);

 f_out[8] = '';

 p = strchr(f_out,' ');

 if (p) *p = '';

 strcat(f_out,".");

 strncat(f_out, ep->f_ext, 3);

 printf("Filename: %sn", f_out);

 fo = fopen(f_out, "wb");

 do {

 	printf("Sector: %03X", sector);

 	atrsector(fp, sector);

 	fread(secbuf, SECTOR_LEN, 1, fp);

 	l = secbuf[SECTOR_LEN-1];

 	printf(" Length: %dn", l);

 	fwrite(secbuf, 1, l, fo);

 	sector = secbuf[SECTOR_LEN-3] & 3;

 	sector *= 256;

 	sector += secbuf[SECTOR_LEN-2];

 } while (--togo > 0);

 fclose(fo);

 dp += 16;

}

fclose(fp);

}

 

This dumps out the sub files from 'The Eidolon' atr disk image I have.

 

Now to arrange them on a cart and replace the file load routines (e.g. $A051). :wink:

 

Regards,

 

Mark

  • Like 1
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...