164 of 318
ZBasic System Library 154 ZX Microcontroller Family MemAddress Type Function returning Integer Invocation MemAddress(var) Parameter Method Type Description var ByRef any variable The variable of which the address is desired. Discussion This function returns the Integer representation of the RAM address of the specified variable. Note that for arrays, you may also specify subscript expressions for all of the array dimensions to yield the address of an individual array element. Without the subscript expressions, the resulting value will be the address of the first element of the array. This function is useful for deriving the address to pass to the several functions that require a RAM address, e.g. BitCopy(), RamPeek(), RamPoke(), etc. The address of any variable can also be obtained using the DataAddress property. For RAM-based variables, the DataAddress property is of type UnsignedInteger. Example Dim addr as Integer Dim ba(1 to 20) as Byte Dim fval as Single addr = MemAddress(fval) addr = MemAddress(ba) addr = MemAddress(ba(2)) addr = fval.DataAddress addr = ba.DataAddress addr = ba.DataAddress(2) Compatibility BasicX only supports the DataAddress property for Program Memory data items. See Also MemAddressU, VarPtr