qa.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GetVer
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* GetVer - Gets DOS version.
;*
;* Shows:   DOS Function - 30h (Get MS-DOS Version Number)
;*
;* Params:  None
;*
;* Return:  Short integer of form (M*100)+m, where M is major
;*          version number and m is minor version, or 0 if
;*          DOS version earlier than 2.0
 
GetVer  PROC
 
        mov     ah, 30h                 ; DOS Function 30h
        int     21h                     ; Get MS-DOS Version Number
        cmp     al, 0                   ; DOS version 2.0 or later?
        jne     @F                      ; Yes?  Continue
        sub     ax, ax                  ; No?  Set AX = 0
        jmp     SHORT exit              ;   and exit
@@:     sub     ch, ch                  ; Zero CH and move minor
        mov     cl, ah                  ;   version number into CX
        mov     bl, 100
        mul     bl                      ; Multiply major by 10
        add     ax, cx                  ; Add minor to major*10
exit:   ret                             ; Return result in AX
 
GetVer  ENDP
                                    -♦-