SDCC for 6502

Programming the 6502 microprocessor and its relatives in assembly and other languages.
GlennSmith
Posts: 162
Joined: 26 Dec 2002
Location: Occitanie, France

Re: SDCC for 6502

Post by GlennSmith »

Hi,
It would be nice to have a 65c02 cross-compiler that didn't have to be forced to run under wine on linux machines(*). Is anybody able to liase with the SDCC dev. group to provide feedback about the "peculiarities" of the 6502/65c02 instructions and architecture?*

I'd offer to help, but I'm very *VERY* rusty at the moment - I still develop more on PIC/ATMega microcontrollers than the 6502. The SBC that I built back in the 90's was not at all reliable, and I've since lost the schematics and the board (all went with the rusty Atom to the great museum in the sky...).
I naively (spelling ? sorry if it's wrong) thought that when I retired I'd have time to play : so far it's not the case.

Could we perhaps work together, for example I could run tests and interface with the dev group, if one or two of you that are able to provide the expertise on what could be added or improved could check over the final results of the tests.

(*) after having supported a factory with 600 Windows machines for decades, I vowed never to use uSoft again. I almost manage, I have an old Win95 laptop just for my 3D architecture suite. Everything else has been on linux for over 10yrs now.
Please provide f/b. Regards, Glenn from France.
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: SDCC for 6502

Post by Proxy »

GlennSmith wrote:
Hi,
It would be nice to have a 65c02 cross-compiler that didn't have to be forced to run under wine on linux machinesce.
What about cc65? It runs natively on linux.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: SDCC for 6502

Post by drogon »

Proxy wrote:
GlennSmith wrote:
Hi,
It would be nice to have a 65c02 cross-compiler that didn't have to be forced to run under wine on linux machinesce.
What about cc65? It runs natively on linux.
Seconded for cc65 and the rest of the suite - I use the assembler on a near daily basis and while I've not used the C compiler for a while I'm looking at it again for some things in the near future.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
GlennSmith
Posts: 162
Joined: 26 Dec 2002
Location: Occitanie, France

Re: SDCC for 6502

Post by GlennSmith »

Proxy wrote:
GlennSmith wrote:
Hi,
It would be nice to have a 65c02 cross-compiler that didn't have to be forced to run under wine on linux machinesce.
What about cc65? It runs natively on linux.
Well, some flavours of Linux... I'm a Mint user (over an Ubuntu core) - I'll have to see if I can MAKE something from the source repository.

I do have an old Win version that works, but it's a hassle to run under wine. I'll see what I can do.
Thanks
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: SDCC for 6502

Post by Proxy »

now i'm a bit confused why you would need to build it yourself.
i thought mint is based on ubuntu, in which case you shouldn't you be able to just do "sudo apt install cc65" in a terminal and have it work? (or even get an IDE like VScode and install the cc65 plugin for it in the UI)

for the record i did try "sudo apt install cc65" on my WSL install of ubuntu and it does actually work without having to build it manually.
Last edited by Proxy on Tue Jun 06, 2023 8:37 pm, edited 1 time in total.
User avatar
Yuri
Posts: 371
Joined: 28 Feb 2023
Location: Texas

Re: SDCC for 6502

Post by Yuri »

I was able to get it compile just fine under Ubuntu under my WSL environment.

They provide binaries for Windows, Linux and Mac OS on their daily builds if you don't want to build yourself:

https://sdcc.sourceforge.net/snap.php
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: SDCC for 6502

Post by drogon »

GlennSmith wrote:
Hi,
It would be nice to have a 65c02 cross-compiler that didn't have to be forced to run under wine on linux machinesce.
What about cc65? It runs natively on linux.r/> Well, some flavours of Linux... I'm a Mint user (over an Ubuntu core) - I'll have to see if I can MAKE something from the source repository.

I do have an old Win version that works, but it's a hassle to run under wine. I'll see what I can do.
Thanks

It's a standard package under Debian and Devuan (which is what I mostly use now), so no reason to think it's not there for other flavours.

However I compiled it from scratch for myself as it's the only way to add a new system into it. I don't recall any issues there. It's nothing special, no GUI, no fancy networking or other stuff needed. It's just another C program...

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
GlennSmith
Posts: 162
Joined: 26 Dec 2002
Location: Occitanie, France

Re: SDCC for 6502

Post by GlennSmith »

Hi,
Yes, I downloaded the sources and i compiled for Ubuntu without any problems. Thanks for the reminder about cc65.
Glenn
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: SDCC for 6502

Post by drogon »

GlennSmith wrote:
Hi,
Yes, I downloaded the sources and i compiled for Ubuntu without any problems. Thanks for the reminder about cc65.
Glenn
Glad you're sorted.

I think it's good that there is a choice of C compilers now (and I used sdcc for a PIC project some years back too but never really thought of it for the 6502).

VBCC runs under Linux too:

http://www.compilers.de/vbcc.html

but I've not tried to use it - mostly because cc65 fits all my needs.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: SDCC for 6502

Post by barnacle »

I was just reminded of SDCC and had a quick look for updates: they're now up to 4.4 and include generation for both (either of) 6502 and 65C02.

I haven't played with it yet to find out whether the previous issues I noted - particularly with interrupt vectors - have been addressed, but it looks possible.

Neil
johnwbyrd
Posts: 89
Joined: 01 May 2017

Re: SDCC for 6502

Post by johnwbyrd »

GlennSmith wrote:
Hi,
It would be nice to have a 65c02 cross-compiler that didn't have to be forced to run under wine on linux machines(*).
Linux is a first-class host for llvm-mos, and it supports 65c02 natively.
GlennSmith
Posts: 162
Joined: 26 Dec 2002
Location: Occitanie, France

Re: SDCC for 6502

Post by GlennSmith »

Quote:
Linux is a first-class host for llvm-mos, and it supports 65c02 natively.
Wow! (or Gosh! or somesuch) : it looks a bit frightening at first... As I haven't yet created the customization files for my setup in cc65 , I'll try and do a comparison between the two environments. The big + for cc65 is that there are many of you out there using it regularly.
Thanks, in any case.
Glenn-in-France
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: SDCC for 6502

Post by drogon »

GlennSmith wrote:
Quote:
Linux is a first-class host for llvm-mos, and it supports 65c02 natively.
Wow! (or Gosh! or somesuch) : it looks a bit frightening at first... As I haven't yet created the customization files for my setup in cc65 , I'll try and do a comparison between the two environments. The big + for cc65 is that there are many of you out there using it regularly.
Thanks, in any case.
Which is a bit of a downer for the LLVM system and those who have made it happen, however unless you're already an LLVM / Clang user, then the "getting into it" may well feel somewhat daunting.

I'm sticking to cc65 for now.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
johnwbyrd
Posts: 89
Joined: 01 May 2017

Re: SDCC for 6502

Post by johnwbyrd »

drogon wrote:
GlennSmith wrote:
Quote:
Linux is a first-class host for llvm-mos, and it supports 65c02 natively.
Wow! (or Gosh! or somesuch) : it looks a bit frightening at first... As I haven't yet created the customization files for my setup in cc65 , I'll try and do a comparison between the two environments. The big + for cc65 is that there are many of you out there using it regularly.
Thanks, in any case.
Which is a bit of a downer for the LLVM system and those who have made it happen, however unless you're already an LLVM / Clang user, then the "getting into it" may well feel somewhat daunting.

I'm sticking to cc65 for now.

-Gordon
Yep, gravity is a thing. cc65 definitely has a much larger installed base. Most of the people using llvm-mos right now are either cycle counters, or people who need strict C compliance. Anyway, as the home page points out, the compiler is on Godbolt, so you can play with it without installing anything. https://godbolt.org/z/T5r1xPYG9
User avatar
Yuri
Posts: 371
Joined: 28 Feb 2023
Location: Texas

Re: SDCC for 6502

Post by Yuri »

johnwbyrd wrote:
Yep, gravity is a thing. cc65 definitely has a much larger installed base. Most of the people using llvm-mos right now are either cycle counters, or people who need strict C compliance. Anyway, as the home page points out, the compiler is on Godbolt, so you can play with it without installing anything. https://godbolt.org/z/T5r1xPYG9
Wait, there's an LLVM back end that will spit out 6502 assembly? o_O
Post Reply