BBC basic file viewer, disc/tape reading & writing software for PCs (unix, PC DOS/windoze); suggested tape format

1. Software for download

None of the PC DOS/windoze binaries of the programs mentioned will be updated by me. If you use one of those toy OS'es, you should switch to a proper OS like FreeBSD and you can use/compile the latest versions of all programs, except for FDC (anyone want to write a kernel driver for FreeBSD? Well, the kernel floppy driver actually only needs little change to change some floppy settings, but I'm not inclined to do this myself).

1.1 BBC basic file viewer

1.2 Disc reading and disk image manipulation

1.3 Tape reading and tape image manipulation

A new version of bbctape and the other utilities will be released at some point, in particular to get round a bug in the FreeBSD audio driver (8 bit mono 22 kHz doesn't work on my PC so I'm using stereo 16 bit 44kHz now) and compiler changes in GCC which don't allow embedded carriage returns in strings any more, for example. I also want to complete tape image support in various utilities and finish the new program 'bbctapeim' which manipulates tape images. bbctape 0.98 uses Fourier integration to calculate the bits; the results, for bad tapes, of the current test version are excellent compared to the other tape reading programs...

All of the following locally downloadable utilities point to a single zip file (dd 10-05-2001) containing all of them, and are source code only (with makefiles for unix, will probably need a few changes for other operating systems).

2012-8-23: I have newer versions with changes for newer compilers (I updated all utilities, fixed some bugs and made various improvements, in 2009-2010). If you're interested just send me an email.

2. Software that's not available for download

2.1 bbccom: communication between unix machine-BBC

I describe bbccom because it's referred to in a few places (www pages etc.). There is no release of this program, as I don't get enough feedback for my programs... Actually I shared an early version with a few people.

2.2 w6502as, w6502dis (old names: whs_as6502, whs_dis6as65502)

A disassembler and assembler for the 6502. The disassembler's output can be seen here as applied to DFS 0.90.

The assembler is a work in progress. I started with this to get around bugs in other assemblers (as6502, xa, acme) as it was easier to write my own than to understand the source code of those programs and where to make changes to fix the bugs that I encountered. The second goal was to make a rigorous assembler with proper error checking and diagnostics. The 3rd goal was to make this my first program in which to use/test source utility programs for interpreter/shell like programs. I intend to make for example a shell for unix that will be small, useful, proper error checking/diagnostics, to replace the bourne/bash/korn/c-shells which are all truly awful when used as a programming language. Programs I write for shells never work properly the first time, it's all very unintuitive and I often get weirdnesses (one method working fine in one version of the shell, not in another). Shell programming is also notoriously difficult to do portably over various (unix-like) operating systems, so I'm planning to ditch /bin/sh for /bin/wsh as soon as possible to use as a shell, programming language for utilities and prototyping etc.

The assembler is very useful because of for example its precise error messages showing what is wrong in what line and what the options are. A few examples:

File test.asm, line 30: missing/bad variable/constant type
in: .variable oint16 file_len:= $70
              ^
 variable type  0: int32
 variable type  1: int16
 variable type  2: int8
 variable type  3: char
 variable type  4: string
 variable type  5: boolean
 variable type  6: fp32

and this:

File test.asm, line 28: Don't know how to handle this
in: .variable int16 file_len:= $70g
                                  ^

That's actually a not very specific message but still pretty clear. Perhaps it should be changed to 'expecting operator' or something like that. But now that the assembler is working fairly well, these and other messages usually make it clear which problem there is in the assembly file, and which problem there may be in w6502as itself (with messages about a possible or definite problem in the assembler etc.).

Also the rigourous nature of this assembler and the mini-language inside it are excellent to find possible problem areas in assembler code (for example overlapping data areas, and warning for things such as unused internal labels or constants, variables). There are a few more changes to be made to the data types to enable more checking for correct use of jump/branches/loads/stores. Also the syntax and way to identify labels in the program may change yet. At the moment the program is working very nicely for my programs (e.g. bbccom 0.73 now uses it, which is fairly large, about 6-7 K machine code), and it already knocks the other assemblers into a cocked hat... I've been working on getting some other programs of mine to work with it such as my debugger/disassembler.


3. Tape image format

 Tape image format:
   first the identifier:
        - 8 bytes: "BBCTAPE" + terminating 0

   followed by data blocks which consist of:
    byte  0     : block type:
    bytes 1 - 4 : block len (MSB)
    bytes 5 - <block_len-1> : data


   Currently assigned block types (all other information can be inferred by the decoding program):
   block type = 0 : silence
       - 4 bytes : MSB block length (=1+4+4)
       - 4 bytes : MSB duration (ms)

   block type = 1 : bit stream:
       - 4 bytes : MSB block length (=1+4+2+4+ ({nbits} +7)/8)
       - 2 bytes : MSB tone frequency (Hz) (= baud rate)
       - 4 bytes : MSB number of bits in the block
       - { ({nbits} +7)/8 } bytes : data block with the bits

   block type = 2 : standard BBC tape block
       - 4 bytes : MSB block length (=1+4+2+ {tape block size})
       - 2 bytes : MSB tone frequency (Hz) (= baud rate)
       - { tape block size } bytes : data block with the actual tape block

Example tape images

None yet for the above format, but here's a single bitstream of fortress: fortress.tape.zip

    bbctape -w /dev/dsp -T fortress.tape

writes it to line out...

Converting a batch of uef images to tape images is easy:

   for i in *.uef; do uef_extract -t "${i%.uef}.tape"; done
To email me, go to this page