How do exactly works the .CAS Format ? (Emulation MSX Fora)MSX Resource Center PassionMSX MSX2 contest           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 141 gasten en 3 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Emulation - How do exactly works the .CAS Format ?

Schrijver

How do exactly works the .CAS Format ?

cesco
msx addict
Berichten: 261
Geplaatst: 06 Januari 2008, 10:08   
Does anybody here knows how the .CAS Format works? I'm talking about the file format used in the MSX emulators to store Tape images

From what I have understood doing a quick "reverse-engineering" with a Hex editor, there are eight characters at the beginning of each file stored in the tape that are always the same:

0x1F, 0xA6, 0xDE, 0xBA, 0xCC, 0x13, 0x7D, 0x74

Then there is a character that is repeated for ten times, and then the name of the file stored in six character, followed by a 0x1F character. The rest of the header is a mistery to me... it probably tells if the following file is a binary file, an ASCII file or a Basic file... how long it is and probably its checksum... but I really don't understand how I can read those values.

For example this appears to be a valid header for a .CAS File:



I'd like to try to make a small utility to manage .CAS files in my free time, like what DiskManager is for the .DSK format. I think it shouldn't be a difficult task...
Vincent van Dam
msx addict
Berichten: 372
Geplaatst: 06 Januari 2008, 10:36   
I have send this to the msx mailinglist once (a few years ago);

The cas format is the result of bypassing the following BIOS calls:

00E1 - TAPION
00E4 - TAPIN
00EA - TAPOON
00ED - TAPOUT

If you call the TAPION function, the BIOS will read from tape untill it has
found a header, and all of the header is read. The TAPOUT function will
output a header. In the cas format the header is encoded to these 8 bytes:

1F A6 DE BA CC 13 7D 74

These bytes have to be at a position that can be divided by 8; e.g. 0000,
0008, 0010 etc. If not, the byte sequence is not recognised as a header.

When outputting data to tape with the BIOS calls TAPOUT the bytes are
written to the .cas file, nothing fancy is done with the bytes (unlike on a
real tape where the byte would be fsk encoded with 1 start bit and 2 stop
bits).

Because the cas file format is the product of some BIOS hooks not all tapes
can be converted to this format. For example, if you would take a gremlin
tape, the data on the tape is encoded entirely differently than the BIOS
would have done (you can hear the different modulation in the sound). The
loader included on the tape writes and reads directly from the tape without
using the bios, but using the IO ports.

You can take a look at the source castools package and example cas files at:
http://home.kabelfoon.nl/~vincentd


cesco
msx addict
Berichten: 261
Geplaatst: 06 Januari 2008, 10:56   
Thank you very much.

How do you recognize if a file on a tape is a Binary or not?
Vincent van Dam
msx addict
Berichten: 372
Geplaatst: 06 Januari 2008, 11:31   
There are 4 types of data that can be stored on a tape;

* binary files (bload)
* basic files (cload)
* ascii files (load)
* custom data (to be loaded using the bios)

Data is stored on the tape in blocks, each block is preceeded by a header (the 1f a6 de .. block). The purpose of this header (the pieeeeeeeeep), is to sync for decoding the fsk data.

Binary files (bload) consist out of two blocks; a binary header block, and a binary data block. The binary header block is specified by 10 times 0xD0, followed by 6 characters defining its filename. The block following this header, is the datablock, which also defines the begin,end and start address (0xFE,begin,end,start).

Basic files (cload) also consist out of two blocks; a basic header block, and a basic data block. The basic header block is specified by 10 times 0xD3, followed by 6 characters defining its filename. The block folowing this header is the datablock (tokenized basic data).

Ascii files (load) can consist out of multiple blocks. The first block is always the ascii header block, which is specified by 10 times 0xea, followed again by 6 characters defining the filename. After this, an unlimited number of blocks can follow. The last block can be identified by the EOF (0x1a) character.

Custom blocks are all blocks that don't fit in the 3 specified above.

You might want to look at the casdir.c code, which implemented the above.
cesco
msx addict
Berichten: 261
Geplaatst: 06 Januari 2008, 12:02   
Now I understand... Thank you very much for your help
 
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.