ZBasic Language Reference
4
ZX Microcontroller Family
D for more detailed information on the ZX-44/ZX-44a including several suggested connection diagrams.
See Appendix E for more detailed information on the suggested ZX-1281 circuitry and Appendix Ffor the
ZX-1280.
The ZX-328n is a 28-pin DIP format integrated circuit that is programmed with the ZX native mode control
program. In order to use the ZX-328n you must add a few external components such as a regulated
supply, a crystal and serial interface circuitry. See Appendix G for more detailed information on the ZX-
328n including several suggested connection diagrams.
It should be noted that ZBasic is a superset of NetMedias BasicX language, incorporating many
improvements and advanced features. Many, perhaps even most, BasicX programs can be recompiled
using the ZBasic compiler and the resulting code should run exactly as it would on the BX-24
microcontroller except for differences due to the fact that the ZX is twice as fast as the BX-24. See
Chapter 5 for more information on compatibility issues.
The n-suffix ZX devices run in native mode meaning that the ZBasic application is compiled to native
object code for the processor. In contrast, the other ZX devices contain a virtual machine (commonly
referred to as a VM) and ZBasic applications are compiled to instruction codes that are executed by the
VM. The primary advantage of the native mode devices is that the application executes faster but the
disadvantage is that the resulting program is larger than the corresponding VM mode program.
Some ZX devices mentioned in this manual have an "e" suffix, e.g. ZX-24e, ZX-24ne. These extended
devices are produced by Oak Micros under license from Elba Corp. and are available in both VM and
native mode versions.
1.3 Conventions
In this manual, specific examples of things that can appear in your ZBasic program are shown in
Courier typeface as are descriptions of the syntax of program elements. Otherwise, discussion and
general references to program elements will be shown in Arial typeface.
When describing the syntax of a ZBasic language element, sometimes portions of it are optional. This
fact is indicated by enclosing the optional portion with left and right square brackets. Literal elements,
those that must appear as typed (but without regard to alphabetic case, of course) appear as themselves.
Often, it is useful to describe an element generally rather than giving a specific instance. When this is
done, the description will be italicized and enclosed with left and right angle brackets and subsequent text
will describe the characteristics of the generalized item.
Here is an example that uses these conventions:
[Private] Const <name> As <type> = <value>
The idea being conveyed is that this program element may begin with the Private keyword or it may be
omitted, i.e. it is optional. The keywords Const and As are specified literally as is the equal sign. The
name of the constant to be defined, its type and value are all specified using a descriptive word or phrase
enclosed in angle brackets. These placeholder components will be explicitly described in the discussion
of the program element.
In some instances, there may be more than one optional element that may appear in a given position. In
these cases, the vertical bar character is used to indicate that any one element may be used, but not
more than one, of course.
[Public | Private] Const <name> As <type> = <value>
This conveys the idea that the either the keyword Public or the keyword Private may be present but it
is also permissible for neither to be present.
In other cases, there may be a set of elements from which exactly one must be chosen.