Overview
by Mike Gordon The SMSReader Project
SMSReader is a parallel port Sega Master System cartridge reader/writer. By default, it can read standard US and European SMS cartridges, and can write to battery-backed SRAM memory in such cartridges.With adaptors, the SMSReader can also handle the following:
The SMSReader software runs on a PC (386 or later), running MS-DOS (or equivalent) or a DOS-based version of Windows, i.e. Windows 95/98 or Windows ME. A bidirectional (PS/2 compliant) parallel port is required to support the hardware.
- Sega SG-1000, SC-3000 and compatible cartridges and cards.
- Sega Mark III (Japanese Master System) cartridges and cards.
- Sega Game Gear cartridges.
- Sega Master System cards.
Purpose of the SMSReader
Firstly, the SMSReader is intended to allow you to back up your own original cartridges (known as "dumping" the ROM), so you can use them with emulators such as Meka, Smeg, FreezeSMS, Dega etc. Although most Sega 8-bit cartridges have already been dumped (thanks to projects like SMS Power), not all of them have been. (I suspect that many undumped variants of released games remain undiscovered!) Additionally, locating good dumps of your favourite games on ROM sites can sometimes prove difficult.
If you intend to actually release the dumps you make, as opposed to just making dumps for your own personal use, please read the Guide To Responsible Dumping.A second function is to allow the transfer of saved games between emulators and the real SMS console. Games such as Phantasy Star contain a battery backed SRAM chip which is used to save your progress. The SMSReader will read the contents of this chip and thereby allow you to continue your game in an emulator. When you're ready to continue playing the real thing, the SMSReader can write the updated save file back to the cartridge.
Finally, the SMSReader can take ROM files you've downloaded, and write them onto specially modified, battery-backed RAM cartridges so you can play them on a real SMS, instead of on an emulator. This also facilitates the development of home-brew SMS programs which can then be run on the real console.
I'll now explain how the SMSReader works. You don't need to know any of this in order to build and use the device, however, so don't worry if anything seems difficult to understand.
SMSReader Design
SchematicHere is the schematic of the SMSReader hardware:
![]()
The design uses a pair of CMOS 4040 counter ICs for addressing - one for the low byte, one for the high byte. The entire Z80 address space of 65536 bytes (0x0000 - 0xFFFF hexadecimal) is covered. In effect, the address space is treated as a continuous "loop of tape", but since we are dealing with large, contiguous blocks of data, 16 kilobytes or more in size, this isn't really an issue. The counters can be clocked very fast, so any memory location can be accessed reasonably quickly.
Four control lines are available from the parallel port (three inverted, one non-inverted) and the SMSReader uses all of them. INIT is used for write enable and is connected directly to the _WR line on the cartridge. _AUTLF is used to reset the counters before a read/write sequence is commenced. _STB is connected to the CLOCK pin on the low counter and is used to increment the counter. Finally _SEL is used to set the _RD pin high during write mode, disabling data output from the "ROM" area of the cartridge.
A 74HC00 quad NAND gate IC is used to implement the logic shown in the lower part of the schematic, such that:
- The _MC-F pin is low only for addresses 0xC000 - 0xFFFF.
- The _M8-B pin is low only for addresses 0x8000 - 0xBFFF.
(These pins aren't actually used by any Sega cartridge that I know of, but since we need the 74HC00 IC anyway we may as well connect them, for completeness.)
- The _RD pin is low only when the address is 0x0000 - 0xBFFF and when the parallel port _SEL pin is high.
(This enables data output from the ROM only when we want to read data from it. Many cartridges do not use this pin, but instead have their own logic for ROM output enable.)
ConstructionThe SMSReader is built on Veroboard (or "strip board") - a SRBP board with 0.1 inch pitch holes and copper strips on one side, forming "tracks" to which components can be soldered. It's a common means of building prototypes or homebrew projects, without the need to etch a custom printed circuit board. Wire links are used to make connections between the components on the board.
Power is obtained from an unregulated DC power supply, such as the one provided with the Sega Master System itself. A 7805 regulator and associated smoothing and decoupling capacitors are used to provide the 5 volt supply required by the ICs and cartridge.
How a cartridge is read
As mentioned previously, the Z80 in the Master System can only address 65536 bytes or 64 kilobytes in total (0x0000 - 0xFFFF hex). How, then, are cartridges of 1 Megabit (131072 bytes) and above implemented?Answer - by using paging. The cartridge ROM is divided into 8 or more discrete 16 kilobyte "pages" which can then be mapped into "frames" starting at 0x4000 and at 0x8000 hex. The paging is controlled by mapper hardware on the cartridge itself - three mapper types are commonly used in Master System cartridges:
Codemasters games (Fantastic Dizzy, Cosmic Spacehead, Micro Machines, etc.) use a different, and incompatible, type of mapper. They aren't supported by the SMSReader at this time.
- 315-5208 - up to 8 16k ROM pages, giving a total of 128k (1 Megabit). Paging at frame 0x8000-0xBFFF is supported.
- 315-5365 - up to 32 16k ROM pages, giving a total of 512k (4 Megabit). Paging at frames 0x4000-0x7FFF and 0x8000-0xBFFF are supported.
- 315-5235 - up to 32 16k ROM pages (512k or 4 Megabit) plus up to 2 16k pages for battery backed RAM allowing saved games. Paging at frames 0x4000-0x7FFF and 0x8000-0xBFFF are supported (RAM is paged only at 0x8000-0xBFFF).
Most Sega-made cartridges do not actually have separate mapper ICs, but instead have the mapper hardware built into a custom ROM. The functionality is identical to that described above, however.
Pages are selected by writing to 0xFFFC - 0xFFFF, as follows:
- 0xFFFC - write 0x08 to select battery backed RAM page 0, 0x0C for page 1, 0x00 to deselect battery backed RAM. If RAM is selected, the selected page will be mapped from 0x8000-0xBFFF.
- 0xFFFD - Frame 0. Write the page number here, and the top 15k of the selected page will be mapped at 0x0400 to 0x3FFF. Not actually used by any commercial games, but supported by 315-5235 and 315-5365 anyway.
- 0xFFFE - Frame 1. Write the page number here, and the selected page will be mapped at 0x4000 - 0x7FFF.
- 0xFFFF - Frame 2. Write the page number here, and the selected page will be mapped at 0x8000 - 0xBFFF.
Here are some examples of how cartridges are read:
32k cartridges (not paged)
- Reset counters to 0x0000
- Read data from 0x0000-0x7FFF (incrementing counter after each byte read)
- Write data to file
128k cartridges (8 pages)
- Reset counters to 0x0000
- Increment counter to 0xFFFC
- Write 0x00 bytes to 0xFFFC-0xFFFF
- Reset counters to 0x0000
- Increment counter to 0x8000
- Read data from 0x8000-0xBFFF
- Increment counter to 0xFFFF
- Write 0x01 to 0xFFFF
- Reset counters to 0x0000
- Increment counter to 0x8000
- Read data from 0x8000-0xBFFF
...
- Write 0x07 to 0xFFFF
- Reset counters to 0x0000
- Increment counter to 0x8000
- Read data from 0x8000-0xBFFF
- Write data to file
Battery backed save game SRAM (1 page)
- Reset counters to 0x0000
- Increment counter to 0xFFFC
- Write 0x08 to 0xFFFC
- Reset counters to 0x0000
- Increment counter to 0x8000
- Read data from 0x8000-0xBFFF
- Write data to file
Writing to SRAM on cartridges which support it is accomplished in the same way.That concludes our overview of the SMSReader and how it works.
This document (c) Mike Gordon 2000, 2001. Last updated 3rd November, 2001.