' *** CSR_EX.BAS - CSRLIN function programming example ***
' This example uses CSRLIN in a subprogram, MsgNoMove, to
' print messages on the screen without disturbing the position
' of the cursor.
'
DECLARE SUB MsgNoMove (Msg$, Row%, Col%)
CLS    ' Clear screen
' Call MsgNoMove to print messages at specified locations
' on the screen
CALL MsgNoMove("A message here.", 9, 12)
CALL MsgNoMove("A message there.", 15, 18)

' Print a message without disturbing current
' cursor position.
SUB MsgNoMove (Msg$, Row%, Col%) STATIC
  
   LOCATE 12, 15
   ' Save the current line.
   CurRow% = CSRLIN
   ' Save the current column.
   CurCol% = POS(0)
   ' Print the message at the given position.
   LOCATE Row%, Col%: PRINT Msg$;
   ' Move the cursor back to original position.
   LOCATE CurRow%, CurCol%
   INPUT "Press any key: ", A$

END SUB

