You can do that by checking the KEYSTATE() of a key and go to a function if that key has been pressed. When the function is over it goes back to the line after the function call. You can also use GOSUB to do the same thing... just don't use GOTO... ever.
` Overwrite text background
set text opaque
` Show instructions
text 0,30,"Press (SPACEBAR) to pause."
do
` Show the current count
text 0,0,str$(Count)
` Check for spacebar and call the Menu function
if keystate(57) then Menu()
` Increase the count
inc Count
loop
end
function Menu()
` Show instructions
text 0,30,"Press (R) to resume. "
do
` Check for R key and exit DO/LOOP
if keystate(19) then exit
loop
` Replace instructions for pause
text 0,30,"Press (SPACEBAR) to pause."
endfunction