Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio –...

7
Using CC65 with Visual Studio – Jeff Birt, [email protected] Visual Studio is a great IDE for code development. You can download the community edition for free from: https://www.visualstudio.com/ . I’m using Visual Studio 2013 Community Edition but the 2015 version is out now and should work just as well. There are a few things you will need to have in addition to Visual Studio, they are linked to below. 1) CC65 a) http://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip b) Unzip CC65 to C:\CC65 2) GNU Make for Windows – choose version to match your PC a) 32 bit: ftp://ftp.equation.com/make/32/make.exe b) 64 bit: ftp://ftp.equation.com/make/64/make.exe c) Copy to C:\CC65 3) WinVICE – choose version to match your PC a) 32 bit: http://sourceforge.net/projects/vice- emu/files/releases/binaries/windows/WinVICE-2.4-x86.zip/download b) 64 bit: http://sourceforge.net/projects/vice- emu/files/releases/binaries/windows/WinVICE-2.4-x64.zip/download c) Unzip WinVICE where ever you want 4) Generic CC65 Makefile (already in Visual Studio CC65 Project Template) a) https://github.com/cc65/wiki/wiki/Bigger-Projects#THE_Makefile_itself 5) Visual Studio CC65 Template a) http://www.soigeneris.com/document/forum/cc65.zip b) Copy the ZIP file (do not unzip) to your VS Templates folder. Next we need to set up some environment variables. After adding these you must log off then back on before they will take effect. You can also use RapidEE to make setting environment variables easier: http://www.rapidee.com/download/RapidEE_setup.exe . The following are my settings; yours may differ depending on where you put things. 1) CC65_HOME = C:\cc65 2) CC65_INC = C:\cc65\include 3) LD65_CFG=C:\cc65\cfg 4) LD65_LIB=C:\CC65\lib 5) MAKE_HOME = C:\cc65 6) WINVICE = C:\Users\birtj\Documents\WinVICE-2.4-x64 7) Add C:\cc65\bin to PATH

Transcript of Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio –...

Page 1: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.

Using CC65 with Visual Studio – Jeff Birt, [email protected]

Visual Studio is a great IDE for code development. You can download the community edition for free

from: https://www.visualstudio.com/ . I’m using Visual Studio 2013 Community Edition but the 2015

version is out now and should work just as well. There are a few things you will need to have in addition

to Visual Studio, they are linked to below.

1) CC65

a) http://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip

b) Unzip CC65 to C:\CC65

2) GNU Make for Windows – choose version to match your PC

a) 32 bit: ftp://ftp.equation.com/make/32/make.exe

b) 64 bit: ftp://ftp.equation.com/make/64/make.exe

c) Copy to C:\CC65

3) WinVICE – choose version to match your PC

a) 32 bit: http://sourceforge.net/projects/vice-

emu/files/releases/binaries/windows/WinVICE-2.4-x86.zip/download

b) 64 bit: http://sourceforge.net/projects/vice-

emu/files/releases/binaries/windows/WinVICE-2.4-x64.zip/download

c) Unzip WinVICE where ever you want

4) Generic CC65 Makefile (already in Visual Studio CC65 Project Template)

a) https://github.com/cc65/wiki/wiki/Bigger-Projects#THE_Makefile_itself

5) Visual Studio CC65 Template

a) http://www.soigeneris.com/document/forum/cc65.zip

b) Copy the ZIP file (do not unzip) to your VS Templates folder.

Next we need to set up some environment variables. After adding these you must log off then back on

before they will take effect. You can also use RapidEE to make setting environment variables easier:

http://www.rapidee.com/download/RapidEE_setup.exe . The following are my settings; yours may

differ depending on where you put things.

1) CC65_HOME = C:\cc65

2) CC65_INC = C:\cc65\include

3) LD65_CFG=C:\cc65\cfg

4) LD65_LIB=C:\CC65\lib

5) MAKE_HOME = C:\cc65

6) WINVICE = C:\Users\birtj\Documents\WinVICE-2.4-x64

7) Add C:\cc65\bin to PATH

Page 2: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.

The easiest way to create a CC65 project is to use the CC65 Project Template for Visual Studio. If you

want to know how to create a CC65 project from scratch it is explained at the end of this document.

Copy the CC65.zip folder in your Visual Studio Templates folder, do not unzip it. My folder is located at:

“..\Visual_Studio_2013\Templates\ProjectTemplates\CC65”. I created a folder named CC65 to organize

things. When you use Visual Studio to create a new project it will show up under the C++ project

templates.

The template contains a simple ‘Hello World’ program based on one of the samples that come with

CC65 and https://helloacm.com/tutorial-1-c-programming-for-6502-8-bit-cpu/ . After creating your

project with the template you should be able to build the project.

We can set things up so that WinVICE automatically start running your code with F5 or the ‘Play’ button.

Change the following settings in the project properties. NOTE: You have to do this even if you use the

CC65 project Template as these settings are not save with the template for some reason. Make sure

you set both the Release and Debug configurations.

1) Project Properties->Configuration Properties->Debugging

a) Command: $(WINVICE)\x64

b) Command Arguments: -autostart "$(ProjectDir)$(Configuration)\$(ProjectName).c64"

c) When you build your CC65 project with the configuration set to Debug two extra files

are generated that will let you do debugging using WinVICE.

1) How to set up debugging with WinVICE

a) When building in the Debug configuration with the settings in the CC65 template a label

file and debug file will automatically be created.

b) In WinVICE enter the monitor and type, ll “programname.lbl” to load the label file.

c) At this time the files are generated but I have not figured out how to use them for

debugging purposes.

Useful links

1) CC65 main page: http://cc65.github.io/cc65/index.html

2) CC65 Wiki: https://github.com/cc65/wiki/wiki

3) Setting up a CC65 project: https://github.com/cc65/wiki/wiki#Setting_up_a_cc65based_project

4) VICE main page: http://vice-emu.sourceforge.net/

Page 3: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.

Manually setting up a CC65 project in Visual Studio

If you want to understand the steps required for creating a CC65 project from scratch then this section is

for you. NOTE: The path to your project MUST NOT contain spaces. For example my project folders are

in: “C:\Users\birtj\Documents\Visual_Studio_2013\Projects”. Visual Studio will default to “..\Visual

Studio 2013\Projects”; if you decide to replace the spaces with underscores you must go into Debug-

>Options and Settings and change the default path settings.

1) Create a new project as a C++ Makefile project

2) Change project properties as shown in the images that follow. Note: The ‘VC++ Directories’ has

no effect when building with CC65. I set them as a note to myself.

3) Add a folder named ‘src’ to your project folder (not the solution folder). My Solution folder

created by Visual Studio is named C64Test it contains the project folder which is named

CC65Test. The project folder contains the folder named ‘src’.

4) Set up the project properties as shown in the following images. You might notice that we are

deleting a folder “../obj/Win32” this is a folder that is automatically created by Visual Studio

because it thinks we are going to build a Win32 project. This folder does not hurt anything but it

annoyed me. For the same reason the Debug and Release folders that are automatically created

in the solution folder are deleted.

Page 4: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.

Screen shots of Visual Studio configuration for Debug build

Page 5: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.
Page 6: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.

Screen shots of Visual Studio configuration for Release build

Page 7: Using CC65 with Visual Studio Jeff Birt, birt j@soigeneris · Using CC65 with Visual Studio – Jeff Birt, birt_j@soigeneris.com Visual Studio is a great IDE for code development.