assembly - TASM ASM 16bit. Load program -


i want load other program asm. write exe program small model. code can find here:

;-------------------macro----------------- newline macro     push ax     push dx      ;print new line     mov dl, 10     mov ah, 02h     int 21h      mov dl, 13     mov ah, 02h     int 21h      pop dx     pop ax endm  println macro info     push ax     push dx      mov ah, 09h     mov dx, offset info     int 21h      newline      pop dx     pop ax endm  ;   input: ;       ax - error code printerrorcode macro     add al, '0'     mov dl, al     mov ah, 06h     int 21h      newline endm ;-----------------end macro----------------  .model small  .stack 100h  .data  inittorunerrortext db "bad init run other programs. error code: ", '$' runexeerrortext db "error running other program. error code: ", '$'  newprogramcmd db 0 folderpath db "c:\files\lab2.exe", 0, '$'  segmentaddress dw 0 epbstruct db 16h dup(0)  .code  main:     mov ax, @data     mov es, ax     mov ds, ax      call inittorun     call runexe      mov ah, 4ch     int 21h  ;   result ;       ax = 0 => ;       ax != 0 => have error inittorun proc     push bx      mov ah, 48h     mov bx, 05h              int 21h      jnc inittorunallgood      println inittorunerrortext      printerrorcode      mov ax, 1      jmp inittorunend  inittorunallgood:     mov segmentaddress, ax     mov ax, 0  inittorunend:     pop bx     ret endp  ;   result ;       ax = 0 => ;       ax != 0 => have error runexe proc     push bx dx      mov ax, segmentaddress     mov word ptr epbstruct, ax     mov word ptr epbstruct + 02h, offset newprogramcmd           mov word ptr epbstruct + 06h, ax                     mov word ptr epbstruct + 0ah, ax                      mov ax, 4b00h                mov dx, offset folderpath   ;temporary, pathtorequredexe     mov bx, offset epbstruct     int 21h      jnc runexeallgood      println runexeerrortext     printerrorcode      mov ax, 1      jmp runexeend  runexeallgood:     mov ax, 0  runexeend:     pop dx bx     ret endp  end main 

if run it, have same output:

bad init run other programs. error code:
8
error running other program. error code:
8

if write lower number allocating memory (dos 48h int 21h), first error disappeared. if try free memory dos 4ah int 21h, don't know size should tell it. how can solve problem? p.s. use tasm 16bit dosbox v0.74


Comments