home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / progjour / 1991 / 06 / alib / dos_errs.asm < prev    next >
Assembly Source File  |  1991-08-21  |  2KB  |  72 lines

  1.     title    ms_dos_strerror - ms_dos interface that sets error string
  2.     include    asm.inc
  3.  
  4.     public    ms_dos_strerror
  5.  
  6.     .const
  7. error_strings    dw    ertx_invalid_function,     ertx_file_not_found
  8.         dw    ertx_path_not_found,     ertx_no_handles_left
  9.         dw    ertx_access_denied,     ertx_invalid_handle
  10.         dw    ertx_memory_destroyed,     ertx_not_enough_memory
  11.         dw    ertx_invalid_memory_blk, ertx_invalid_environ
  12.         dw    ertx_invalid_format,     ertx_invalid_access_cod
  13.         dw    ertx_invalid_data,     err14
  14.         dw    ertx_invalid_drive,     ertx_del_current_dir
  15.         dw    ertx_not_same_device,     ertx_no_more_files
  16.  
  17. ertx_invalid_function    db    'Invalid function',0
  18. ertx_file_not_found    db    'File not found',0
  19. ertx_path_not_found    db    'Path not found',0
  20. ertx_no_handles_left    db    'No handles left',0
  21. ertx_access_denied    db    'Access denied',0
  22. ertx_invalid_handle    db    'Invalid handle',0
  23. ertx_memory_destroyed    db    'Memory ctrl blks destroyed',0
  24. ertx_not_enough_memory    db    'Not enough memory',0
  25. ertx_invalid_memory_blk    db    'Invalid memory blk adr',0
  26. ertx_invalid_environ    db    'Invalid environment',0
  27. ertx_invalid_format    db    'Invalid format',0
  28. ertx_invalid_access_cod    db    'Invalid access code',0
  29. ertx_invalid_data    db    'Invalid data',0
  30. err14            db    '?',0
  31. ertx_invalid_drive    db    'Invalid drive',0
  32. ertx_del_current_dir    db    'Deleting current dir',0
  33. ertx_not_same_device    db    'Not same device',0
  34. ertx_no_more_files    db    'No more files',0
  35. MAX_ERROR_CODE    equ    18
  36.  
  37.  public ertx_invalid_function,ertx_file_not_found,ertx_path_not_found
  38.  public ertx_no_handles_left,ertx_access_denied,ertx_invalid_handle
  39.  public ertx_memory_destroyed,ertx_not_enough_memory,ertx_invalid_memory_blk
  40.  public ertx_invalid_environ,ertx_invalid_format,ertx_invalid_access_cod
  41.  public ertx_invalid_data,ertx_invalid_drive,ertx_del_current_dir
  42.  public ertx_not_same_device,ertx_no_more_files
  43.  
  44.     .code
  45.     extn    ms_dos,set_strerror
  46.  
  47.  
  48. ;;    ms dos strerror
  49. ;
  50. ms_dos_strerror proc
  51.     call    ms_dos
  52.     jc    mde1            ;  if error during dos function
  53.     ret
  54.  
  55. mde1:    push    ax
  56.     cmp    ax,MAX_ERROR_CODE
  57.     ja    mde2            ;  if error code too high
  58.     add    ax,ax
  59.     jz    mde2            ;  if error code too low  (AX==0)
  60.  
  61.     xchg    ax,si            ; set error string
  62.     mov    si,error_strings[bp+si-2]
  63.     xchg    ax,si
  64.     call    set_strerror
  65.  
  66. mde2:    stc
  67.     pop    ax
  68.     ret
  69. ms_dos_strerror endp
  70.  
  71.     end
  72.