Hacker News new | past | comments | ask | show | jobs | submit login
Sega Master System Architecture: A Practical Analysis (copetti.org)
271 points by Parseus on Oct 14, 2020 | hide | past | favorite | 77 comments

Something kind of interesting, the architecture for the Sega 8-bit consoles (and the Sega 8-bit computer, the SC-3000) are extremely close to that of the Colecovision and the MSX 8-bit computers (which are in turn different, but very close to each other). Hobbyists regularly port games between the systems. There was definitely something in the air for Z80-based systems at the time. The Sega Game Gear is also almost identical to the Master System and can also play Master System games with an adapter.

Curiously, the Sinclair ZX systems also used a Z80 as the CPU and there are also a great many ports of ZX Spectrum games to the MSX computers, but those are a bit more complicated.

If you've never played SG-1000 games, they're worth it. The system had about the same power as the Colecovision, but the games are Japanese style games of the era vs Western games the Coleco mostly received. The ports are so stripped down that they're functionally demakes and it's often rewarding to see games just a bit too complex for the system stripped down to their core gameplay and graphics essentials. My favorite is the port of Elevator Action, which barely holds together, but somehow has all of the game there.


The TMS9918 video chip is the common thread between those machines, and it's a fascinating bit of hardware.

The interface between the TMS9918 and its host system is dead simple: 8 data bits, 1 mode bit, 1 chip select bit, and nothing else. It manages its own 16 kB of VRAM and no other timing or clock signals are required between the 9918 and its host CPU.

As a result it was used in all sorts of machines of the era: TI 99/4A, Colecovision, Coleco Adam, MSX, Sega SG-1000, plus multiple different expansion cards for the TRS-80 and Apple II. It also supports genlock video input and was used in early-80s video production.

Most importantly, its programming interface is well defined and extensible. It allowed Yamaha and Sega to produce upgraded chips for the Sega Master System and MSX2 while maintaining backward compatibility, something that Commodore wasn't able to do with the VIC-II chip in the C64.

In late 1981 I built a computer around the Z80, TMS9918A (actually 9928A as I wanted PAL-M output) and the TMS5220 voice synthesis chips. I called it "Einstein" and only found out decades later that there was a computer from Tatung with the same name, processor and video chip that sold in the UK in 1984. Great minds think alike, it seems...

I was not able to get a datasheet for the 9918 and had to abandon the project. In early 1983 I did get a nice book from Texas Instruments by asking them to send it to an address in the US, but I only skimmed it. That was a huge mistake. A few months later I started a new computer project for the Logo programming language and remembered that Logo in the TI99/4 kept "running out of ink". There were only 256 different characters which could be redefined but the screen was 32x24 = 768 characters in size. So 2/3 of the screen had to be blank as the turtle moved around it. So I went with the Motorola 6883/6847 combo instead (the same as the TRS-80 Color Computer).

It so happens that the TMS9918A used in the TI99/4A has a new mode that the TMS9918 didn't: you can divide the screen in 3 with a different character set for each part. That would have given me Logo with infinite ink.

The TMS9918 is as simple as it is beautiful. A couple of years ago I wrote an MSX emulator in Java for fun. A pretty accurate TMS9918 emulator took just a couple of hours to write with the original technical handbook at hand, in 561 lines of Java code.


I am making a Youtube video series about the TMS9918A. So far, I’ve driven it with an Arduino and a 6502. The next video will get VRAM hooked up.


I think the Z80 was overall, due to its instruction set, the 8-bit CPU of choice unless the system builder needed to be cheap; and this makes sense given it was pretty much engineered to be a cheaper CPU than the Motorola 6501.

So it made sense that Commodore used a 6502 variant and I'm betting Nintendo chose a 6502 core for its NES to keep costs down. But all your old Japanese 8-bit arcade games of the 80s were Z80-based.

The Famicom used a 6502 clone from Ricoh in part because that’s the only thing they could find; every other chip manufacturer had too much backlog. They had already used the Ricoh chip in arcade boards, and just went with that one.

While more computer and console systems were designed with a Z80, the 6502 computers and consoles vastly outsold the Z80 systems.

The Z80 has more powerful instructions but they take longer to execute. The 6502 instructions are faster but you need more of them to do the same task.

In the end, a 1 MHz 6502 was almost equivalent to a 3 MHz Z80. The Z80 was available up to 4 MHz but often ran at 3.58 MHz) and the 6502 was mostly 1 MHz (eg. Apple II, Commodore 64) but in a few systems (eg. BBC Micro, Commodore 128) it was 2 MHz.

My trusty graphing calculator, a TI-85, also was Z80-based.

Motorola made 68xx, MOS Technologies made the short-lived 6501 which became the famous $25.00 6502 with some tweaks.

I think some of this is just that the industry was really small at the time. If you wanted a processor there were only a handful of choices, and most were completely unsuitable (too expensive mostly) for the home market. Low cost graphics and sound were similarly small markets. But it was also a wide open field in the home console biz, especially with ATARI spectacularly imploding only a few years earlier, so lots of people were throwing their hat in the ring and building the kind of system that made the most sense given the available parts.

MSX was an industry standard of making home PCs so it's easy to port softwares.

And the MS stands for Microsoft.

MSX was the original Xbox.

AFAIK, MSX stands for "machines with software exchangeability".

I don't know what the letters stand for but this was definitely a Microsoft (and ASCII Corp.) project for standardization of home computer hardware. Like XBox, but multi-vendor.

This is correct and it's mostly in Eastern part of the world. I owned a Spectravideo 328 when I was a kid. One of many kind of MSX computers.

The 328 was the precursor to the MSX standard. The 728 was MSX.

The differences were so small you could load most MSX programs on the 328 if you used a small software loader.

I learned this about 25 years too late. :-D

That was an afterthought, so that japanese companies didn't think they were directly tied to Microsoft.

If you turned the system on without a game in and you held up, 1 and 2 all simultaneously, there was a secret game built in to the system. When my friend got his SMS he did that on accident the first time he turned it on, leading to much confusion.


Welp, there goes an hour in the rabbit hole¹.

¹ https://www.smspower.org/Development/BIOSes

My SEGA (sold in the EU) shipped with Sonic installed, it booted Sonic if no cartridge were detected, interesting that it started as a hidden game.

The Master System II sold in Australia had Alex The Kidd as a built in game...

Parent and grandparent and GGP are all correct. The snail game is built into all(?) of the system revisions and accessed as such, later systems had other "pack-in" games burnt into ROM. I bought my SMS 22 years ago, so I'm not 100% sure but I think mine came with a cartridge of Hang-On/Safari Hunt, rather than being built into the machine.

Can confirm. Here in EU I have seen both the Alex Kidd model and the Sonic 1 model (the later succeeded the former as Sonic became way more popular than Alex Kidd ever was. Makes sense to me).

I have never seen one packed with Hang-On myself, but I recall seeing it was a thing in a magazine (although, over time, this magazine turned to be pretty unreliable, but I'm pretty sure a Master System bundle with a Sega arcade port and a gun game were a thing in this region)

@ variants: there is also the Game Gear, a handheld by SEGA with similar specs to the Master System


> With a late start into the handheld gaming market, Sega rushed to get the Game Gear into stores quickly, having lagged behind Nintendo in sales without a handheld on the market. As one method of doing so, Sega based the hardware of the Game Gear on the Master System, albeit with a much larger color palette than its predecessor: the Game Gear supported 4096 colors, compared to the 64 colors supported by the Master System. Part of the intention of this move was to make Master System games easy to port to the Game Gear.

You could also get a really simple adapter to plug Master System cartridges straight into the Game Gear


I had a Gamegear when I was at school. It was a great console but it ate batteries at an insane pace.

The external battery packs (first a wired pack about the size of a 6" sub sandwich, then the battery back) were pretty much a mandatory accessory.

The power cord from the Master System II was a direct plug in. I must have played thousands of hours wired like that.

The VDP's Mode 4 was the secret sauce; it made the SMS graphics almost on-par with the NES. You still have 8x8 tiles, but with a single 16-color palette instead of four different 3-color palettes. For scrolling, the NES has 2-4 screen buffers, but the SMS just lets you hide one single row and column of tiles offscreen. This isn't as bad as it sounds since -- on SMS you can write to VRAM at any time during the frame, as opposed to NES where you can only write during vertical blank.

I've ported a simple NES game written in C to the SMS (https://8bitworkshop.com/projects/?n=sms-sms-libcv/chase) and I think it'd be feasible to write a translation layer between the two platforms. Sound might be a little tricky, since NES's APU is more advanced.

Something I didn't see mentioned: The Mega Drive/Genesis models 1 and 2 are backwards compatible with the Master System (but not the SG-1000) through a cartridge slot adapter called the Power Base Converter. If you have a Mega EverDrive, it can be used to play Master System ROMs.

The Z80 cpu used in genesis for sound processing and it can used in the compatibility mode to run master system games.

The MD VDP also supports SMS video mode (but not the original TMS9918 modes)

This is why F-16 Fighting Falcon doesn't work on the MD.

I feel like the SMS has the best sound from that era, but it might just be my nostalgia :)

"Escape in a Forest" from Ninja Gaiden on the SMS is my all time favorite: https://youtu.be/E3IWkLFfD6M but the whole OST is a masterpiece that does not get the credit it deserves.

The music in the Double Dragon port is also quite fantastic.


The FM module version is even better: https://youtu.be/fWlnsW3ywsI

I always get the sense that whoever did it was having a blast.

That really brings me back. That was a heck of a game.

Totally agree. SN76489 had a particularly dreamy 8-bit sound (BBC micro also used it AFAIK). Thanks for sharing (never played SMS Ninja Gaiden).

I never know if I would have preferred the music of the Yamaha YM2413 FM chip that was available as an extension to the Mark III and came with the Japanese Master System only.

It does sound great though - Yamaha YM2413:


Texas Instruments SN76489:


Here's my all-time favorite from the 8-bit era: https://www.youtube.com/watch?v=Ls7rlhjazGo

Pictionary, of all games, had a fantastic soundtrack.

That's Tim Follin for ya! https://youtu.be/GC1dTzyb5Gs

Tandy PC compatibles (and the IBM PCjr) used the same chip. (Modulo differences in the RNG for the noise channel)

Why would it differ in the RNG, I wonder?

Different versions of the chip (different manufacturers, integrated into a larger IC..) just laid the RNG out a bit differently, I'm not sure what the reasons were.

There's a detailed comment at the top of MAME's emulation code for these chips (and a lot of parameters on the emulator's class constructor): https://github.com/mamedev/mame/blob/master/src/devices/soun...

Interesting, I thought the SNES was much better due to its use of sampled sounds which sounded more naturally. It holds up amazingly well still today. I always thought the MegaDrive sounded plasticky and tacky, but it might very well be just because I grew up with a SNES.

SNES is the next generation, with the Genesis/MegaDrive. SMS is NES era.

I prefer MegaDrive due to its distinctive sound; sampled audio lacks character. However, like with the GameBoy, it really matters what model you have. Rev 1 Genesis and grey brick gameboys have excellent sound.

Oh right, I misread. The SMS sound hardware was indeed quite good for its time!

> I prefer MegaDrive due to its distinctive sound; sampled audio lacks character.

Interesting, to me the MD sounds like any random 90s FM sound card or MIDI synth, while the SNES is instantly recognisable.

The two systems have very different approaches to audio. The SNES is completely sample based. This was novel technology at the time. The MD/Genesis instead has a more traditional solution consisting of an FM chip and "sound generator" or "noise" chip. It's hard to say which is "best" in this regard. They are fundamentally different approaches and each has it's own limitations.

You can't really create sounds on the SNES. Instead, the chip is fed samples of recorded audio and then the chip allows for different actions to be taken on that sample (e.g. adjusting the EQ, Envelope, Loop, etc). The major limitations with this approach is bit depth for the samples (quality) and storage (sample length).

On the MD, the chips themselves create the sounds either through direct manipulation of the waveforms (FM) or by selecting a specific waveform and performing various modifications such as pitch or frequency (sound chip). This is like having a synth built into the unit. It's only going to sound like that particular synth and with some clever hacks, you can get close to realistic sounding audio, they are still hacks at the end of the day. The MD isn't capable of playing samples using the built in hardware.

The SNES was capable of producing a near limitless array of sounds and could even reproduce realistic sounding instruments as it was just playing audio samples. Something the MD simply couldn't do. That said, for the sounds the MD could produce, it would sound "better," if that makes sense. As an analogy, playing a song on a YM2612 based synth and the MD, which uses the same FM chip, would sound identical. However, playing a song on a YM2612 synth and then playing the same song on the SNES (via samples) would be noticeably different, or may not even be possible at all due to the limitations of the hardware at the time.

One little correction, I think: the MD/Genesis had one PCM channel so it could play samples. Hence digitized speech in some games, for example. But, yes, it had nowhere near the capability to manipulate samples (aside from involving the CPU, of course!) that the SF/SNES's chip had.

What an interesting time when there were so many valid extremely different approaches to problems like "making sound" that led to such different outcomes.

And the SEGA logo chorus. "Seeeegaaa" wasn't FM Synth.

FM synth is more an instrument than a sample sink, and it can often sound terrible. Consider Doom for the 32X, which had just abysmal sounding music; but in the right hands...

Doom 32X Original Music: https://www.youtube.com/watch?v=RYqS5OEN4_U&list=PLB5E3C2912...

It's like someone's farting into a didgeridoo accompanied by the cheapest casio electric kids' piano.

Doom 32X Music Hack: https://www.youtube.com/watch?v=FehpU0sjXrQ

Oh hey, that's a world of difference.

Same hardware, far more capable hands.

Anyhow, it's easy to find good compilations of good Genesis music:


That EWJ2 track... Yeegad.

I _highly_ recommend listening with a good pair of headphones or home hifi that has great range.

The EWJ2 track is unfortunately not FM synth, it's CD audio from the PC/Playstation/Saturn version. Not sure what it's doing in that playlist.

It does sound unnaturally clean for the fm synth.

If you're interested in seeing what the Sega Master System can do when it's pushed to its absolute limits:

Blast! demo (2017), pulling off some crazy rotation and perspective effects https://www.youtube.com/watch?v=I742MvGhkME&feature=emb_logo

"Games That Push the Limits of the Sega Master System" https://www.youtube.com/watch?v=H4Ze11Z8ffU

Road Rash - This is unbelievable. Visually, it's nearly up to the standards of the Genesis version. Although of course the Genesis version didn't run at a particularly high frame rate. https://www.youtube.com/watch?v=SlfLgnE6OIw

I saved my paper route money and was trying to decide between an NES and an SMS. I think I chose the SMS because it was different. Everyone had an NES. But as time went on, I wished I had an NES. Way more games and cultural relevance.

Sega Genesis / Mega Drive was the first console I learned to program for, maybe when I was about 11-12 or so and was getting a start at ASM when I found hex editing too limiting in the ROM hacking scene.

The Genesis/MD uses a Z80 processor as its sound processor alone - so it is amazing to me to consider running everything off that on a Sega Master System!

I'm a little obsessed with Sega Saturn homebrew at the moment, or I'd try some SMS homebrew - but the article was fascinating!

Sega Saturn homebrew? I though that was an oxymoron. I love my Saturn like there is no tomorrow but it seemed like to me the homebrew sense was dead due to the whole system architecture. The only thing I hear about is the Z engine which is insane in its capabilities.


It's a shame the scene is so quiet as the Saturn is a fascinating machine. If you use something like Jo Engine then it's not too difficult to get up and running. If you want to roll your own and still have something that performs it gets messy. Stuff like dealing with bus contention between the SH2s, the VDP access timing/slot system, that funky little DSP. You can see why it took so long to get decent libraries for it. It's still fun to see how far you can push the hardware.


Is a fantastic open-source homebrew platform for the Saturn that the Z-treme engine is based off of.

I recall watching all the phases of the Z-treme's engine's development on the jo-engine forums as XL2 was creating it. So cool to watch. :)

speaking of SEGA, Twisted Electronics just released an FM synth that uses a pair of FM audio chips (YM2612) similar to the one discussed in the Sega Master, this one is from the 'Mega Drive'. https://twisted-electrons.com/product/megafm/

Can someone explain, does s Japanese master have better sound? From clips it sounds 100 times better.

Japanese Sega Master System (and older Sega Mark III when used together with the FM Sound Unit) had an additional Yamaha YM2413 sound chip.

Thanks, the megadrive actually has the master system hardware in it. I've got an everdrive and I can play master system ROMs on it. It's actually a Japanese megadrive that I own, I want to dig it out and see if the sound is better!

They had an additional fm synth chip that was not present in the us and European models from what I remember.

My first video game. That design was way ahead of its time.

I don't get the impression that it was - it came out later than the NES and was a bit more powerful, but much less so than the 16-bit systems.

There are some (relatively) impressive games for the Master System, but I think that's because it stuck around into the nineties, in regions where there was an installed base i.e. not the USA. Late-generation games often benefit from better optimisation, and things like more cartridge space. The Master System port of Mortal Kombat, for instance, despite being pretty horrible as a game, is miraculous from a technical point of view. Despite being heavily cut-down, of course, it was an attempt to create the same game. That's a port (or demake or whatever else you'd want to call it) of a 1992 arcade cabinet, onto a home console released in 1985.

The Master System and the Mega Drive (Sega Genesis) were huge in South America where I grew up. They were also a lot cheaper than SNES and more widely available.

Sorry, I find the article impossible to read owing to the spidery font rendered in 50% gray. Who thinks that is a good idea?

SMS came with Sonic the Hedgehog? Interesting! I thought it was introduced with the Genesis.

It was! The 8-bit SMS/Game Gear version was introduced in 1991.

Though it was not a port, rather a completely different game developed by a completely different team. It was a good game in its own right, but it’s not comparable to the 16 bit original.

Some people (like me) prefer the 8 bit Sonic games. Sonic 2 for Master System was a completely original game, and it is a 2D platforming gem.

I agree, and in fact Sonic 2 for SMS was my first foray into Sonic as a child. A great game. A brilliant game. But way too different to make useful comparisons to the 16 bit games.

And music (and production, I believe?) by Yuzo Koshiro. A legend.

Oh..so was it a port? Hadn't the genesis been introduced by then?

It was a demake[1], by a different developer, with totally different levels, simplified graphics and audio, and slightly different gameplay.

1: warning, tvtropes: https://tvtropes.org/pmwiki/pmwiki.php/Main/VideoGameDemake

Always in awe of articles like these, where does a person with this kind of knowledge work?

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact