Using Alternative Data Types

Most Proton commands will support a range of data types without requiring Type Conversion.  To enable your macros to be equally accommodating the wizard can generate code which is specific to the context in which it is used.  For example, a Macro might take a word variable argument in one instance in the code and that same argument as a byte in a different instance.

 

When you check “Use Alt” against any argument or check “Allow Type Conversion” in step 1 the wizard will generate a set of conditional statements each invoking different data move code according to the data type being presented in the current instance of the macro.

 

Note – when relying on type conversion you should be aware of the potential errors that could arise when passing data to a different data type.  E.g. a 16 bit word, unless it contains a value of less than 255, will not pass the correct value into a data byte variable.

 

With “Use Alt” unchecked the code will always pass a variable of the given size or, where appropriate, a number (literal) of equivalent size.  If the data type is incompatible it will generate an error message in the assembler.

 

The list below shows how each data type is handled by the generator:

 

Var Type

Allowed Types

Alternative Types

Byte

Byte, Num 8

Word, Dword, Float, Num16, Num 32

Word

Word, Num 16

Byte, Word, Dword, Num8, Num 32

DWord

DWord, Num32

Byte, Word, Float, Num8, Num16

Float

Float, Num32

Byte, Word, DWord, Num8 Num16

Label

Label, Num16

Word, Num8, Num16

Char

ASCII Char, Num8

None

String

String(Ptr), Num 16

None

Byte Array

Byte Array (Ptr)

None

Word Array

Word Array (Ptr)

None