Skip to main content

AddressOf

Syntax

* ... =  ADDRESSOF( sub/function  )                       * ' get the starting address of the sub/function

   or    ... = ADDRESSOF ( variable/string )

Description

The address of a variable or function can be determined with the ADDRESSOF operator.   Earlier versions of the compiler did not use ( ) around the object, and that syntax is still allowed though not recommended.

The variable, string, sub or function must be declared prior to the use of ADDRESSOF operation.

Example

xx = 0

interrupt sub doit
' insert
code to clear the interrupt
xx = xx+1
end
sub

'... other code including MAIN
go here

VICVectAddr3 =
ADDRESSOF ( doit ) +1 ' setup the 3rd interrupt to
execute doit (+1 for Thumb code)

Differences from other BASICs

  • no equivalent in Visual BASIC
  • no equivalent in PBASIC

See also