Compiling Lynx homebrew projects

As a follow-up to my post on compiling the sources for CC65 here are some instructions to compile homebrew projects without a graphical user interface or Integrated Development Environment (IDE) like Visual Studio or CodeBlocks. I will show you how to do some more setup of your Windows installation to be able to compile homebrew projects.

Environment variables

CC65 needs a couple of environment variables for all tools to work correctly. You can read more about this in part 2 of the Lynx programming tutorial, but for your convenience here is the lowdown:

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

and your PATH variable should contain the MinGW msys bin path and the CC65 base directory. Part 2 contains some instructions to create the permanent environment variables.

@SET CC65_HOME=%PROGRAMFILES%\CC65
@SET PATH=%CC65_HOME%\bin;C:\MinGW\msys\1.0\bin;%PATH%
@if exist %CC65_HOME%\wbin (
    @set PATH=%CC65_HOME%\wbin;%PATH%
)
@SET CA65_INC=%CC65_HOME%\asminc
@SET CC65_INC=%CC65_HOME%\include
@SET LD65_CFG=%CC65_HOME%\cfg
@SET LD65_LIB=%CC65_HOME%\lib
@SET LD65_OBJ=%CC65_HOME%\obj

Below is a batch script that can do the same for you. Examine the script, then after you have verified it is benign copy and paste it to a text file. Save the file as cc65vars.bat in your CC65 installation directory (probably C:\Program Files\CC65).

Then create a shortcut by right-clicking the cc65vars.bat file and choose Send To > Desktop (Create shortcut) from the context menu. Go to your desktop and right-click the shortcut. Choose Properties and edit the Target field. Enter this value:

%comspec% /k “%PROGRAMFILES%\cc65\cc65vars.bat”

Change the ‘Start in’ field to %PROGRAMFILES%\cc65\ and fill in ‘Open CC65 Tools Command Prompt’ in the Comment field. The cogwheel icon of the shortcut should change to the familiar black command prompt. Give the shortcut a fancy name like ‘CC65 Tools Command Prompt’.

image

Now double-click the shortcut and a command prompt should open that looks like this:

image

That’s it. All set to start compiling your sources.

An example: “Shaken, not stirred” by Karri Kaksonen

You can try your installation by compiling the sources of a homebrew game called “Shaken, not stirred”. As before, create a clone of Karri’s Git repository for Shaken by using this clone url: https://bitbucket.org/karri/shaken.git. Use either Git for Windows tooling or Visual Studio (or whatever else you might have for that).

After cloning the Shaken repo, start the command prompt we created before and navigate to the root of the repo. Run make.exe and everything should run smooth when the setup is okay.

image

You might notice in the output that the final stage of zipping the cart.lnx file didn’t happen correctly. I’ll figure out where to get the zip.exe tool to have this succeed as well. Frankly, I do not bother zipping the files that are a maximum of 512 kB.

image  image

Feel free to contact me here or at the AtariAge Lynx Programming forum if you run into problems you cannot fix.

Have fun. Let me know of your particular details, tips or tricks so I can include them here and at the tutorial.

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

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