Yes, you can call subroutines from within a function as long as that subroutine is contained in the same .dba file. If you are using a function that has been #INCLUDED (which you should be) then it would look something like this:
FUNCTION my_function()
REPEAT
IF SPACEKEY() = 1 THEN GOSUB space_sub
UNTIL RETURNKEY() = 1
EXITFUNCTION
space_sub:
RETURN
ENDFUNCTION
You have to use an ENDFUNCTION for the true ending of your code block and EXITFUNCTION to leave the function itself. All variables are localized to that code block, though.
http://www.canceriannewmedia.com