Page 2 of 2

Re: ConBasic- Hello World

Posted: Tue Apr 21, 2020 2:42 pm
by joshklod
Hi all,

I'm not sure I entirely understand this discussion, it's just barely over my head. That said, I would be very interested in a way to incorporate pieces of C code into a larger BASIC program.

I can see two major benefits of this:
  • Interfacing with C libraries supplied by vendors
  • Gradually transitioning from BASIC to C one module at a time
Please tell me that this is possible.

Re: ConBasic- Hello World

Posted: Wed Apr 22, 2020 3:56 pm
by basicchip
In theory mixing C and BASIC could be done, but it would not be straight forward. All the hooks are there, but in my opinion it would be a hard task to try to mix the 2.

C on BASiC calls routines in the firmware for IO, PRINT and a number of other functions. Those happen to be written in C.

Taking advantage of that you could translate BASIC to C-on-BASIC with mostly syntax changes. It depends on how large your program is and whether you need to do more than one program, whether you try to automate that or not.

Going from C to BASIC would be much harder as there are lots of things BASIC doesn't really support, structures, types, multidimensional arrays, unions, ...