Navigation:  Reference > Commands >

User Defined Command

Print this Topic Previous pageReturn to chapter overviewNext page

 

This will define the beginning of (or entry to) a User Defined Command (UDC).

 

CMD sac Required - This is a special alpha constant.  It is the name you give to this command.  It may be up to 32 characters long.  It must not be the same as any line label used anywhere else in the program.

 

udc_parameters fn/v1,fn/v2,...,fn/vx The values being passed to the UDC.  A maximum of 20 fields may be specified.  The field names are separated with commas.

 

 

COMMENTS

This command allows you to create your own commands within TAS.  It is similar to using a GOSUB, however, you can pass values at the same time.  The UDC does not allow you to return a value.  For that, you should refer to the UDF (User Defined Function).

 

NOTE:  You must include the compiler directive #UDX before the first user defined command is referenced in the program.  This alerts the compiler that there are UDCs (or UDFs) in your code and, when it runs into a command it doesn't recognize, it adds it to the label list rather than generating an error message.

 

NOTE:  In the command line itself (that calls the UDC) you may use fields, constants and expressions.

 

NOTE:  Make sure you don't use the UDC in the program as you would a function.  For example, don't make the example, SmallCmd, listed below, look like this:

 

SmallCmd('A',99,x+1)

 

If you do you will get an error that a label was used but not found in your program.

 

 

SEE ALSO

FUNC

 

EXAMPLE

x = 10

SmallCmd 'A', 99, x+1

//more code here

ret

 

 

cmd SmallCmd sc1, sc2, sc3

#proc

Define sc1 type a size 1 local

Define sc2 type i size 2 local

Define sc3 type i size 4 local

//Do what ever you want here.

 // MSG for SC1 SC2 and SC3 'A 99 11'

#endp

 ret

 

 


Page url: http://www.cassoftware.com/tas/manual/userdefinedcommand.htm