la@doc.ic.ac.uk (Liaket Ali) (01/25/91)
Hi Amiga Fans! Could anyone offer some help (info/source) on how to convert raw MFM data into intelligible information. In the RKM Libs&Devs, mention is made of the use of the blitter in this task but I could not find any further info on it. Also is it possible to use the CPU to do the decoding. Any help would be appreciated. ============================================================================== LIAKET ALI a.k.a. la@doc.ic.ac.uk
v089pfrb@ubvmsd.cc.buffalo.edu (Jeffrey C Murphy) (01/27/91)
In article <2786@gould.doc.ic.ac.uk>, la@doc.ic.ac.uk (Liaket Ali) writes... >Hi Amiga Fans! > >Could anyone offer some help (info/source) on how to convert raw MFM data into >[del...snip....del...cut..] With MFM every data bit is followed by a clock bit (the clock bit is toggled according to the status of the adjacent clock bits: if an adjacent data bit is set then the clock bit is reset and versa vice-a) Data: 1 0 1 0 0 0 0 1 Clock: 0 0 0 0 1 1 1 0 MFM: 0100010010101001 To decode you can use this simple routine (assuming you already have the data in memory): ... MOVE.L (A0)+,D0 ; get first longword MOVE.L (A0)+,D1 ; get second ANDI.L #$55555555,D0 ;remove clock bits ANDI.L #$55555555,D1 ;for d1 too LSL.L #1,D1 ; Shift bits in D1 over one position OR.L D1,D0 ; Overlay D1 on D0 and put in D0 ... As far as the blitter goes, it can do this much faster than the cpu can (unless you have a fast cpu) but requires you to set up structures for the blitter (which I have not really learned about yet....) I got the decode routine from Amiga Disk Drives Inside and Out by Abacus, which is about the worst proging book I have ever read (they repeatedly refer to absolute memory addresses! and routines that are not always at the addresses that they say.) This is because they get the book from Data Becker, a german company which thinks the amiga is really a C64 with everything permanently in rom. sigh... Anywaze... a pretty good book (although not the best) is the amiga programmer's handbook by sybex. I don't know if it is still available. Hope this helps. Jeff M. SUNYAB v089pfrb@ubvmsd.bitnet
jesup@cbmvax.commodore.com (Randell Jesup) (01/27/91)
In article <2786@gould.doc.ic.ac.uk> la@doc.ic.ac.uk (Liaket Ali) writes: >Hi Amiga Fans! > >Could anyone offer some help (info/source) on how to convert raw MFM data into >intelligible information. In the RKM Libs&Devs, mention is made of the use of >the blitter in this task but I could not find any further info on it. Also is >it possible to use the CPU to do the decoding. Decode is easy. take the two halves of the longword, and each of them with $55555555, shift the even bits 1 left, and or them together. Note that in the headers, they are adjacent - in the data block, it goes <all the odd bits> <all the even bits> (or vice versa, I forget at the moment). There was stuff about this in the RKMs. Encoding isn't so simple. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)
p554mve@mpirbn.mpifr-bonn.mpg.de (Michael van Elst) (01/29/91)
In article <18157@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes: > Decode is easy. take the two halves of the longword, and each of >them with $55555555, shift the even bits 1 left, and or them together. That's true for the Amiga version of MFM. Plain IBM compatible controllers (that use MFM as well) use a different scheme. Regards, -- Michael van Elst UUCP: universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve Internet: p554mve@mpirbn.mpifr-bonn.mpg.de "A potential Snark may lurk in every tree."
jesup@cbmvax.commodore.com (Randell Jesup) (01/30/91)
In article <1480@mpirbn.mpifr-bonn.mpg.de> p554mve@mpirbn.UUCP (Michael van Elst) writes: >In article <18157@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes: >> Decode is easy. take the two halves of the longword, and each of >>them with $55555555, shift the even bits 1 left, and or them together. > >That's true for the Amiga version of MFM. Plain IBM compatible controllers >(that use MFM as well) use a different scheme. True. On IBM MFM, the data is stored in sequential order with timing bits. So to get 16 bits of data, you take a longword, remove every other bit, then compress the remaining ones down to 16 bits. (Actually more likely you do a series of lsr #2,dn; ror #1,dm after a single lsr #1,dn; ror #1,dm, or use a table-based routine). IBM format also uses gaps inbetween each sector header and sector data, and gaps inbetween sector data and the next sector header, 3 sync marks instead of 2, a different sector format type (amiga is 0xff), and of course CRCs instead of checksums. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)
s1013734@usage.csd.oz (Peter Urbanec,5SK,6621322,6621322) (02/12/91)
From article <2786@gould.doc.ic.ac.uk>, by la@doc.ic.ac.uk (Liaket Ali): > > Could anyone offer some help (info/source) on how to convert raw MFM data into > intelligible information. In the RKM Libs&Devs, mention is made of the use of > the blitter in this task but I could not find any further info on it. Also is > it possible to use the CPU to do the decoding. > Sure you can do encoding and decoding using the CPU, just write a program that will do exactly the kind bit of decode described in RKM (11->01 type of thing) Programing the blitter to do it is rather tricky, but I know that people have done it in the past. The Abacus book `Amiga DiskDrives inside and out' might have routines that do it, but I think they would be processor based. BUT!!!! Why the hell would you want to do it by yourself? You can get the trackdisk device to give you your data in the proper form. +------------------------------------------------------+ | Peter Urbanec s1013734@spectrum.cs.unsw.oz.au | | University of New South Wales, Sydney, Australia | +------------------------------------------------------+ | The only sin is stupidity | | - Unknown. | +------------------------------------------------------+