summaryrefslogtreecommitdiff
path: root/decoders/mfm/__init__.py
blob: 24dfe3b9b914b83b3ff42ecbcadb834293b68f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2023 Eric Anderson <ejona86@gmail.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##

'''
FM and MFM is a combined clock/data encoding used on floppy disks. The bit
stream requires a stacked decoder to detect a format-specific sync pattern to
determine the byte boundaries and to separate the clock and data.

The necessary sampling frequency is often 8x the data rate, so sampling at
least at 16x the data rate is recommended.

There are various interfaces with floppy disk drives, but most are very similar
in principal to the Shugart interface. They use open-drain signals with events
signaled with falling edges. Decoding the data is mostly done with the Read
Data (RDATA, RD) and Write Data (WDATA, WD) lines, with optional help from
Index (IDX), Write Gate (WG), and other lines. The "Enable low" and "Enable
high" channels are most directly used by setting one of the channels to WG to
enable decoding only when writing or reading. But they can also be used with
other signals like Disk Select, Step, Track 0, and Side Select.
'''

from .pd import Decoder