TRS-80 Color Computer cassette restorer
prototype version - (c) 2005 Powel
Powel@NetCourrier.com

1. What is it ?

CAS_REST.EXE displays datas from TRS-80 cassette and allows to restore them.

I wrote it because I was exasperated to see many "I/O ERROR" messages and be stopped by that. I wrote it quickly, for that reason many things are not comfortable (none cursor, but only scrolling, manuel deletion of stop-blocs, etc ...). It is obvious that this program is for the "do-it-yourselfers" who loves the TRS-80 Color Computer, maybe for somebody who wants make a real software ( the source files : CAS_REST.PAS MEMORY.PAS FICHIER.PAS ).

This program run in dos mode, and using the text mode 80 x 50 with 16 colors.

2. How to proceed ?

You must sample cassette (or piece of cassette) to sound file with the format : 11025 Hz, 8 bits unsigned ; e.g. the .WAV use this format.
The datas are displayed with the TRS-80 characters and you can scroll with line, byte or bit precision.
You choose a bytes bloc to restore, and the program will save this bloc in .PAK format (compatible with David Keil and Jeff Vavasour Emulators).

3. Usage

If your sampled sound file name is "devil.wav" :
cas_rest devil

If your sampled sound file name is "devil.raw" :
cas_rest devil.raw

The program run :


The keys are :
scroll linearrows up, down
scroll bytearrows left, right
scroll bitarrows (left, right) + CTRL
scroll 8 bytesTab
scroll pagepageUp, pageDown
scroll beginHome
decrease bit0LowF1
increase bit0LowF2
decrease bit0HighF3
increase bit0HighF4
decrease bit1LowF5
increase bit1LowF6
decrease bit1HighF7
increase bit1HighF8
decrease all levelsF9
increase all levelsF10
stop bloc deletionback-space
begin bloc markspacebar
end bloc markspacebar
exitEsc

4. Details

When you save datas in a cassette with the TRS-80, it wrotes a 1200 Hertz sound for bit 0, and 2400 Hertz sound for bit 1.
The duration of the sound is very short ... 1 period !
If you could trace a diagram of the speaker which play the sound, you will see that :

Period is t1-t0 ; the time duration of speaker displacement. Period is minima time for the speaker be able to play a sound. The frequence = 1 / period, if a sound frequence is 1200 Hertz, the period longer will be approximatively 0.00083 milli-seconds. If a sound frequence is 2400 Hertz, the period longer will be approximatively 0.000415 ms.
For that reason, the program measure the period time for know if TRS-80 wrotes a bit value 0 or bit value 1.
By waiting for the upper front (see green arrows on the last graph), the program knows when the period begin and the period end.
This is an example of datas converting from cassette used by cas_rest.exe :

But after many years, the cassette ribon stretch itself, and when you read your cassette, the frequences decreases and bit value 1 isn't probably around 2400 Hz, but 2000 Hz or 1800 Hz, and the TRS-80 sub-routines in ROM can't guess what is the good level frequence to use and will be display you an aggravating "I/O ERROR" when you type cload or cloadm ...

Then with CAS_REST.EXE you can adjust the frequences level with F1..F10 keys :
800 Hz (bit 0 Low) < bit 0 < 1400 Hz (bit 0 High)
2000 Hz (bit 1 Low) < bit 1 < 2400 Hz (bit 1 High)

You can see that line "byte value, binary format" indicates "1-+++-11" 1 or 0 are bits value detected but "-" means the frequence is lower than "bit 0 Low" value, "+" means the frequence is higher than "bit 1 High" and if a "?" is displayed it means the frequence is higher than "bit 0 High" and is lower than "bit 1 Low".
Then if one of 8 bits is not detected the line "byte value, decimal format" will display "-1" for indicates he can't know the byte value.

When you found the good frequences level, you can use "spacebar" for select begin and end of bytes bloc then you save it to pc file (.pak).
cas_rest.exe asks you where you want save the bloc in the TRS-80 (emulator) memory.
While saving, if cas_rest.exe encounter any unknown bytes, then it will be wrotes 6809 "NOP" command in file.

5. Restoration example