home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / c / csh4.zip / FEXEC.ASM < prev    next >
Assembly Source File  |  1985-09-05  |  1KB  |  72 lines

  1. ; Copyright (C) 1984 by Manx Software Systems
  2. ; :ts=8
  3.     include lmacros.h
  4. dataseg segment para public 'data'
  5. param    equ    this word
  6. env    dw    ?
  7. cline    dw    ?,?
  8. fcb1    dw    ?,?
  9. fcb2    dw    ?,?
  10.     extrn    errno_:word
  11. dataseg    ends
  12.     assume    ds:dataseg
  13. save_ss    dw    0
  14. save_sp    dw    0
  15.     procdef    fexec,<<filname,ptr>,<enva,word>,<clinea,ptr>,<fcb1a,ptr>,<fcb2a,ptr>>
  16. ;            char *fexec(name,env,cline,fcb1,fcb2)
  17. ;
  18.     push    si
  19.     push    di
  20.     pushf
  21.     push    [030H]
  22.     push    [02EH]
  23.     push    ds
  24.     push    es
  25.     mov    cs:save_ss,ss
  26.     mov    cs:save_sp,sp
  27. ;
  28. ;    set up parameter block for exec call
  29. ;
  30.     mov    ax,enva
  31.     mov    env,ax
  32. ifndef LONGPTR
  33.     mov    ax,ds
  34.     mov    es,ax
  35. endif
  36.     ldptr    ax,clinea,es
  37.     mov    cline,ax
  38.     mov    cline+2,es
  39.     ldptr    ax,fcb1a,es
  40.     mov    fcb1,ax
  41.     mov    fcb1+2,es
  42.     ldptr    ax,fcb2a,es
  43.     mov    fcb2,ax
  44.     mov    fcb2+2,es
  45. ;
  46.     mov    ax,ds
  47.     mov    es,ax
  48.     mov    bx,offset param
  49.     ldptr    dx,filname,ds        ;name of file to exec
  50.     mov    ax,04b00H
  51.     int    21h
  52.     mov    ss,cs:save_ss
  53.     mov    sp,cs:save_sp
  54.     pop    es
  55.     pop    ds
  56.     jnc    noerror
  57.     mov    errno_,ax
  58.     mov    ax,666
  59.     jmp    short done
  60. noerror:
  61.     sub    ax,ax
  62. done:
  63.     pop    [02EH]
  64.     pop    [030H]
  65.     popf
  66.     pop    di
  67.     pop    si
  68.     pret
  69.     pend    fexec
  70.     finish
  71.     end
  72.