First post, by llm
hello.exe that should get executed by exeload.exe
hello.asm
.model small
.stack 200h
dseg segment 'DATA'
hello db 'hello',0dh,0ah,'$'
dseg ends
cseg segment 'CODE'
assume cs:cseg
start:
mov ax,dseg
mov ds,ax
mov dx,offset hello
mov ah,09h
int 21h
mov ax,4C00h
int 21h
cseg ends
end start
build with masm/uasm or wasm
exeload.asm
.model small
.stack 200h
dseg segment 'DATA'
filename db 'hello.exe',0
commandline db ' ',0dh
params:
dw 0 ; copy caller environment if 0
dw offset commandline
dw seg commandline
dw 0ffffh,0ffffh ; fcb1
dw 0ffffh,0ffffh ; fcb2
error_msg db 'exec failed$',0dh,0ah
dseg ends
cseg segment 'CODE'
assume cs:cseg
start:
mov ax,dseg
mov ds,ax
mov es,ax
mov dx,offset filename
mov bx,offset params
mov ax,4B00h
push ds ; save ds for return
push es ; save es for return
; seems to be needed for old dos versions
mov cs:[stk_seg],ss ; save stack seg and
mov cs:[stk_ptr],sp ; stack pointer in cseg
int 21h
jnc execute_ok
; ax = 8 = Insufficient memory
mov dx,offset error_msg
mov ah,09h
int 21h
jmp exit
execute_ok:
cli
mov ss,cs:[stk_seg]
mov sp,cs:[stk_ptr]
pop es
pop ds
sti
exit:
mov ax,4C00h
int 21h
stk_ptr dw 0
stk_seg dw 0
cseg ends
end start
build with masm,uasm,wasm
the call to int 21h ah=4B00h returns with cf = 1 and ax = 8 => insufficent memory
i though exe program do not allocate the complete free ram like com programs - am im wrong - can find any references