[net.micro.cpm] how to execute programs from within cpm programs

hestenes@sdcsla.UUCP (Eric Hestenes) (08/05/85)

Can anyone give me a hint as to how someone would call one program,
say WORDSTAR or something simpler, from within another program.

Methods using Turbo Pascal, 'C' or assembler would be useful.

( Please don't tell me to use AUTORUN, etc. I want to call programs from  )
( within programs, not do batch processing of commands.  		  )


--------------------------
Eric Hestenes
Institute for Cognitive Science, C-015
UC San Diego, La Jolla, CA 92093
arpanet: hestenes@nprdc.ARPA
other: ....ucbvax!sdcsvax!sdcsla!hestenes

rlk@wlcrjs.UUCP (Richard L. Klappal) (08/11/85)

In article <946@sdcsla.UUCP> hestenes@sdcsla.UUCP (Eric Hestenes) writes:
>Can anyone give me a hint as to how someone would call one program,
>say WORDSTAR or something simpler, from within another program.
>
>Methods using Turbo Pascal, 'C' or assembler would be useful.


Both AZTEC (MANX) and BDS C support the 'exec' statement or an equivalent,
that allow a program to call another.  

NOTE:  These calls are NOT forks, so you cannot return to the original
program.

I believe both systems supply enough of the source to show how it is done.
(if I remember correctly, the file name of the new program is stored
in the BDOS buffer (?at BDOSBASE+8 (?)), and a couple of pointers need
to be set up pointing to the start and end of the filename.


If this is not enough help, send me mail, and I will try to look up
the details.



Richard Klappal

UUCP:		..!ihnp4!wlcrjs!uklpl!rlk  | "Money is truthful.  If a man
MCIMail:	rklappal		   | speaks of his honor, make him
Compuserve:	74106,1021		   | pay cash."
USPS:		1 S 299 Danby Street	   | 
		Villa Park IL 60181	   |	Lazarus Long 
TEL:		(312) 620-4988		   |	    (aka R. Heinlein)
-------------------------------------------------------------------------

cem@intelca.UUCP (Chuck McManis) (08/13/85)

> In article <946@sdcsla.UUCP> hestenes@sdcsla.UUCP (Eric Hestenes) writes:
>Can anyone give me a hint as to how someone would call one program,
>say WORDSTAR or something simpler, from within another program.
>
>Methods using Turbo Pascal, 'C' or assembler would be useful.
>

Aside from the fact that Turbo Pascal provides the function
Execute(FilVar) where FilVar is the name of the program to run, if
you want to be really slick, you could run ZCPR3 and stuff the
name of the file to run (and all of its arguments) into the External
Command line buffer and then exit to the CCP. Next thing running would
be your program. (I have done this from turbo and found the results to
be rather effective.

--Chuck 
-- 
"Unix, the Teco of Operating Systems."      - - - D I S C L A I M E R - - - 
{ihnp4,fortune}!dual\                     All opinions expressed herein are my
        {qantel,idi}-> !intelca!cem       own and not those of my employer, my
 {ucbvax,hao}!hplabs/                     friends, or my avocado plant. :-}

djl@gitpyr.UUCP (Dave Lane) (08/17/85)

Bug? What bu....GULP!

Well,  I don't really know how you would go about it under CP/M 2.x, but 
under CP/M + (aka, CP/M 3.x), there is a new BDOS call (actually, there 
are now MANY new BDOS calls....), number 47(decimal), which is "Chain to
Program."  To use it, place a complete command line (null terminated) in
the default DMA buffer at 0080H, and execute this call.  If the E reg. is
set to 0FFH, then the CCP will change the default drive and user to the
current values; if E is anything else, they will remain the default DMA
values.

There are many new features in CP/M + seem nice, such as this, and there is
a "Load Overlay" call, date and time support, file passwording (in the
banked version), YES, CP/M+ does support banked memory.  Neat stuff.
I started using CP/M 2.2, but I never really got into writing assembly for
it until I got this CP/M+ system.  I think they have done some nice things
here for the asm programmer.  (well, that's my two bits.....)


-- 
Dave Lane, User Assistant, Office of Computing Services,
Georgia Institute of Technology, Atlanta, Georgia  30332

...!{akgua,allegra,amd,hplabs,ihnp4,masscomp}!gatech!gitpyr!djl
...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally,ut-ngp}!gatech!gitpyr!djl