flat assembler
Message board for the users of flat assembler.
Index
> DOS > Execute DOS .exe or .com program in FASM |
Author |
|
cpcdos 12 Aug 2013, 19:13
Hi!
I'm french * I would like know how execute a DOS .exe or .com program in FASM ? Thank. |
|||
12 Aug 2013, 19:13 |
|
AsmGuru62 12 Aug 2013, 20:04
I am not sure what are you asking.
To create an EXE or COM file for DOS -- there are examples of such programs in FASM package for DOS. To execute the child EXE or COM from a parent program please follow this documentation: http://www.ctyme.com/intr/rb-2939.htm |
|||
12 Aug 2013, 20:04 |
|
cpcdos 12 Aug 2013, 20:27
ho !
this is complicated for me .. there are not code examples ? |
|||
12 Aug 2013, 20:27 |
|
AsmGuru62 12 Aug 2013, 21:24
I do not understand your question.
What are you trying to do? When you say: "execute EXE or COM" -- what do you mean? |
|||
12 Aug 2013, 21:24 |
|
cpcdos 12 Aug 2013, 23:42
I want to know (as a shell) running a another exe. (Child) with my fasm program
|
|||
12 Aug 2013, 23:42 |
|
Picnic 13 Aug 2013, 13:10
cpcdos wrote: there are not code examples ? Check the DOS related FAQ. In section X (Starting with real mode programming) says How to execute an external program in ASM? DOS386 has spent a lot of time to organize all those links. |
|||
13 Aug 2013, 13:10 |
|
cpcdos 15 Aug 2013, 10:56
Yes perfect ! thank you !
But how to execute a .exe format ? I see this instruction mov bx,10010h shr 4 for allocate 64ko, but if i want execute a .exe format, i just adjust memory ? |
|||
15 Aug 2013, 10:56 |
|
DOS386 19 Aug 2013, 11:19
cpcdos wrote: Yes perfect ! thank you ! But how to execute a .exe format ? Same as DOS .COM, DOS will care. > I see this instruction > mov bx,10010h shr 4 Code: MOV BX, $1001 ; $0001'0010 Byte's (64 KiB + 16 Byte's) > for allocate 64ko, but if i want execute a .exe format, > i just adjust memory ? Use MZ EXE format and "heap" for your code, no need to resize then. AsmGuru62 wrote: If your shell is a windows shell -- use CreateProcess() API to start a child program. Also, try to use WinExec() API -- it has much less parameters than CreateProcess(). I do not have any working code for that. Search this forum for WinExec or CreateProcess -- maybe someone already posted code you need. This ^^^ is about spawning in Windows, NOT in DOS. DOS: http://www.ctyme.com/intr/rb-2939.htm INT $21 / AH=$4B Picnic wrote: Check the DOS related FAQ. In section X (Starting with real mode programming) says How to execute an external program in ASM? Updated, now in section C |
|||
19 Aug 2013, 11:19 |
|
patchariadog 17 Oct 2013, 19:00
You can launch any file (.exe .txt etc) by using this code
Code: invoke ShellExecuteA,NULL,NULL,filepathandname,NULL,NULL,SW_NORMAL just add this to the idata section of your code Code: library Shell32,'Shell32.dll' import Shell32,\ ShellExecuteA,'ShellExecuteA' You must have a computer that is running windows xp or later to use this code |
|||
17 Oct 2013, 19:00 |
|
DimonSoft 18 Oct 2013, 12:40
patchariadog wrote: You must have a computer that is running windows xp or later to use this code The ShellExecute function is also available in Win9x, especially the ANSI version. MSDN says that minimal OSes are Windows NT 3.1, Windows 95. |
|||
18 Oct 2013, 12:40 |
|
patchariadog 18 Oct 2013, 13:55
oh I did not know that, thanks!
|
|||
18 Oct 2013, 13:55 |
|
ACP 23 Oct 2013, 17:42
I seem to recall that HX dos extender does not support ShellExecuteW but I don't remember if ShellExecuteA is supported. If it is than actually you might run it under DOS+HX
|
|||
23 Oct 2013, 17:42 |
|
DOS386 25 Oct 2013, 17:35
ACP wrote: I seem to recall that HX dos extender does not support ShellExecuteW but I don't remember if ShellExecuteA is supported. If it is than actually you might run it under DOS+HX ShellExecuteA YES ShellExecuteExA YES ShellExecuteW NO ShellExecuteExW NO Note that HELL-EXECUTE just wraps deprecated WinExec function which then wraps BrewProcess function, and with HX this goes to DPMILD32 using enhanced INT $21/AX=$4Bxx ... so this is NOT the preferred straightforward way to spawn in DOS _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
25 Oct 2013, 17:35 |
|
freecrac 14 Nov 2013, 11:02
DOS386 wrote:
I like to free up the memory with calculating the number of bytes that our MZ EXE is needed and then using int 21h/ah=4Ah for to resize the memory. (Just doing it before we manipulate the ES-segment register for an other reason.) Code: mov bx, ss ; first we subtract the address in ES mov ax, es ; from the address in SS sub bx, ax ; the result is the number of paragraphs ; from our PSP to the beginning of our stack mov ax, sp ; because the stackpointer points to the end of our stacksegment add ax, 0Fh ; we become with the content of SP the length of our stack(+round up) shr ax, 4 ; converting to paragraphs add bx, ax ; adding to the length mov ah, 4Ah ; Input: BX= new size in paragraphs int 21h ; ES= segment of block to resize RESIZE MEMORY BLOCK Int 21/AH=4Ah http://www.ctyme.com/intr/rb-2936.htm ;------------------------------------------------------------- Some additional words for to execute a child-program using the 4Bh EXEC-function if the child want to get and search for some own commandline parameter: We have to get the current PSP address before we can get the commandline. Because the current PSP is not necessarily the caller's PSP. (I saw many codelistings are only pointing to CS:80h... without for to get the current PSP address before.) GET CURRENT PSP ADDRESS Int 21/AH=62h http://www.ctyme.com/intr/rb-3140.htm Dirk |
|||
14 Nov 2013, 11:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.