5 ms·
Why is he doing this with an x86 compiler. The c64 used a 6510. None of this code would ever work. ...Oh, if you jump to about halfway through he starts using
by egypturnash 10y ago
Why is he doing this with an x86 compiler. The c64 used a 6510. None of this code would ever work.
...Oh, if you jump to about halfway through he starts using an x86->65xx translator. Okay. Nice.
- Hydraulix989 10y agoThere already seems to be a 6502 backend for LLVM specifically geared for c64: https://github.com/c64scene-ar/llvm-6502 https://github.com/c64scene-ar/llvm-6502 Which means you can just use the clang frontend and even write C++17 code which compiles down to 6502 ML.
- lefticus 10y agoI was unable to get any of the existing 3 llvm 6502 backends to produce reasonable code. Which is why I went this route. I meant to mention that in the video...
- hermanhermitage 10y agoThere's also https://github.com/puppeh/gcc-6502 https://github.com/puppeh/gcc-6502 and https://github.com/puppeh/gcc-6502-bits https://github.com/puppeh/gcc-6502-bits to get 6502 directly out of gcc.
- lefticus 10y agoI don't believe I found those, thank you.
- smcl 10y agoBy reasonable code do you mean performant, or just plain working?
- Hydraulix989 10y agoIf I had to guess, now knowing that there's a crushing stack size limitation for 6502 CPU, probably "just plain working."
- cmrdporcupine 10y ago6502 is notoriously difficult to target a C compiler to. Limited stack depth, only 3 registers, and I believe some other limitations to the ISA that make hand it hard to target C to it. cc65 seems to be the only viable one around last I looked. And it doesn't support the 65816, only the 6502. WDC offers their own compiler, but it's not fully open/free.