News/Sega of Japan Sound Documents and Source Code

From Hidden Palace
Jump to navigation Jump to search
Soj md sound folders spine - for article.jpeg
250px link=:File:Sega of Japan Mega Drive Sound Documents - MD Sound Sample (68000+Z80) Floppy.zip
Soj md sound floppy z80 front - for article.jpeg

Sega of Japan Mega Drive Sound Documents - Black Folder
Sega of Japan Mega Drive Sound Documents - Green Folder
Sega of Japan Mega Drive Sound Documents - MD Sound Sample (68000+Z80) Floppy
Sega of Japan Mega Drive Sound Documents - MD Sound Sample (Z80) Floppy

Hello everyone! Today we have something a little bit different to share with you.

With the help of Frank Cifaldi from the Video Game History Foundation, we were able to preserve rare never-before-seen technical documents for the Yamaha YM2612 synthesis sound chip and the official Sega Mega Drive sound drivers developed exclusively by Sega of Japan!

(NOTE: While these documents are official, the information contained within cannot compete with reverse engineered information. As such, the information might sometimes be incorrect and should not be taken as gospel. These documents are presented for historical purposes.)

Video game consoles before and during the 16-bit era were unique in various different ways. Since there were no hardware standards like there are in today’s consoles, each console used unique hardware that could produce vastly different results in comparison to other consoles that were released during the same time. For instance, the sound hardware that powered the Sega Mega Drive was a completely different animal in comparison to the sound hardware that powered the Super Nintendo Entertainment System (SNES). While the SNES used a custom sample based chip called the S-SMP, the Sega Mega Drive utilized FM synthesis through the use of the Yamaha YM2612.

Yamaha YM2612 chip.jpg

(Source: Wikipedia.org)

The Yamaha YM2612 is a six-channel FM synthesis chip (with an optional DAC channel for digital audio) that was created as a stripped-down version of the YM2608 sound chip, which was most commonly used in Japan’s popular NEC PC-8801 and PC-9801 series of computers. The YM2612 chip is mostly known for being the main sound chip for the Sega Mega Drive, but the chip was also included with the FM Towns computer series as well. The Sega Mega Drive also utilized the Texas Instruments SN76496 PSG sound chip, which was used in the Sega Master System.

The YM2612 inside the Mega Drive could be “driven” with the console’s main Motorola 68000 (68k) CPU or its Zilog 80 (Z80) co-processor by use of a “sound driver”. Sound drivers are programs that allow a programmer to take control of the features of the sound chip. Since there were very few shared libraries for game development during this time, many developers took it upon themselves to create their own sound driver that would allow them to create music and sound effects. In the effort to streamline game development, Sega created various sound drivers that game developers could use to help implement music and sound faster. In North America and Europe, Sega of America commissioned Recreational Brainware to create the “Genesis Editor for Music and Sound effects” (or “GEMS”) driver, which would be used for games such as Comix Zone, Sonic Spinball, Garfield: Caught in the Act, and many more.

Before Sega of America became a software powerhouse in the 90s, most of the games were developed primarily in Japan. In the 80s, Sega of Japan created their own sound driver called “SOUND-SORCE” which was being utilized for the Sega Mark V (the original codename for the Sega Mega Drive during development). SOUND-SORCE, programmed and designed by Tokuhiko Uwabo, was originally intended to be a Z80 only sound driver that could be used to drive the SN76496 chip in the Master System. When the Sega Mega Drive was released, the driver was ported over to drive both the SN76496 chip and the new YM2612 chip as well. Sometime after the Mega Drive had been released in Japan, the SOUND-SORCE driver was rewritten so that the YM2612+SN76496 could be driven by both the Z80 as well as the Motorola 68000 (68k), which was the main CPU used within the Mega Drive. This driver was created by Hiroshi Kubota, who was often credited as ‘’’JIMITA’’’ in various Sega games in the early 90s, including Moonwalker and Sonic 1 & 2. The reason for creating the two drivers was possibly done to give game developers options for how they wanted to produce the sound on the console by being able to shift resources to different parts of the hardware as needed, if the game’s programming demanded it. Since a Mega Drive’s game programming was done on the Motorola 68000, a programmer could off load sound related tasks to the separate Z80 processor to free up CPU cycles on the main processor, but with limited functionality. The 68000 based sound driver was most likely created to take advantage of the vastly superior computational power the main CPU provided. These two sound drivers were the most commonly used sound drivers in Japanese developed titles, and up until now they were commonly referred to as the “SMPS” sound drivers. SMPS is most commonly associated with games such as Sonic 1-3, 3D Blast, Shinobi 3, Castle of Illusion, Alex Kidd, Golden Axe, Phantasy Star, and many more.

At the moment, it’s not known why exactly Sega of Japan never released the SOUND-SORCE/SMPS audio drivers for use outside of Japan. It’s likely that the tools and hardware required to work with the driver were custom made for Japanese microcomputers in mind. Like the video game consoles from that time period, Japanese computers were also incredibly different from the computers that were sold in other countries. The documentation was written for strictly Japanese developers, so support would have been difficult to provide for those internationally. For instance, while Sonic 2, 3, 3D Blast, and Dick Tracy were being developed outside of Japan, all the sound programming was done internally at Sega of Japan. Internal politics could have also prohibited the use of these drivers as well.

Even though all the different sound drivers that were created for the Mega Drive utilized the same sound chip, each driver could produce different sounding music and effects. Since various drivers implement different ways of controlling the sound hardware in the console, this meant that music and sound data could be represented in different ways as well. A sound driver would also provide sound designers and music composers a means of creating data that could be interpreted by the driver. Up until the early 90s, most video game music composers were programmers themselves, some of them would even contribute to the programming and development of the sound driver. The majority of music and sound back then was done using macros and enumerated assembly called Music Macro Language (not MIDI, as is commonly misattributed to music made back during this time). Flags, opcodes, and music routines (such as loops, returns, conditional branches, etc) were used to allow sound designers to directly write music in a notation specific to the sound driver. These additional music routines and flags were often used to optimize music data for size and to provide easy ways of creating more complex music and sound effects.

Pc9801.jpg

NEC PC-9801 (Credit: ihin-blog.com)

The general workflow for creating music and sound for the Mega Drive, as detailed in supporting documents included with the drivers, suggest that programming was done on NEC PC-9801 DOS based workstations. The sound designer/music composer would write the music using the driver’s specific macro format. The source code for the sound data itself would then be assembled/compiled on the workstation as Motorola hex data or a binary file and then transmitted to a “ROM-RAM board”. The ROM-RAM board loads a small program called the “SOUND EDITOR” (ED11) that can edit, view, and playback data through the sound driver on the actual hardware while also providing a means to transfer data back and forth between the Mega Drive and the PC98. The ROM-RAM board could be used to debug and modify any sound data as needed and transfer it back to the computer. As time went on, game developers would find ways to allow those unfamiliar with computer programming to contribute music and sound by making the process easier with updated versions of the drivers and new software tools.

Traditionally, many people believe that Japanese developed Mega Drive games sound superior to Internationally made games on average. This is likely due to the fact that documentation on the YM2612 wasn’t widely distributed to those outside of Japan. Official Yamaha documentation was provided with the documentation for Sega of Japan’s sound driver, allowing Japanese developers to have a better understanding of the sound hardware. Internationally, the only known source of documentation on the Yamaha chip could be found as part of a series of technical documents issued by Sega of America. Sega of America’s documents weren’t perfect and contained some errors when explaining some of the intricacies of the chip, and omitted some technical detail for the sake of brevity. To our knowledge, Yamaha’s official documentation on the chip was never provided to anyone outside of Japan (except possibly to the developers of GEMS and Sega of America, where issues could have occurred while translating the documents from Japanese).

This lack of documentation has also harmed efforts in emulating the sound as well. For many years since the inception of Mega Drive emulation, there have always been issues with accurately emulating sound. Aside from needing a lot of system resources for accurate emulation, the lack of documentation meant that much of the early work was a combination of trial and error and reverse engineering. It took many years before sound emulation would come close to being perfect. The lack of documentation on one of Japan’s most popular sound drivers for the Mega Drive also meant that all the variations of the driver had to be reverse engineered through disassembly in order to be understood.

Today, we can finally bring you some much needed documentation for both the YM2612 chip and the sound drivers that Sega of Japan used to create music and sound effects for the Sega Mega Drive. The original owner of these documents had two binders full of sound driver, YM2612, and PSG documentation including two 5.25 inch floppy disks containing source code, sample files, documentation, and tools for both Tokuhiko Uwabo’s Z80 sound driver and Hiroshi Kubota’s 68000+Z80 sound driver. Both the binders as well as the floppies seem to have been authored around January/February 1991, around the time Sonic the Hedgehog was in active development.

Both binders consist of mostly the same information, with the black binder containing the most documentation of the two. The contents of both binders were scanned with a HL-L2380DW printer/scanner at 600 dpi. The documents were then reassembled into searchable PDFs using ABBYY FineReader 15 and ReadIris 17 to make searching just a bit easier. The original raw scanned images are also presented in the original order as found in the binders, since some pages were originally out of order. Most of the documentation presented in both binders can also be found on the floppies themselves.

Sound editor 68k.png

ED11.S28

The floppy disk containing Hiroshi Kubota’s 68000 sound driver also contains a few binary files in Motorola S-record (SREC) format that can be used to load various sound editors. As mentioned before, this would be transferred to a RAM-ROM board where it could then be interfaced with by using a PC-98 series microcomputer. The floppy disk also contains a program (MPU.COM) that can convert data transferred by a PC-98 MIDI Processing Unit (MPU-PC98) into either 8-bit or 4-bit ADPCM for playback on the Mega Drive. There are a few demo songs from the Mega Drive port of Michael Jackson’s Moonwalker and a few PCM drum samples as well (some of which were used in a wide range of Mega Drive titles such as Shinobi III). The floppy contains a tool (CF.EXE) that can still be run in DOSBOX that will convert SREC formatted files into raw binary data. It appears that Kubota’s setup consisted of a NEC PC-98 computer with X68K assembler for compiling the source code and sample files and the ERX68K simulator environment. A ZAX ICD-series in-circuit emulator (pictured below) was used along with a NEC PC-98 serving as a host computer that could be controlled with a program called ZICE.

Zax.jpg

ZAX IN-CIRCUIT EMULATOR PROBE (ERX 318P) for use in Mega Drive development, back before PsyQ was a thing.

The floppy disk containing Tokuhiko Uwabo’s Z80 sound driver contains a lot more documentation on Mega Drive sound development, considering this was one of the earlier sound drivers to be created for the Mega Drive. Like the 68000 driver, the floppy contains some sample project files from Dick Tracy, which would have been in development at Sega Technical Institute at around the time these documents were being put together. One of the more interesting documents included on this floppy disk is a document detailing the common work flow for planning, creating, and implementing sound data inside a typical game during development. According to Tokuhiko Uwabo, the person in charge of the game’s sound would receive specifications from the person in charge of the project (usually the game planner, or director). These specifications would include a summary of the game and a list of songs and sound effects that would be required for the game. Once the specifications have been agreed upon, a meeting would be held with the entire project team to discuss when the data would be needed for the project. Typically two months before the game is meant to go gold, the music would be composed and submitted to the team for approval, then sound effects would be created once the music is done. The music and sound would then be converted to work on the sound driver, and then the first pass at implementing the sound would be handed over to the programmers to be checked with the game’s planner. Around one month before the game goes gold, the game’s sound and music would then be checked and modified in one more pass. If everything goes well, the sound and music should be finalized just two weeks before the game is completed.

This is just the tip of the iceberg, as there is still a lot to go through. Research on this release is still ongoing, but we hope that there is enough to keep you busy for a while!

The Video Game History Foundation Logo.jpeg

Once again we would like to thank Frank Cifaldi from the Video Game History Foundation for lending us a hand in properly preserving the data on these floppies. These 5.25 inch floppy disks are almost thirty years old, and the data on them could have been slowly deteriorating. Thankfully the data was able to be preserved in full with no errors using a KyroFlux, and the information has been dumped in its entirety for your pleasure.

Until next time!

Mj dead.jpg