[net.micro.cpm] Chaining programs

u557593877ea@ucdavis.UUCP (Bruce K. Martin Jr.) (01/18/86)

Fellow netlanders--
  I am looking for a quick and dirty way to get one CP/M program to execute
another.  I have been told (by someone who didn't have the details) that
it is possible to have the CCP perform this function (thereby relieving me
of the problem of writeing a loader).  If anyone has done this or could give
me a pointer to some information, I would appreciate the help.
                              Thanks in advance,
                                        Bruce

-- 
 Bruce K. Martin Jr. [UUCP] ...{dual,lll-crg,ucbvax}!ucdavis!deneb!u557593877ea
 (916) 756-6518      [ARPA] ucdavis!deneb!u557593877ea@ucb-vax.arpa
  As usual, all the above views are completely my own.  All proprietary
names and phrases are the property of their respective firms.  Is that all mom?

     "You have to be trusted by the people that you lie to..."
                                         Pink Floyd

jparnas@vger.UUCP (Jacob M. Parnas) (01/19/86)

In article <60@ucdavis.UUCP>, u557593877ea@ucdavis.UUCP (Bruce K. Martin Jr.) writes:
> Fellow netlanders--
>   I am looking for a quick and dirty way to get one CP/M program to execute
> another.  I have been told (by someone who didn't have the details) that
> it is possible to have the CCP perform this function (thereby relieving me
> of the problem of writeing a loader).  If anyone has done this or could give
> me a pointer to some information, I would appreciate the help.

The best example that I have of this is contained in the source code to
the public domain program SYNONYM3.  Basically what is done is that the
command line buffer in the CCP is stuffed with the command line to be
executed, the proper length and character position pointer is set and 
control is transferred to the CCP.  This does not work with ZCPR, and can
only be used if the program you are chaining from does not overwrite the
CCP.  Get the source to SYNONYM3 from a BBS or your local user group and
have fun.

John M. Sully
...!ucbvax!ucscc!ucscl!suzuki

michaelk@copper.UUCP (Michael Kersenbrock) (01/20/86)

If you are using CP/M 3.0, you can use the "chain to program" BDOS 
service call.  It is bdos function 47.

You load a null-terminated command line into the default dma buffer, then:

You have reg C: 2fh
	 reg E: ffh if you want the ccpt to initialize the default drive
	        to the "current" drive and user number (rather than
		"reset" to default values).

Then call the BDOS (addr 5 was it?).

Don't know off hand if this call works in 2.2 or not.  Haven't worked
with that version for a few years now.


-- 

Mike Kersenbrock
Tektronix Software Development Products
Aloha, Oregon

edg@micropro.UUCP (Ed Greenberg) (01/20/86)

In article <306@vger.UUCP> jparnas@vger.UUCP (Jacob M. Parnas) writes:
>In article <60@ucdavis.UUCP>, u557593877ea@ucdavis.UUCP (Bruce K. Martin Jr.) writes:
>> Fellow netlanders--
>>   I am looking for a quick and dirty way to get one CP/M program to execute
>> another.  I have been told (by someone who didn't have the details) that
>> it is possible to have the CCP perform this function (thereby relieving me
>> of the problem of writeing a loader).  If anyone has done this or could give
>> me a pointer to some information, I would appreciate the help.
>
>The best example that I have of this is contained in the source code to
> ...

An easier way to do this is to write a $$$.SUB file onto the A drive of
the system, then warm boot.  

A $$$.SUB file is usually the result of running SUBMIT.  The format is
to have all the commands (with arguments expanded) in REVERSE order with
each command occupying a 128 byte record.  Thus record 0 of the file
will contain the last command to be executed and record N-1 will contain
the first command, where there are N commands.

The format of each record is a count byte at offset 0, then the command
line to be executed at offset 1, then a 0 byte immediately after the
command (no CR or LF).

You can examine an existing $$$.SUB by running a long submit, pressing
the reset button halfway through, then booting from ANOTHER boot disk
and loading the original boot disk in B:.  Then use DDT on the existing
$$$.SUB file.  Be sure to delete this file before putting the boot disk
back in A: or you will keep going where you left off the next time you
warm boot.

DBASE II uses this method of program chaining, to execute something,
then return to DBASE.  You can too.  You don't have to worry about
overwriting the CCP or anything.  

Another trick is to reload your program at the end of the chain
procedure with some argument that tells it that it is being rerun.
Thus, you might get dates and other parameters from a file rather than
the user...  Avoid copyright messages, etc.

Let me know if you want to discuss this sort of thing further.
						-e
-- 
Ed Greenberg			| {hplabs,glacier}!well!micropro!edg
MicroPro International Corp.	|  {ucbvax,decwrl}!dual!micropro!edg
San Rafael, California		|       {lll-crg,ptsfa}!micropro!edg

rab@well.UUCP (Bob Bickford) (01/22/86)

In article <169@copper.UUCP>, michaelk@copper.UUCP (Michael Kersenbrock) writes:
> If you are using CP/M 3.0, you can use the "chain to program" BDOS 
> service call.  It is bdos function 47.
> 
> Don't know off hand if this call works in 2.2 or not.  Haven't worked
> with that version for a few years now.
> 

Nope, no such call in 2.2
The call exists in 3.0 as well as MP/M and CP/M-86 however.

       Robert Bickford     (rab@well.uucp)

Chapman.ES@xerox.ARPA (01/22/86)

If a discussion ensues, I'd like to be included.

Has anyone mentioned that placing a (single) new command, in the format
you describe for the submit file, at CCP+3, and then just RETurning from
your program will also do a chain?  I believe that the current disk and
user stay logged in with this procedure.  This is for CP/M 1.x and 2.x,
and of course, only works if the CCP hasn't been overwritten.  I don't
know about other versions of CP/M and I haven't ever used this myself,
so some of the details may not be exactly correct.

Cheryl

shaprkg@sdcrdcf.UUCP (Bob Shapiro) (01/23/86)

In article <533@well.UUCP> rab@well.UUCP (Bob Bickford) writes:
>In article <169@copper.UUCP>, michaelk@copper.UUCP (Michael Kersenbrock) writes:
>> If you are using CP/M 3.0, you can use the "chain to program" BDOS
>> service call.  It is bdos function 47.
>>
>> Don't know off hand if this call works in 2.2 or not.  Haven't worked
>> with that version for a few years now.
>>
>
>Nope, no such call in 2.2
>The call exists in 3.0 as well as MP/M and CP/M-86 however.
>
>       Robert Bickford     (rab@well.uucp)

  The BDS C compiler for 8-bit CPM systems has both chaining of programs
and root-segment capabilities.  Its a good deal even without these features,
but here is an added bonus for you.

                        Bob Shapiro