Skip to main content
gamedev.net
🔒 Locked

Calling Another Program using Asembly

Started by pmcastillo Oct 18, 2005 at 6:25 PM 8 replies 1.5k views
Original Post
pmcastillo
pmcastillo
How to call Another Program using Asembly?
Promit
Promit
I suppose the best thing to do would be to invoke the shell function with the name of the program. You might also be able to use Win32 CreateProcess, if you need more control over what's going on.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
pmcastillo
pmcastillo
Ummmmm... I'm new in Assembly Language... I use TASM 2.0... And also not an English man...

1.) What is "invoke"?

2.) What is "shell function"?
andhow
andhow
you do not directly "call another program". instead, you call functions provided to you by the operating system / runtime library. no matter what language you use (including assembly) you will be calling these functions, not doing it yourself. so your question is really two questions:
1) what functions should you call?
2) how do you call the function from (1) in assembly?

(2) is easy. for (1), if you are working with win32 (MS Windows), check out the msdn documentation on
creating processes and interprocess communication.
And how!
pmcastillo
pmcastillo
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)


.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


Also, is the


mov DS,DX
mov es,BX


Right?


dyerseve
dyerseve
Anonymous was me

You could try:

mov DS,segment ProgramName
mov ES,segment ParamBlock

Although I really have no idea how to do it. I'm used to 32-bit where you usually don't need to deal with segments at all.
izzo
izzo
DS and ES should just be whatever the current code segment is, since your data is in your code segment. Your program looks like a .COM file and I think at startup a .COM file has CS = DS = ES.

sam
pmcastillo
pmcastillo
Thanks everyone! Ok now I'll just have to DIGEST everything... =) Thanks guys! I'll just post if I got a problem...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.