Official NokturnFM Atari ST OPL2 / 3 cartridge page
Updates
| 20.06.2026 | Updated links in Downloads Added custom / experimental builds of ScummVM 2026.3.1git with OPL support enabled. |
| 25.05.2026 | Updated links in Downloads There’s possibility to download either latest releases and latest development version of nFM library / NokturnFM.play. |
| 08.05.2026 | Added link in Downloads section to NokturnFM.play and nFM library automated builds / releases. Alternative builds are now provided for Linux(x64_86 / aarch64), Windows (MinGW32-w64, x64_86) and Atari (in few variants for major Atari cross compilers). |
| 05.04.2026 | Now anyone can send donation via LiberaPay, added donate button and link in “Donate” section. Updated ScummVM integration info about Atari OPL integration state. |
| 02.03.2026 | Added info about nFM library and NokturnFM.play repository. Updated “Ordering information and availability” section. Removed 1st wave preorder information. Added links to eBay auctions. nokturnFM.play instructions moved now to official nFM library repository page. Some formatting adjustments. |
| 08.01.2026 | Added new NokturnFM.play v0.7 archive. Updated known issues and NokturnFM.play screenshot. |
| 18.11.2025 | Updated NokturnFM.play v0.2 known issues (reported by DML, thanks!). |
| 19.10.2025 | Updated final 1st batch prices. |
| 02.10.2025 | Added NokturnFM logos, added cased cartridge photos, links to Allegro. Updated external link section. Added warranty disclaimer. Made correction related to “FM Melody Maker’ cartridge interface, it uses same principles as NokturnFM cart, but uses different address space. |
| 21.09.2025 | Added hardware differences between OPL2 and OPL3 chips (source: Vogons). |
| 13.09.2025 | Added more detailed information about calculating delays between OPL address / data writes. Improved programming info navigation. |
| 11.09.2025 | Added information about 1st wave of preorders. Ready to buy carts (without case) were renamed to “early, development” ones. |
| 03.09.2025 | Redacted content, reworked quick links and expanded external resources section. |
| 02.08.2025 | Added links to recordings of Atari version of SCUMMVM running PC games and using custom OPL driver to replay music via NokturnFM2 cartridge. Added preliminary ordering info, quick links with revised cartridge versions (revised pcb with case). |
| 28.12.2024 | Initial version |
Quick links
- Brief page content summary
- Project overview
- Target audience
- Warranty disclaimer
- Hardware overview
- Programming interface
- External AdLib / Sound Blaster / OPL programming information resources, trackers and music archives
- Software supporting NokturnFM cartridges
- Downloads
- Ordering information and availability
- F.A.Q.
- Feedback
- Donate
- Greetings
Brief summary
This is official support web page of NokturnFM family of sound cartridges equipped with YM3812 (OPL2) and YM262-M (OPL3) sound chips popular in 80’ / early 90’ and present in synths, arcade games, IBM PC’s Sound Blaster / AdLib cards and various sound expansions for C64 and MSX computers. Here you will find all the needed tools, programming information related to NokturnFM cartridges for Atari ST family of computers, ordering information along with some pointers to OPL2/3 programming informations and music data.
Atari is a trademark of the respective company, and is no way related to NokturnFM2 or NokturnFM3 mentioned below.
Shortly about project
NokturnFM2 / FM3 cartridges are a result of my experiments with integrating existing devices equipped with OPL2 / 3 soundchips with Atari ST line of computers. After checking several options existing on the market I came to conclusion that hardware interfaces used on those devices are too cumbersome for plain 8MHz models and I’ve decided to design custom device with much more straightforward and faster interface. Second motivation was sort of envy that users from other platforms like C64, MSX or even 8-bit Atari’s (YMari) had possibility to use OPL2/3 sound chips for years. C64 has Sound Expander and Xentax’s FM-YAM, MSX has MoonSound (,which uses better and expanded OPL4), even 8-bit Atari has YAMari and Melody.
For who it is for?
If you still own Atari ST, Mega ST(e), TT, Falcon 030 computer, have unsed cartridge slot and want to expand your computer’s sound capabilities with FM sound synthesis then you shouldn’t look no more. OPL2/3 chips were invented much later than YM2149 and provide more channels and sound capabilities. Using NokturnFM cartridges especially with games / software ported from PC XT/AT might reduce cpu costs related to audio (Sound Blaster FM chip parts doesn’t have to be emulated). It might be also used with MIDI sequencer (if someone creates drivers for Cubase for instance or create program, which will react to incoming MIDI events) - with proper instrument patch set OPL chips can emulate GM / GM2 midi standard, no external sound module is needed (,which was frequent practice in IBM PC XT/AT era). NokturnFM’s cartridges are fully accessible and documented, helper functions are provided below to get you started, so anyone can explore capabilities of both OPL2 and OPL3 sound chips on Atari. Currently there’s no native Atari OPL2 / 3 trackers, but tunes can be made on PC trackers like RAD (Reality Adlib Tracker) or others, alternatively converted to VGM / VGZ and replayed on Atari.
Warranty disclaimer
THESE PRODUCTS ARE PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESE PRODUCTS OR THE USE OR OTHER DEALINGS IN THESE PRODUCTS.
Hardware overview
Handling precautions
Handle with care, do not touch electronic components on pcb directly with bare hands, handle pcb by edges. Cartridge should be inserted with ‘This side up!’ text facing upwards. Eliminate static electricity from your body before touching pcb (by touching metal, grounded items for instance).
Do not:
- move / adjust position of cartridge, when computer is on,
- do not connect it upside down, turning computer on in this case may damage both computer and cartridge.
Installation / Setup
- Make sure computer is off, insert gently cartridge into cartridge port.
- In case of NokturnFM3 cartridge connect audio out to speakers or amplifier, NokturnFM2 contains volume potentiometer and can be used with headphones or speakers / amplifier. Turn volume down.
- Turn on computer. If computer boots, shows either Atari logo or white screen and proceeds to desktop, then everything is fine. In case of white screen or computer isn’t booting there might be an issue with your cartridge port, power supply or cartridge wasn’t properly inserted.
In case of weird noises you can always press RESET button to reinitialise onboard sound chip and restart program / game / application.
Device doesn’t require any drivers and is available right after powering computer on. Cartridge ports wear if carts are frequently inserted and removed, also some cartridges with improper edge connectors can wear down slowly internal connector, which can cause improper contacts and improper cart operation. Unfortunately ST cartridge ports cannot be easily replaced or repaired, they aren’t snadard and widely available. At least not in small amounts and aren’t cheap. Mostly they can only salvaged from other Atari motherboards and replaced. I’ve tested those cartridges thoroughly on various Atari ST models (ST / STe / Mega ST, Falcon 030), but I cannot guarantee that they will be working on all hardware configurations. Use cartridges at your own risk, I will not be responsible for any damages made to your hardware.
Minimal requirements
16/32-bit Atari ST compatible computer, 0,5MiB RAM with free cartridge port slot. No drivers required.
Cartridge models
Currently there are two types of cartridges:
NokturnFM2 specification
- Yamaha OPL2 (YM3812) - provides nine concurrent FM channels with two operators per channel. It features a percussion mode (or rhythm mode) that turns the last three channels into percussion / rhythm channels to produce 5 percussion / rhythm sounds. Used on the original AdLib card and clones.
- Minijack output
- Volume control
- Hardware OPL reset button
- Chiseled 30° connector
NokturnFM3 specification
- Yamaha OPL3 (YM262-M) - is an extended version of the original OPL2 chip, adding an extra register base for a total of 18 two-operator channels. Twelve of these channels may be combined to form six four-operator channels. Each channel can be routed to a maximum of 4 output channels, though there are no sound cards that actually use all four (,which is the case with this cart).
- 100% backward compatible with OPL2, can emulate dual OPL2 setup.
- Faster writes in comparison to NokturnFM2, OPL3 has faster internal master clock
- Minijack output
- No volume control
- Hardware OPL reset button
- Chiseled 30° connector
Both cartridges are supplied with 3d printed PLA case in gray colour and have rubber feet, so cartridge does not hang from port.
Hardware interface is similar to Atari ST ‘Melody Maker FM’ cartridge by Hybrid Arts, which in fact contained reduced cost OPLL chip, similar to OPL2, but with predefined and not changable instrument set. NokturnFM cartridges use different address space though. It also means that Atari ST OPL interface is one-way only, we can write to OPL chip, not read from it, which is sufficient for it’s operation, but software sound chip detection procedures, like on PCs aren’t possible.
Software is currently in the works, there is quite simple commandline player called ‘NokturnFM.play’, which allows replay tunes in vgm / vgz / dro / Reality Adlib Tracker formats.
There’s will be also FM library, which will allow easier integration of OPL chip’s with your games / demos / programs. It isn’t published yet, but it’s capabilities can be seen in ‘NokturnFM.play’ player and ScummVM driver. Library encapsulates OPL chip management, but is independent from underlying hardware. It uses driver architecture, so there is possibility to use other devices with Atari ST equipped with OPLx chips without changing exisiting programs. Basic programming information is provided below and is free to use.
NokturnFM3 OPL2/3 replay demonstration
Programming interface
As Atari ST cartridge port is read only, we fake writes with port reads, NokturnFM cartridges use $fffa0000 address space.
Sending data to OPL
Hardcoded delays
OPL3_DELAY_ADDR_WRITE / OPL3_DELAY_DATA_WRITE defines and OPL2_DELAY_ADDR_WRITE / OPL2_DELAY_DATA_WRITE below are delays required by OPL chips to succesfully perform data writes and depend on OPL chip type. Each OPL model uses different internal master clock, which is either slower or faster than Atari ST(or compatible) CPU clock, so writes are dependent on CPU bus speed, if cpu is slower, then there’s no problem, this is different for faster CPU’s. Currently most Atari ST computers have 8MHz or 16MHz clock’s, but accelerators are more common.
For usual 8 / 16MHz cpu clocks common values are:
8MHz
OPL2_DELAY_ADDR_WRITE / OPL2_DELAY_DATA_WRITE (8 / 44)
OPL3_DELAY_ADDR_WRITE / OPL3_DELAY_DATA_WRITE (1 / 1)
16 MHz
OPL2_DELAY_ADDR_WRITE / OPL2_DELAY_DATA_WRITE (4 / 122)
OPL3_DELAY_ADDR_WRITE / OPL3_DELAY_DATA_WRITE (4 / 4)
; OPL address write
...
; OPL address write delay
rept OPL3_DELAY_ADDR_WRITE ; delay after address write
nop
endr
; OPL data write
...
; OPL data write delay
rept OPL3_DELAY_DATA_WRITE ; register data write delay
nop
endr
As cpu ranges can vary (like with more common accelerated machines), hardcoded values might be insufficient in all cases and delay has to be computed at runtime.
OPL delays independent from cpu and bus speed
Here’s routine I’ve used in latest version of VGM player (not published yet), it is based on FreeMint delay code written by Roger Burrows, but repurposed:
TIMERD_VEC equ $110
MFP_REGS equ $fffffa01
MFP_IERB equ MFP_REGS+8
MFP_ISRB equ MFP_REGS+16
MFP_IMRB equ MFP_REGS+20
MFP_TCDCR equ MFP_REGS+28
MFP_TDDR equ MFP_REGS+36
XDEF _runDelayCalibration
XDEF runDelayCalibration
TEXT
; calibrate using MFP TimerD
_runDelayCalibration:
runDelayCalibration:
clr.l intcount ;initialise interrupt count
lea MFP_TCDCR,a0 ;a0 -> Timer C/D control reg
andi.b #$f0,(a0) ;stop TimerD
lea MFP_TDDR,a0 ;a0 -> TimerD data
clr.b (a0) ;set count = 256
move.l TIMERD_VEC,d1 ;save old TimerD vector in d1
lea handle_timer,a0
move.l a0,TIMERD_VEC ;set up new TimerD vector
lea MFP_IERB,a0
move.b (a0),ierbsave
bset.b #4,(a0) ;set interrupt enable bit
lea MFP_IMRB,a0
move.b (a0),imrbsave
bset.b #4,(a0) ;set interrupt mask bit
lea MFP_TCDCR,a0 ;a0 -> Timer C/D control reg
ori.b #$02,(a0) ;set pre-scaler = divide-by-10 & start TimerD
move.l 4(a7),d0 ;loopcount
cal_loop:
subq.l #1,d0
bpl.s cal_loop
move.l intcount,d0 ;d0 = interrupt count
move.l d0,intsave ;save it
lea MFP_TCDCR,a0 ;a0 -> Timer C/D control reg
andi.b #$f0,(a0) ;stop TimerD
lea MFP_IERB,a0 ;restore interrupt bits
move.b ierbsave,(a0)
lea MFP_IMRB,a0
move.b imrbsave,(a0)
move.l d1,TIMERD_VEC ;restore TimerD vector
move.l intsave,d0 ;return interrupt count
rts
;
; handle timer interrupt from calibration
;
; an interrupt occurs every 256/(2457600/10) seconds,
; i.e. every 1/960 second.
;
; overhead calculation
; --------------------
; 68000 at 8MHz
; an interrupt occurs every 8000000/960 = 8333 cycles.
; the overhead is 116/3333, approx 1.4%
; other systems are even less, so we ignore
handle_timer: ;68000:
;interrupt dispatch ;44
addq.l #1,intcount ;12+16 = 28
bclr.b #4,MFP_ISRB ;12+12 = 24
rte ;20
;total 116
BSS
intcount: ds.l 1
intsave: ds.l 1
ierbsave: ds.b 1
imrbsave: ds.b 1
#include <mint/falcon.h>
#include <mint/osbind.h>
// initial 1 millisecond delay loop values
#define LOOPS_68060 110000 // 68060 timing assumes 110MHz for safety
#define LOOPS_68030 3800 // 68030 timing assumes 32MHz
#define LOOPS_68000 760 // 68000 timing assumes 16MHz
#define CALIBRATION_TIME_MS 100 // target millisecs to run calibration
uint32_t gLoopcount_1_msec;
uint32_t gDelay_1usec;
static inline void delayInit(int32_t mcpu)
{
switch(mcpu)
{
case 60:
{
gLoopcount_1_msec = LOOPS_68060;
} break;
case 40:
case 30:
{
// assumes 68030
gLoopcount_1_msec = LOOPS_68030;
} break;
default:
{
// assumes 68000
gLoopcount_1_msec = LOOPS_68000;
}
};
}
// calibrate delay values: must only be called *after* interrupts are allowed
// NOTE: we use TimerD so we restore the RS232 stuff
extern uint32_t runDelayCalibration(uint32_t loopcount);
static inline void delayCalibrate(void)
{
// first, we save the status of the relevant parts of the system.
// since TimerD is used by the standard serial port for baud rate
// control, we need to save the current interrupt status and baud
// rate. the interrupt status must be saved via direct hardware
// access; for the baud rate, we can use a system call. however,
// since the serial port may have been remapped, we need to map it
// back to the standard device first.
int32_t old_device = Bconmap(6); // ok even if Bconmap() doesn't exist
int32_t old_rate = Rsconf(-2,-1,-1,-1,-1,-1);
// disable interrupts then run the calibration
// (the calibration saves & restores the interrupt status)
int32_t ret;
if (Super((void *)1L) == 0L)
ret = Super(0L);
else
ret = 0;
const uint32_t loopcount = CALIBRATION_TIME_MS * gLoopcount_1_msec;
const uint32_t intcount = runDelayCalibration(loopcount);
if (ret)
{
SuperToUser((void *)ret);
}
Rsconf(old_rate,-1,-1,-1,-1,-1);
Bconmap(old_device);
// intcount is the number of interrupts that occur during 'loopcount'
// loops. an interrupt occurs every 1/960 sec (see os.s).
// so the number of loops per second = loopcount/(intcount/960).
// so, loops per millisecond = (loopcount*960)/(intcount*1000)
// = (loopcount*24)/(intcount*25).
if (intcount)
{
// check for valid
gLoopcount_1_msec = (loopcount * 24) / (intcount * 25);
}
gDelay_1usec = gLoopcount_1_msec / 1000;
}
void calibrateHardwareDelay(int32_t mcpu)
{
delayInit(mcpu);
delayCalibrate();
}
; OPL2 timings
; Master clock = 3,58 Mhz
; minimal time after address write mode = 12 cycles
; minimal time after data write mode = 84 cycles
; 12 / 3,58 = ~ 3,3 µs after the address write
; 84 / 3,58 = ~ 23,5 µs after the data write
; 100ns strobe hold
OPL2_DELAY_ADDR_WRITE equ 4
OPL2_DELAY_DATA_WRITE equ 24
OPL2_DELAY_STROBE_HOLD equ 1
; OPL3 timings
; Master clock = 14,32MHz
; minimal time after address write mode = 32 cycles
; minimal time after data write mode = 32 cycles
; 32 / 14,32 = ~ 2,23µs after the address write if we write data
; 32 / 14,32 = ~ 2,23µs after the data write
; 100ns strobe hold
OPL3_DELAY_ADDR_WRITE equ 3
OPL3_DELAY_DATA_WRITE equ 3
OPL3_DELAY_STROBE_HOLD equ 1
XREF gDelay_1usec
XREF _gDelay_1usec
VAR_DELAY_1US equ _gDelay_1usec
OsDelay macro labelname, reg
move.l VAR_DELAY_1US,\2
.\1\@:
subq.l #1,\2
bpl.s .\1\@
endm
...
; perform OPL address write
... address write
; delay after OPL3 address write
rept OPL3_DELAY_ADDR_WRITE
OsDelay addrWrite,d4 ; delay after address write
endr
; perform data write
... data write
; delay after OPL3 data write
rept OPL3_DELAY_DATA_WRITE
OsDelay dataWrite,d4 ; register data write delay
endr
...
On our program startup we need to pass cpu type retrieved from operating system ‘Cookie Jar’ to calibrateHardwareDelay() function. Afterwards we can use OsDelay m68k macro as in listing above.
Doubly exported label is added in case we use newer mintelf gcc compiler for which underscores in symbols aren’t needed. m68k assembly is written in Devpac / VASM syntax.
If you know more accurate or better approach don’t hestitate to let me know..
Reading OPL state
Due to hardware design there’s no possibility to read OPL chip state, which actually isn’t needed in most cases, so opl shadow registers need to be maintained after opl chip reset.
OPL2 write routines can be used with FM Melody Maker cartridge, timings are the same (OPLL chip is cost-reduced OPL2 chip variant), but cart base address is different, register map is different and there is a preset instrument list, which cannot be altered. One interesting thing is that OPLL chips can be emulated by OPL2, because OPLL instrument patches were reverse engineered.
NokturnFM cartridge hardware interface
Cart base address: $fffa0000
Below is Atari ST bus signal mapping to OPL2 / 3 inputs. A0 is not present on cartridge port.
XX - unused
RSRV - reserved for future use
| Bit No. | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Addr Line | XXX | XXX | XXX | A12 | A11 | A10 | A9 | A8 | A7 | A6 | A5 | A4 | A3 | A2 | A1 | A0 |
| OPL line | XX | XX | XX | RSRV | RSRV | A1 | A0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | XX |
noktrnfm.h (example C interface header):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef NOKTURNFM_H
#define NOKTURNFM_H
// Atari ST/e/TT/F030 NokturnFM2/3 programming interface
// Copyright 2019-26 Paweł Góralski
// WWW: https://nokturnal.pl
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
typedef struct
{
uint8_t port;
uint8_t reg;
uint8_t value;
} sOplRegisterWrite;
extern void Opl3CartWrite(const sOplRegisterWrite* write);
extern void Opl2CartWrite(const sOplRegisterWrite* write);
#endif
nfm_m68k.s:
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
; #################################################################################################
; # Atari ST/e/TT/F030 NokturnFM2/3 programming interface
; # (c) 2019-2026 Pawel Goralski / [nokturnal]
; #################################################################################################
; ############ programming interface
OPL_REG_SELECT equ $00
OPL_DATA_WRITE equ $01
OPL_REGISTER_ARRAY0 equ $00
OPL_REGISTER_ARRAY1 equ $01
RSRESET
port: rs.b 1
reg: rs.b 1
val: rs.b 1
CART_BASE equ $fffa0000
OPL_MODE_BIT equ 9
OPL_REGISTER_ARRAY_BIT equ 10
OPL_RESET_BIT equ 12
Opl3CartWrite:
move.l 4(sp),a0 ; d0/a0 should be saved by caller
movem.l d2-3,-(sp) ; save scratch registers
move.b port(a0),d2 ; opl3 register array 0/1
move.b reg(a0),d0 ; opl2 register address
move.b val(a0),d1 ; opl2 value to write under previously set address
move.l #$000000FF,d3 ; set up mask
move.l #CART_BASE,a0 ; store cartridge port address base for later use
and.l d3,d0
and.l d3,d1
and.l d3,d2
andi.b #$01,d2 ; discard unit id part
; OPL address write
.modeIsSet:
lsl.w #1,d0 ; shift address to set first A1-A8 data lines
tst.b d2 ; check register array 0/1
beq.s .regArrayDone
bset #OPL_REGISTER_ARRAY_BIT,d0 ; set OPL_REGISTER_ARRAY_BIT if true
or.w d2,d0 ; combine register array state with shifted register
; address, otherwise it's not needed
.regArrayDone:
tst.b 0(a0,d0.l) ; write
rept OPL3_DELAY_ADDR_WRITE ; delay after address write
nop
endr
; OPL data write
lsl.w #1,d1 ; shift data to set A15-A7 data lines
or.w d2,d1
bset #OPL_MODE_BIT,d1
tst.b 0(a0,d1.l) ; write
rept OPL3_DELAY_DATA_WRITE ; register data write delay
nop
endr
movem.l (sp)+,d2-3 ; restore scratch registers
RTS
Opl2CartWrite:
move.l 4(sp),a0 ; d0/a0 should be saved by caller
movem.l d2,-(sp) ; save scratch registers
move.b reg(a0),d0 ; opl2 register address
move.b val(a0),d1 ; opl2 value to write under previously set address
move.l #$000000FF,d2 ; load mask
and.l d2,d0
and.l d2,d1
move.l #CART_BASE,a0 ; store cartridge port address base for later use
; OPL address write
lsl.w #1,d0 ; shift address to set first A1-A8 data lines
tst.b 0(a0,d0.l) ; write
rept OPL2_DELAY_ADDR_WRITE
nop
endr
; OPL data write
lsl.w #1,d1 ; shift address to set first A1-A8 data lines
bset #OPL_MODE_BIT,d1 ; enable data write
tst.b 0(a0,d1.l) ; write
rept OPL2_DELAY_DATA_WRITE
nop
endr
movem.l (sp)+,d2 ; restore scratch registers
RTS
YM3812 (OPL2) memory map cheatsheet
+-----------------------------------+ +-----------------------------------------------+
|ADDR | REGISTER ARRAY 0 (A1=L) | | REGISTER ARRAY 0 (A1=L) |
|(HEX) | 0x00 | | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
+-----------------------------------+ +-----------------------------------------------+
| $01 | - - 0 0 0 0 0 0 ( 0x00 ) | | | WVE | LSI TEST | WVE = WAVEFORM enable (OPL2 only)
| $02 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | TIMER 1 |
| $03 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | TIMER 2 |
| $04 | 0 0 0 - - - 0 0 ( 0x00 ) | | RST | MT1 | MT2 | x | x | x | ST2 | ST1 | IRQ Reset / TIMER 1-2 Control
| $05 | - - - - - - - - ( ---- ) | | x | x | x | x | x | x | x | x |
| $06 | - - - - - - - - ( ---- ) | | x | x | x | x | x | x | x | x |
| $07 | - - - - - - - - ( ---- ) | | x | x | x | x | x | x | x | x |
| $08 | 0 0 - - - - - - ( 0x00 ) | | CSM | NTS | x | x | x | x | x | x | CSM Speech synthesis mode (OPL2 Only) / note select
=======================================================================================|
| $20 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AM | VIB | EGT | KSR | MULT |
.. | |
| $35 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AM | VIB | EGT | KSR | MULT |
=======================================================================================|
| $40 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | KSL | TL |
.. | | | |
| $55 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | KSL | TL |
=======================================================================================|
| $60 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AR | DR | Attack Rate / Decay Rate
.. | | |
| $75 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AR | DR |
=======================================================================================|
| $80 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | SL | RR | Sustain Rate / Release Rate
.. | | |
| $95 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | SL | RR |
=======================================================================================|
| $A0 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | F NUMBER (L) |
.. | | |
| $A8 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | F NUMBER (L) |
=======================================================================================|
| $B0 | - - 0 0 0 0 0 0 ( 0x00 ) | | x | x | KON | BLOCK | FNUM(H) |
.. | | |
| $B8 | - - 0 0 0 0 0 0 ( 0x00 ) | | x | x | KON | BLOCK | FNUM(H) |
=======================================================================================|
| $BD | 0 0 0 0 0 0 0 0 ( 0x00 ) | | DAM | CVB | RYT | BD | SD | TOM | TC | HH |
=======================================================================================|
| $C0 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | CHD | CHC | CHB | CHA | FB | CNT |
.. | | |
| $C8 | 0 0 0 0 0 0 0 0 ( 0x00 ) | | CHD | CHC | CHB | CHA | FB | CNT |
=======================================================================================|
| $E0 | - - - - - - 0 0 ( 0x00 ) | | x | x | x | x | x | x | WS | Wave Select
.. | | |
| $F5 | - - - - - - 0 0 ( 0x00 ) | | x | x | x | x | x | x | WS |
+======================================================================================+
YM262-M (OPL3) memory map cheatsheet
+---------------------------------------------------------------+ +---------------------------------------------------------------------------------------------------+
|ADDR | REGISTER ARRAY 0 (A1=L) | REGISTER ARRAY 1 (A1=H) | | REGISTER ARRAY 0 (A1=L) / REGISTER ARRAY 1 (A1=H) |
|(HEX) | 0x00 | 0x00 | | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | / | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
+---------------------------------------------------------------+ +---------------------------------------------------------------------------------------------------+
| $01 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | LSI TEST | / | x | x | LSI TEST |
| $02 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | TIMER 1 | / | x | x | x | x | x | x | x | x |
| $03 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | TIMER 2 | / | x | x | x | x | x | x | x | x |
| $04 | 0 0 0 - - - 0 0 ( 0x00 ) | - - 0 0 0 0 0 0 ( 0x00 ) | | RST | MT1 | MT2 | x | x | x | ST2 | ST1 | / | x | x | CONNECTION SEL |
| $05 | - - - - - - - - ( ---- ) | - - - - - - - 0 ( 0x00 ) | | x | x | x | x | x | x | x | x | / | x | x | x | x | x | x | x | NEW |
| $06 | - - - - - - - - ( ---- ) | - - - - - - - - ( ---- ) | | x | x | x | x | x | x | x | x | / | x | x | x | x | x | x | x | x |
| $07 | - - - - - - - - ( ---- ) | - - - - - - - - ( ---- ) | | x | x | x | x | x | x | x | x | / | x | x | x | x | x | x | x | x |
| $08 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | x | NTS | x | x | x | x | x | x | / | x | x | x | x | x | x | x | x |
=======================================================================================================================================================================|
| $20 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AM | VIB | EGT | KSR | MULT | / | AM | VIB | EGT | KSR | MULT |
.. | | / | |
| $35 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AM | VIB | EGT | KSR | MULT | / | AM | VIB | EGT | KSR | MULT |
=======================================================================================================================================================================|
| $40 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | KSL | TL | / | KSL | TL |
.. | | | | / | | |
| $55 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | KSL | TL | / | KSL | TL |
=======================================================================================================================================================================|
| $60 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AR | DR | / | AR | DR |
.. | | | / | | |
| $75 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | AR | DR | / | AR | DR |
=======================================================================================================================================================================|
| $80 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | SL | RR | / | SL | RR |
.. | | | / | | |
| $95 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | SL | RR | / | SL | RR |
=======================================================================================================================================================================|
| $A0 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | F NUMBER (L) | / | F NUMBER (L) |
.. | | | / | |
| $A8 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | F NUMBER (L) | / | F NUMBER (L) |
=======================================================================================================================================================================|
| $B0 | - - 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | x | x | KON | BLOCK | FNUM(H) | / | x | x | KON | BLOCK | FNUM(H) |
.. | | | / | |
| $B8 | - - 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | x | x | KON | BLOCK | FNUM(H) | / | x | x | KON | BLOCK | FNUM(H) |
=======================================================================================================================================================================|
| $BD | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | DAM | CVB | RYT | BD | SD | TOM | TC | HH | / | DAM | CVB | RYT | BD | SD | TOM | TC | HH |
=======================================================================================================================================================================|
| $C0 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | CHD | CHC | CHB | CHA | FB | CNT | / | CHD | CHC | CHB | CHA | FB | CNT |
.. | | | / | |
| $C8 | 0 0 0 0 0 0 0 0 ( 0x00 ) | 0 0 0 0 0 0 0 0 ( 0x00 ) | | CHD | CHC | CHB | CHA | FB | CNT | / | CHD | CHC | CHB | CHA | FB | CNT |
=======================================================================================================================================================================|
| $E0 | - - - - - 0 0 0 ( 0x00 ) | - - - - - 0 0 0 ( 0x00 ) | | x | x | x | x | x | Wave Select | / | x | x | x | x | x | Wave Select |
.. | | | / | |
| $F5 | - - - - - 0 0 0 ( 0x00 ) | - - - - - 0 0 0 ( 0x00 ) | | x | x | x | x | x | Wave Select | / | x | x | x | x | x | Wave Select |
+======================================================================================================================================================================+
Differences between OPL2 and OPL3 sound chips
Not documented in Yamaha data sheets
- Sinus table is a little different: the negative part is off by one.
- In order to enable selection of four different waveforms on OPL2 one must set bit 5 in register 0x01 (test). On OPL3 this bit is ignored and 4-waveform select works always. (Don’t confuse this with OPL3’s 8-waveform select.)
- Envelope Generator: all 15 x rates take zero time on OPL3. On OPL2 15 0 and 15 1 rates take some time while 15 2 and 15 3 rates take zero time.
- channel calculations: output of operator 1 is in perfect sync with output of operator 2 on OPL3; on OPL and OPL2 output of operator 1 is always delayed by one sample compared to output of operator 2.
Documented in datasheets
- YMF262 does not support CSM (speech synthesis) mode
External AdLib / Sound Blaster / OPL programming information resources, trackers and music archives
- Using OPL soundchips on Atari ST overview of hardware OPL soundchip options on Atari ST
- nFM library OPL2 / OPL3 cross platform OPL library. Written in C, gently sprinkled with assembly. Supports various OPL hardware and can emulate OPL soundchips in software on various operating systems and architectures. What isn’t there can be added, it is in an active development.
- OPLx Page
- OPL Archive OPL2/3 Music archive with files in VGM format.
- VGM Rips Music data dumps from various games, contains OPL2 / 3 / OPLL chip packs.
- Furnace Tracker OPL2/3 tracker (among others), which can export VGM files
- RAD Tracker FM / Adlib tracker
- AdLib Tracker II FM/Adlib tracker
- Adplug free, cross-platform, hardware independent AdLib sound player library
- VGMSlap (VGM Silly Little Adlib Player), open-source, MS-DOS based player for Yamaha OPL1/2/3 Video Game Music (VGM) files.
- Arduino OPL2 Library OPL2 / OPL3 audio library for the CE OPL2 Audio Board or OPL3 Duo! board, compatible with Arduino, Teensy, Raspberry Pi and other Arduino-like boards. Great reference for OPL programming, although is in C++.
- OPL3 Bank editor A small cross-platform editor of the OPL3 FM banks supporting different formats. Can use software emulation and real OPL devices(OPL3LPT/OPL2LPT/OPL3 Express etc..).
Software supporting NokturnFM cartridges
NokturnFM.play
‘NokturnFM.play’ is a music replay program for the OPL / OPLL / OPN device variants, that lets you replay various formats using real sound chips. It came to be during experiments with OPL devices on Atari and uses handy library, which due it’s driver architecture allows easy addition of new devices / drivers.
Requirements:
Atari ST computer or compatible, TOS or EmuTOS operating system, medium resolution and up One of supported devices connected via cartridge port, Centronics / parallel port or usb (,which requires proper driver).
ScummVM hardware OPL2 / 3 support on Atari
ScummVM is a program which allows you to run certain classic graphical adventure and role-playing games, provided you already have their data files.
OPL driver was already implemented for Atari in ScummVM Full / Lite for several OPL devices, here is a short demo recorded on Atari Falcon 030 / CT60:
Usage of real sounchip reduces significantly cpu load, which translates to better frame rates and we can enjoy AdLib sound as heard in old PC games. Additionally NokturnFM3 cartridge can emulate dual OPL2 chip setups. More details can be found here.
Patch was already submitted to ScummVM project and waits for review and merge to official branch.
nFM - crossplatform Yamaha OPL API
nFM is cross-platform, open source API allowing easy access and management of Yamaha OPL2 (YM3812) / OPL3 (YMF262) soundchips. It is written in a mix of C (C17>) and m68k assembly primarily targeted at Atari TOS, but due it’s driver architecture can be used under Windows / Linux. It also exposes some other helper functions, application written once can use any OPL device via uniform driver interface. Both NokturnFM.play, ScummVM Atari integration uses it. More about it can be can be found in an announcement from February 2026 and in official nFM project repository.
TBA
There’s new JAM plugin and MxPlay plugins in development, so VGMs will be playable from desktop applications. Also BadMood integration in the works.
If you are Atari developer, who plans to use cartridges in your games / demos / applications or need help with integration then let me know. You can also head directly to nFM repository for all your Atari / OPL development needs.
Ordering information and availability
Currently are available following types of cart builds:
1) Final versions as in preorder , besides additional case, has minor changes, mostly related to rearranged, lower profile components and changes in reset button type, so it is more accessible and has uniform clock generation circuit.
2) Early, fully functional versions of NokturnFM2 / NokturnFM3 carts. They have have different passive elements in comparison to final ones - bigger with higher profile. They don’t have proper case and are supplied with plastic stands.
Sound chips in those carts are genuine, but are sourced from various places. Some of them are like new, some of them are more or less battered, so treat all of them as previously used.
If you are interested in early, development version cartridges, send an e-mail to: orders@nokturnal.pl with ‘NokturnFM early, development version order’ in subject or use Allegro or eBay links from below. For final NokturnFM2 or NokturnalFM3 contact me by sending an e-mail to: orders@nokturnal.pl with ‘NokturnFM order request’ in subject, I might have still some devices left.
| model photo | name | eBay offer | Allegro offer | direct order (unit price without P&P) |
| NokturnFM2 | N/A | N/A | order | |
| NokturnFM3 | N/A | N/A | order | |
| NokturnFM2 (early, development version) | link | link | 78 EUR | |
| NokturnFM3 (early, development version) | link | link | 95 EUR |
Downloads
Important: Distributing software provided here is prohibited without my consent, but you can provide direct link to this page.
nFM library / NokturnFM.play releases on nFM repository page
nFM library / NokturnFM.play releases (direct download)
nFM library / NokturnFM.play development builds download
Experimental ScummVM build 2026.3.1git lite with OPL support updated: 21.10.2026
Experimental ScummVM build 2026.3.1git full with OPL support updated: 21.10.2026
Older NokturnFM.play releases (Atari only)
NokturnFM.play v0.7 updated: 01.08.2026
NokturnFM.play v0.2 updated: 27.12.2024
Ready to use collections of OPL2/OPL3/OPL-L music
F.A.Q.
Q: Will NokturnFM2 / FM3 will work with my Atari setup?
A: Yes, as long as it has free cartridge port.
Feedback
If you have any feedback, suggestions, feature requests etc. you can send it to: nokturnal@nokturnal.pl
Donate
If you like this project and want more like this in the future feel free to donate via LiberaPay or PayPal to partially help cover my hardware and software development time, expenses related to hardware / electronic parts, electricity or coffee. By buying Atari hardware from me you also support development and increasing chances that new things will show up in the future. Thank you!
Greetings
I would like to thank for support during development to following people (in no particular order): T0ri, BadWolf, Willy, Insane, Sqward, Sporniket, stephen_usher, Exxos, Czietz and everyone who supported the project along the way and anyone I’ve forgot.