*EXPA
' Save the variable content of a variable to be used as an internal variable
' --> The content of the specified variable will be stored in the storage region managed by the YVM system
Varpush A&,B&,C&,D#,E#
' The content of the variable stored by Varpush can be changed at will.
GetUnitData 2,"CR",A&
GetUnitData 3,"CR",B&
GetUnitData 4,"CR",C&
GetUnitData 5,"X",D#
4
GetUnitData 6,"Y",E#
' In the case where nesting is used in processing,
' the variables with the same names of A&,B&,C& are used in Subroutine *EXPB.
' however, the variable content will be used in *EXPB Varpush/Varpop
' saving/returning, so there will be no arbitrary rewriting of the variable content.
Gosub *EXPB
Print A&,B&,C&,D#,E#
' The content of the saved variable is returned ' --> When Varpop is executed, the variable content
saved by the nearby Varpush will be returned.
Varpop
Return
*EXPB
' The content of variables A&,B&,C&,D#,E# is stored to a different region by
' Varpush which is executed at the beginning of the *EXPA Subroutine
' so there is no danger of the content returned before disappearing.
' Varpush can be executed up to a maximum of 16 times.
Varpush A&,B&,C&,D#,E#
GetUnitData 2,"X",A&
GetUnitData 3,"X",B&
GetUnitData 4,"X",C&
D#=3
E#=100/512
Print A&,B&,C&,D#,E#
Varpop
Return
FZ4 User's Manual
Using Custom Command
293