Navigation bar
  Start Previous page
 59 of 208 
Next page End  

ZBasic Language Reference
51
ZX Microcontroller Family
End Sub
The DataAddress property can be applied to arrays and structures as well.  When used with arrays it is
best to append it after the array indices, if any.  For most data items, the type of the DataAddress
property is UnsignedInteger.  However, for compatibility with GetProgMem() and other routines related
to Program Memory, the type of the DataAddress property for Program Memory data items is Long.
Along similar lines, subroutines and functions have an associated property called CodeAddress whose
type is Long.  The CodeAddress property is employed in a similar manner as the DataAddress property is
as shown by the example below.  Of course, use of the CodeAddress property of a subroutine is not
limited to the code in the subroutine itself.  It can be applied to any subroutine or function that is visible to
the code.  In short, if you can invoke the subroutine or function, you can also get its address via the
CodeAddress property.
Example
Dim addr as Long
Sub Main()
  addr = Main.CodeAddress
End Sub
It should be noted that for native mode devices, the CodeAddress property returns a word address
instead of the usual byte address.  In most cases, this fact is transparent but it should be kept in mind for
special circumstances such as passing the address of a procedure to GetProgMem() for example.  One
advantage of this anomaly is that procedure addresses for ZX devices containing up to 128K of Program
Memory may be represented in 16-bit data items on native mode devices.
Previous page Top Next page