nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
5.03k stars 489 forks source link

Add support of Tiny C Compiler (TCC) compiler #648

Open nesbox opened 6 years ago

nesbox commented 6 years ago

https://bellard.org/tcc/

RobLoach commented 5 years ago

Looks like it's no longer maintained? :cry:

Anrock commented 4 years ago

Lots of fresh commits in repo: https://repo.or.cz/w/tinycc.git. Even if Fabrice Bellard himself it no longer working on a project - it's opensource and there are a lot of contributors there.

nesbox commented 4 years ago

Ok, let's give it a try :)

joshgoebel commented 3 years ago

You mean as a language you could use to write cartridges? That would be cool, but...

tcc generates x86 code.

Do you have some idea how this would work? We support running languages in a variety of VMs (Lua, Wren, JS)... so we need something that includes it's own VM or runtime, not native x86 code.

joshgoebel commented 3 years ago

https://github.com/jpoirier/picoc (a C interpreter) looks like it might be more up-to-speed, but also seems quite old with no activity?

joshgoebel commented 2 years ago

Or C/C++ via WASM, ie #1259. This should be doable as soon as I push my PR. Though the workflow might be a bit more complex than if it was "built in" in the same way the other interpreters are.

nesbox commented 2 years ago

I wanted to use TCC as a compiler for TIC code, not to write carts :)

RobLoach commented 2 years ago

I have to agree with nesbox here. Writing a TIC-80 cart in C when you could chose Lua or Wren seems insane :upside_down_face:

joshgoebel commented 2 years ago

Well, C isn't the language I'd pick either, just it happens to be an easy target to support for WASM - so someone who is a super pro with C might feel differently... :-)

RobLoach commented 2 years ago

Ah, I understand the motivation now haha

joshgoebel commented 2 years ago

I think porting games from other platforms written in C might be one reason someone would be interested. I could take my Arduboy Remastered work for WASM-4 and now drop it right into TIC-80 with very little effort because of the ability to compile C and have everything "just work".

aliceisjustplaying commented 6 months ago

@nesbox isn't this already supported per https://github.com/nesbox/TIC-80/tree/main/templates/c?

joshgoebel commented 6 months ago

Compiled to WASM, yes.

aliceisjustplaying commented 6 months ago

ah but I guess you want to be able to write C within TIC-80.