1Disk: Brother word processor 2============================ 3 4Brother word processor disks are weird, using custom tooling and chipsets. 5They are completely not PC compatible in every possible way other than the 6size. 7 8Different word processors use different disk formats --- the only ones 9supported by FluxEngine are the 120kB and 240kB 3.5" formats. The default 10options are for the 240kB format. For the 120kB format, which is 40 track, do 11`fluxengine read brother -s :t=1-79x2`. 12 13Apparently about 20% of Brother word processors have alignment issues which 14means that the disks can't be read by FluxEngine (because the tracks on the 15disk don't line up with the position of the head in a PC drive). The word 16processors themselves solved this by microstepping until they found where the 17real track is, but normal PC drives aren't capable of doing this. Particularly 18with the 120kB disks, you might want to fiddle with the start track (e.g. 19`:t=0-79x2`) to get a clean read. Keep an eye on the bad sector map that's 20dumped at the end of a read. My word processor likes to put logical track 0 on 21physical track 3, which means that logical track 77 is on physical track 80; 22luckily my PC drive can access track 80. 23 24Using FluxEngine to *write* disks isn't a problem, so the 25simplest solution is to use FluxEngine to create a new disk, with the tracks 26aligned properly, and then use a word processor to copy the files you want 27onto it. The new disk can then be read and you can extract the files. 28Obviously this sucks if you don't actually have a word processor, but I can't 29do anything about that. 30 31If you find one of these misaligned disks then *please* [get in 32touch](https://github.com/davidgiven/fluxengine/issues/new); I want to 33investigate. 34 35Reading disks 36------------- 37 38Just do: 39 40``` 41fluxengine read brother 42``` 43 44You should end up with a `brother.img` which is 239616 bytes long. 45 46Writing disks 47------------- 48 49Just do: 50 51``` 52fluxengine write brother 53``` 54 55...and it'll write a `brother.img` file which is 239616 bytes long to the 56disk. (Use `-i` to specify a different input filename.) 57 58Dealing with misaligned disks 59----------------------------- 60 61While FluxEngine can't read misaligned disks directly, Brother word processors 62_can_. If you have access to a compatible word processor, there's a fairly 63simple workaround to allow you to extract the data: 64 65 1. Format a disk using FluxEngine (by simply writing a blank filesystem image 66 to a disk). This will have the correct alignment to work on a PC drive. 67 68 2. Use a word processor to copy the misaligned disk to the newly formatted 69 disk. The machine will happily adjust itself to both sets of alignments. 70 71 3. Use FluxEngine to read the data off the correctly aligned disk. 72 73I realise this is rather unsatisfactory, as the Brother hardware is becoming 74rarer and they cope rather badly with damaged disks, but this is a limitation 75of the hardware of normal PC drives. (It _is_ possible to deliberately misalign 76a drive to make it match up with a bad disk, but this is for experts only --- I 77wouldn't dare.) 78 79Low level format 80---------------- 81 82The drive is a single-sided 3.5" drive spinning at not 300 rpm (I don't know 83the precise speed yet but FluxEngine doesn't care). The 240kB disks have 78 84tracks and the 120kB disks have 39. 85 86Each track has 12 256-byte sectors. The drive ignores the index hole so they're 87lined up all anyhow. As FluxEngine can only read from index to index, it 88actually reads two complete revolutions and reassembles the sectors from that. 89 90The underlying encoding is exceptionally weird; they use two different kinds of 91GCR, one kind for the sector header records and a completely different one for 92the data itself. It also has a completely bizarre CRC variant which a genius on 93StackOverflow reverse engineered for me. However, odd though it may be, it does 94seem pretty robust. 95 96See the source code for the GCR tables and CRC routine. 97 98Sectors are about 16.2ms apart on the disk (at 300 rpm). The header and 99data records are 0.694ms apart. (All measured from the beginning of the 100record.) The sector order is 05a3816b4927, which gives a sector skew of 5. 101 102High level format 103----------------- 104 105Once decoded, you end up with a file system image. 106 107### 120kB disks 108 109These disks use a proprietary and very simple file system. It's FAT-like 110with an obvious directory and allocation table. I have reversed engineered 111a very simple tool for extracting files from it. To show the directory, do: 112 113``` 114.obj/brother120tool image.img 115``` 116 117To extract a file, do: 118 119``` 120.obj/brother120tool image.img filename 121``` 122 123Wildcards are supported, so use `'*'` for the filename (remember to quote it) 124if you want to extract everything. 125 126The files are usually in the format known as WP-1, which aren't well 127supported by modern tools (to nobody's great surprise). Matthias Henckell has 128[reverse engineered the file 129format](https://mathesoft.eu/brother-wp-1-dokumente/) and has produced a 130(Windows-only, but runs in Wine) [tool which will convert these files into 131RTF](https://mathesoft.eu/sdm_downloads/wp2rtf/). This will only work on WP-1 132files. 133 134Any questions? please [get in 135touch](https://github.com/davidgiven/fluxengine/issues/new). 136 137### 240kB disks 138 139Conversely, the 240kB disks turns out to be a completely normal Microsoft FAT 140file system with a media type of 0x58 --- did you know that FAT supports 256 141byte sectors? I didn't --- of the MSX-DOS variety. There's a faint 142possibility that the word processor is based on MSX-DOS, but I haven't 143reverse engineered it to find out. 144 145Standard Linux mtools will access the filesystem image and allow you to move 146files in and out. However, you'll need to change the media type bytes at 147offsets 0x015 and 0x100 from 0x58 to 0xf0 before mtools will touch it. The 148supplied `brother240tool` will do this. Once done, this will work: 149 150``` 151mdir -i brother.img 152mcopy -i brother.img ::brother.doc linux.doc 153``` 154 155The word processor checks the media byte, unfortunately, so you'll need to 156change it back to 0x58 before writing an image to disk. Just run 157`brother240tool` on the image again and it will flip it back. 158 159The file format is not WP-1, and currently remains completely unknown, 160although it's probably related. If anyone knows anything about this, please 161[get in touch](https://github.com/davidgiven/fluxengine/issues/new). 162