Author Topic: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...  (Read 20026 times)

Offline DigitalMonk

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #15 on: May 24, 2010, 03:19:14 pm »
 :oops:  I appear to have missed KeyBinder under the Contrib plugins.  D'oh!  Rectifying that immediately...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #16 on: May 24, 2010, 04:50:34 pm »
A few things to notice:

17. Set "Command line macro" to:  cl65 -c -g -Oi -I ${APP_PATH}\..\cc65\include -L ${APP_PATH}\..\cc65\lib -o
Probably one can do it even better because you are mixing special with project specific parameters here.
I would use:
$compiler $options $includes -c -o $objects_output_dir$file_name.o $file
Make sure you've chosen "cl65.exe" as compiler in the compiler options. Put the include directory to the include directories for the compiler in the compiler's option. Then enable "-g" and "-Oi" in the build options of your project. Notice in addition that you don't need the library directory here at all.

20. Set "Command line macro" to:  ld65 -v -t c64 -L ${APP_PATH}\..\cc65\lib\ -Ln $exe_dir\$exe_name.LBL -o $exe_dir\$exe_name.PRG $link_objects c64.lib
Same applies for the linker:
Use:
$linker $link_options $libdirs -Ln $exe_dir\$exe_name.LBL -o $exe_dir\$exe_name.PRG $link_objects $libs
Put -v -t c64 into the linker build options of your project (!) so you can select a different target platform, too. Also, put c64.lib as library to link against to your project's build options and add the RIGHT library directory for your target platform to the linker directories.

Finally: Make sure in the project you've just created you name the extension of output executable to "prg" and de-select to create the extension automatically in the build target options of the project properties.

This works very well for me for at least C64 and C128 target platform. :-)
« Last Edit: May 24, 2010, 04:53:05 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline DigitalMonk

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #17 on: May 24, 2010, 05:30:35 pm »
Hmmm...  I was having problems with cl65 if I didn't specify the library path, because cl65 is the "compile and link" tool. (remember, I'm on a USB stick, so I've got no environment variables at all that I can rely on)  I tried to use cc65 directly, but was having no luck there, either.  And when I switched to using cl65, it insisted on being told where c64.lib was.  But then, I'm just learning the cc65 toolchain as I go, so I probably just whiffed something (or several things).

Secondly, thank you for the suggestions.  That's definitely a better way to do it.  I suspect that I'll only ever do this one project, so it all works out the same for me, but anyone who is even remotely serious should do it your way.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #18 on: May 24, 2010, 05:42:58 pm »
[...]
(remember, I'm on a USB stick, so I've got no environment variables at all that I can rely on) 
[...]

If you have a default.conf (or any other personality) on your usb-stick (you most likely have, because if not you would not have a compiler), you can use the "Environment variables"-plugin.

Offline DigitalMonk

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #19 on: May 24, 2010, 05:47:02 pm »
If you have a default.conf (or any other personality) on your usb-stick (you most likely have, because if not you would not have a compiler), you can use the "Environment variables"-plugin.

Ah, very handy.  Thank you!  Having the dev environment on a stick has been incredibly convenient.

I also just remembered why I quit trying to use cc65.exe and switched to "cl65.exe -c" instead.  "cl65.exe -c" goes from .c -> .o in one step, but cl65.exe just goes .c->.s.  I told the compile command for .c files that it would generate a like-named .s file, and then set up a rule for .s files that used ca65.exe, but somewhere along the way I just failed to get the chaining to work.  When I got cl65.exe to compile .c's to object files, I was happy so I stopped there.

rchennau

  • Guest
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #20 on: May 24, 2011, 12:09:16 am »
I just wanted to say thanks for posting this setup guide.  I've modified it to fit CC65 to build for the Atari.

Attached is the cbp file.

Steps:
1. Download the attached files Atari.cbp.txt and main.c.txt and rename without the .txt
2. Install code blocks (C::B) using your favorite linux installer (user@hostname: ~$apt-get add codeblocks)
3. Launch C::B
4. Make a subdirectory in your .codeblocks/UserTemplates directory of Atari
5. copy downloaded files to .codeblocks/UserTemplates/Atari
6. File->New->From Template...
7. Choose Atari

Happy coding!   :D

The steps I changed from the original setup for C64 differ in the following ways.
1. I removed all C::B checked build flags in compiler.
2. I added project custom build flags of -v -t atari -Oi
3. I added project custom link flags of -v
4. I changed the project link library under linker settings to atari.lib
5. I removed the steps around adding .s files in the menu->settings->compiler and debugger->other settings->advanced options
6. I added .o files in the advanced options compile routines
7. I changed the compiler logging to full command line under other settings.

I'm going to cross post this on the CC65 wiki as a setup guide.   


[attachment deleted by admin]

Offline DigitalMonk

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
« Reply #21 on: May 24, 2011, 03:26:51 pm »
Cool!  Glad to be of help.  I have to admit that having a little retro-dev IDE that I can carry anywhere is a lot of fun, and I hope it will be for you as well.