Changes
The .TAP files contain blocks of tape-saved data. All blocks start with two bytes specifying how many bytes will follow (not counting the two length bytes). Then raw tape data follows, starting with the flag byte. Unlike speccy format, the checksum bytes are not included, so you don't need calculate the crc-ccitt every 256 bytes, or padding the last page with zeroes, or ending with four 0xff bytes trailer.
^^^^^...... first block is 29 bytes (28 bytes+flag)
file name ..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
block number ............................................^^
^^^^^............... logical length, in consecutive blocks (88 bytes)
flag byte ........^^
second block data ...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 16 Filename Padded to 16 bytes with nulls
The file type (byte 18) is split into a number of fields:
= Trapping the ROM routine =
The recommendable entry point in the Amstrad CPC ROM is a routine named "CAS READ", that has the next parameters:
HL = location of data
DE = length of data
So when you trap the routine, you must check that sync byte matches with A register and length of block-1 with DE register. Then copy from file to memory starting at HL address, and finally change the F register to 0x45 (no errors) and the PC with the exit point. Addresses are, in hexadecimal, in the next table:
Exit Point 2872 29E2 29E2