Hi all.

Is it possible to load and execute FASM for DOS as overlay?
Posted on 2002-10-08 08:11:23 by JohnFound
Hi John,
what do you mean an overlay?
Posted on 2002-10-08 12:58:25 by slop
Overlay is method of loading and executing programs (in format exe or com) in dos. (see INT 21h Fn 4b03h) The difference from execute (Fn 4b00h) is that overlay is called using normal far CALL, and return from overlay is via RET instruction not via "INT 21h Fn 4ch" of the DOS.

So, I suppose that if I change "INT 21h AX=4c00h" at the end of FASM with RET, maybe it will works. But FASM uses some strange memory modes of the processor and I don't know what will happen if it simply exits with RET.
Posted on 2002-10-08 14:10:18 by JohnFound
The FRM should not be a problem, but you can't simply exit with RET, because stack is not always correctly cleaned before executing exit_program in 'system.inc'. So you should store the stack pointer somewhere in memory at the beginning of program (just after the start label) and restore it before doing ret in the exit_program routine.
Posted on 2002-10-08 14:48:05 by Tomasz Grysztar
Thanks. Now all is clear.
Posted on 2002-10-08 14:58:57 by JohnFound
I'm not sure I understood. If you mean to spawn() it, I did it and I can testimony it works great.
Posted on 2002-10-08 16:56:49 by Maverick
Yes, but what the hell is spawn()? :confused: :stupid:
Posted on 2002-10-09 06:46:02 by JohnFound
spawn() is a C function for calling a program.
Posted on 2002-10-09 10:32:10 by dxantos