YM2610 registers: Difference between revisions
Jump to navigation
Jump to search
m (→ADPCM-B part: add some descriptions) |
(→FM part: add more FM registers) |
||
Line 118: | Line 118: | ||
*6 – 48.1 | *6 – 48.1 | ||
*7 – 72.2 | *7 – 72.2 | ||
=== Channel Registers === | |||
Depending on which channel you want to write to, the ports used are different: | |||
* Channels 1/2: Ports 4/5 | |||
* Channels 3/4: Ports 6/7 | |||
====Per-Operator Registers==== | |||
The ranges given for the address represent all of the parameter values. Each channel's operators are laid out as follows: | |||
{|class="wikitable" | |||
! Operator || 1 || 2 || 3 || 4 | |||
|- | |||
! Channels 1, 3 | |||
| $x1 || $x5 || $x9 || $xD | |||
|- | |||
! Channels 2, 4 | |||
| $x2 || $x6 || $xA || $xE | |||
|} | |||
{|class="regdef" | |||
| '''Address (Z80 port 4 or 6)''' || '''Data (Z80 port 5 or 7)''' || | |||
|- | |||
| $31-$3E | |||
| {{8BitRegister|-|1|DT|3|MUL|4}} | |||
| Detune (DT) and Multiple (MUL) | |||
|- | |||
| $41-$4E | |||
| {{8BitRegister|-|1|Total Level|7|}} | |||
| Total Level (Volume) | |||
|- | |||
| $51-$5E | |||
| {{8BitRegister|KS|2|-|1|AR|5}} | |||
| Key Scale (KS) and Attack Rate (AR) | |||
|- | |||
| $61-$6E | |||
| {{8BitRegister|AM|1|-|2|DR|5}} | |||
| AM On (AM) and Decay Rate (DR) | |||
|- | |||
| $71-$7E | |||
| {{8BitRegister|-|3|SR|5}} | |||
| Sustain Rate (SR) | |||
|- | |||
| $81-$8E | |||
| {{8BitRegister|SL|4|RR|4}} | |||
| Sustain Level (SL) and Release Rate (RR) | |||
|- | |||
| $91-$9E | |||
| {{8BitRegister|-|4|SSG-EG|4}} | |||
| SSG-EG | |||
|} | |||
====Overall Channel Registers==== | |||
The first value listed in the Address column is for channels 1/3; the second is for channels 2/4. | |||
{|class="regdef" | |||
| '''Address (Z80 port 4 or 6)''' || '''Data (Z80 port 5 or 7)''' || | |||
|- | |||
| $A1,$A2 | |||
| {{8BitRegister|F-Num 1|8}} | |||
| F-Numbers and Block (1/2) | |||
|- | |||
| $A5,$A6 | |||
| {{8BitRegister|-|2|Block|3|F-Num 2|3}} | |||
| F-Numbers and Block (2/2)<br/>(must set this first) | |||
|- | |||
| $A9,$AA | |||
| {{8BitRegister|2CH * F-Num 1|8}} | |||
| 2CH - 2 Slot F-Numbers/Block (1/2) | |||
|- | |||
| $AD,$AE | |||
| {{8BitRegister|-|2|2CH * Block|3|2CH * F-Num 2|3}} | |||
| 2CH - 2 Slot F-Numbers/Block (1/2)<br/>(must set this first) | |||
|- | |||
| $B1,$B2 | |||
| {{8BitRegister|-|2|FB|3|ALGO|3}} | |||
| Feedback (FB) and Algorithm (ALGO) | |||
|- | |||
| $B5,B6 | |||
| {{8BitRegister|L|1|R|1|AMS|2|-|1|PMS|3}} | |||
| Left (L)/Right (R) output, AM Sense (AMS), and PM Sense (PMS) | |||
|} | |||
= ADPCM-A part = | = ADPCM-A part = |
Revision as of 04:21, 27 November 2015
SSG part
Address (Z80 port 4) | Data (Z80 port 5) | |||||||||||||||||||
$00 |
|
Channel A | ||||||||||||||||||
$01 |
| |||||||||||||||||||
$02 |
|
Channel B | ||||||||||||||||||
$03 |
| |||||||||||||||||||
$04 |
|
Channel C | ||||||||||||||||||
$05 |
| |||||||||||||||||||
$06 |
|
Noise channel | ||||||||||||||||||
$07 |
|
/Enable for Noise and Tone | ||||||||||||||||||
$08 |
|
Channel A | ||||||||||||||||||
$09 |
|
Channel B | ||||||||||||||||||
$0A |
|
Channel C | ||||||||||||||||||
$0B |
|
|||||||||||||||||||
$0C |
|
|||||||||||||||||||
$0D |
|
See diagram. |
If 'Mode' = 1, the EG is used instead of the 4bit volume value. f = 8M / (Coarse*256 + Fine) ?
Timers
Address (Z80 port 4) | Data (Z80 port 5) | ||||||||||||||||||
$24 |
| ||||||||||||||||||
$25 |
| ||||||||||||||||||
$26 |
| ||||||||||||||||||
$27 |
|
- TA = Timer A, TB = Timer B
- Timers will tick until they have reached zero, at which point an IRQ will be generated if enabled. Reading port $04 will show which timer caused it.
- The actual timer counter registers are not directly accessable. They can be reset to zero or initialised from load registers $24-$26
- Writing 0 to the load bits in register $27 will reset the timer counter registers to zero
- Writing 1 to the load bits will copy the respective timer load register to the timer counter. This only works when the timer is at zero.
- When a timer expires, it is automatically reloaded from the load registers and continues.
- Timer flag reset refers to the same flags that are read from port $04
- CSM mode is for automatic key on for operators on the second FM channel when timer A expires?
FM part
Common FM Registers
Address (Z80 port 4) | Data (Z80 port 5) | |||||||||||||||||||
$22 |
|
LFO Frequency | ||||||||||||||||||
$28 |
|
Key On/Off |
LFO Frequency values are as follows:
- 0 – 3.98
- 1 – 5.56
- 2 – 6.02
- 3 – 6.37
- 4 – 6.88
- 5 – 9.63
- 6 – 48.1
- 7 – 72.2
Channel Registers
Depending on which channel you want to write to, the ports used are different:
- Channels 1/2: Ports 4/5
- Channels 3/4: Ports 6/7
Per-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 | 2 | 3 | 4 |
---|---|---|---|---|
Channels 1, 3 | $x1 | $x5 | $x9 | $xD |
Channels 2, 4 | $x2 | $x6 | $xA | $xE |
Address (Z80 port 4 or 6) | Data (Z80 port 5 or 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 |
|
SSG-EG |
Overall Channel Registers
The first value listed in the Address column is for channels 1/3; the second is for channels 2/4.
Address (Z80 port 4 or 6) | Data (Z80 port 5 or 7) | |||||||||||||||||||
$A1,$A2 |
|
F-Numbers and Block (1/2) | ||||||||||||||||||
$A5,$A6 |
|
F-Numbers and Block (2/2) (must set this first) | ||||||||||||||||||
$A9,$AA |
|
2CH - 2 Slot F-Numbers/Block (1/2) | ||||||||||||||||||
$AD,$AE |
|
2CH - 2 Slot F-Numbers/Block (1/2) (must set this first) | ||||||||||||||||||
$B1,$B2 |
|
Feedback (FB) and Algorithm (ALGO) | ||||||||||||||||||
$B5,B6 |
|
Left (L)/Right (R) output, AM Sense (AMS), and PM Sense (PMS) |
ADPCM-A part
'Dump' in register $00 is the key on/off bit. Write 0 to start playing specified channels and write 1 to stop playing.
Address (Z80 port 6) | Data (Z80 port 7) | ||||||||||||||||||
$00 |
| ||||||||||||||||||
$01 |
| ||||||||||||||||||
$08~$0D (one for each channel) |
| ||||||||||||||||||
$10~$15 (one for each channel) |
| ||||||||||||||||||
$18~$1D (one for each channel) |
| ||||||||||||||||||
$20~$25 (one for each channel) |
| ||||||||||||||||||
$28~$2D (one for each channel) |
|
ADPCM-B part
Address (Z80 port 4) | Data (Z80 port 5) | |||||||||||||||||||
$10 |
|
Start/Repeat/Reset flags | ||||||||||||||||||
$11 |
|
Left/Right Output | ||||||||||||||||||
$12 |
|
|||||||||||||||||||
$13 |
|
|||||||||||||||||||
$14 |
|
|||||||||||||||||||
$15 |
|
|||||||||||||||||||
$19 |
|
Determines sample playback rate | ||||||||||||||||||
$1A |
| |||||||||||||||||||
$1B |
|
|||||||||||||||||||
$1C |
|
ADPCM-A & B channels flag control |
- Datasheet states playback formula as F=[Delta-N / 256] x 55.5KHz (correct?)
- Write to flag control to reset/mask channel end flags
- Write 1 to reset and/or mask selected flag
- Write 0 to unmask selected flag
- Masking a flag will prevent it from being raised when a channel sample reach its end, this means you have to write 1, then 0 to clear a flag and keep it active.
- Flags must be manually cleared, playing a new sample on the channel won't clear it.
Reading
The only writable registers that can also be read are from the SSG. All other ports and addresses return different data.
Z80 port # | Data | Notes | ||||||||||||||||||
$04 |
|
When a timer expires and IRQ is enabled for the timer, the respective bit is set | ||||||||||||||||||
$05 |
|
Attempting to read non-SSG registers will fail | ||||||||||||||||||
$06 |
|
When a channel has reached the end address and stops, the respective bit is set, unless masked | ||||||||||||||||||
$07 | not implemented | Always returns $00 |