Assembly load and execute issue

Posted by Jean Carlos Suárez Marranzini on Programmers See other posts from Programmers or by Jean Carlos Suárez Marranzini
Published on 2012-04-07T20:38:06Z Indexed on 2012/04/07 23:43 UTC
Read the original article Hit count: 458

Filed under:

I'm trying to develop Assembly code allowing me to load and execute(by input of the user) 2 other Assembly .EXE programs. I'm having two problems:

-I don't seem to be able to assign the pathname to a valid register(Or maybe incorrect syntax)

-I need to be able to execute the other program after the first one (could be either) started its execution.

This is what I have so far:

mov ax,cs ; moving code segment to data segment
mov ds,ax

mov ah,1h ; here I read from keyboard
int 21h
mov dl,al

cmp al,'1' ; if 1 jump to LOADRUN1 
JE LOADRUN1 
popf

cmp al,'2' ; if 1 jump to LOADRUN2 
JE LOADRUN2
popf

LOADRUN1:
    MOV AH,4BH
    MOV AL,00
    LEA DX,[PROGNAME1] ; Not sure if it works
    INT 21H


LOADRUN2:
    MOV AH,4BH
    MOV AL,00
    LEA DX,[PROGNAME2] ; Not sure if it works
    INT 21H

; Here I define the bytes containing the pathnames
PROGNAME1 db 'C:\Users\Usuario\NASM\Adding.exe',0 
PROGNAME2 db 'C:\Users\Usuario\NASM\Substracting.exe',0

I just don't know how start another program by input in the 'parent' program, after one is already executing.

Thanks in advance for your help! Any additional information I'll be more than happy to provide.

-I'm using NASM 16 bits, Windows 7 32 bits.

© Programmers or respective owner

Related posts about assembly