Skip to content
Compressor and decompressor for the run-length encoding used in 8-bit Konami video games.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


GraveyardDuck is a simple tool to decompress and recompress graphic files used in the old Famicom Disk System game Dracula II: Noroi no Fuuin, better known as Castlevania: Simon's Quest in the US.

It also works on Ai Senshi Nicol, Rampart and possibly other Konami games.

Compression Teardown

The above games use a very simple variant of run-length encoding (RLE), a simple compression scheme used in many early bitmap graphic formats.

Konami's RLE scheme can be expressed in a few simple rules:

  • if(n < 128) then write the following byte n times to the decompressed stream
  • if(n > 128) then write the following n bytes to the decompressed stream
  • if(n == 128) then write the following 256 bytes
  • if(n == 255) then terminate compression

In practice, the case of (n == 255) is almost impossible to encounter given the nature of the graphics this scheme is designed to compress.


Assuming the parameters:

  • FILENAME: The file into/from which data will be compressed/decompressed
  • POSITION: Offset where compressed data is located or will be stored
  • BLOCK: The file to which decompressed data will be written or from which it will be sourced

Decompression -d [FILENAME] [POSITION] [BLOCK]

Compression -c [FILENAME] [POSITION] [BLOCK]


Derrick Sobodash


Copyright © 2012, 2013 Derrick Sobodash

You can’t perform that action at this time.