xTibor / rs-on-c64

Running Rust code on the Commodore 64
46 stars 4 forks source link

Update patches for MRustC and CC65 #1

Open Serentty opened 5 years ago

Serentty commented 5 years ago

It should be easy to patch a newer version of CC65, as only a few lines need to be changed, but the file codegen_c.cpp in MRustC has changed significantly, so the patch for it needs to be updated in order to work with current versions of the compiler.

xTibor commented 5 years ago

To be honest I moved on from this experiment. I kinda lost interest in C64 programming for a while after I learned that CSDb banned my account for inactivity and now they want me to beg forgiveness to their mods to reinstate it. There was an another C64 musicdisk project I really wanted to release there, but bummer. Killed my enthusiasm for the platform.

However if anyone comes up with a MR for version bumping, I'll happily merge it.

Serentty commented 5 years ago

Alright. I might learn from what you've done here and make a new project, then. I'm very interested in seeing this go places.

Serentty commented 5 years ago

Would you by any chance happen to still have the files for this lying around? Stuff like your own builds of MRustC and CC65, the an already compiled version of core, and stuff like that? Trying to replicate your results is proving challenging, and it would be helpful to have something to use for reference.

xTibor commented 5 years ago

You don't need core, just the mrustc binary in a state to be able to spit out a .c source. After it produced that C source it's gonna fail with some build error, disregard that. Then compile that file further with CC65. (See the compile.sh for the exact commands I used)

I don't have the compiler binaries anymore. Just apply the patches I made and follow the standard build procedures of those project. That's what I did.

Serentty commented 5 years ago

Alright, I'll take a look again.

Serentty commented 5 years ago

I haven't been able to get things to work without compiling core somehow. Your own example seems to use stuff from it, too. Are you sure you didn't compile it somehow, and if not, do you remember how you did it?

xTibor commented 5 years ago

They are compiler intrinsics, MRustc recognizes those and directly emits memcpy and friends on them without needing anything from core for compiling the C source.

Serentty commented 5 years ago

Huh, interesting. When I tried it the compiler looked for core. Do I have to do something to tell it not to try to link core?

xTibor commented 5 years ago

No idea then. Are you sure it didn't produce any C file in your working directory before throwing that error? Mrustc is expected to fail after codegen in the compilation step. What is exactly looking for core? Logs?

Serentty commented 5 years ago

Ah, I think I was passing CC=cc65 to MRustC to get it to use CC65 for the final step. I'll try doing it manually next time.

kfox commented 5 years ago

@Serentty if you get it working, let me know. i was also trying to replicate @xTibor 's setup to no avail, but would still love to try using Rust on the C64! 😄

Serentty commented 4 years ago

@xTibor I was working for quite a while to get this working, but I wasn't able to, and neither were my friends who also tried. I ended up moving on kind of how you did, but now there's a new homebrew 6502-based computer by The 8-Bit Guy that has rekindled my interest in getting Rust to run on the 6502. Tell me if you ever get back into this. In the meantime, Mutabah said he'd be willing to lend me a little time in order to get MRustC working with CC65 again, but no promises.