vbcc optimizing C compiler now with Oric Atmos support
Re: vbcc optimizing C compiler now with Oric Atmos support
Regarding CC65 support of multiple architectures, yes it is definitely the way to go if you want to do multi-plateform projects.
The OSDK is only targeting the Oric, that's the only intent: I don't actively make it impossible to use it for other plateforms (that's why I added some switches to YM2MYM for example, because some MSX and Spectrum people asked for that), but supporting anything else is not part of my objective.
Regarding Tap2DSK requiring Old2MFM, yes, that's an old thing on my todo list, just never had the time to do it.
The OSDK is only targeting the Oric, that's the only intent: I don't actively make it impossible to use it for other plateforms (that's why I added some switches to YM2MYM for example, because some MSX and Spectrum people asked for that), but supporting anything else is not part of my objective.
Regarding Tap2DSK requiring Old2MFM, yes, that's an old thing on my todo list, just never had the time to do it.
- xahmol
- Flight Lieutenant
- Posts: 437
- Joined: Sun Jun 28, 2020 7:32 pm
- Location: Utrecht, The Netherlands
- Contact:
Re: vbcc optimizing C compiler now with Oric Atmos support
Oh, and to clarify DBug, was not intended in any way as criticism as I understand fully where you are coming from. Just wanted to add my perspective in staying with CC65.
- xahmol
- Flight Lieutenant
- Posts: 437
- Joined: Sun Jun 28, 2020 7:32 pm
- Location: Utrecht, The Netherlands
- Contact:
Re: vbcc optimizing C compiler now with Oric Atmos support
Very true and exactly the main reason what still makes me not considering it yet. My present code apart from the assembly part and the graphics optimalisaties is also portable to non 6502 targets using completely different cross compilers. That is what made my TI-99/4a port of Ludo possible.
On the other hand of the spectrum, things like 8BitUnity and certainly Crosslib oversimplify graphics way to much to my taste, making the games look ugly, especially on the Oric. I respect their efforts quite a lot, but prefer myself to redo graphics and music for each target separately.
I am very charmed by TRSE as well, but that one also is a complete new language in its own (or actually not new as it is basically Pascal, but for me coming from C that is a BIG hurdle). TRSE also lacks an Oric Atmos target, and a proper implementation of the C128 80 column chip.
Re: vbcc optimizing C compiler now with Oric Atmos support
I have just uploaded version r3p3 with the following additions for testing:
- new config +atmosb creates a raw binary without tape header
- new config +atmosr creates a re-entrant tape file without autostart and a BASIC header
- support for command line parameters like in cc65 implementation
- source for the atmos-specific files in libsrc/6502-atmos
- minor cleanups
Re: vbcc optimizing C compiler now with Oric Atmos support
I have uploaded an update that contains the source for the atmos startup-code in libsrc/6502-atmos.
The vbcc.pdf contains an ABI description in "6502 Backend=>ABI". vbcc comes with a standard C library, but other functions would have to be adapted as lcc apparently uses a different ABI.- Calling conventions/parameter passing, to see if we can reuse our libraries/existing code
vbcc functions will usually need its stack pointer set up (you can often get around without using the software stack, but it's hard to tell beforehand) and it needs its zero page registers. Furthermore, in some cases support functions from its library are needed (e.g. floating point or multiplication). Presumably pretty similar to the situation with lcc.- Can VBCC generate a simple function without any setup code, like for example you want to make a complete program in assembler, but call some function written in C, without having to do anything crazy complicated to make that work.
Btw. when having a short look at the osdk library functions to check the ABI, I stumbled upon the multi16 function. If I understand correctly that it does a 16x16=>16 multiplication, then it can probably be removed. In twos-complement arithmetic signed and unsigned multiplication are identical (unless the result is larger than the operands).
Re: vbcc optimizing C compiler now with Oric Atmos support
I am not on a mission to convince everybody to change their compiler. What sets vbcc apart from cc65 might be:
- much better code quality
- support for more language features like c99, floating-point, large stacks
- more standard assembly syntax
- support for more different object and output formats
- support for more 6502 derivates like 45gs02
- support for far-pointers
Re: vbcc optimizing C compiler now with Oric Atmos support
However that does not really work with cc65, because it does not preserve the data segment. Initialized variables do not have the correct values when running the program a second time.
I have now uploaded a vbcc update that contains a re-entrant config +atmosr similar to the ones I am using for C64 etc. It does create a BASIC header and can be started multiple times with RUN (with correctly initialized variables).
Re: vbcc optimizing C compiler now with Oric Atmos support
XA-VBCC sub-topic: Very good news - it works! One point goes to the vbcc
What I forgot was that actually CC65's o65 object format is different and the idea of the above search/replace thing was to link CC65 object files (or libraries) with XA and VBCC. Anyway...
Attached is simple example test.c + testa.s compiled with XA and VBCC to binary and then added TAP header.
ZIP file contains a bash build script and all intermediate files.
What I forgot was that actually CC65's o65 object format is different and the idea of the above search/replace thing was to link CC65 object files (or libraries) with XA and VBCC. Anyway...
Attached is simple example test.c + testa.s compiled with XA and VBCC to binary and then added TAP header.
ZIP file contains a bash build script and all intermediate files.
- Attachments
-
- test-xa-vbcc.zip
- (2.77 KiB) Downloaded 43 times
Re: vbcc optimizing C compiler now with Oric Atmos support
I've just updated the benchmarks: 2023-02-07 vs 2023-02-08.
It's very handy to open both link in two browser tabs and switching between them you can see the differences .
You can find also the results in csv format - it would be cool to have kind of chart but when my free time allows...
First I've used the binary Release 3 (patch 2) of vbcc for 6502 - vbcc6502_r3p2.zip then I've updated the vbcc sources from Download compiler sources (29/04/2022) - vbcc.tar.gz and the results were the same. After the last announce about Release 3 (patch 3) of vbcc for 6502 - vbcc6502_r3p3.zip - I tested it and the results are the same again.
To build the examples I'm using:
So, Very good improvement for vbcc compared to version 2022-03-xx! Congrats
It's very handy to open both link in two browser tabs and switching between them you can see the differences .
You can find also the results in csv format - it would be cool to have kind of chart but when my free time allows...
First I've used the binary Release 3 (patch 2) of vbcc for 6502 - vbcc6502_r3p2.zip then I've updated the vbcc sources from Download compiler sources (29/04/2022) - vbcc.tar.gz and the results were the same. After the last announce about Release 3 (patch 3) of vbcc for 6502 - vbcc6502_r3p3.zip - I tested it and the results are the same again.
To build the examples I'm using:
Code: Select all
$ .../bin/vbcc6502 -O=3 -speed -size -maxoptpasses=8 -quiet -o=outfile.o infile.c
Re: vbcc optimizing C compiler now with Oric Atmos support
Unfortunately that is not a good command line. When calling vbcc directly (instead of using the frontend vc), the -O option specifies a bit mask of optimizations (see the vbcc.pdf for details). -O=3 is not the same as using -O3 with the frontend. Please use either -O=991 (= -O1), -O=1023 (= -O2) or -O=-1 (= -O3). Only then will you get decent results. Also, consider that there is still more functionality in the frontend, e.g. calling the code compressor or doing cross-module optimizations.iss wrote: ↑Wed Feb 08, 2023 5:58 pm To build the examples I'm using:Code: Select all
$ .../bin/vbcc6502 -O=3 -speed -size -maxoptpasses=8 -quiet -o=outfile.o infile.c
-maxoptpasses=8 seems a bit low.
Furthermore, -speed and -size tell the compiler whether you want to optimize for speed or for size. So using both does not really make sense. Use -speed for fast code and -size for small code. Not specifying either will use a reasonable compromise.
Optimizing for size is still a bit neglected in vbcc, so you might try either -O=991 -size or -O=-1 -size. It is a bit hit and miss which option yields better results. Also you can try to run the code compressor (vcpr6502) when you only care about size and do not mind slower code.
Re: vbcc optimizing C compiler now with Oric Atmos support
Maybe it would make sense to have some tooltips on each of the column headers to show the command line parameters used to build each version.iss wrote: ↑Wed Feb 08, 2023 5:58 pm I've just updated the benchmarks: 2023-02-07 vs 2023-02-08.
It's very handy to open both link in two browser tabs and switching between them you can see the differences .
Re: vbcc optimizing C compiler now with Oric Atmos support
Indeed, I have this in my build script
Code: Select all
# 111110000000000
# 432109876543210
# CFLAGS="${CFLAGS} -O=$(echo "ibase=2;000000100010011"| bc)"
Tooltips... nice idea!
Re: vbcc optimizing C compiler now with Oric Atmos support
Maybe also indicate somewhere on the page what C and R actually mean
- xahmol
- Flight Lieutenant
- Posts: 437
- Joined: Sun Jun 28, 2020 7:32 pm
- Location: Utrecht, The Netherlands
- Contact:
Re: vbcc optimizing C compiler now with Oric Atmos support
Recognise that, but always took that as a given therefore never use variables where that is an issue as pre-initialised. Good to know though that this can be different in your compiler.
Of the other features, for me it is a little bit hard to appreciate things that I never learned to use. Proper float support might be handy. For the rest: I learned C to code in CC65, so never learned proper C So that also causes that I do not miss what CC65 does not have.
Understand floats. The rest I have to study if that would be beneficial for what I do.