[net.micro.pc] BASICA shell useage

andrew@alberta.UUCP (Andrew Folkins) (06/10/85)

While digging around a local bookstore, I came across "Mapping the IBM PC
and XT", which contained a section on using the BASICA shell command, 
which I thought I'd pass along. (Sorry, I don't remember the publisher.)
 
The usual problem with using this (undocumented) feature is that your
BASIC program gets slightly clobbered because a copy of command.com
is loaded, which affects the pointers to your basic text. Try putting a
line like 'shell "type filename"' in your program, run it, then list it
to see what happens. To get around this, you have to save and restore
the pointer to your basic program, located at offsets $30 and $31 
of basic's data segment (see note 3 of page I-2, the memory map, in the 
basica manual) :
 
10 def seg
20 low = peek(&h30) : hi = peek(&h31)
30 shell "type file"   ' any DOS command, except basica
40 poke &h30, low : poke &h31, hi
50 print "it worked!"
 
Interestingly enough, the program seems to return from DOS and continue
executing ok without saving the pointers (but I haven't tested this a lot
so I'm not sure what happens in non-trivial programs).

-- 
Andrew Folkins
ihnp4!alberta!andrew
 
Underlying Principle of Socio-Genetics : 
       Superiority is recessive.