FM: Difference between revisions
Jump to navigation
Jump to search
(Fixed FM channels numbers) |
mNo edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
!Data (Z80 port 5) | !Data (Z80 port 5) | ||
| | | | ||
|- | |||
|$21 | |||
|{{8BitRegister|?|8}} | |||
| Test register. Ignore or set to $00 for normal operation. | |||
|- | |- | ||
|$22 | |$22 | ||
Line 13: | Line 17: | ||
|- | |- | ||
|$28 | |$28 | ||
|{{8BitRegister|Slot|4|-|1|Channel|3|}} | |{{8BitRegister|Slot (OP4/OP3/OP2/OP1)|4|-|1|Channel|3|}} | ||
| Key On/Off for each channel. | | Key On/Off for each channel, with operators control. | ||
|} | |} | ||
Line 45: | Line 49: | ||
| 110 | | 110 | ||
|} | |} | ||
This strange numbering seems to be due to the fact YM2610 is a YM2610B with 2 removed FM channels. | This strange numbering seems to be due to the fact YM2610 is a YM2610B with 2 removed FM channels (000 and 100). | ||
Line 69: | Line 73: | ||
|colspan=4|{{8BitRegister|-|2|Block|3|F-Num 2|3}} | |colspan=4|{{8BitRegister|-|2|Block|3|F-Num 2|3}} | ||
|F-Numbers and Block (2/2)<br/>(must set this first) | |F-Numbers and Block (2/2)<br/>(must set this first) | ||
|- | |- | ||
|$B1||$B2||$B1||$B2 | |$B1||$B2||$B1||$B2 | ||
Line 85: | Line 81: | ||
|colspan=4|{{8BitRegister|L|1|R|1|AMS|2|-|1|PMS|3}} | |colspan=4|{{8BitRegister|L|1|R|1|AMS|2|-|1|PMS|3}} | ||
|Left (L)/Right (R) output, AM Sense (AMS), and PM Sense (PMS) | |Left (L)/Right (R) output, AM Sense (AMS), and PM Sense (PMS) | ||
|} | |||
2CH mode additional operator frequencies: | |||
* OP1 frequency is stored in the usual CH2 frequency registers ($A2/$A6) | |||
* write to Z80 ports 4/5 | |||
{|class="wikitable" | |||
!colspan=3|Address||colspan=4|Data||rowspan=2| | |||
|- | |||
|OP2||OP3||OP4||colspan="4"| | |||
|- | |||
|$A8||$A9||$AA | |||
|colspan=4|{{8BitRegister|2CH * F-Num 1|8}} | |||
|2CH mode F-Num LSB | |||
|- | |||
|$AC||$AD||$AE | |||
|colspan=4|{{8BitRegister|-|2|2CH * Block|3|2CH * F-Num 2|3}} | |||
|2CH mode F-Num MSB & Block<br/>(must set this first) | |||
|} | |} | ||
Line 91: | Line 105: | ||
{|class="wikitable" | {|class="wikitable" | ||
! Operator || 1 || | ! Operator || 1 || 3 || 2 || 4 | ||
|- | |- | ||
! Channels 1, 3 | ! Channels 1, 3 |
Latest revision as of 19:32, 18 June 2018
The FM (Frequency Modulation) is part of the YM2610 sound chip. It provides 4 channels, each having their own set of 4 operators, panning and amplitude values. It's the most used way of producing music in games.
Common registers
Address (Z80 port 4) | Data (Z80 port 5) | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$21 |
|
Test register. Ignore or set to $00 for normal operation. | ||||||||||||||||||
$22 |
|
LFO control and frequency (see below). | ||||||||||||||||||
$28 |
|
Key On/Off for each channel, with operators control. |
LFO frequency values are as follows:
- 0 – 3.98Hz
- 1 – 5.56Hz
- 2 – 6.02Hz
- 3 – 6.37Hz
- 4 – 6.88Hz
- 5 – 9.63Hz
- 6 – 48.1Hz
- 7 – 72.2Hz
Channel numbering:
FM Channel | Binary Code |
---|---|
CH1 | 001 |
CH2 | 010 |
CH3 | 101 |
CH4 | 110 |
This strange numbering seems to be due to the fact YM2610 is a YM2610B with 2 removed FM channels (000 and 100).
Channel registers
Depending on which channel you want to write to, the Z80 ports used are different:
- Channels 1 & 2: Ports 4/5
- Channels 3 & 4: Ports 6/7
Address | Data | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CH1 | CH2 | CH3 | CH4 | CH1 | CH2 | CH3 | CH4 | |||||||||||||||||||
Port 4 | Port 6 | Port 5 | Port 7 | |||||||||||||||||||||||
$A1 | $A2 | $A1 | $A2 |
|
F-Numbers and Block (1/2) | |||||||||||||||||||||
$A5 | $A6 | $A5 | $A6 |
|
F-Numbers and Block (2/2) (must set this first) | |||||||||||||||||||||
$B1 | $B2 | $B1 | $B2 |
|
Feedback (FB) and Algorithm (ALGO) | |||||||||||||||||||||
$B5 | $B6 | $B5 | $B6 |
|
Left (L)/Right (R) output, AM Sense (AMS), and PM Sense (PMS) |
2CH mode additional operator frequencies:
- OP1 frequency is stored in the usual CH2 frequency registers ($A2/$A6)
- write to Z80 ports 4/5
Address | Data | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
OP2 | OP3 | OP4 | |||||||||||||||||||||||
$A8 | $A9 | $AA |
|
2CH mode F-Num LSB | |||||||||||||||||||||
$AC | $AD | $AE |
|
2CH mode F-Num MSB & Block (must set this first) |
Operator registers
The ranges given for the address represent all of the parameter values. Each channel's operators are laid out as follows:
Operator | 1 | 3 | 2 | 4 |
---|---|---|---|---|
Channels 1, 3 | $x1 | $x5 | $x9 | $xD |
Channels 2, 4 | $x2 | $x6 | $xA | $xE |
Address | Data | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CH1 | CH2 | CH3 | CH4 | CH1 | CH2 | CH3 | CH4 | |||||||||||||||||||
Port 4 | Port 6 | Port 5 | Port 7 | |||||||||||||||||||||||
$31-$3E |
|
Detune (DT) and Multiple (MUL) | ||||||||||||||||||||||||
$41-$4E |
|
Total Level (Volume) | ||||||||||||||||||||||||
$51-$5E |
|
Key Scale (KS) and Attack Rate (AR) | ||||||||||||||||||||||||
$61-$6E |
|
AM On (AM) and Decay Rate (DR) | ||||||||||||||||||||||||
$71-$7E |
|
Sustain Rate (SR) | ||||||||||||||||||||||||
$81-$8E |
|
Sustain Level (SL) and Release Rate (RR) | ||||||||||||||||||||||||
$91-$9E |
|
Envelope generator (not to be confused with the SSG one) |