= Assign a 16-bit value to a TML variable or a memory location |
Syntax
Legend: D (destination), S (source).
Operands label: 16-bit address of a TML instruction label value16: 16-bit integer immediate value VAR16x: integer variable VAR16x VAR32x(L): the low word of VAR32x long variable VAR32x(H): the high word of VAR32x long variable Dm: data memory operand TypeMem: memory operand. (VAR16x): contents of variable VAR16x, representing a 16-bit address of a variable
Binary code
The destination is 16-bit TML variable and the source is: a 16-bit immediate value, a label, 16-bit TML variable, high or low part of a 32-bit TML variable or the contents of a memory location whose address is indicated by a 16-bit TML variable (a pointer). The destination is a memory location whose address is indicated by a 16-bit TML variable (a pointer) and the source is: a 16-bit immediate value or a 16-bit TML variable. The destination is the high or low part of a 32-bit TML variable and the source is: a 16-bit immediate value or a 16-bit TML variable. If the pointer variable is followed by a + sign, after the assignment, it is incremented by 1. The memory location can be of 3 types: RAM for data (dm), RAM for TML programs (pm), EEPROM SPI-connected for TML programs (spi). Some instructions use a 9-bit short address for the destination variable. Bit value X specifies the destination address range: All predefined or user-defined TML data are inside these address ranges, hence these instructions can be used without checking the variables addresses. However, considering future developments, the TML also includes assignment instructions using a full address where the destination address can be any 16-bit value. In this case destination variable is followed by “,dm”.
Execution Copies a 16-bit value from the source to the destination
Example1 int Var1; Label1: // Label1 = TML program address ... Var1 = Label1;
Example2 int Var1; ... Var1 = 26438;
Example3 int Var1, Var2; ... Var2 = Var1;
Example4 int Var1; long Var3; ... Var1 = Var3(L);
Example5 int Var1; long Var3; .... Var1 = Var3(H);
Example6 int Var1; ... Var1, dm = 3321;
Example7 int Var1, Var2; ... Var1, dm = Var2;
Example8 int Var1, pVar2; ... Var1 = (pVar2), dm;
Example9 int Var1, pVar2; ... Var1 = (pVar2+), dm;
Example10 int pVar1; ... (pVar1), spi = 0x5422;
Example11 int pVar1; ... (pVar1+), spi = 0x5422;
Example12 int pVar1, Var2; ... (pVar1), pm = Var2;
Example13 int pVar1, Var2; ... (pVar1+), pm = Var2;
Example14 long Var5; ... Var5(H) = 0xAA55 ;
Example15 long Var5; ... Var5(L) = 0xAA55;
Example16 int Var1; long Var5; ... Var5(H) = Var1;
Example17 int Var1; long Var5; ... Var5(L) = Var1;
|