[net.micro.pc] Using DEBUG with BASICA, help!!

mcmillan@eosp1.UUCP (Tobias D. Robison) (03/11/84)

References:

I'm trying to debug assembly language routines in basica, and am seeing
weird things.  Maybe someone can tell me what is happening.  Briefly,
I have an assembler tha generates *.COM files.  I assemble a subroutine,
and then, with my BASIC program, read it into memory.  I have tried
using an ARRAY for the memory, also random addresses like "DEF SEG &h4000".
The only memory that ever works for me is this:
"DEF SEG &hBa00" (memory within the color crt memory,
for additional pages of display data.)

The first byte of my subroutine is a hex 0CC (a "break").  To debug,
I first:

>Debug basica

When debug prompts me with a dash, I "g", and enter BASIC.  I then load and
run my basic program, which RELIABLY loads my assembly routine wherever I
tell it, and then starts to execute.  I have made several tests in which,
just before calling the subroutine, I "ppek" to see if it is still where I
placed it.  It is usually destroyed.  In most cases where the subroutine
seems still to be there, I try to call it and die (apparently because
DEBUG is no longer alive).  Some more pertinient details:

The PCDOS is rev 2.0.  The PC is NOT an XT.  My Basic program assigns some
variables, but does nothing interesting before trying to call the subroutine.
The subroutine is "unlocated" code (can execute anywhere in memory).
I always do an appropriate  DEF SEG, and any necessary
assignment with "varptr", immediately before using a variable dependent upon
these statements.

I finally found a "dependable" way to execute that break, and get into the
debugger:

(1) Place a "stop" statement just before calling the subroutine.

(2) Run the basic program.

(3) When the program stops, execute an immediate "peek" to see if the
subroutine isn't there.

(4) If it isn't there, re-execute the program.

Usually, the second time around, the program seems to be there; I "cont",
and the break works.  I'm in the debugger and can proceed happily.

This is a hell of a way to run a software environment!! What's going on??

					- Toby Robison
					allegra!eosp1!robison
					decvax!ittvax!eosp1!robison
					princeton!eosp1!robison
					(NOTE! NOT McMillan; Robison.)