I use a loop in the main program to receive nonstop data.
It usually can process around 19200bps of info with those CASE statements full of code.
I use to receive data also in the CASE statements, because some commands need 1 to 50 bytes of data.
MAIN:
C = HRSIN
IF C <> $FF THEN
;do something if it is not a start command character ( $FF )
ELSE
CMND = HRSIN
SELECT CMND
CASE X
do something
CASE X+1
do something
CASE X+2
do something
CASE X+3
do something
CASE X+100
for z = 1 to 50
i[z] = HRSIN
next
do something with that array.
ENDSELECT
ENDIF
GOTO MAIN