Omron SYSMAC C200H-ASC02 Operation Manual page 75

Ascii unit
Hide thumbs Also See for SYSMAC C200H-ASC02:
Table of Contents

Advertisement

BASIC Language
VARPTR Function
2002
LDD 2,X
2004
ADD #10
2007
STD 2,X
2009
PULX
2010
PULA
2011
RTS
Program Remarks:
When program execution branches to the assembly language routine, the
TYPE of <argument> is stored in the accumulator A, and the memory ad-
dress where the argument is stored is input to the index register X. The value
of the argument is stored in the accumulator D, to whose contents &H10 will
be added. The result of the addition is written to the address of <argument>.
Purpose:
Returns the memory address of the variable argument
Format:
<x> = VARPTR(<variable>)
<variable> is a number, string, or array variable.
Example:
B = VARPTR (A)
Remarks:
The VARPTR function returns the address of the first byte of data identified
with the variable. A value must be assigned to the variable prior to the call to
VARPTR or an error will result. Any type variable name may be used (numer-
ic, string, array).
Note that all simple variables should be assigned before calling VARPTR for
an array because addresses of arrays change whenever a new simple vari-
able is assigned.
VARPTR is used to obtain the address of a variable or array so that it may be
passed to an assembly language subroutine. A function call of the form
VARPTR(A(0)) is specified when passing an array, so that the lowest ad-
dressed element of the array is returned.
The following figure illustrates the relationship between the variable type and
the address indicated by VARPTR.
Section 4-2
65

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents