Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Exec & parameter in ASM

Posted on 1997-10-26
4
Medium Priority
?
351 Views
Last Modified: 2013-11-22
Do you know how to execute a program and to access to the programmer parameters from an ASM program?
0
Comment
Question by:kilobug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Expert Comment

by:rbr
ID: 1216358
To get the paramters use int 21h function 62h. The returnvalue in BX is the
segment adress of the PSP of the current program. At the adress BX:0080
are the number of bytes of your parameter block and starting at BX:0081
you can read the parameters of your program.
0
 

Author Comment

by:kilobug
ID: 1216359
Thanx anyway, but this is only a part of the question...

  I will explain what I exactly want:
* To make a DOS ASM program which can execute other programs (EXE and COM).
* To make a DOS ASM program which can access to the parameter given on the command line.(This is easier, the main thing is the execution).
0
 
LVL 10

Accepted Solution

by:
rbr earned 400 total points
ID: 1216360
For executing a other program use int 21h function 4bh subfunction 0

AH=4bh
AL=00h
ES=segmentadress of parameterblock
BX=offsetadress of parameterblock
DS=segmentadress of the programname you want to execute
DX=offsetadress of the programname

The parameterblock must contain the following.
Byte 0-1: Segment of enviromentblock
Byte 2-3: Offset of command-parameters
Byte 4-5: Segment of command-parameters
Byte 6-7: Offset of 1st FCB
Byte 8-9: Segment of 1st FCB
Byte 10-11: Offset of 2nd FCB
Byte 12-13; Segment of 2nd FCB.
If Byte 0-1 are 0 the enviroment block of the calling program is used.
If you don't need any FCB Byte 6-13 can have any value you want.
The programname must be a string with a 0 at the and. No wildchars are
allowed. The command-paramters must have the following form.
Byte 0: Length of the command-paramters.
Byte 1-Length: command-paramters.
Bate Length+1: Carriage Return (ASCII 13). Do not cont this character to
the length.
0
 

Expert Comment

by:Thefly
ID: 1216361
Here is my solution to copy command line option string (from PSP to a PSP buffer var)

dosseg
.model large
.stack 200h
.data
;psp
psp dw 0
pspbuffer db 128 dup (0)
.386
.code
        push es
        mov ax,@data
        mov ds,ax
        pop es
        mov ax,es
        mov psp,ax
        mov bp,80h
        mov cx,es:[bp]
        mov ch,0
        inc cx
        psploop:
        mov bx,bp
        sub bx,80h
        mov ax,es:[bp]
        mov pspbuffer+bx,al
        inc bp
        loop psploop
        mov ax,4c00h
        int 21h
end

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question