|Top Previous Next|
This is not a BASIC/C tutorial
What is it, then?
It's a brief introduction to Tibbo BASIC and Tibbo C aimed at showing you what's there and what's not, and what is different from other popular BASIC/C implementations.
The popular C implementation is the ANSI C standard, popularized by the classical 1978 book by Kernighan and Ritchie titled "The C Programming Language". You can still buy it on Amazon.
A popular version of BASIC is harder to pinpoint. Many developers have a concept of what the modern BASIC is, and this concept is often an amalgam of several BASIC implementations.
BASIC and C are equals
BASIC is not simpler. C isn't faster. Choosing one over another is largely a matter of personal preference and habit.
The only exception is pointer arithmetic — if you need pointers you have to go with C.
Tibbo BASIC or C. Tibbo BASIC and C.
Tibbo BASIC and Tibbo C are two independent programming languages. Each has its own compiler, both rely on the same linker.
You may choose to develop applications in Tibbo BASIC, Tibbo C, or a combination of the two.
When they coexist in a single application, Tibbo BASIC and C can only exchange data through simple variable types (bytes, words, etc.).
Although both BASIC and C support arrays and structures, their implementations are different between these two languages.
Tibbo BASIC and C applications are event-driven — all code is executed in event handlers, which are invoked in response to events.
This is known as the event-based execution.
Static memory model
Tibbo BASIC and C use the static memory model — all RAM is allocated at compile time and there is no heap.
PROs: no "out of memory" situations — ever! No need for garbage collection and no associated overhead.
CONs: No dynamic sizing of memory structures. No dynamic object creation/destruction. No recursion or reentrant calls.
Declare before use
In Tibbo BASIC/C, all variables, procedures (functions), etc. must be declared before they can be used.
There are no "invariant" types or "if I used it then it must exist" assumptions.
No B.S. (babysitting, that is)
Some development system are over-the-top protective. You get a flood of warnings about minute things.
We don't like this. You are not going to get a warning when a variable "overflows" or when you assign a 16-bit value to an 8-bit variable.
We just assume it's by design, as it often is!
Tibbo BASIC and C are "pure"
...In the sense that the two languages have just the minimal set of operators, constructs, etc. to make them useful.
All input/output and device-specific stuff are handled by objects, which are specific to the selected target platform.
For example, you won't find a PRINT (or printf) statement in Tibbo BASIC or C — because there is no default output device to print to.
If your target device doesn't have an LCD then there is no lcd. object and no printing to the LCD.
And so on. You get the picture.
BASIC and C don't care about lines (and line breaks)
That's right. You can have the entire contents of your file on a single line, and that will be OK.
Line breaks (or absence thereof) do not add any meaning to your code.
For compatibility with many other BASIC incarnations, Tibbo BASIC supports statement separation with colons.
This is purely for your convenience. The compiler doesn't care if you use colons or not.
There are two exception to this rule.
The first one is the single-line if-then_else construct in BASIC.
The way it is designed requires that it is placed and fits entirely on its own separate line:
The second exception concerns preprocessor directives. These cannot be split into multiple lines.