Jump to content
IGNORED

How to run cc65


Preppie

Recommended Posts

I have the cc65 folder on my desktop and a small textfile with a C program in the cc65 folder, the question is how do I run it?

 

I have absolutely no idea how to use the command line, I've spent an hour reading the documentation but it assume you have knowledge of command line and I'm no further forward.  I'm used to clicking an icon and getting a result :)

 

I'd be very grateful if someone could tell me what to type into that black screen. 

Link to comment
Share on other sites

1 hour ago, Wrathchild said:

Take a look at Yaron's tutorials he has posted here and here, that should be enough to get you started :)

 

Thanks, but they assume you know what you're doing, the only thing I know about the command line is if you type 'dir' u get a directory list - all I can do is point and click.

 

 

  • Like 1
Link to comment
Share on other sites

assuming you've navigated to folder where your source is in (*) and its in, say, a single C file, then use:

 

cl65 -t atari -O -o <filename>.xex <filename>.c

The '-t' tell us the system we are targeting, '-O' is optional but good to have, it tells the toolset to use the optimzer.
We can specify the output filename with '-o', useful to have the xex extension so it can be opened in Altirra by association.

Finally the files to build from are listed, so in this case just "<filename>.c"

 

(*) A useful tip for windows command boxes is to type "CD" then a space and if you have your source folder opened in an explorer window, you can drag-drop the folder into the command box and it will paste the path onto the command line. Hit 'Enter/Return' to effect the change of directory. Note, if your source is on a different drive you'll need to change to that before/after the CD. Do that by, for example, typing "D:" and return.

 

image.thumb.png.e263dfccc99b70a8a6c529ebdd2e2c49.png

  • Like 2
  • Thanks 3
Link to comment
Share on other sites

Ok, after some searching through the cc65 folder I found the cl65.exe in the bin folder.  Moved my C txt file to the bin folder then used the newly discovered cd command to move to the bin folder and execute the command you gave me.

 

This may be totally obvious to you guys but not to a complete novice, or maybe I've done it all wrong but somehow it worked anyway lol

 

Thanks wrathchild for holding my hand :)

Edited by Preppie
Link to comment
Share on other sites

Happy to help.


Another tip then. In the cc65 folder I'd have batch file that sets up the environment.

Leave your sources in its own folder, e.g. "C:\CC65\PROJECTS\MY_TEST"

 

After the command window is opened, 'cd' to "C:\CC65" and then run the batch file "CC65VARS".

 

This adds CC65's binary folder to the set of folders searched when you run an program.

CC65 also needs a could of environment variables so these are set too.

(though I think more recent versions may take care of that for you but its not going to hurt to set these anyway)

 

now you can "CD PROJECTS\MY_TEST" and just run cl65 from the command line.

 

Good luck!

@echo off
rem
echo Setting environment for using CC65 tools.
rem
set PATH=c:\cc65\bin;%PATH%
set CC65_INC=c:\cc65\include
set CC65_LIB=c:\cc65\lib

 

 

CC65VARS.BAT

Edited by Wrathchild
attached file was for D: drive, replace with one for C:
Link to comment
Share on other sites

4 hours ago, Wrathchild said:

Happy to help.


Another tip then. In the cc65 folder I'd have batch file that sets up the environment.

Leave your sources in its own folder, e.g. "C:\CC65\PROJECTS\MY_TEST"

 

After the command window is opened, 'cd' to "C:\CC65" and then run the batch file "CC65VARS".

 

This adds CC65's binary folder to the set of folders searched when you run an program.

CC65 also needs a could of environment variables so these are set too.

(though I think more recent versions may take care of that for you but its not going to hurt to set these anyway)

 

now you can "CD PROJECTS\MY_TEST" and just run cl65 from the command line.

 

Good luck!


@echo off
rem
echo Setting environment for using CC65 tools.
rem
set PATH=c:\cc65\bin;%PATH%
set CC65_INC=c:\cc65\include
set CC65_LIB=c:\cc65\lib

 

 

CC65VARS.BAT 152 B · 1 download

 

for newer cc65 version the environment variable is CC65_HOME

 

i.e.:

 

set CC65_HOME=C:\CC65


 

Link to comment
Share on other sites

Once you feel more confident with the command line, you can try installing MSYS2 or any similar environment to get full Unix-like command line. However, PowerShell could be also good option to control your CC65.

 

And there are other goodies...

https://github.com/cc65/wiki/wiki/Using-cc65-with-Visual-Studio-Code

which will get you a decent IDE for CC65/CA65.

 

 

 

 

 

  • Thanks 1
Link to comment
Share on other sites

10 hours ago, Preppie said:

That didn't work either then I realised cc65 was on desktop so I moved it to be directly on the C drive and that solved it :)  


Thanks again, now all I have to do is learn how to code C.

 

Good luck with that.

My experience with CC65 was the following (I knew C before):

 

1. Wow, now I can create high performance games in a language other than assembler!

2. Where are libraries for platform-dependent functions (graphics, sound, controls, PMG, DLIST, DLI, VBI)?

3. Eh, I have to write them myself, and at least partially in assembler!

4. How do I mix assembler and c code? It seems impossible!

5. No, no, no, it is pretty easy to do it, if you know how LD65 works.

6. Ooops, the LD65 has so steep learning curve! The atari.cfg file is so cryptic!

7. I have it, assembler, display list, graphics data, character sets included with LD65. And all loaded to proper addresses.

8. Engine for BAHA Software's TRAIN game is born. A joy!

 

 

 

  • Like 1
Link to comment
Share on other sites

Having not written in C before I have no expectations, and I don't mind spending a bit of time and effort learning a new language, I just think having to learn something just to run a program is a bit crazy when point and click has been around for decades.

 

I don't mind doing a bit of assembler.  My current game is in FastBasic with an assembler VBI to display the graphics, but writting a full assembler program is a bit daunting so I thought C might get me a bit of extra speed for when I need it.

 

It would be cool to be able to code in VS or notepad++ and press a button to get the program to run but looking at this page https://marketplace.visualstudio.com/items?itemName=SharpNinja.cc65 with it's talk of extension setting and config files just sounds like gobbledygook to me.  On top of that, pressing the install button does nothing anyway.

 

The main thing is that I can now run a C program so I can do some speed tests and see how much faster it is than FastBasic (if at all, i have no idea atm) 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...