Atari Lynx programming tutorial series:
- Part 2: Development environment for Windows
This is the second part of the tutorial to learn how to program Atari Lynx games. In the first part we looked at what you will need to get started. One of the requirements is a development environment.
Historically there have been three development environments that I know of:
- Epyx development kit with an Amiga 1000 machine
- BLL (Behind Lynx Lines) kit from Bastian Schick
- CC65 with some additional tooling from BLL
I have chosen for the last one in the row. The CC65 compiler suite is still in active development and it seems the most modern suite. I have experimented with it and hooked it up with Visual Studio as my main GUI for development. It all works fine. Here’s how I set up things. Follow along and you will have a working environment.
Let me reiterate that this environment is for the Windows operating system. As long as you have that OS, you are good to go. The other tooling does not cost any money. It is my personal preference, and other platforms and OSes are just fine. Your mileage may vary though, and you will need at least a different text editor for editing source files.
Installing CC65 compiler suite
Start by downloading the CC65 suite from http://www.cc65.org. You will want the latest snapshot at ftp://ftp.musoftware.de/pub/uz/cc65/snapshot/ (version 2.13.9 at the time of this writing) with the sources and the additional Atari Lynx files.
- CC65 tools
- Atari Lynx related files
Snapshot: cc65-snapshot-sources-184.108.40.20621008.tar.bz2 or individual files at ftp://ftp.musoftware.de/pub/uz/cc65/snapshot/sources/
Unzip all files into a single directory. I opted for “C:\Program Files\CC65” for my Windows 7 64 bit machine. Even though the CC65 suite is not 64 bit yet, having the Program Files folder eliminates the differences between 32 and 64 bit Windows OS machines. From the Sources I only took the src and libsrc folders, but this is completely optional. The result should be something like this:
It is convenient to have access to the bin folder from CC65, where all the executables (compiler, assembler, linker and more) are located.
- Unix utilities
You will also need the Unix tools from SourceForge, that you can download at http://sourceforge.net/projects/unxutils/. Extract these to the CC65\wbin folder. There are command-line tools such as rm (Remove) and copy that we need later.
I have edited the Path environment variable for this. Go to your Computer properties page (Right-click the Computer icon in Windows Explorer) and select “Advanced system settings”. From there, click on the bottom button that says “Environment Variables…”.
Pick the Path variable from the System variables list and click Edit…
Add the folders bin and wbin from the folder to which you extracted the CC65 files. THese are probably C:\Program Files\CC65\bin and C:\Program Files\CC65\wbin. Make sure you add a semicolon before each new directory path.
Also, create new environment variables:
- CA65_INC: C:\Program Files\CC65\asminc
- CC65_INC: C:\Program Files\CC65\include
- CC65_HOME: C:\Program Files\CC65
- LD65_CFG: C:\Program Files\CC65\cfg
- LD65_LIB: C:\Program Files\CC65\lib
- LD65_OBJ: C:\Program Files\CC65\obj
The CC65 suite should now be ready for development. Try typing CC65 from a command windows and see if something like this pops up:
As you can see the CC65.exe was available.
Although you can work from here with Notepad and command prompts, we can make life easier for ourselves. The next step is optional. Pick whatever text editor you like and your favorite GUI environment like Code::Blocks, Mono or Visual Studio.
Setting up Visual C++ 2012 for Atari Lynx projects
First, you need to download Microsoft Visual Studio 2012 Express for Windows Desktop from the Microsoft website: http://www.microsoft.com/visualstudio/eng/downloads#d-express-windows-desktop
Alternatively, you could use Microsoft Visual C++ 2010 Express
After the download, run the setup program and install Visual Studio 2012. This should be a pretty straight forward process.
After the installation you have a GUI for source code and resource file management, that can work together with the CC65 compiler to provide a rich and productive environment. This may sound like a commercial, and I guess that some of it is. But I do believe that this will give a pleasant experience for a lot of development scenarios. Maybe some video will be in order.
As a final step to smoothen the transition from VS2010 to VS2012 and back, add one final path to the PATH environment variable:
- C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
(for Visual Studio 2010) –or–
- C:\Program Files\Microsoft Visual Studio 11.0\VC\bin
(for Visual Studio 2012)
Another tip is to turn of IntelliSense information for C/C++ projects. This will help not getting too many warnings and errors from Visual Studio trying to understand what your C code is all about. This works great for C programs targeted for Windows and not so much for Lynx targets. The option is found under the menu Tools, Options, Text Editor, Advanced:
Simply change the value from False to True and you are good to go.
If you want to give Visual Studio a spin for CC65, I recommend you download this “Hello World” project. Unzip it (again, unblock the zip archive before extracting the files) and open the Starter.sln solution file.
You can double-click the game.c source file from the Solution Explorer. To compile the Lynx rom image, open the Build menu, choose Build Solution. and check the Output window at the bottom.
The next part of the tutorial will focus on the files inside this project, how Visual Studio and CC65 work together and what we need to do to build a working rom image.