Date : Mon, 30 Apr 2001 21:02:55 +0000
From : "W.H.Scholten" <s_whs@...>
Subject: Tape reading/writing
L.S.
I got encouraged to do get into tape reading by seeing various
versions of acornsoft games in uef format. I made uef_to_archive, and
modified make_uef to write tape blocks (see below).
As I don't think the uef format is a good idea (I prefer original data
and other data (cover scans etc) to be completely separate, and it can
all easily be handled on a meta level with config files anyway), I
didn't work on make_uef anymore, but had a look around at other programs
that already existed.
...so, I took Robert Schmidt's tape reading program which seems to
recognize more blocks than the (simpler) uef decoder and made it decode
from sound card too, added header CRC checking, extracting in archive
format or tape blocks.
Ok, I thought, not bad, why not integrate tape writing as well? So I
took Ole Stauning's program, ripped out the relevant code and now I have
bbctape 0.94 on my HD.
Btw, O.Stauning's program also has reading code, but it didn't seem to
work on many files (esp. ones that are not so clean), so I didn't look
at that part of his program any further.
The block reading is extremely useful for bad tapes: I have a rather
bad tape of meteors v2.4 which make_uef couldn't really handle.
Extracting blocks at a time, then using the recording of the other side,
different tape decks (yes, makes a difference! I have a simple mono
player/voice recorder which won't play some tracks in such a way that it
can be decoded (on the PC or the BBC), but for other tracks it works
better than a hifi). This in the end gave me a complete version. Also,
you can restore files with unrestorable blocks (dropouts) if they're
source code, by using older versions and filling in the mssing block.
I also have a program that puts such blocks back as an archive format
file; they can also be written to a file or line out with 'bbctape'.
(tested this by writing a couple of games with line-out connected
to the cassette port of the BBC. Of course, this is quite slow, about 78
bytes/s, and that excludes the delay of the header tone! With bbccom I
get about 940 bytes/s).
Anyway, here's the output of bbctape's help which gives you an idea of
what it can do:
bbctape, version 0.94, (C) 2001 W.H.Scholten, 1996 R.Schmidt, 1996
O.Stauning
bbctape can:
- show BBC computer files in an audio file (or line-in)
- decode audio files made from BBC microcomputer tapes, or directly
from the sound card by playing such a tape to 'line in', and can write
the data to files or data blocks (by default only file information on
blocks recognized is shown).
- create audio files suitable for writing to tape or directly to a BBC
microcomputer via the sound card's line-out.
Synopsis:
bbctape [{-e | -b} [-f]] [-d] <file> ..
bbctape -w <audio file> [-freq <sample freq>] [-baud <baud rate> ]
[-bits <start/stop bits>] [-B] <bbc file> ...
bbctape -h
Parameters:
-e : extract files (with associated .inf files)
-b : extract files as blocks (including the tape header and data crc)
-f : force handling of bad blocks (display block information, write
block)
-w <file> : create a raw audio file (or write to line-out)
-freq, -baud, -bits : set sample frequency, baud rate, start/stop bits
-B : write tape blocks using the given name as a basename
-D : enable verbose debugging and error messages (might be useful
in case you get CRC errors)
<file> : audio file or sound card device (/dev/dsp); input files must
be unsigned 8-bit mono 22-44 kHz raw audio
-?,-h : show this help text
If none of the options -e, -b or -w are specified, BBC files found in
the tape file are only shown, not extracted.
e.g.
bbctape /dev/dsp
scans files on line-in,
bbctape -e test.raw
extracts files from test.raw,
bbctape -w /dev/dsp ELITE
writes the file ELITE to line-out,
bbctape -w /dev/dsp -B ELITEcode
writes the tape block files ELITEcode_00, ELITEcode_01, ... in tape
format to line-out (with header tone etc).
All in all I have the following new programs :
- archive_format (read disk/file attributes from .inf/.dsk files).
For use in other programs/emulators. Used by e.g. bbctape (and in
modified form in bbcim 0.99)
- bbctape 0.94 (tape reading/writing)
- bbctapeblocks (combine tape blocks into an archive file)
- make_tape_blocks (based on make_uef, read tapes to files/blocks, in
the very few cases bbctape can't read a certain block, make_tape_blocks
usually can)
- uef_extract v3 (extract blocks in an uef file to archive format or
blocks, or just scan the files present in the uef file)
All programs are BSD/X or public domain, except for make_tape_blocks
(GPL).
All code has makefiles for unix (I'm using FreeBSD), audio code assumes
OSS (unix), should be easily changeable to other OS's, e.g. using the
audio code from make_uef/make_tape_blocks, but I leave that to whoever
is interested in that.
I don't have a homepage at the moment, mail me for copies of these
programs. I will upload to 'the BBC lives' soon.
Regards,
Wouter Scholten
PS. Tape image reading/writing (needed for e.g. fortress) is
incorporated in the current version 0.95 but for some reason, reading
sometimes gives a lot of 'bad bits' whereas block reading hardly ever
does. Not sure what the exact problem is (I've successfully made a tape
image from a wav of jcb digger, written it to line-out -> cassette of
the BBC which loaded it in successfully, but with other audio files I'm
having less success).