English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 11 March 2020, 10:21   #1
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 126
RunCommand and CreateProc is dos library

In the modified version of FS-UAE used to debug with vscode, the executable launch is done using RunCommand or CreateProc Kickstart under 2.0.

I've discovered that the call to this functions needs to be preceded by some other calls to prepare the environment. Like it would be in a CLI environment, to set the program location, program name, etc..

I've listed some that seem to be relevant:

Code:
    SetProgramName -- Sets the name of the program being run (V36)
    success = SetProgramName(name)
    D0                        D1

    CurrentDir -- Make a directory lock the current directory
    oldLock = CurrentDir( lock )
    D0                    D1

    SetProgramDir -- Sets the directory returned by GetProgramDir (V36)
    oldlock = SetProgramDir(lock)
    D0                       D1

    SetCurrentDirName -- Sets the directory name for the process (V36)
    success = SetCurrentDirName(name)
         D0                        D1
But I didn't find a documentation with a clear explanation of:
  • which methods are needed before a call to RunCommand and CreateProc
  • what are their availability regarding to the Kickstart versions (I think the v36 mean not before Kickstart 3.6)
Do you know a source (book or online page) where I can find this information ?
Or better, do you have the answer ?
Thanks for all your help and insights !
prb28 is offline  
Old 11 March 2020, 11:03   #2
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,061
V36 is kickstart 2.0 (or unfinished versions of 1.4).
hooverphonique is offline  
Old 11 March 2020, 11:34   #3
patrik
Registered User
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 39
Posts: 588
Were any Amigas sold with V36?
patrik is offline  
Old 11 March 2020, 11:45   #4
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 342
Quote:
Originally Posted by prb28 View Post
In the modified version of FS-UAE used to debug with vscode, the executable launch is done using RunCommand or CreateProc Kickstart under 2.0.
It is done via RunCommand for shell commands, and CreateNewProc() for workbench processes. Besides, the two calls are unrelated and not "two methods to startup programs". RunCommand() overloads the current process with the segment of another binary loaded before, and returns to the caller once done. It also fiddles arguments into the stdin of the called binary, and is the general (Tripos) method to execute a binary for the shell.

CreateNewProc() (and it's less capable older cousin CreateProc()) detaches a new process from the current process. By default, it does not create a shell at all.

You also have "System()" which loads starts a shell binary.

Quote:
Originally Posted by prb28 View Post
I've discovered that the call to this functions needs to be preceded by some other calls to prepare the environment. Like it would be in a CLI environment, to set the program location, program name, etc..
No, nothing like that. RunCommand() requires a shell, but that's about it. There are no other requirements.

Information on these calls can be found in the AmigaDos manual, 3rd Edition, Bantam Books, or in the Amiga Guru Book, Ralph Babel (self-published).
Thomas Richter is offline  
Old 11 March 2020, 12:02   #5
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 126
Quote:
Originally Posted by hooverphonique View Post
V36 is kickstart 2.0 (or unfinished versions of 1.4).
Thanks, it make sense, I was lost with the 36.
prb28 is offline  
Old 11 March 2020, 12:06   #6
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 126
Quote:
Originally Posted by Thomas Richter View Post
No, nothing like that. RunCommand() requires a shell, but that's about it. There are no other requirements.
Thanks for all this infos.

At least I found that a call to currentdir helps to open files in the debuged program without having to use the full path. It’ the case with a CLI program.
prb28 is offline  
Old 11 March 2020, 21:10   #7
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 342
Quote:
Originally Posted by prb28 View Post
Thanks for all this infos.

At least I found that a call to currentdir helps to open files in the debuged program without having to use the full path. It’ the case with a CLI program.
What are you trying to attempt? The requirements for RunCommand() etc. are, well, those of the seglist you want to call, or whose segment you want to use to create a process.
Thomas Richter is offline  
Old 11 March 2020, 22:15   #8
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 126
Quote:
Originally Posted by Thomas Richter View Post
What are you trying to attempt?
I'm trying to have a program launched with RunCommand or CreateProc (or anything else) with the same behavior as it was started in a CLI command.
As a example if you call the Open() command with a relative path it will resolve the file location.
prb28 is offline  
Old 12 March 2020, 10:30   #9
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 342
CreateProc() is not a "program launcher". Try System(), this is what it is good for. It also creates the struct CommandLineInterface and copies the shell variables.
Thomas Richter is offline  
Old 12 March 2020, 23:43   #10
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 126
Quote:
Originally Posted by Thomas Richter View Post
CreateProc() is not a "program launcher". Try System(), this is what it is good for. It also creates the struct CommandLineInterface and copies the shell variables.
ok thanks, i'll try it.
I did not find a reference to System(), I suppose the function is SystemTagList : http://amigadev.elowar.com/read/ADCD_2.1/Includes_and_Autodocs_3._guide/node01C5.html
prb28 is offline  
Old 13 March 2020, 08:59   #11
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 342
Correct. System() comes with two prototypes, which go to the same _LVO in the dos.library, one which takes a pointer to a taglist, and one var-arg function which takes the tags explicitly. The former is SystemTagList(), the latter System(). But it's all the same.

What System() does is that it creates a new shell, copies all the shell variables and settings, and from that shell, runs the indicated program. That will give you a fully working shell environment as you requested.

However, it cannot run from a seglist as the shell cannot execute seglists. The shell only runs programs by name.
Thomas Richter is offline  
Old 13 March 2020, 22:30   #12
prb28
Registered User

 
Join Date: May 2018
Location: France
Posts: 126
Thanks for all Thomas !
prb28 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open-source dos.library Don_Adan Coders. System 271 28 October 2015 20:28
execute function from dos.library Foul Coders. Asm / Hardware 5 08 August 2012 18:56
dos.library Open() hangs MrD Coders. Asm / Hardware 15 24 July 2012 20:55
Dos.library question. Thorham Coders. General 2 11 January 2011 22:03
Accessing dos.library during boot time Leffmann Coders. General 9 16 February 2009 20:26

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:35.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.07269 seconds with 14 queries