lynn / chibicc

A small C compiler… for uxn
MIT License
118 stars 5 forks source link

Official releases of uxnasm won't assemble the cc output right now #5

Closed hikari-no-yume closed 1 year ago

hikari-no-yume commented 1 year ago

The version of uxnasm included in the macOS binary release at https://100r.co/site/uxn.html doesn't accept the output from this compiler right now:

$ gcc -I. -P -E examples/day3.c -o tmp.c
$ ./chibicc tmp.c > c.tal
$ uxnasm c.tal c.rom
Unknown token: main
Unknown token: main
Assembly: Failed to assemble rom.
$

lynn says it's because a bare token like main being a function call is a newish feature. It works when building the latest uxnasm from source (git clone https://git.sr.ht/~rabbits/uxn && cd uxn && ./build.sh).

I guess many other people might have one of these binary releases, so we might want to change the emitted function calls to work the old way.

lynn commented 1 year ago

For reference the "immediate rune" shortcuts that were introduced into uxnasm just 4-5 months ago are…

The old forms each assemble into 4 bytes (LIT2 + address + opcode), the new forms into 3 bytes (opcode + address).

neauoire commented 1 year ago

The old builds have been updated and should include a uxnasm that supports immediate words. No need to support the old forms. Even the self-hosted assembler(drifblim) that I use supports them.

lynn commented 1 year ago

Thanks, @neauoire! I think that nicely addresses this.