flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
macomics 09 Sep 2025, 14:39
TASM is a compiler. It doesn't run external programs on execution. The operating system does this.
If you're talking about TASM, then it's probably DOS. Although there is also TASM32 for Windows. Under DOS, you have the INT21h 4Bh function to run external program. But in order for it to work, you need to reduce the memory size for your program (INT21h 4Ah function). Then DOS will be able to allocate the freed memory for the running program. For Windows, you have kernel32.lib (import32.lib) and the CreateProcessA function. |
|||
![]() |
|
sgabor68 10 Sep 2025, 07:47
Thank you for your help, I'll try. I only mentioned that I use TASM because other compilers like FASM can indicate syntax errors within the program.
|
|||
![]() |
|
AsmGuru62 10 Sep 2025, 15:24
1. Please tell us what Operating System you are using to run the external program.
2. Please post the FASM code which shows the syntax errors. |
|||
![]() |
|
sgabor68 11 Sep 2025, 07:42
Hello.
I would like to run the DOS command line interpreter (cmd.exe) found in Windows system32 under a DOS operating system. I tried a code snippet, but it is probably interpreted by FASM only because TASM gives syntax errors (4). The code: org 100h ; first, we need to free the conventional memory we don't use, ; so there will be some memory available for the program we want ; to run, if we used MZ format of executable, the directive ; "heap 0" would be enough for this purpose, in case of .com ; program we have to free that memory manually be resizing the ; memory block starting at our PSP (es is already set to it) mov ah,4Ah ; resize memory block mov bx,10010h shr 4 ; only memory needed for .com int 21h ; now set up the pointer to command line in the parameters block mov word [cmdline],_command mov word [cmdline+2],ds ; we are ready to execute the program now mov ax,4B00h ; load and execute program mov dx,_program ; ASCIIZ path of program mov bx,params ; parameter block int 21h int 20h ; exit program _program db 'c:\command.com',0 _command db 0 ; length of command line db 13 ; must end with CR character params: environment dw 0 ; segment of environment, 0 means to use parent's one cmdline dd ? ; pointer to command line default_fcb1 dd 0 ; pointers to file control blocks default_fcb2 dd 0 Thanks if you have some good advice. |
|||
![]() |
|
macomics 11 Sep 2025, 09:07
That's right. This is a fragment of the program for fasm.
The syntax is slightly different for TASM. If I haven't forgotten all the features yet, then for TASM this program will look like this. Code: .386 .model small segment text assume cs:text, ds:text, es:text org 100h ; first, we need to free the conventional memory we don't use, ; so there will be some memory available for the program we want ; to run, if we used MZ format of executable, the directive ; "heap 0" would be enough for this purpose, in case of .com ; program we have to free that memory manually be resizing the ; memory block starting at our PSP (es is already set to it) startup: mov ah,4Ah ; resize memory block mov bx,1001h ; only memory needed for .com int 21h ; now set up the pointer to command line in the parameters block mov word ptr cmdline,_command mov word ptr cmdline[2],ds ; we are ready to execute the program now mov ax,4B00h ; load and execute program mov dx,offset _program ; ASCIIZ path of program mov bx,offset params ; parameter block int 21h int 20h ; exit program _program db 'c:\command.com',0 _command db 0 ; length of command line db 13 ; must end with CR character params: environment dw 0 ; segment of environment, 0 means to use parent's one cmdline dd ? ; pointer to command line default_fcb1 dd 0 ; pointers to file control blocks default_fcb2 dd 0 ends text end startup |
|||
![]() |
|
Tomasz Grysztar 11 Sep 2025, 09:59
macomics wrote: The syntax is slightly different for TASM. If I haven't forgotten all the features yet, then for TASM this program will look like this. Code: mov word ptr cmdline,offset _command mov word ptr cmdline[2],ds Code: segment text use16 And switching to "ideal" mode would make it a bit closer to fasm: Code: ideal p386 model small segment text use16 assume cs:text, ds:text, es:text org 100h Code: mov [word cmdline],offset _command mov [word cmdline+2],ds |
|||
![]() |
|
AsmGuru62 11 Sep 2025, 13:12
Please correct me, but I think that CMD.EXE found in Windows OS is not a DOS executable file.
|
|||
![]() |
|
Hrstka 12 Sep 2025, 08:25
Trying to run a Windows program under DOS usually results in a message "This program cannot be run in DOS mode" and termination.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.