Quote Originally Posted by aerostar View Post
From the looks of it you have a terminator character 06, so use the STR see manual

"STR followed by a byte array variable, count and optional ending character will receive a string of characters. The string length is determined by the count or when the optional character is encountered in the input."

So regardless of how many characters you are expecting put into the command the MAX COUNT characters it will return and then the optional ending character.

Then all you need to do is look down the array and pick out the value you need - the 06 is the terminator.

Thanks aerostar

something like this:

get_key:

hserout ["rg", 13]
Hserin 1000, start, [STR char\4\$06] '
pause 10

if char[0] = $30 then
goto get_key
endif
char[0] = char[0] - %110000
char[0] = char[0] << 6
char[1] = char[1] - %110000
char[1] = char[1] << 4
char[2] = char[2] - %110000
b0 = char[0]+char[1]+char[2]
lookdown b0, [101,184,183,181,162,161,153,208,201,199,177,149,19 5,89,102,99],keypressed
hserout ["rdkey= "dec keypressed,13,10]
pause 10
return

is it possible to simplify the pressed key number ?