Skip to content

Commit 6a5daaf

Browse files
authored
Add YM2414 (OPZ) support via ymfm (#145)
- Add DEVID_YM2414 (0x30) device ID - Vendor ymfm source files (commit 17decfa) in emu/cores/ymfm/ - ymfm.h - Core infrastructure - ymfm_opz.h - YM2414 (OPZ) implementation - ymfm_fm.h/ipp - FM engine - Create C++ wrapper (ymfmintf.cpp/h) with extern C interface - Integrate into build system (CMakeLists.txt, Makefile) - Register device in SoundEmu.c - YM2414 specs: 8 FM channels, 4 operators per channel - Used in Yamaha TX81Z, DX11, YS200 synthesizers The implementation follows existing patterns (similar to ICS2115) and is designed to support future ymfm chip additions (OPN, OPM, OPLL, etc.).
1 parent 57585ea commit 6a5daaf

File tree

12 files changed

+4099
-0
lines changed

12 files changed

+4099
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ LIBEMUOBJS = \
230230
$(LIBEMUOBJ)/cores/x1_010.o \
231231
$(LIBEMUOBJ)/cores/c352.o \
232232
$(LIBEMUOBJ)/cores/iremga20.o \
233+
$(LIBEMUOBJ)/cores/ymfmintf.o \
233234
$(LIBEMUOBJ)/Resampler.o \
234235
$(LIBEMUOBJ)/panning.o \
235236
$(LIBEMUOBJ)/dac_control.o

emu/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ option(SNDEMU_MSM5205_ALL "Sound Device MSM5205: all cores" OFF)
8686
option(SNDEMU_MSM5232_ALL "Sound Device MSM5232: all cores" OFF)
8787
option(SNDEMU_BSMT2000_ALL "Sound Device BSMT2000: all cores" OFF)
8888
option(SNDEMU_ICS2115_ALL "Sound Device ICS2115: all cores" OFF)
89+
option(SNDEMU_YM2414_YMFM "Sound Device YM2414 (OPZ): ymfm core" OFF)
8990

9091
# console/computer presets
9192
option(SNDEMU__PRESET_SMS "Sound Dev. Preset: Sega Master System/Game Gear" OFF)
@@ -151,6 +152,7 @@ if(SNDEMU__ALL)
151152
set(SNDEMU_MSM5232_ALL ON)
152153
set(SNDEMU_BSMT2000_ALL ON)
153154
set(SNDEMU_ICS2115_ALL ON)
155+
set(SNDEMU_YM2414_YMFM ON)
154156
endif()
155157

156158

@@ -648,6 +650,16 @@ if(SNDEMU_ICS2115_ALL)
648650
set(EMU_FILES ${EMU_FILES} cores/ics2115.c)
649651
set(EMU_CORE_HEADERS ${EMU_CORE_HEADERS} cores/ics2115.h)
650652
endif()
653+
if(SNDEMU_YM2414_YMFM)
654+
set(EMU_DEFS ${EMU_DEFS} " SNDDEV_YM2414" " EC_YM2414_YMFM")
655+
set(EMU_FILES ${EMU_FILES} cores/ymfmintf.cpp cores/ymfm/ymfm_opz.cpp)
656+
set(EMU_CORE_HEADERS ${EMU_CORE_HEADERS} cores/ymfmintf.h)
657+
set(EMU_CORE_HEADERS ${EMU_CORE_HEADERS}
658+
cores/ymfm/ymfm.h
659+
cores/ymfm/ymfm_opz.h
660+
cores/ymfm/ymfm_fm.h
661+
)
662+
endif()
651663

652664
add_library(${PROJECT_NAME} ${LIBRARY_TYPE} ${EMU_FILES})
653665
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)

emu/SoundDevs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@
4949
#define DEVID_MSM5232 0x2D
5050
#define DEVID_BSMT2000 0x2E
5151
#define DEVID_ICS2115 0x2F
52+
#define DEVID_YM2414 0x30 // YM2414 (OPZ), used in TX81Z
5253
#endif // __SOUNDDEVS_H__

emu/SoundEmu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define SNDDEV_MSM5232
5757
#define SNDDEV_BSMT2000
5858
#define SNDDEV_ICS2115
59+
#define SNDDEV_YM2414
5960
#endif
6061

6162
#ifdef SNDDEV_SN76496
@@ -190,6 +191,9 @@
190191
#ifdef SNDDEV_ICS2115
191192
#include "cores/ics2115.h"
192193
#endif
194+
#ifdef SNDDEV_YM2414
195+
#include "cores/ymfmintf.h"
196+
#endif
193197

194198
const DEV_DECL* sndEmu_Devices[] = {
195199
#ifdef SNDDEV_SN76496
@@ -335,6 +339,9 @@ const DEV_DECL* sndEmu_Devices[] = {
335339
#endif
336340
#ifdef SNDDEV_ICS2115
337341
&sndDev_ICS2115,
342+
#endif
343+
#ifdef SNDDEV_YM2414
344+
&sndDev_YM2414,
338345
#endif
339346
NULL // list end
340347
};

emu/cores/ymfm/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# ymfm - Yamaha FM sound cores
2+
3+
This directory contains vendored source files from the ymfm project.
4+
5+
## Source
6+
- **Project**: ymfm (Yamaha FM sound cores)
7+
- **Author**: Aaron Giles
8+
- **Repository**: https://github.com/aaronsgiles/ymfm
9+
- **Commit**: 17decfae857b92ab55fbb30ade2287ace095a381
10+
- **Date**: 2025-12-31
11+
12+
## License
13+
BSD-3-Clause
14+
15+
Copyright (c) 2020-2021 Aaron Giles
16+
17+
See the header comments in each file for full license text.
18+
19+
## Files
20+
- `ymfm.h` - Base classes and core infrastructure
21+
- `ymfm_opz.h` - YM2414 (OPZ) implementation
22+
- `ymfm_fm.h` - FM engine base classes
23+
- `ymfm_fm.ipp` - FM engine template implementations
24+
25+
## Integration
26+
These files are used by `ymfmintf.cpp` to provide YM2414 (OPZ) emulation support in libvgm.

0 commit comments

Comments
 (0)