vbcc optimizing 6502 compiler with X16 support

All aspects of programming on the Commander X16.
vbc
Posts: 6
Joined: Tue Feb 23, 2021 3:31 pm

vbcc optimizing 6502 compiler with X16 support

Post by vbc »


Hi,

thanks to contributions from András Péteri, the vbcc compiler now comes with support for the X16. I am not very familiar with this machine, but the generated code seems to work well in an X16 emulator. Please let me know if something does not work. So far there is no banking support for this target yet. I am not sure about the state of development, but if the banking scheme is finalized, it would probably be a good idea to add the necessary library routines.

A few of the good things:

- compiler is under active development

- supports C99 (variable-length arrays, designated initializers etc.)

- generates optimized code (see dhrystones in sample directory)

- supports banked memory and far-pointers

- (limited) floating point support based on Steve Wozniaks code

- (pretty good) 32/64bit IEEE floating point support based on SANE

- support for 65C02 extensions

- support for writing interrupt handlers

- attributes for putting variables into zero page

- supports stack-frames > 256 bytes

Changes since r1:

- new target: MEGA65 (native mode, some banking support)

- new target: Commander X16 (thanks András Péteri)

- new options -prefer-statics/-force-statics (allocate local variables in static memory rather than on the stack)

- new option -range-opt (first implementation of some range-based optimizations changing induction variables to smaller types)

- added support for o65 object file format

- added support for Oric target format

- better use of x register

- improved cross-module function-inlining

- IEEE math library works with 65c02

- several code generation improvements

- fixed several bugs

- slightly reworked examples

 

User avatar
desertfish
Posts: 1094
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

vbcc optimizing 6502 compiler with X16 support

Post by desertfish »


Where can we find this new version?

vbc
Posts: 6
Joined: Tue Feb 23, 2021 3:31 pm

vbcc optimizing 6502 compiler with X16 support

Post by vbc »



1 hour ago, desertfish said:




Where can we find this new version?



Oops. Sorry, I forgot to add the link.

You can find it at http://www.compilers.de/vbcc.html (under 6502 related Download/link area).

Sean
Posts: 30
Joined: Sat Feb 06, 2021 3:13 am

vbcc optimizing 6502 compiler with X16 support

Post by Sean »



17 minutes ago, vbc said:




Oops. Sorry, I forgot to add the link.



You can find it at http://www.compilers.de/vbcc.html (under 6502 related Download/link area).



Thank you.  FYI, you did remember the link when you posted to 6502.org.

vbc
Posts: 6
Joined: Tue Feb 23, 2021 3:31 pm

vbcc optimizing 6502 compiler with X16 support

Post by vbc »

I have uploaded version 3 of the vbcc distribution for 6502 targets at http://www.compilers.de/vbcc.html



Major changes since last update:



- several bug fixes

- improved code generation

- linker mask optimizations to reduce overhead of some library functions (still much room for improvement)

- improved attribute checks for banking

- C64 new features:

+ stdio functions allow file access on 1541 compatible drives

- MEGA65 new features:

+ free license for commercial usage

+ code generator uses 32bit extensions

+ code generator uses HW multiplier

+ full automated banking support

+ ROM-less library enabling full use of the entire RAM

+ stdio functions allow reading of files on SD card

- BBC new features:

+ stdio functions allow file access

+ full automated banking support for systems with sideways RAM

+ support for command line arguments

+ configuration for clean return after exit

- CBM PET new features:

+ added as new target



We are happy to announce that the Museum of Electronic Games & Art e.V. (http://www.m-e-g-a.org) has decided to sponsor the MEGA65 version of vbcc.

This does not only help us to continue supporting and improving this port but it also allows us to relax the terms of use for the MEGA65 community. Everyone may now freely use vbcc to develop MEGA65 code for commercial as well as non-commercial usage (for details please refer to the license in the documentation).



We thank MEGA e.V. for the confidence in vbcc and hope that this step will help in the creation of new software for the MEGA65.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

vbcc optimizing 6502 compiler with X16 support

Post by TomXP411 »


I'd like to clarify something...

The documenation says (emphasis mine):


Quote




vbcc is copyright in 1995-2022 by Volker Barthelmann. This archive may be redistributed without modifications and used for non-commercial purposes.



This means we can't use vbcc to make software that we want to sell, without contacting him for a license.  So if you're planning to write commercial software for the Commander X16 using vbcc, you'll want to contact Volker Barthelmann first, to find out what his licensing terms are. 

 

User avatar
desertfish
Posts: 1094
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

vbcc optimizing 6502 compiler with X16 support

Post by desertfish »


Hm, the copyright is about vbcc itself, isn't it? It doesn't say about the generated code?

TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

vbcc optimizing 6502 compiler with X16 support

Post by TomXP411 »



On 4/29/2022 at 11:58 AM, desertfish said:




Hm, the copyright is about vbcc itself, isn't it? It doesn't say about the generated code?



It seems to say that you can't use the compiler to create commercial programs. There are exceptions in the license specifically allowing you to create Amiga and MEGA 65 programs, which implies that  creating commercial programs for any other platform are prohibited. If that's not Barthelmann's intent, then that's fine. I'm hoping @vbc will post to clarify that.



Here's the relevant text:


 


Quote




vbcc is copyright in 1995-2022 by Volker Barthelmann. This archive may be redistributed without modifications and used for non-commercial purposes.



An exception for commercial usage is granted, provided that the target CPU is M68k and the target OS is AmigaOS. Resulting binaries may be distributed commercially without further licensing. An exception for commercial usage is granted, provided that the target CPU is 6502 with MEGA65 extensions and the target HW is MEGA65. Resulting binaries may be distributed commercially without further licensing.



In all other cases you need my written consent. This copyright applies to vc, vbcc, vsc and vcpr.



The "resulting binaries" phrase points to Barthelmann placing limitations on your use of code compiled by vbcc. I can't see any other plain English reading of this that makes sense. 

Actually, a more clear license really is needed here that stipulates what exactly is covered - user compiled programs or vbcc itself, and what constitutes commercial use. @Wavicle has brought up some good examples on Discord, such as creating a program that is itself free, but then someone uses that program on something like Twitch and monetizes the stream...

The questions I have are: 

1. Can a user compile a program with vbcc and sell their compiled program? 

2. Can a user compile a program with vbcc and use the program to another purpose, such as video animations or to run a 3D printer or CNC machine?

2a. What if those uses are monetized?

3. What are the terms for a commercial license for low-volume sellers, like we'd have for the CX16, or for people using the progam for other purposes, as suggested above?

Again, I invite @vbc or Barthelmann to reach out and clarify this intent. Right now, this seems like we can only use vbcc for hobbyist use, and while that's valid, I don't want anyone to inadvertently cause themselves trouble by trying to sell something they compiled with vbcc without a commercial license.

vbc
Posts: 6
Joined: Tue Feb 23, 2021 3:31 pm

vbcc optimizing 6502 compiler with X16 support

Post by vbc »



On 4/29/2022 at 11:30 PM, TomXP411 said:




It seems to say that you can't use the compiler to create commercial programs. There are exceptions in the license specifically allowing you to create Amiga and MEGA 65 programs, which implies that  creating commercial programs for any other platform are prohibited. If that's not Barthelmann's intent, then that's fine. I'm hoping @vbc will post to clarify that.



Yes, you need to obtain a license to create commercial programs with vbcc, unless it is for one of the sponsored targets.


On 4/29/2022 at 11:30 PM, TomXP411 said:




The questions I have are: 

1. Can a user compile a program with vbcc and sell their compiled program? 



Only if they get a license.


On 4/29/2022 at 11:30 PM, TomXP411 said:




2. Can a user compile a program with vbcc and use the program to another purpose, such as video animations or to run a 3D printer or CNC machine?

2a. What if those uses are monetized?



If the program is used commercially, a license is needed. Otherwise not.


On 4/29/2022 at 11:30 PM, TomXP411 said:




3. What are the terms for a commercial license for low-volume sellers, like we'd have for the CX16, or for people using the progam for other purposes, as suggested above?



I haven't thought much about that yet. Maybe €50 for one developer on an as-is basis. I would not want it to prevent anyone from being able to use vbcc to create commercial programs for such systems. The licensing terms mainly have other customers in mind.

Also, for the CX16 I only used an emulator and never tested it on real hardware. The CX16 port is mainly based on the C64 port and it does not really make much use of CX16 features at the moment. So you should definitely test it first, before thinking about using it for commercial CX16 programs. ?

I'd be interested to hear how it works on real hardware and if there are features lacking.

Wavicle
Posts: 282
Joined: Sun Feb 21, 2021 2:40 am

vbcc optimizing 6502 compiler with X16 support

Post by Wavicle »



On 4/29/2022 at 4:42 PM, vbc said:




If the program is used commercially, a license is needed. Otherwise not.



I'm most curious about how viral the license is intended to be. There are X16 Enthusiasts here making tools and game engines for others to use. Some of those could end up in the form binary library object files. Linking against a vbcc-compiled library will implicitly include binary data produced by vbcc into that project without the library user ever touching vbcc. Will the non-commercial licensing restriction then infect that project, or stop at the library? Well-intentioned library authors need to know if there is an implicitly viral license that library users will need to be aware of.

Post Reply