home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / caway349.zip / BIN / VERSION.ASM < prev    next >
Assembly Source File  |  1996-06-17  |  1KB  |  71 lines

  1. ;
  2. ;Example to detect if running under CauseWay and to get version if so.
  3. ;
  4.  
  5.     .model small
  6.     .386
  7.     .stack 1024
  8.  
  9.     .code
  10.  
  11. start    proc    near
  12.     mov    ax,DGROUP
  13.     mov    ds,ax
  14.  
  15. ;
  16. ;Get CauseWay API interrupt vector address.
  17. ;
  18.     mov    ax,3531h
  19.     int    21h
  20. ;
  21. ;Check segment/selector isn't zero.
  22. ;
  23.     mov    ax,es
  24.     or    ax,ax
  25.     jz    @@NotCauseway
  26. ;
  27. ;Move back to where the CauseWay ID should be and check for it.
  28. ;
  29. ;CauseWay API handler is preceded by:
  30. ;
  31. ; DB "CAUSEWAY"
  32. ; DB MajorVersion
  33. ; DB MinorVersion
  34. ;
  35. ;MajorVersion is in the range 0-255
  36. ;MinorVersion is in the range 0-99
  37. ;
  38. ;Both version numbers are binary, ie, NOT ASCII or BCD.
  39. ;
  40.     sub    bx,10
  41.     cmp    es:dword ptr[bx],"SUAC"
  42.     jnz    @@NotCauseway
  43.     cmp    es:dword ptr[bx+4],"YAWE"
  44.     jnz    @@NotCauseway
  45. ;
  46. ;Running under CauseWay so let the user know.
  47. ;
  48.     mov    dx,offset IsCauseWayText
  49.     mov    ah,9
  50.     int    21h
  51.     jmp    @@Done
  52. ;
  53. ;Not running under CauseWay so let the user know.
  54. ;
  55. @@NotCauseway:    mov    dx,offset NotCauseWayText
  56.     mov    ah,9
  57.     int    21h
  58. ;
  59. ;Exit to DOS/CauseWay
  60. ;
  61. @@Done:    mov    ax,4c00h
  62.     int    21h
  63. start    endp
  64.  
  65.     .data
  66.  
  67. IsCauseWayText    db "Running under CauseWay.",13,10,"$"
  68. NotCauseWayText db "Not running under CauseWay.",13,10,"$"
  69.  
  70.     end start
  71.