Solved

Exec & parameter in ASM

Posted on 1997-10-26
4
326 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
  • 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 200 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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