Hi!
Is there a way to launch a CC65 compiled program with parameters ?
For example, suppose I compiled a program called "ED" to edit some text file on the disk. If I want to call "ED" with a parameter giving the name of the text file to be loaded, like "ED README.TXT", is it possible to pass the parameter "README.TXT" to the program "ED" ?
If was thinking about using the basic "!" command, but I don't know how it could interact with a cc65 compiled program.
Thanks for your feedbacks,
Jacques
Launch c program with parameters
Launch c program with parameters
Old French Oric Atmos Nerd
Re: Launch c program with parameters
As far as I know, neither SEDORIC or TDOS have a way to pass parameters to executables when they are launched.
That being said, I did a quick test using a comment after the command, and it seems to still be present in the command buffer in page zero.
As you can see both my 'WHATEVER and 'DBUG TEST are still visible at offset $5A, I'm not sure these are guaranteed to be valid, but that could possibly be a way worth exploring: Launch whatever command you want, and have the parameters as a comment.
Now, does that work if a command is passed from a script or other program, no idea.
That being said, I did a quick test using a comment after the command, and it seems to still be present in the command buffer in page zero.
As you can see both my 'WHATEVER and 'DBUG TEST are still visible at offset $5A, I'm not sure these are guaranteed to be valid, but that could possibly be a way worth exploring: Launch whatever command you want, and have the parameters as a comment.
Now, does that work if a command is passed from a script or other program, no idea.
Re: Launch c program with parameters
Thanks for the tip Dbug ! I'd never have thought of doing it that way.
Old French Oric Atmos Nerd
- ibisum
- Wing Commander
- Posts: 1869
- Joined: Fri Apr 03, 2009 8:56 am
- Location: Vienna, Austria
- Contact:
Re: Launch c program with parameters
jacqu, if you figure this out, perhaps we could do a C implementation that could be plonked into the OSDK, as well? Its something I've often thought about, but never considered there wouldn't be a std arg parser in the C lib ..
Re: Launch c program with parameters
Hi ibisum,
Seems that I did not read the doc until the end: CC65 already implements some main() function args parsing method based on the very same idea than Dbug’s one.
Though, Dbug’s approach of using ‘ instead of REM seems to be more compact and elegant.
I’m planning to write a wysiwyg text editor for Oric with encryption feature. With such an app, I might have finally found some serious usefulness for this old machine in 2024 (this does not mean that I don’t appreciate the fun part of the hobby. For example, I’m really looking forward to playing Dbug’s new game in gestation). I’m still in the early stages of this project and I’m still not sure how to handle safely the storage of the files on the disk.
I read this excellent article : https://www.idreamtin8bits.com/oric-scr ... o-the-oric
This made me grasp the great challenge of getting thorough disk errors handling, which is a prerequisite for my project. All tips on this topic will be warmly welcomed.
Seems that I did not read the doc until the end: CC65 already implements some main() function args parsing method based on the very same idea than Dbug’s one.
Though, Dbug’s approach of using ‘ instead of REM seems to be more compact and elegant.
I’m planning to write a wysiwyg text editor for Oric with encryption feature. With such an app, I might have finally found some serious usefulness for this old machine in 2024 (this does not mean that I don’t appreciate the fun part of the hobby. For example, I’m really looking forward to playing Dbug’s new game in gestation). I’m still in the early stages of this project and I’m still not sure how to handle safely the storage of the files on the disk.
I read this excellent article : https://www.idreamtin8bits.com/oric-scr ... o-the-oric
This made me grasp the great challenge of getting thorough disk errors handling, which is a prerequisite for my project. All tips on this topic will be warmly welcomed.
Old French Oric Atmos Nerd
Re: Launch c program with parameters
Hi, @jacqu!
Passing parameters to a program turned to be a real challenge!
Dbug's idea is the only way for an universal solution and (after lot hours ) I have it working !
Reading CC65 docs is really helpful, take a look also in the sources of the CC65 standard library.
I need some time to polish the code and update my openOricLibrary - I hope to do it this week!
The problem is really very interesting for hacking, don't hesitate to dive into it.
So far I found 3 hidden traps!!!
Passing parameters to a program turned to be a real challenge!
Dbug's idea is the only way for an universal solution and (after lot hours ) I have it working !
Reading CC65 docs is really helpful, take a look also in the sources of the CC65 standard library.
I need some time to polish the code and update my openOricLibrary - I hope to do it this week!
The problem is really very interesting for hacking, don't hesitate to dive into it.
So far I found 3 hidden traps!!!
Re: Launch c program with parameters
May be I am wrong but I think there's no use to pass parameters to C program with an Oric. Just write your parameters in a specific memory area from the "calling program" and read them back from the c program. PEEK/POKE way (in ORIC.H) :
#define peek(a) mem[a]
#define deek(a) (* (int *)(mem+a))
#define poke(a,x) (mem[a]=(x))
#define doke(a,x) (* (int *)(mem+a) = (x))