const char *VERsion="$VER: SaveROM 2.0";
/* (C) by Stefan Haubenthal 1993-96 */
/* DISCLAIMER:  Usage of this image file is reserved for those users who
are already in posession of an Atari ST/TT or Falcon and thus having a legal
right to use the ROM software. This method is intended for those who lack the
ability to extract the image due to hardware shortcomings or system damage. */

#include <stdio.h>
#ifdef __TOS__
#include <tos.h>
#endif
#define NAME "TOS.IMG"

void main()
{
FILE *image;
char *rom;
char *ver,*rev;
long len;

#ifdef __TOS__
Super(0);
#endif
rom=(char *)*(long *)0x4f2;
ver=rom+2;
rev=rom+3;
printf("Saving %s V%d.%02d\n",NAME,*ver,*rev);
image=fopen(NAME,"wb");
if ((*ver==1) && (*rev<6)) len=0x30000L;
          else if (*ver<4) len=0x40000L;
                      else len=0x80000L;
fwrite(rom,1,len,image);
fclose(image);
}