How to Fix Byte-Swapped Cartridge Dumps: A Verification Guide

This byte-swapped cartridge dump guide shows how to spot reversed byte pairs, fix them with dd conv=swab, and carefully verify against a DAT checksum.
A byte-swapped cartridge dump is a file where every adjacent pair of bytes was written in reverse order. It shows up when a 16-bit system is read with a programmer that stores words rather than bytes, so the low byte and high byte of each word trade places. The game data is all there; the order is just wrong. An emulator given a swapped file will usually show a garbled title or a blank screen. The fix is mechanical, but confirm the diagnosis first, because an interleaved dump and a headered dump need different treatment. Everything here concerns a lawful personal backup of a cartridge you own; no download source belongs in this process.
Recognize a byte-swapped dump
Open the file in a hex editor and look at the first bytes and at any ASCII strings. Readable text is the giveaway: when pairs are reversed, every two-letter chunk of a title reads backward, so SEGA becomes ESAG and the NES header N E S becomes E N followed by the 0x1A control byte. Header magic values are the fastest check. The table lists what a clean file should show.
| System | Where to look | Expected value |
|---|---|---|
| NES | Offset 0, iNES header | 4E 45 53 1A |
| Genesis | Offset 0x100, console name | SEGA GENESIS or SEGA MEGA DRIVE |
| SNES | Offset 0x7FB0 or 0xFFB0, title | Plain ASCII game name |
| N64 .z64 | Offset 0 | 80 37 12 40 |
| N64 .v64 | Offset 0 | 37 80 40 12 |
The three N64 extensions are often mistaken for corrupt dumps. A .z64 file is native big-endian and starts 80 37 12 40, a .v64 file is the byte-swapped form and starts 37 80 40 12, and a .u64 file is little-endian and starts 40 12 37 80. Only the .v64 case is a simple adjacent-byte swap; the .u64 case reverses each 32-bit word.
Rule out headers and interleaving first
Two other conditions look similar and are not byte swaps. A copier header is extra data at the front of a file rather than reversed data: NES .nes images carry a 16-byte iNES header, and many older SNES .smc images carry a 512-byte copier header that a headerless .sfc file does not. Strip a header before swapping the ROM body, then put it back, or the result will be shifted. When a board uses two ROM chips, a naive read can produce a dump where even and odd bytes came from separate chips, so the fix is de-interleaving, not swapping; tools such as uCON64 handle that. If a single byte swap does not produce a readable header, stop and reconsider.
Swap the byte pairs with dd
Once you are sure the file is a plain byte-swapped dump, the shortest fix is GNU dd. It has a conversion flag that swaps every adjacent pair of bytes, and that operation is its own inverse: running it twice returns the original file. That property is useful as a sanity check, but it also means you must not blindly rerun it. The ordered procedure I use is below.
- Copy the dump to a working directory and make a second copy named with a .bak extension, so the original stays untouched.
- Check the file size with a byte count; a clean cartridge dump is normally even, so an odd total length is worth investigating before converting.
- Run dd with the swab conversion, for example dd if=dump.sfc of=fixed.sfc conv=swab, keeping the input and output names distinct.
- Open fixed.sfc in the hex editor and confirm the opening bytes now match the expected signature from the table.
- If the header is still garbled, delete the output, restore from the .bak copy and reconsider interleave or a copier header instead.
- Keep the intermediate files until the checksum verification passes, then remove them.
Fix SNES copier headers and N64 variants
SNES files need one extra decision. If a .smc and its 512-byte copier header are byte-swapped together, strip the 512 bytes, swap the remaining ROM body, then prepend a clean header or save as a headerless .sfc; note which form you produced, since DAT files expect a specific one. For N64, a .v64 file becomes a valid .z64 after a single swab pass, while a .u64 file needs a 32-bit word reversal. Rename the extension to match the byte order you produced. The suffixes are .z64, .v64 and .u64, but the first four bytes are the authority, not the name.
Verify against a DAT checksum
Do not trust a readable title as proof. Compute a cryptographic hash of the fixed file and compare it with a community DAT record. Tools such as ClrMamePro, RomVault and RomCenter read Logiqx XML DAT files from sets like No-Intro and check CRC32, MD5, SHA-1 and byte size in one pass; on a shell, md5sum, sha1sum and crc32 give the same evidence. Use the DAT revision for your region, since a PAL image and an NTSC image of the same game have different hashes. A matched SHA-1 means the bytes now equal a known good dump; a mismatch means another transformation is still applied. Hash the original .bak copy too, so you can prove the conversion changed exactly the bytes you expected.
Keep a working copy and a note
I keep a small text file next to each converted dump recording the source cartridge, the exact dd command and both hashes. That turns a one-off fix into something reproducible. The .bak copy stays until the checksum matches. Never overwrite the only copy of a personal backup with an experimental conversion, and never apply a swap to a file a DAT already lists as good. Verification is cheap; reconstructing a lost dump is not.
Mistakes that create new problems
The common errors are predictable. Swapping an already-correct file returns it to a garbled state, because the operation is an involution; always hash before and after. Swapping a headered .smc without removing the header shifts every byte by 512 and breaks the internal header location. Treating a two-chip interleaved dump as a byte swap produces noise, so check whether the even and odd bytes look like two separate streams. Converting a .u64 N64 image with a simple swab gives yet another wrong order. Work slowly, keep the original, and let the checksum be the final word: when the SHA-1 matches a known good entry, the file is fixed, and you can move on to the next dump in the pile.
Related reading
If you want to keep digging into this corner of the library, these two posts on Roms Get go a little further:
