4MELFA-BASIC IV
Detailed specifications of MELFA-BASIC V
4-138
4.3.24 User-defined external variables
If the number of program external variables listed above is insufficient or it is desired to define variables with
unique names, the user can define program external variables using a user base program.
(1) By defining a variable having an underscore (_) for the second character of the identifier with the DEF
statement in the user base program
Note)
, that variable will be handled as an external variable.
(2) It is not necessary to execute the user base program.
(3) Write only the lines necessary for declaring variables in the user base program.
(4) If it is desired to define array variables in a user base program and use them as external variables, it
is necessary to declare them using the Dim instruction again in the program in which they will be
used. It is not necessary to declare local variables (variables valid only within programs) again.
Example) Example of using user-defined external variables
On the main program (program name 1) side
On the user base program (program name UBP) side
Procedure before using user-defined external variables
1) First, write a user base program. Use "_" for the second character of the variables.
2) Register the program name in the "PRGUSR" parameter and turn the power off and on again.
3) Write a normal program using the user-defined external variables.
10 Dim P_200(10)
' Re-declaration of external variables
20 Dim M_200(10)
' Re-declaration of external variables
30 Mov P_100(1)
40 If M_200(1) =1 Then Hlt
50 M1=1
' Local variable
10 Def Pos P_900, P_901, P_902, P_903
20 Dim P_200(10)
' It is necessary to declare this variable again in the
program in which they will be used.
30 Def Inte M_100
40 Dim M_200(10)
' It is necessary to declare this variable again in the
program in which they will be used.
Parameter name
Value
PRGUSR
UBP