A new well-known compiler

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: A new well-known compiler

Post by iss »

(Continuing this thread because the info is still preliminary to open new one.)



This is Ascii Frogger by @rax (without game logic) used as benchmark.
Attached you can find the source code and TAP files with self-explaining names which compiler was used.
You can compare the sizes of TAP's too.

Unfortunately the fastest compilers have more problems for normal usage - unimplemented use-cases, non standard C dialect, etc.
Attachments
ascii-frogger-benchmark.zip
(7.14 KiB) Downloaded 102 times
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: A new well-known compiler

Post by iss »

... attached are all intermediate files from compilation (generated c->asm, objects, etc).
If someone is interested can have deeper look inside the compilations process.
Attachments
ascii-frogger-compilation.zip
(1.56 MiB) Downloaded 114 times
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: A new well-known compiler

Post by jbperin »

What's interesting in some compilers you're experiencing is that they are true 8 bits compilers.
I think it helps to make them more efficient and space saving.
It seems to me that the one in OSDK allways work on 16 bits variables even for simple 8 bits typed variables (such as unsigned char or char).

I also like the way they use the stack.

For gcc and kickc, the generated assembly code is surprisingly light.
Here's an example for instruction:

Code: Select all

vallo >>= 4;
VBCC does:
VBCCconvertsShift.PNG
Where Kickc does:
KickCconvertsShift.PNG
And GCC also does:
GCCconvertsShift.PNG
Very impressive.
applepie
Officer Cadet
Posts: 45
Joined: Thu Dec 15, 2022 4:53 pm

Re: A new well-known compiler

Post by applepie »

Iss this benchmark is very interesting ! Would you share the linker script (.ld) you used for kickc ? In the .zip archive I can see the none.tgt target file but not the linker one...
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: A new well-known compiler

Post by iss »

applepie wrote: Mon Dec 26, 2022 5:29 pm...linker script (.ld) you used for kickc ?
Attached. 'none.cfg' is actually the '.ld' ;)
Attachments
kickc-none-link.zip
(556 Bytes) Downloaded 53 times
applepie
Officer Cadet
Posts: 45
Joined: Thu Dec 15, 2022 4:53 pm

Re: A new well-known compiler

Post by applepie »

Thank you !

One more question : I can't see anything specific to the Oric in those two files, how did you managed to configure memory, start address ? kickc --help does not give any clue.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: A new well-known compiler

Post by iss »

The start address is set with 'none.tgt'

Code: Select all

{
    "extension": "bin",
    "link": "none.cfg",
    "start_address": "@START@",
    "cpu": "MOS6502X",
    "interrupt": "hardware_all",
    "emulator": "mos6502vm"
}
I change the '@START@' string to the desired value during linking.
Post Reply