Navigation bar
  Start Previous page
 49 of 158 
Next page End  

43
Caution: although Program Memory data items can be modified, the memory in which they are stored
has a write cycle limit.  For ZX devices with external Program Memory (e.g. the ZX-24a), the limit is
approximately a million writes.  For ZX devices with internal Program Memor (e.g. the ZX-24n), the limit is
approximately 100,000 writes.  Writing to a particular address more than this may cause the memory to
become unreliable.  Also, writing to Program Memory is much slower than writing to RAM-based
variables.
BasicX Compatibility Note
In BasicX mode, Program Memory string types are not supported nor are any vector types other
than the Byte types.  Also, in-line initializers are not supported, the DataAddress property
cannot be used to determine the address of an individual Program Memory data element, and
quoted strings cannot be used to specify data values.  Finally, Program Memory data items may
only be defined at the module level.
You may completely omit the initialization data from the definition of a Program Memory data item,
including the parentheses that normally enclose it.  If you do this, you must use the Source method to
specify the initialization data as shown below.  This alternate initialization mechanism is supported for
backward compatibility with BasicX and is not recommended for new applications.  Note, particularly, that
this somewhat odd construction involving a Call does not produce any run-time executable code.  It is
merely a signal to the compiler to read the initialization data from the specified file.
Dim d1 as New ByteVectorData
Sub Main()
Dim b as Byte
' specify the initialization data
Call d1.Source("mydata.txt")
b = d1(2)
End Sub
Only one method of specifying the initialization data can be used for any particular Program Memory data
item.  Attempting to specify the initialization data multiple times will result in a compiler error even if the
data supplied in the multiple cases is identical.
2.11 String Types
ZBasic supports several variations of the fundamental type String.  You may define a string variable
thusly:
Dim msg as String
The amount of space required for this variable definition and the maximum size of the string that it can
represent varies depending compiler command line options and Option Directives.  By default, the
maximum string size is 255 characters.  See Section 3.26 for more information on the implementation
details of the various string data types.
2.11.1 Bounded Strings
A bounded string is nothing more than a way to specify a string having a maximum length that may be
different than the default string length.  A bounded string is defined using the syntax:
{Public | Private | Dim} <name> as [New] BoundedString(<size-expr>)
Previous page Top Next page