ColecoVision

Development

Tutorial

Introduction to sdcc

ColecoVision system

Playing music

Hardware

Homebrew kits

Homebrew kit CV

Homebrew kit CVs

Software

libcv and libcvu

png2cv

png2cvs

abc2cvm

cvmtuning

compression utilities

Games

colecovision.eu

ColecoVision

How to buy

STM8

MCS-51

LLVM+SDCC

Contact

An introduction to ColecoVision development using SDCC.

Introduction

HITECH-C for CP/M is the most common choice among ColecoVision programmers using the C language. Most ColecoVision programming tools are intended for use with this compiler. There are some problems with HITECH-C though: It's non-free (definitions of "free software" vary, but they all include the freedom to distribute and modify the software and distribute modified versions), it needs to be run on a CP/M emulator, it implements only the ANSI C / ISO C90 standard, it is no longer maintained.

There are a few alternatives to HITECH-C for CP/M, including the commercial edition of HITECH-C, the IAR compiler and z88dk. Another alternative, which has been successfully used to create ColecoVision games including the popular "Search for the stolen Crown Jewels" series is sdcc.

sdcc is a free C compiler for 8 bit systems which implements a large part of the ISO C99 standard, generates faster and smaller code than HITECH-C in many cases. It is free software, actively maintained and keeps improving.

Since there are not many programmers using sdcc for ColecoVision development there is a lack of documentation. A usability inspection identified documentation problems as the major usability problem for newbies to ColecoVision development using sdcc.

Prerequisites

This tutorial assumes that the reader is familiar with the C programming language and a modern operating system such as Windows or GNU/Linux.

Installation of necessary tools

If you are using an operating system other than Windows, such as GNU/Linux you can skip over the Cygwin stuff and just install the packages mentioned below and sdcc the way it is typically done on your operating system. Then continue with the installation of png2cv below.

Cygwin Setup
Cygwin Setup program. Packages are selected by clicking on the arrows on the left. The View button can be used to sort the list alphabetically
sdcc and the ColecoVision tools used with it were written for unixoid systems. The easiest way to use them on Windows is through Cygwin, a free unixoid environment for Windows. The Windows user should get the Cygwin setup program. Cygwin contains nearly a thousand software packages which can be individually selected at installation. For ColecoVision development the following packages are needed (in addition to those selected by default):

You can use the search box in the Cygwin setup program to easily find them.

Unfortunately sdcc and the ColecoVision-specific tools are not part of Cygwin and will have to be installed manually.

SDcc running in Cygwin
Unpacking and configuring sdcc in Cygwin
sdcc 3.1.0 or newer is recommended. It can be downloaded at Sourceforge. Windows users should download the "sdcc" package and compile from source, not the "sdcc-win32" binary package. These days most tarballs can be installed by I.e. for sdcc: More detailed sdcc installation instructions can be found at it's website (do not use the Windows installation instructions there, since you'll want to use sdcc within Cygwin).

png2cv 0.11 (to create ColecoVision image data from png images) and png2cvs 0.4 (to create ColecoVision sprites from png images) or newer can be downloaded from this site. They install just like sdcc (Warning: Windows / IE sometimes rename .tar.gz files to .tar.tar, just use tar -xzf filename.tar.tar).

The colecovision library can be found here. The archive should be unpacked to a convenient place for ColecoVision development. The library consists of libcv, libcvu and demo programs. libcv is a low-level library that exposes the ColecoVision's hardware to the C programmer. libcvu contains some useful higher-level functions which the programmer will use most of the time. The cursor and cursor32 demos show how to use sprites and controller input. If everything above has been installed correctly they should compile to .rom files without problems. The commands entered to compile the library and create a demo ROM might look like this:

ROMfile in Windows Explorer
Cygwin directory structure with cursor32 demo ROM file
You can run the .rom file in a ColecoVision emulator.