; 00h WORD segment of environment to copy for child ;process (copy caller's environment if 0000h) ; 02h DWORD pointer to command tail to be copied into child's PSP ; 06h DWORD pointer to first FCB to be copied into child's PSP ; 0Ah DWORD pointer to second FCB to be copied into child's PSP

; 0Eh DWORD doesnt concern al=0 ; 12h DWORD doesnt concern al=0

ProgramName db "Program.exe$" ;Name of the program(with extension!)[/code]Take a look at Ralf Browns Interrupt list(INTERRUP.G) for further details.

Now, I know that, INT 21H/AH=4BH is the function for "LOADING AND/OR EXECUTING A PROGRAM". I tried to look at Ralph Brown's Interrupt List (http://www.ctyme.com/intr/rb-2939.htm) but it was so many things! It confused me! So, I tried to "verbatimly" put the code in my program, but it still don't work. Here's my code: (I'm using TASM for DOS-based Programs)

Almost. Memory addressing is done in segment:offset mode. You've properly got the offset part right, but here your setting the segment equal to the offset, which isn't pointing where you want it to.

Luckily, you've got your program defined as a DOS .COM file, so at startup all of your segments are the same anyway. You can actually just eliminate that code and the segments will be pointing where you want them.

It's good for safety reasons to set up the segments properly, as you can't always assume your segments are what you think they are as your program executes. Here's one of a thousand ways to do it:

[code] push cs pop ds push cs pop es[/code]

That will set DS and ES to whatever CS is.

This program may still not work-you probably need to free up some memory for the new program to load into before it'll work. This is yet another headache you're going to have to deal with. Welcome to assembly!

: Now, I know that, INT 21H/AH=4BH is the function for "LOADING AND/OR EXECUTING A PROGRAM". I tried to look at Ralph Brown's Interrupt List (http://www.ctyme.com/intr/rb-2939.htm) but it was so many things! It confused me! So, I tried to "verbatimly" put the code in my program, but it still don't work. Here's my code: (I'm using TASM for DOS-based Programs): : [CODE]: .MODEL TINY: .CODE: ORG 0100H: : MAIN:: JMP START: ProgramName DB "TEST.COM$": ParamBlock DB "$": : START:: mov ah,4bh ;Function 4bh: mov al,0 ;0 = load and execute: mov dx,offset ProgramName ;Pointer to the program name: mov bx,offset ParamBlock ;Pointer to the parameter block: : mov DS,DX: mov es,BX: INT 21H: : INT 20H: END MAIN: END: [/CODE]: : Also, is the: : [CODE]: mov DS,DX: mov es,BX: [/CODE]: : Right?: : [blue]OK, to be honest, it was confusing for me too. I was going to tell you that you should read the com file to the memory and then jump to it, but when I ran it, some weird stuff happened.

Heres what I tried:

1)First open the com file2)Then read it to the memory (to 100h)3)Then jump to 2 bytes before the program(100h-2), where I had previously written the opcode for int 21h (021CDh)4)Run the next program from cs:100h(which is right after my int 21h at cs:0feh)

When I compiled and run it, Windows gave a really fun error about me using a disk utility designed for an earlier version of DOS:P.Perhaps it works under pure DOS, I dont know...Here's the code:[code].MODEL TINY.CODE ORG 0100HMAIN:

Here's a sample DOS call routine I've got tucked away in my asm directory. I don't remember if I wrote this or not, but I can certainly see that I didn't comment it!

I just compiled and ran it under windows XP dos, so it should work on anything prior to that too. Calls a batch file called mybatch.bat, which I had simply do a DIR on the current directory.[code].model small.codeORG 100Hmain: Jmp start

Sorry about the lack of comments. I'm sure if I stare at this hard enough I can figure out what it's doing, so if you have any questions, let me know. You should be able to replace the batch file with another .COM file or .EXE. I've used similar code to add a DOS shell feature to one of my applications.

[b][red]This message was edited by anthrax11 at 2005-10-20 2:34:15[/red][/b][hr]: Just a thought...: : When you read the program to memmory, wont it overwrite the loading program? Both program's can't start at 100h...: : If this is the case, solve it by allocating some memmory for the loading program, and then run it...: : The one and only [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]: : Yes, that was the idea, to overwrite it. It was a bad idea, forget it.

OK, I tried allocating memory, but for some reason I always get an insufficient memory error(8), even if I try to get like 32 bytes or so. I dont know if the rest of the code works:

END MAIN END[/code]Btw, I didn't get the automatic notification thingy. Whats up?My e-mail provider(live.hot.ee) is going through major changes and everyones flaming them because of all the bugs, maybe thats the problem, I dont know.

[blue]Haha, Got all the letters 2 minutes after posting never mind then.[/blue]