home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / OS2HIST.ZIP / OS2DEFS.ASH < prev    next >
Text File  |  1988-01-22  |  4KB  |  139 lines

  1. ; ***********************************************************************
  2. ; *                                      *
  3. ; *  OS2DEFS.ASH - Definitions and macros for OS/2.            *
  4. ; *                                      *
  5. ; *  This file contains definitions, macros, and structures        *
  6. ; *  that are important for dealing with OS/2 from an assembly        *
  7. ; *  language program.                            *
  8. ; *                                      *
  9. ; ***********************************************************************
  10. ; *                                      *
  11. ; *  Revision History:                            *
  12. ; *                                      *
  13. ; *  12/05/87    MPL        Created file                *
  14. ; *                                      *
  15. ; ***********************************************************************
  16.  
  17.  
  18. ; ***********************************************************************
  19. ; *                                      *
  20. ; *  System Constants                            *
  21. ; *                                      *
  22. ; ***********************************************************************
  23.  
  24.  
  25. FOREVER        equ    0FFFFFFFFH        ; for DOSSEMWAIT & friends
  26.  
  27.  
  28. ; ***********************************************************************
  29. ; *                                      *
  30. ; *  OS2CALL macro                            *
  31. ; *                                      *
  32. ; *  This macro is used to call OS/2 system services.  The syntax    *
  33. ; *  for it is as follows:                        *
  34. ; *                                      *
  35. ; *      OS2CALL    funcname,<arg1,arg2,...>                *
  36. ; *                                      *
  37. ; *  If any of the arguments are more than one token (as in        *
  38. ; *  OFFSET foobar) they must also be enclosed in angle brackets:    *
  39. ; *                                      *
  40. ; *      OS2CALL DOSPUTMESSAGE,<0,msglen,DS,<offset message>>        *
  41. ; *                                      *
  42. ; ***********************************************************************
  43.  
  44. OS2CALL        macro    funcname,arglist
  45.         irp    x,<arglist>
  46.         push    x
  47.         endm
  48.         ifndef    funcname
  49.         extrn    funcname:far
  50.         endif
  51.         call    funcname
  52.         endm
  53.  
  54. ; ***********************************************************************
  55. ; *                                      *
  56. ; *  PUSH@ macros and friends                        *
  57. ; *                                      *
  58. ; *  These macrosf push the addresses of objects onto the stack        *
  59. ; *                                      *
  60. ; ***********************************************************************
  61.  
  62.  
  63. PUSH@        macro    addr
  64.         push    SEG addr
  65.         push    OFFSET addr
  66.         endm
  67.  
  68. PUSH@CS        macro    addr
  69.         push    CS
  70.         push    offset CS:addr
  71.         endm
  72.  
  73. PUSH@DS        macro    addr
  74.         push    DS
  75.         push    offset DS:addr
  76.         endm
  77.  
  78. PUSH@ES        macro    addr
  79.         push    ES
  80.         push    offset ES:addr
  81.         endm
  82.  
  83. PUSH@SS        macro    addr
  84.         push    SS
  85.         push    offset SS:addr
  86.         endm
  87.  
  88. PUSHL        macro    addr
  89.         push    word ptr addr+2
  90.         push    word ptr addr+0
  91.         endm
  92.  
  93. PUSHX        macro    wrd
  94.         push    wrd SHR 16
  95.         push    wrd AND 0FFFFH
  96.         endm
  97.  
  98.  
  99. ; ***********************************************************************
  100. ; *                                      *
  101. ; *  ERRJMP macro                            *
  102. ; *                                      *
  103. ; *  This macro is used to test for OS/2 errors.  The syntax for    *
  104. ; *  the macro is:                            *
  105. ; *                                      *
  106. ; *      ERRJMP place_to_go_if_errors                    *
  107. ; *                                      *
  108. ; *  Control will be transfered to the indicated address if AX        *
  109. ; *  is nonzero following an OS/2 error.                *
  110. ; *                                      *
  111. ; ***********************************************************************
  112.  
  113. ERRJMP        macro    whereto
  114.         local    skip01
  115.         or    ax,ax            ; test for OS2 error
  116.         jz    skip01            ; if no error continue
  117.         jmp    whereto            ; go to error routine
  118. skip01:
  119.         endm
  120.  
  121.  
  122. ERRJMPN        macro    whereto            ; same as ERRJMP except 
  123.                         ; where to go is SHORT
  124.         or    ax,ax            ; test for errors
  125.         jnz    whereto            ; jump if error
  126.         endm
  127.  
  128.  
  129. ; ***********************************************************************
  130. ; *                                      *
  131. ; *  OS/2 Error codes of interest                    *
  132. ; *                                      *
  133. ; ***********************************************************************
  134.  
  135.  
  136. ERROR_SEM_TIMEOUT    equ    121        ; semaphore wait timed out
  137.  
  138.  
  139.