home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / asm / wasm / dos.mac < prev    next >
Text File  |  1987-08-13  |  1KB  |  61 lines

  1.  List-
  2.  
  3. ;=============================================================================
  4. ; DOS Macro Interface
  5. ;
  6. ; These are macros to implement a few common DOS functions.
  7.  
  8. ;================================================
  9. ; Execute a DOS function call.
  10. ;
  11. ;  FUNC - function number: 8 bit operand.
  12.  
  13. Dos Macro Func
  14.  Mov Ah, Func
  15.  Int 21h
  16.  Endm
  17.  
  18. ;================================================
  19. ; Reallocate the segment in ES to the specified
  20. ; number of bytes.
  21. ;
  22. ;  BYTES - new size of segment in bytes: 16 bit
  23. ;   operand.
  24.  
  25. Reallocate Macro Bytes
  26.  Mov Bx, Bytes
  27.  Mov Cl, 4
  28.  Shr Bx, Cl
  29.  Inc Bx
  30.  Dos 4ah
  31.  Endm
  32.  
  33. ;================================================
  34. ; Allocate a new segment with the specified
  35. ; number of bytes. AX returns the segment address.
  36. ;
  37. ;  BYTES - new size of segment in bytes: 16 bit
  38. ;   operand.
  39.  
  40. Allocate Macro Bytes
  41.  Mov Bx, Bytes
  42.  Mov Cl, 4
  43.  Shr Bx, Cl
  44.  Inc Bx
  45.  Dos 48h
  46.  Endm
  47.  
  48. ;================================================
  49. ; Exit the program with error code set.
  50. ;
  51. ;  ERR - error code (default 0): 8 bit operand.
  52.  
  53. Exit Macro Err
  54.  If Type(Err) And Type()
  55.   Sub Al, Al
  56.  Else
  57.   Mov Al, Err
  58.  Endif
  59.  Dos 4ch
  60.  Endm
  61.