8
Overview
©2000-2008 Tibbo Technology Inc.
it is not native binary code which the hardware processor can understand directly;
instead, it is interpreted by the VM.
Since the VM is under the complete control of the Master Process, the actual
hardware processor will not crash because of an error in your Tibbo Basic
application. Your application may operate incorrectly, but you still will be able to
debug it. The Master Process can stop or restart the Virtual Machine at will, and
can exchange debug information with TIDE, such as report current execution state,
variable values, etc.
Simply put, you can think of the VM as a sort of a 'sandbox' within the processor.
Your application can play freely, without the possibility of crashing or stalling TiOS
due to some error.
The queue is used to 'feed' your program with
which it should handle.
The Master Process monitors the various interfaces of the platform and generates
events, putting them into the queue. The Virtual Machine extracts these events
from the other side of the queue and feeds your program with them. Various parts
of your program execute in response to events.
Objects
Objects represent the various component part of your platform. For example, a
platform with a serial port might have a ser object. A platform can be described as
a collection of objects.
Under Tibbo Basic, the set of object you get for each platform is fixed. You cannot
add new objects or create multiple instances of the same object.
Objects have properties, methods and events. A property can be likened to an
attribute of the object, and a method is an action that the object can perform.
are described in the next section.
Objects are covered in further detail under
Objects, Events and Platform Functions
.
Events
An event is something which happens to an object. Plain and simple. A fridge
might have door object with an on_door_open event, and a paper shredder might
have a detector object with an on_paper_detected event.
Events are a core concept in Tibbo Basic. They are the primary way in which code
gets executed.
The target device maintains an event queue. All events registered by the system
go into this queue. On the other end of the queue, the Virtual Machine takes out
one event at a time and calls an event handler for each event.
Event handlers are subroutines in your code which are 'fired' (executed) to handle
an event. Often, event handlers contain function calls which run other parts of the
program.
While processing an event, other events may happen. These events are then
queued for processing, and patiently wait for the first event to complete before
beginning execution.
All Tibbo Basic programs are single-threaded, so there is only one event queue. All
events are executed in the exact order in which they were queued.
It may sometimes seem that some events should get priority over other events.
This functionality is not supported under Tibbo Basic. This is not crucial, as events
8
8
78