home *** CD-ROM | disk | FTP | other *** search
- ; DOSVER.ASM example routine for linking assembler routines to QuickBASIC
-
- ; Calling syntax: CALL DOSVER(VERSION$, MAJORV%, MINORV%)
- ; location on the stack: 10 8 6
-
-
- public DOSVER ; this makes the routine name callable from QuickBASIC
-
- .model medium ; this sets things up properly for use with QuickBASIC
- .CODE
-
-
- DOSVER proc far
- push bp ; save old BP value
- mov bp,sp ; BP now points to the parameters
-
- mov ah,30h ; function to get the DOS version
- int 21h ; execute the function
-
- ; we now have the major version number in AL
- ; ...and the minor version number in AH
-
- mov cl,ah ; put minor version # in CL
- mov ch,0 ; convert from a byte to a word
- mov ah,0 ; convert AL from byte to word
-
- mov bx,6[bp] ; get the address of MINORV%
- mov [bx],cx ; return the minor version number
-
- mov bx,8[bp] ; get the address of MAJORV%
- mov [bx],ax ; return the major version number
-
- mov bx,10[bp] ; get address of the string info
- cmp word ptr [bx],4 ; is VERSION$ long enough?
- jb Done ; no, it's too short-- exit
-
- mov bx,2[bx] ; get address of VERSION$ itself
-
- add al,"0" ; convert major version # to ASCII
- mov [bx],al ; store it in VERSION$
- inc bx ; move to the next character
- mov byte ptr [bx],"." ; store decimal point in VERSION$
- inc bx ; move to the next character
- mov al,cl ; put the minor version in AL
- aam ; convert to digits in AL and AH
- xchg al,ah ; put digits in correct order
- add ax,"00" ; convert minor version # to ASCII
- mov [bx],ax ; store it in VERSION$
-
- Done: pop bp ; restore old BP value
- ret 6 ; return (2 * three parameters)
- DOSVER endp
-
- end
-