TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

Add support of Tiny C Compiler (TCC) compiler

Open nesbox opened this issue 7 years ago • 14 comments
trafficstars

https://bellard.org/tcc/

nesbox avatar Aug 01 '18 06:08 nesbox

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

RobLoach avatar Aug 16 '19 05:08 RobLoach

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.

Anrock avatar Nov 06 '20 10:11 Anrock

Ok, let's give it a try :)

nesbox avatar Nov 06 '20 10:11 nesbox

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 avatar Nov 05 '21 03:11 joshgoebel

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 avatar Nov 05 '21 05:11 joshgoebel

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.

joshgoebel avatar Jan 01 '22 22:01 joshgoebel

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

nesbox avatar Jan 02 '22 08:01 nesbox

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:

RobLoach avatar Jan 02 '22 17:01 RobLoach

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... :-)

joshgoebel avatar Jan 02 '22 18:01 joshgoebel

Ah, I understand the motivation now haha

RobLoach avatar Jan 02 '22 18:01 RobLoach

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".

joshgoebel avatar Jan 02 '22 19:01 joshgoebel

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

aliceisjustplaying avatar May 02 '24 16:05 aliceisjustplaying

Compiled to WASM, yes.

joshgoebel avatar May 03 '24 15:05 joshgoebel

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

aliceisjustplaying avatar May 03 '24 16:05 aliceisjustplaying