Syntax:
Part | Description |
<RoutineType> |
Required. This tells the compiler what type of routine you've created. Acceptable values are:
|
<ParameterList> |
Optional. Parameter Lists are optional and their restrictions depend on whether the routine is an ASM routine or not.
For non-ASM routines, you would declare your arguments just like you would in the Dim and Global commands. See the example below. For ASM routines, see below in the notes section. |
<Type> | Optional. The As <Type> is used only on functions, not Asm Functions or either type of Sub. If the As <Type> is omitted, the compiler will look to see if the function name has an identifier and will assign the <Type> automatically. |
Notes (Taken from the Basiegaxorz documentation):
The parameter list specifies which values from the called function go into the CPU registers. The parameter list can accept the data registers, d0-d7, which will return the actual values of what the programmer passes to the sub or function.
When specifying a data register, the size of the data register (byte, word, or long) has to be specified somewhere in the parameter list, along with the actual data register. For instance, to put a byte value into d0, you could use either the d0.b or d0 as byte (both will do the same thing). The same goes for word, and long data types. If an address register, a0-a7, is specified, the pointer that holds the value that is passed to the sub or function will be returned. The pointer will only return the value in the heap. It will not return the actual location of a variable.
A size doesn't have to be specified for address registers, since a long, or 32-bit magnitude is always assumed. However, a data type has to be specified for an address register, so that the compiler will be able to distinguish whether it should return a pointer for an integer value, or a long value, or a string (all which have different offsets in the heap).
Acceptable parameters:
Example: