BBC MICRO - TUBE Z80 interface

Post Reply
Well known member
Posts: 1772
Joined: Mon Jul 16, 2007 7:39 pm

BBC MICRO - TUBE Z80 interface

Post by stefano »

A note related to the BBC Micro, currently z88dk-appmake and the 'cpmtools' are not able, by design, to deal with its disk formats.
A lot of attempts to create a valid 'diskdefs' configuration can be found on the web, but *they're all wrong*.
The reason is on the very uncommon way the BBC hardware assigns the disk sectors, (correctly managed by MAME, if you configure the 'TUBE' slot for a Z80 CPU).

Physically it works on 512 bytes sectors and applies a skew table at that granularity level.
Logically it uses the same directory and block sizes for both the 200K and 400K disk images, working on the whole side 0 first and moving on the second side only when it runs out of space. This makes the 2 sided disks readable at 50% also on the single side drives and permitted to reuse the same control code, e.g. my DPB tool get the same parameter table when looking at both the logged on disk formats:


Probably the CP/M disks require a fingerprint at the beginning, I think it will be something similar (the first 8 bytes are for the disk name):

{ "bbcmicro", "Acorn BBC Micro (Z80)", &acorn_spec, 16, "Z88DK CPMDISC\xa4", 1 },

Conclusion: to support this disk format appmake should first pair the 256 byte logical sector and AFTER THAT shuffle the 512 byte sectors with the skew table.

Code: Select all

Acorn CP/M uses the following double sided disc format:-

80 tracks / surface
10 sectors / track
256 bytes / sector

A double sided disc is regarded by CP/M as a single logical disc with 160 tracks numbered from 1 to 159.
In order to obtain the best disc performance the following logical to physical track mapping is performed.

Logical CP/M Physical
track track
0-79 0-79 (top surface)
80-159 79-0 (bottom surface)

The first 3 tracks on the top surface are reserved for the CP/M system.

The CP/M directory starts at track 3 sector 0 and uses 4K bytes to allow up to 128 directory entries/disc.
This leaves 388K bytes/disc available for user programs and data.

Acorn CP/M uses deblocking to allow the physical disc sector size to be larger than the logical CP/M record
size of 128 bytes. Although a 256 byte sector size is used the effective sector size is 512 bytes as all disc
operations read or write 2 sectors at a time using an appropriate sector skew. The following table defines
the logical record to physical sector relationship.

Logical CP/M Logical disc Physical disc
record (128 bytes) sector (512 bytes) sector (256 bytes)
0 0 0
1 0 0
2 0 1
3 0 1
4 1 4
5 1 4
6 1 5
7 1 5
8 2 8
9 2 8
10 2 9
11 2 9
12 3 2
13 3 2
14 3 3
15 3 3
16 4 6
17 4 6
18 4 7
19 4 7

By the way, the '-debug' option in MAME can be already used to load programs in memory after the CP/M boot.
They can be saved on the live disk image and loaded back to be run (e.g. "A:> SAVE 0 PRGM.COM").
You do not have the required permissions to view the files attached to this post.
Post Reply