The correct technique to create a byte array of hex values in Synergy is to store them in a 1-byte alpha variable using XCALL ASCII. A byte array might be necessary, for example, when the receiving device is expecting one while using the Synergy socket API.
Although one might consider using the %HEX function, %HEX does not return a 1-byte value. The smallest number of characters returned with %HEX is 2 (passing 1 for magnitude) bytes. Thus, %HEX wouldn't work to populate a byte array.
XCALL ASCII, however, will convert a decimal value into a single (byte) ASCII character. The resulting ASCII character is the 8-bit binary pattern equivalent to the decimal value, and with traditional Synergy, the byte data type represents an 8-bit signed integer. Thus, if the decimal values are stored in a decimal array, and the hex values will be stored in an alpha array, you can use code like the following:
alp_vals ,[15]a1
…
dec_vals ,[15]d2 ,64,32,65,32,66,32,67,32,68,32,69,32,70,32,71
…
for counter = from 1 thru 15
begin
xcall ascii(dec_vals[counter], alp_vals[counter])
end
|