Programming tutorial: Part 2–Development environment

Atari Lynx programming tutorial series:

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:

  1. Epyx development kit with an Amiga 1000 machine
  2. BLL (Behind Lynx Lines) kit from Bastian Schick
  3. 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.

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:

image_thumb2[1]

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…”.

image_thumb5

Pick the Path variable from the System variables list and click Edit…

image_thumb2

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:

  1. CA65_INC: C:\Program Files\CC65\asminc
  2. CC65_INC: C:\Program Files\CC65\include
  3. CC65_HOME: C:\Program Files\CC65
  4. LD65_CFG: C:\Program Files\CC65\cfg
  5. LD65_LIB: C:\Program Files\CC65\lib
  6. 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:

image_thumb11

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

http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-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:

image_thumb15

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.

image_thumb5[1]

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.

image_thumb21

Next time

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.

Advertisements
This entry was posted in Tutorial. Bookmark the permalink.

15 Responses to Programming tutorial: Part 2–Development environment

  1. Pingback: Programming tutorial: Part 3–Analyzing Hello World | Diary of an Atari Lynx developer

  2. Pingback: Programming tutorial: Part 4–Creating a project | Diary of an Atari Lynx developer

  3. Pingback: Programming tutorial: Part 5–Exploring TGI | Diary of an Atari Lynx developer

  4. Pingback: Programming tutorial: Part 6–Colors | Diary of an Atari Lynx developer

  5. Pingback: Programming tutorial: Part 7–The basics of sprites | Diary of an Atari Lynx developer

  6. Pingback: Programming tutorial: Part 8–Changing appearances | Diary of an Atari Lynx developer

  7. Pingback: Programming tutorial: Part 9–Advanced sprites | Diary of an Atari Lynx developer

  8. Pingback: Programming tutorial: Part 3–Analyzing Hello World | Diary of an Atari Lynx developer

  9. Pingback: Programming tutorial: Part 10–Collisions | Diary of an Atari Lynx developer

  10. Pingback: Programming tutorial: Part 11–Pens and more collisions | Diary of an Atari Lynx developer

  11. nitrofurano says:

    i’m using Linux only (Debian and Ubuntu) – what you can recommend instead?

  12. Shane Skekel says:

    Would it be possible to configure Notepad++ or Programmer’s Notepad for those who don’t have Visual Studio?

    • alexthissen says:

      Sure, that would be possible. I think you will need to combine some command-line scripts to run the MAKE utility. If you do not have Visual Studio (there are free editions for Visual C++ Express BTW), because maybe you work on a different platform, then you will also need the MAKE.exe unix tool instead of the NMake.exe from VC++. That means the *.mak files are also slightly different as the syntax of the make.exe and nmake.exe differ.
      Programmer’s Notepad allows for the definition of tools. I haven’t tried to get a setup working, but it seems doable. Let me know how you fare, so I might do a write-up on alternate tooling. There have been suggestions to look into CodeBlocks as a dev environment.

  13. aminor00 says:

    I found that my VS 2012 Express Desktop installed itself to the 32bit/x86 Program Files directory: (C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin).

    I amended your instructions above an added the different path to the PATH environment variable and the build stopped complaining an not finding nmake!

  14. aminor00 says:

    When I first opened the Project file VS2012 popped up a dialog box with a message about the file being created in an earlier version of VS and did I want to update it. I said No. Probably that was incorrect.

    I had to edit the “Starter” project properties and make the path changes that you talk about in Tutorial 4 under Configuration Properties > VC++ Directories and > NMake

    Also, the lynxCC65.mak file has a reference to the same place in the first line:

    CC65=”C:\Program Files (x86)\CC65″

    As I installed CC65 to the “C:\Program Files\” folder I just changed that path too and now the build completes with no errors.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s