ConBasic- Hello World

Questions about the BASICtools and MakeItC
joshklod
Posts: 7
Joined: Tue Feb 27, 2018 7:52 pm

Re: ConBasic- Hello World

Post 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.



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ConBasic- Hello World

Post 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, ...

Post Reply