home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT6 / DOSVER.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  1.9 KB  |  44 lines

  1.  
  2. page 55,132
  3. ;
  4. ;       PROGRAM DosVer ( Chapter 6 )
  5. ;
  6. ;       15 Jan 1992
  7. ;
  8. ;       This is a sample of DOS service usage.  This program
  9. ;       gets the Dos version number and sets the return code
  10. ;       equal  to  this  value.   You can use this result in
  11. ;       BAT-files with the help of ErrorLevel function.  You
  12. ;       can get either the major or minor part of the number.
  13. ;       To get the major part of the number, pass the letter
  14. ;       H to  the  program  as  a  parameter  by  typing the
  15. ;       following command line
  16. ;
  17. ;       DosVer H
  18. ;
  19. ;       The return code will be equal to the majnor part  of
  20. ;       the  number  of your DOS version (for example if you
  21. ;       are  using  MS-DOS  3.31  the  result  will  be  3).
  22. ;       Passing  the  parameter L to the program you can get
  23. ;       the  minor part  of  your DOS  version  number ( for
  24. ;       example if you are using MS-DOS 3.31 the result will
  25. ;       be 31).
  26. ;
  27. .model  tiny               ; This is needed for COM- files
  28. .code                      ; This starts the CODE segment
  29.         org     100h       ; This is needed for COM- files
  30. begin:  
  31.         mov     bx,0       ; Clear the offset register
  32.         mov     bl,byte ptr cs:80h      ; Read the parameters length
  33.         mov     dl,byte ptr cs:[bx]+80h ; Read the last symbol
  34.                                         ;    of parameter string
  35.         and     dl,0DFh    ; UpCase the letter in DL
  36.         mov     ah,30h     ; DOS service 30h - get the DOS version
  37.         int     21h        ;    AH - minor part, AL - major part
  38.         cmp     dl,'L'     ; Check if the minor part required
  39.         jne     finish     ;   If not, leave the major part in AL
  40.         mov     al,ah      ;   If yes, move the minor part into AL
  41. Finish: mov     ah,4Ch     ; DOS service 4Ch - terminate program
  42.         int     21h        ;    AL - the return code
  43.         end     begin      ; The running starts from the label BEGIN
  44.