[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file type changer



Adalbert Goertz <be404@yfn.ysu.edu> wrote:

> Can somebody tell me what file type changes are permissible?
> I  can change TXT to BIN with no problem.
> I changed a BAS to SYS and my systej crashed when I ran teh SYS.
> I tried to change DNA to SYS16 and system crashed.
> So, what are the rules?

The main rule is not to change anything to an inappropriate file type.
The majority of file types are only valid if the contents of the file
are in the appropriate format and/or contain the right sort of code.

The BIN and TXT file types are pretty generic.  Almost every other file
type is specific.  You should not change file types unless you are sure
that the new type is correct (or you risk a crash, as you discovered).

In particular, all executable file types (including SYS16, EXE, NDA,
CDA, PIF, TIF, DRV, etc.) have very specific internal file structures.
In general, you cannot change any of these files to other types, or
change arbitrary files to any of these types.

(There are a few exceptions, but they are few and far between.)


BIN can be used for pretty much anything, as it is simply a memory
image.  The most common use of BIN files is saving an area of memory
with the BSAVE command in BASIC.SYSTEM (or a translated "B" file from
DOS 3.3).  In this case the auxiliary type of the file indicates the
memory address at which the file was saved (or the address at which it
should be loaded).

Some programs use BIN as a default filetype if they don't know the
correct type.  Determining the actual file type is difficult.  The best
bet is to try decoding the file with GSHK or ShrinkIt, in case it in
Binary II format, or is a ShrinkIt archive.  If ShrinkIt doesn't
recognise the file, you will have to look at the contents of the file to
try to work out what it is.  This is not easy.

This sort of BIN file will probably not have a valid auxiliary type (an
auxiliary type of zero is a good clue that the file is not a memory
image).


TXT is similarly generic.  The most common use is a sequential ASCII
text file.  They can also be used for random access data files
(particularly by BASIC programs), or the TXT file type may be used by
default if the program doesn't know what type to use.

-- 
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand