Add TRS-80 support.

This commit is contained in:
David Given
2019-03-03 17:25:38 +01:00
parent 1e1d4317ec
commit fd960b8778
4 changed files with 70 additions and 6 deletions

34
doc/disk-trs80.md Normal file
View File

@@ -0,0 +1,34 @@
Disk: TRS-80
============
The TRS-80 models I, III and IV (but not the II, 100, 2000, Colour Computer
or Pocket Computer) was a popular line of Z80-based home computers made by
Tandy Corporation and sold by Radio Shack. There were some of the first
generation of domestic micromputers, with the Model I released in 1978.
There were a myriad of different floppy disk interfaces, some produced by
Tandy and some by third parties, using all the various combinations of 40-
and 80-track, FM, MFM, etc.
Luckily the encoding scheme was mostly compatible with the IBM scheme, with a
few minor variations: when using FM encoding, the TRS-80 wrote the sectors on
track 17 (where the directory was) with a non-standard DAM byte.
FluxEngine's IBM reader can handle TRS-80 disks natively.
Reading discs
-------------
Just do:
```
.obj/fe-readibm
```
You should end up with an `ibm.img` of the appropriate size. It's a simple
array of sectors in JV1 format.
If you've got a 40-track disk, use `-s :t=0-79x2`.
If you've got a single density disk, use `--read-fm=true`. (Double density is
the default.)

View File

@@ -93,6 +93,7 @@ Here's the table.
| [Brother 120kB](disk-brother.html) | 🦄 | | |
| [Brother 240kB](disk-brother.html) | 🦄 | 🦄 | |
| [Macintosh 800kB](disk-macintosh.html) | 🦖 | | and probably the 400kB too |
| [TRS-80](disk-trs80.html) | 🦖 | | a minor variation of the IBM scheme |
| [Victor 9000](disk-victor9k.html) | 🦖 | | experimental, probably buggy |
{: .datatable }

View File

@@ -42,6 +42,8 @@ SectorVector AbstractIbmDecoder::decodeToSectors(const RawRecordVector& rawRecor
case IBM_DAM1:
case IBM_DAM2:
case IBM_TRS80DAM1:
case IBM_TRS80DAM2:
{
if (!idamValid)
break;
@@ -88,21 +90,46 @@ int IbmFmDecoder::recordMatcher(uint64_t fifo) const
* clock: X X - X - X X X = 0xd7
* data: X X X X X X - - = 0xfc
*
* ID record:
* IDAM record:
* flux: XXXX-X-X-XXXXXX- = 0xf57e
* clock: X X - - - X X X = 0xc7
* data: X X X X X X X - = 0xfe
*
* ID record:
* DAM1 record:
* flux: XXXX-X-X-XX-X-X- = 0xf56a
* clock: X X - - - X X X = 0xc7
* data: X X X X X - - - = 0xf8
*
* DAM2 record:
* flux: XXXX-X-X-XX-XXXX = 0xf56f
* clock: X X - - - X X X = 0xc7
* data: X X X X X - X X = 0xfe
* data: X X X X X - X X = 0xfb
*
* TRS80DAM1 record:
* flux: XXXX-X-X-XX-X-XX = 0xf56b
* clock: X X - - - X X X = 0xc7
* data: X X X X X - - X = 0xf9
*
* TRS80DAM2 record:
* flux: XXXX-X-X-XX-XXX- = 0xf56c
* clock: X X - - - X X X = 0xc7
* data: X X X X X - X - = 0xfa
*/
uint16_t masked = fifo & 0xffff;
if ((masked == 0xf77a) || (masked == 0xf57e) || (masked == 0xf56f))
return 16;
return 0;
switch (masked)
{
case 0xf77a:
case 0xf57e:
case 0xf56a:
case 0xf56f:
case 0xf56b:
case 0xf56c:
return 16;
default:
return 0;
}
}
int IbmMfmDecoder::recordMatcher(uint64_t fifo) const

View File

@@ -12,6 +12,8 @@
#define IBM_IDAM_LEN 7 /* plus prologue */
#define IBM_DAM1 0xF8 /* sector data (type 1) */
#define IBM_DAM2 0xFB /* sector data (type 2) */
#define IBM_TRS80DAM1 0xF9 /* sector data (TRS-80 directory) */
#define IBM_TRS80DAM2 0xFA /* sector data (TRS-80 directory) */
#define IBM_DAM_LEN 1 /* plus prologue and user data */
/* Length of a DAM record is determined by the previous sector header. */