"Hello, World!" with cc65

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

"Hello, World!" with cc65

Post by SlithyMatt »


If you are trying to get started developing for the X16 with C and/or assembly, I've created this video to help:





 

If you just want to get the "Hello, World!" repo and start hacking, you can get it from my GitHub: https://github.com/SlithyMatt/x16-hello-cc65

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

"Hello, World!" with cc65

Post by SlithyMatt »


As promised, my channel update: 





 

User avatar
Jestin
Posts: 85
Joined: Sat Jun 27, 2020 10:14 pm
Contact:

"Hello, World!" with cc65

Post by Jestin »


Both videos are great!  I'm looking forward to the follow up CC65 videos.  I've been learning 6502 by doing a project with acme, but I feel like I'm outgrowing it.  Meanwhile, cc65 (or really ca65) feels very intimidating since I've never defined segments before.  With acme, I just have a big `main.asm` where I import other files in the order I want them assembled.  It's very peasant-level, but it's been working so far.  I'd love to hear you explain how you structure your binaries, rather than just trying to divine it by looking at the XCI engine source code.  Keep up the great work!

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

"Hello, World!" with cc65

Post by SlithyMatt »



3 hours ago, Jestin said:




Both videos are great!  I'm looking forward to the follow up CC65 videos.  I've been learning 6502 by doing a project with acme, but I feel like I'm outgrowing it.  Meanwhile, cc65 (or really ca65) feels very intimidating since I've never defined segments before.  With acme, I just have a big `main.asm` where I import other files in the order I want them assembled.  It's very peasant-level, but it's been working so far.  I'd love to hear you explain how you structure your binaries, rather than just trying to divine it by looking at the XCI engine source code.  Keep up the great work!



Actually, most of my projects are just like how you describe, including the XCI engine. You don't have to mess around with segments and linking if you don't want to. Just throw everything in the "CODE" segment and use .include to order it, so you only need to have .segment instructions in the main file, which you can copy verbatim from my all-assembly example here.

SerErris
Posts: 172
Joined: Sat Aug 08, 2020 9:18 am

"Hello, World!" with cc65

Post by SerErris »


Hi,

what editor do you use? I am trying to integrate it now in Visual Studio Code.

I am working on Windows - I potentially could switch for the complete development to Ubuntu in a VM, but would like to keep everything in the same place. For now all the stuff is sitting in Files on my Windows part. 

So worked through your instructions and setup the cygwin and the cc65 inside cygwin. I also created a link from my home directory to the working directory. All great.

I have installed Visual Studio Code and were able to create a link to the cygwin shell (works great).

I downloaded the CC65 integration (cc65 for 6502/65816 machines from SharpNinja) from the marketplace. But where I now struggle is to link the cc65 compiled under cygwin to Visual Studio Code. Main reason: I need to call CC65 within the cygwin environment because of the cygwin libraries required. I cannot just run the ca65.exe for instance as it will not find the cygwin libraries if I am not in the cygwin environment.

Any idea how to get this integrated?

/Edit: got one step further - it is important for the CYGWIN environment that you setup the Windows PATH environment variable .. Then the cygwin.dlls could be found and you can run ca65 from a windows cmd window ... Cracking on with the integration into CS Code

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

"Hello, World!" with cc65

Post by SlithyMatt »


Were you able to get make to run from outside the Cygwin terminal? It may depend on being inside the bash shell, I haven't tried it outside. When I'm running on Windows, I keep the Cygwin terminal up for building and Git Bash for running the pre-built emulator and doing any Git command line operations that can't be done in Atom (I avoid the DOS command prompt whenever possible).

But I would generally recommend developing inside Linux. You can use either a VM (VirtualBox with Ubuntu running inside the VM works great!) or using the Windows Subsystem for Linux.

SerErris
Posts: 172
Joined: Sat Aug 08, 2020 9:18 am

"Hello, World!" with cc65

Post by SerErris »


I have found out, that you are actually not using VS Code and also do not have any build run integration. You have a manual build and run process (e.g. create a Makefile and than run make command in cygwin). That works - no doubt. But I am looking for the integrated solution.

 

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

"Hello, World!" with cc65

Post by SlithyMatt »


You can do it with VS Code or Atom, but it's going to take some more setup. For me personally, I don't care about using multiple terminals. I prefer to have a persistent shells for building and running.

SerErris
Posts: 172
Joined: Sat Aug 08, 2020 9:18 am

"Hello, World!" with cc65

Post by SerErris »



1 minute ago, SlithyMatt said:




Were you able to get make to run from outside the Cygwin terminal? It may depend on being inside the bash shell, I haven't tried it outside. When I'm running on Windows, I keep the Cygwin terminal up for building and Git Bash for running the pre-built emulator and doing any Git command line operations that can't be done in Atom (I avoid the DOS command prompt whenever possible).



But I would generally recommend developing inside Linux. You can use either a VM (VirtualBox with Ubuntu running inside the VM works great!) or using the Windows Subsystem for Linux.



Yes, you just need to setup CYGWIN in your Windows PATH variable. 

For me that is D:\Development\cygwin\bin ... after that you can run anything that has been compiled under cygwin just from cmd window.



211255902_Screenshot2020-09-19161223.thumb.jpg.f1ef13a1abb72b8c16f7df6f9df35e5b.jpg

As I said - developing inside Linux would be the last option. It is simply to much back and forth for me.



Also I am not looking for running it manually, I am looking to get it fully integrated into VS Code. There is a plugin for CC65 and also a integration into vice (it just runs the emulator with some commands), so that should work with x16emu as well. However it does not work like that - I could not  get VS Code to compile it with CC65 it is looking for a compiler/assembler to do the work and does not understand the CC65 plugin stuff or does not link it to the workspace ?

 

 

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

"Hello, World!" with cc65

Post by SlithyMatt »


Can't VS Code work with a makefile? That would seem to be a pretty basic feature.

Atom has the atom-make package. VS Code must have something similar.

Post Reply