3.A constant value is stored in 16 nibbles.

4.Having constants starting with something that can be interpreted as a hex number, or an ARM register is not a good idea as the compiler might get confused. For example: DC SPFOO 4 MOV R4 SPFOO will generate an error on FOO as the compiler will interpret the mov as a mov from SP to R4.

MASD introduces a ‘constant pointer’ called CP which helps to define constants. CP is defined by:

CP=ExpressionHex

CP is defined by 5 nibbles; its default value is 80100 (an area of memory that can be used freely by programmers). To declare a constant with the current CP value and then increase CP by Increment:

EQUCP Increment ConstantName

Notes:

1.In ASM and ARM mode, DCCP Increment ConstantName is also valid

2.Increment is a hexadecimal value, to use a decimal value, put a leading #.

For example, if CP equals to $10, the following defines a Foo constant with a value of $10 and then changes the value of CP to $15:

EQUCP 5 Foo

Several constants can be defined at once using CP.

: Inc CstName0 CstName1 ... CstNameN-1 :

The above defines N constants CstNamex with a value of CP+x*Inc and then changes the CP value to CP+N*Inc. By default, Inc is a decimal number or an expression that can be immediately evaluated.

These features are extremely useful to define areas of memory for storage of ASM program variables.

Notes:

1.If the entry point library (see related section) is installed on your calculator, all the values in the constant library will be available in your programs the same way than constants are.

2.You can define a constant in your program to override the value of an entry in the equation library.

Expressions

An expression is a mathematical operation that is calculated at compilation time. Terms of this operation are hexadecimal or decimal values, constants or labels. An expression stops on a separation character or a ‘]’.

DCCP 5 @Data

...

D1=(5)@Data+$10/#2 D0=(5)$5+DUP LC(5)"DUP"+#5

The above are correct expressions (provided that the entry point library is installed).

Notes:

A hexadecimal value must begin with a $.

A decimal value may begin with a # or a number directly.

A & or (*) equals the offset of the current instruction in the program (This value has no meaning in itself, but may be used to calculate the distance between a label and the current instruction). In absolute mode, this represents the final address of the instruction.

The value of a label is the offset of the label in the program (This value has no meaning in itself, but may be used to calculate the distance between a label and the current instruction). In absolute mode, this represents the final address of the instruction.

The Development Library 6-15