gdgqler wrote, On 14/11/09 08:15:
On 8 Nov 2009, at 09:44, John Gilpin wrote:

Is there a way of stepping through a BASIC program, line by line, for debugging 
purposes?  If so how?

The way I debug BASIC programs is to use a routine called Puse, which causes a 
pause.

DEFine PROCedure Puse
 LOcal a$(2)
 OPEN#20,con
 a$=INKEY$(#20,-1)
 CLOSE#20
END DEFine

By placing this inside the program I can see what's happening. For example

2000 Fling: REMark some procedure
2005 Puse:PRINT "Line 2000":Puse

allows me to see if I have gone past line 2000. Pressing any key allows the 
program to continue (to the next Puse).

You can add a PRINT facility to Puse by:

 DEFine PROCedure(b$)
.
.
  PRINT#20,b$
.
.
END DEFine

This works well even inside compiled BASIC programs.

... and of course further de-bugging info could be added, like printing critical global variables each time.


Tony

--
QBBS (QL fido BBS 2:257/67) +44(0)1442-828255
t...@firshman.co.uk http://firshman.co.uk Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman
   TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to