Well, if you go for the 999 then a 0-65535 is possible as the final result needs a word variable.
One idea untested is this:
Code:
array var byte[5]
index var byte
i var byte
word_v var word
'Get keypress
index=0
loop:
gosub key_read
if mykey=32 then loop 'No key press returns 32
array[index]=myvar
index=index+1
if index=5 then calculate_result
goto loop
...
caculate_result:
word_var=0:mult=10000
for i=index-1 to 0 step -1
word_var=word_var*mult+array[i]
mult=mult/10
next i
index=0
goto display_result
As there is the index counter, there is no need to press '#'. Numbers must be entered in 5 digit format, e.g. 00123.
Also there is no filter if the user keys in a number greater than 65535, in which case result will be of course wrong due to overflow.
Ioannis
Bookmarks