gdgqler wrote:
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).
The way the question was formulated, a "line by line" stepping through
a program - specifically, a boot script - was wanted. This hardly adds
to the responses already given, although its fine if only a few lines
want monitoring.
To your example I venture to suggest the following improvement:
DEFine PROCedure Puse(l%)
LOcal c%
c% = FOPEN('con_')
PRINT#c%; 'Line'! l%
or
LIST#c%; l%: rem Unless compiled, of course
PAUSE#c%; -1
CLOSE#c%
END DEFine
Call with
2005 Puse 2000
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.
Actually,
DEFine PROCedure(b$)
doesnt work at all ;o) Probably just a ruse to see if anyone was
paying attention.
Per
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm