Skip to content
/ md-pong Public

A simple example Mega Drive game (pong) built using SGDK

Notifications You must be signed in to change notification settings

dgrubb/md-pong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md-pong

A simple example Mega Drive game (pong) built using SGDK

md-pong main menu

Build instructions

After setting up a local toolchain and SDK, simply reference the Makefile provided by gendev:

    $ git clone https://github.com/dgrubb/md-pong && cd md-pong
    $ make -f $GENDEV/sgdk/mkfiles/makefile.gen clean all

The result will be a binary ROM image suitable for loading directly into an emulator:

    $ gens out/rom.bin

Image resources

The Mega Drive colour palette is a little limited: nine colours per palette, with up to four palettes. The rescomp tool, which is part of SGDK, can convert oridinary PNGs to title data but has some strict requirements reflecting the restrictions of the Mega Drive VDP. I've had reasonable success with rescomp by first pre-processing PNGs to a suitable palette and bit-depth (requires ImageMagick installed):

    $ convert input_image.png -alpha off -type palette -colors 9 PNG8:output_image.png

Build environment

Putting in place a suitable SDK and toolchain has a few nuances. The following steps are those I used on Arch to utilise SGDK (Sega Genesis Development Kit) and the gendev toolchain builder. While my test distro was Arch these steps should also be roughly applicable to other distributions such as Debian/Ubuntu.

  1. Install the pre-requisite packages: git build-essential texinfo curl wget unzip openjdk-8-jdk
  2. Checkout gendev (SGDK will be automatically checked out later in the process), assuming a "Projects" directory exists:
    $ cd ~/Projects
    $ git clone https://github.com/kubilus1/gendev
  1. Build the mk68 toolchain and binutils:
    $ cd ~/Projects/gendev && make
  1. Create an installation location for the toolchain. Typically, this is /opt/gendev:
    $ cd /opt
    $ sudo mkdir gendev && sudo chown $USER:$USER gendev
  1. Export the install location to your local environment and install. This step consists of copying the compiled objects to /opt/gendev and writing to your local environment scripts to ensure $GENDEV is always in your path:
    $ cd ~/Projects/gendev
    $ GENDEV=/opt/gendev make install
  1. Profit.

About

A simple example Mega Drive game (pong) built using SGDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published