is anyway to run a outside program in KOS ?
for exemple, if i want that my program run the file /cd/dcdivx.bin its possible ?
thanks again !
Load a outside .BIN in KOS ?
- Arqueiro
- DCEmu Nutter
- Posts: 785
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Tue Jul 02, 2002 9:29 am
- Has thanked: 0
- Been thanked: 0
- Contact:
-
- DC Developer
- Posts: 9951
- Joined: Sun Dec 30, 2001 9:02 am
- Has thanked: 0
- Been thanked: 1 time
Load the bin into memory, and call arch_exec()
See kos/kernel/arch/dreamcast/include/arch/exec.h
Basically, you do something like:
See kos/kernel/arch/dreamcast/include/arch/exec.h
Basically, you do something like:
Code: Select all
void *blob;
ssize_t length = fs_load("/cd/dcdivx.bin", &blob);
assert(length > 0);
arch_exec(blob, length);
- Arqueiro
- DCEmu Nutter
- Posts: 785
- Joined: Tue Jul 02, 2002 9:29 am
- Has thanked: 0
- Been thanked: 0
- Contact:
very cool ! i will try make some testes later....
3d graphics and visualization ?
http://www.arquiteturadigital.com
http://www.arquiteturadigital.com
-
- DC Developer
- Posts: 9951
- Joined: Sun Dec 30, 2001 9:02 am
- Has thanked: 0
- Been thanked: 1 time
Actually, it isn't. They don't use KOS's built-in way of doing it, but they all work on the same principles.
The arch_exec function has to replace the currently running program with the new program, and then jump to it. Obviously, this is impossible, because you'd be overwriting the code that's doing the overwriting.
arch_exec contains code for a small assembly program, known as a trampoline. It allocates enough memory to hold the trampoline, then copies it over. Then it writes the new program's address and length into pre-defined locations withing the trampoline, shuts down KOS, and runs the trampoline function.
The trampoline function copies the new program to the standard start address, clears the data and instruction caches, and does the same kind of initialization as the IP.BIN bootstrap normally does. It then starts the new program, which doesn't have any idea that there was a program here before.
In the case of DemoMenu, it uses it's own custom trampoline which does a lot more than the KOS one. It stays resident in memory, much like DCLoad does, and it's supposed to return to the DemoMenu menu when your program's finished. It also causes severe problems (like a system crash) if you try to use KOS's arch_exec function to load another program.
DreamInducer is more like KOS's arch_exec, but the trampoline appears to be stored in a separate file, for some reason.
The arch_exec function has to replace the currently running program with the new program, and then jump to it. Obviously, this is impossible, because you'd be overwriting the code that's doing the overwriting.
arch_exec contains code for a small assembly program, known as a trampoline. It allocates enough memory to hold the trampoline, then copies it over. Then it writes the new program's address and length into pre-defined locations withing the trampoline, shuts down KOS, and runs the trampoline function.
The trampoline function copies the new program to the standard start address, clears the data and instruction caches, and does the same kind of initialization as the IP.BIN bootstrap normally does. It then starts the new program, which doesn't have any idea that there was a program here before.
In the case of DemoMenu, it uses it's own custom trampoline which does a lot more than the KOS one. It stays resident in memory, much like DCLoad does, and it's supposed to return to the DemoMenu menu when your program's finished. It also causes severe problems (like a system crash) if you try to use KOS's arch_exec function to load another program.
DreamInducer is more like KOS's arch_exec, but the trampoline appears to be stored in a separate file, for some reason.
-
- DCEmu Uncool Newbie
- Posts: 1459
- Joined: Sat Dec 27, 2003 10:40 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
i see, its much clearer now, thanks.
would people be interested by an app working about like dchakker but being able to load bins from the pc?
WaCk0 asked me if it was possible some time ago, i said i think it would be quite easy to implement in something like dchakker if it was open source, but if its possible to do it using a simple function and its useful for people i think i could do something like that.
but it wouldnt be possible to return to the list like in dchakker though since it requires more than what kos function offers if i understood correctly.
would people be interested by an app working about like dchakker but being able to load bins from the pc?
WaCk0 asked me if it was possible some time ago, i said i think it would be quite easy to implement in something like dchakker if it was open source, but if its possible to do it using a simple function and its useful for people i think i could do something like that.
but it wouldnt be possible to return to the list like in dchakker though since it requires more than what kos function offers if i understood correctly.