Chapter 3 Creating and Editing Screens Example After executing TODWORD command, the WORD value in $0 is converted to a D WORD value and stored in $1. As it is in DWORD format, it indicates that the value has occupied $1 and $2 these two addresses. (this is an operation of unsigned 16-bit data). TOWORD (Convert BYTE to WORD) Equation Var1 = TOWORD (Var2, Var3) Explanation Convert Var3 number of BYTE data from Var2 to Var3 number of WORD values and start storing the result in Var1.The high byte will be filled with 0. Remark The calculation result can be stored as unsigned WORD. Var1 and Var2 can be internal memory only. Var3 can be internal memory or constant. The unit of Var2 is WORD.
Each WORD of Var2 can be converted to two WORDs. After data conversion is completed, the low and high bit of the converted WORD data will be exchanged. Example Assume that the value of $0 is 12, this will convert 12 BYTES (6 WORDS) to 12 WORDS starting at $4 and store the result in $10 to $12 (this is an operation of unsigned 16-bit data). Revision May, 2010 3-335