User forums > Embedded development
cc65 (6502/6510) toolchain for hobbyist retro work -- need help...
DigitalMonk:
Thanks everyone, but especially jens.
Going through the Advanced settings, it was actually easier to set up than trying to set it up through toolchain executables and options (since those weren't designed for what I was trying to do. I'm not complaining about the normal compiler setup stuff, I'm just trying to brag on the Advanced settings for being pretty slick).
My biggest problem was getting my cl65 parameters right (I'm entirely new to the cc65 toolchain as well), and then remembering that I'd set my project as a console app, so I needed to fix the "Link into console application" instead of the "Link into application".
Anyway, my projects now compile just fine.
My current problem is that I'm not sure how to set up the debugger command line so that it will fire up x64. The command line is pretty simple, just "c:\WinVICE\x64.exe MyProg.PRG". I thought that would be the default behavior if I just put x64.exe in the Debugger entry for the toolchain executables, but that doesn't seem to be working (or else, I'm failing to start the debugger and mistakenly telling C::B to run MyProg.PRG, which definitely won't work :) )
Any further pointers are still welcome. Once I've got all the bits up and running, I'll post all the necessary settings, since Google has already indexed this thread for "cc65 CodeBlocks" searches.
DigitalMonk:
[Edited 5/24/2010 to add KeyBinder plugin usage]
[Editing again on 5/24/2010 to add output parsing suggestions]
OK, as promised, here are the steps I took to give myself a "C64 Development IDE on a stick" (a USB stick). This looks long, but that's just 'coz I'm trying to be explicit about everything... You also don't have to put it on a stick, but it should be fairly obvious how to modify this for a permanent installation (or just set it up this way on whatever hard drive instead of a USB stick -- there's nothing magically stick-ey about any of this)
1. Install Code::Blocks (make sure to choose KeyBinder under the Contrib Plugins during installation!) and cc65. Download and unzip WinVICE somewhere.
2. Copy C::B directory onto your stick.
3. Copy cc65 directory onto your stick underneath your C::B directory (exact placement may not be critical, but you'll need to adjust your paths accordingly in later steps if you put it elsewhere)
4. Copy WinVICE directory onto your stick underneath your C::B directory
5. Locate default.conf in your user Application Data directory (c:\Documents and Settings\{My User Name}\Application Data\CodeBlocks\default.conf (for XP) or c:\Users\{My User Name}\Application Data\CodeBlocks\default.conf (for Vista and Win7)), and move it onto your stick in the C::B directory (same directory that has codeblocks.exe)
6. Run codeblocks.exe from your stick.
7. Use menu -- Settings | Compiler and debugger...
8. Pick a compiler, I used GCC. It's not critical given the hackish way I set up my commands and ignored some of the built in variables...
9. Press the Copy button and name your new settings something like "cc65 for C64".
10. With "cc65 for C64" selected, press "Set as default" (your option -- may not wish to do this if you're actively using this C::B for other kinds of projects, but I'm focused on C64 development)
11. Go to tab -- Toolchain executables
12. Set the "Compiler's installation directory" to ${CODEBLOCKS}\cc65
13. For the actual paths, it doesn't exactly matter what you pick (I'm going to hardcode them into the commands -- if you feel like being nicer later, you'll need to be more careful here). Only the "C compiler" and "Linker for {whatever}" entries will matter for these instructions. I've set ld65.exe for the two Linker lines and cl65.exe for everything else. The main thing is that whatever appears on these lines MUST be present in the ${CODEBLOCKS}\cc65\bin directory, or C::B will complain about a misconfigured compiler.
14. Go to tab -- Other settings (it's off to the right)
15. Press "Advanced options..." button
16. With "Compile single file to object file" selected, press the "+" button and add "c" as a file extension, then make sure it is selected.
17. [EDIT: This will work, but is a horrible habit to get started. See later posts for the RIGHT way to do this.] Set "Command line macro" to: cl65 -c -g -Oi -I ${APP_PATH}\..\cc65\include -L ${APP_PATH}\..\cc65\lib -o $objects_output_dir\$file_name.o $file
18. You can repeat steps 16 and (a modified) 17 to add ".s" for assembly files, but I'm not using those, so I haven't tested it yet.
19. Change the "Command" droplist to "Link object files to executable"
20. [EDIT: Ditto on horribleness and suggestions to read later posts] 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
21. Repeat steps 19 and 20 for the other "Link object files to console/native executable", if you feel like it. If not, just make sure that when you make new projects, you set your project type to "executable" instead of "console executable" or "native executable".
22. Click on the "Output parsing" tab.
23. Click on "Compiler error" in the listbox
24. In the "Regular expression" box, delete the first pair of matched parentheses () and the colon : that separates the filename from the line number. Then you'll have to wrap some escaped parens \(\) around the line number phrase. Or just paste this in: ([][{} \t#%$~A-Za-z0-9_:+/\.-]+)\(([0-9]+)\):[ \t](.*)
25. Click on "Compiler warning" in the listbox
26. Same idea, but keep the [Ww]arning part in place. Here's mine: ([][{} \t#%$~A-Za-z0-9_:+/\.-]+)\(([0-9]+)\):[ \t]([Ww]arning:[ \t].*)
27. Click on the Others tab
28. I cleared the check for "Supports PCH", but I'm not sure that it matters...
29. Press OK to close this dialog, then OK to close the other dialog.
30. Use menu -- Tools | Configure tools...
31. Press Add
32. Set Name to "Run it" (your choice)
33. Set Executable to ${CODEBLOCKS}\WinVICE-2.2-x86\x64.exe
34. Set Parameters to ${TARGET_OUTPUT_FILE}
35. Set Working directory to ${PROJECT_DIR}
36. Set the radio buttons to "Launch tool visible detached (without output redirection)" the last option.
37. Press OK to close this dialog, then OK to close the other dialog.
38. Use menu -- Settings | Editor...
39. Scroll down to "Keyboard shortcuts" and select it.
40. Expand the Tools part of the tree ("Run it" should appear)
41. Click on "Run it" in the tree
42. Click in the "New shortcut" text box and type whatever key sequence you want to use
You should be set up now. You can create new executable projects, compile and link them into .PRG files with the single Build command (defaulted to CTRL-F9 for me), and run the program in the emulator with the Tools|Run it menu.
As a side note, in WinVICE, I like to go into the Settings menu and turn ON "Save settings on exit" and turn OFF "Confirm on exit", and then go into the Options menu and turn ON "Double size", but those are all just personal preferences.
I'd be ecstatic to hear from other users who have better/slicker setups. In particular, I'd like to get WinVICE working as my debugger, instead of as a generic "tool", so that I could press one hotkey and have C::B save all my files, compile them, and start up the program. The problem seems to be that I can't keep C::B from wanting to inject some command line arguments into the debugger command line. But what I've got here is still pretty nice, and C::B is great (thank you code completion).
DM
MortenMacFly:
--- Quote from: DigitalMonk on May 21, 2010, 07:06:32 pm ---OK, as promised, here are the steps I took to give myself a "C64 Development IDE on a stick" (a USB stick).
--- End quote ---
Harhar! This is damn cool! 8) My first PC was a C128. This brings back memories... POKE 53280,XXX... POKE 53281,YYY :lol:
DigitalMonk:
My first computer was a VIC-20. The first computer I had that I did any reasonable amount of programming on was my C64. The first computer I had that I did any GRAPHICAL programming on was my C128 (thank you CBM BASIC 7.0 for adding graphics commands).
Now that I've got a C compiler and a nice dev environment, goofing around in free time has let me get a scrollable zoomable map (just a simple grid for now) up and running (or walking, I suppose -- that 1MHz 8 bit processor doesn't really run anywhere)
MortenMacFly:
--- Quote from: DigitalMonk on May 21, 2010, 09:22:47 pm ---The first computer I had that I did any reasonable amount of programming on was my C64.
--- End quote ---
Same here. I even learned a bit assembler (well... you had to if you wanted to do something speedy). That was really fun but never turned out to be something useful. Today I own this:
http://en.wikipedia.org/wiki/C64_Direct-to-TV
That brings back the stories like e.g. Mission Impossible... you know... the game with the nice speech processor... :lol:
Oh dear... I guess meanwhile I am so off-topic that I am violating our own forum rules myself. ;-)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version