Please check the following points. Don't you escape from a subroutine without "RETURN" after you have jumped to the subroutine with "GOSUB"? Isn't the nest of recursive function call too deep?