;Copyright 2000 - Mark McDonald All rights reserved
; DECLARE: FUNCTION getBiosDate$()
;     Returns computers BIO date in mm/dd/yy format.
;     EXAMPLE:  T$ = GETBIOSDATE   '07/09/97'

Extrn Get$Alloc:Far
Extrn Get$Loc:Far

MCode      Segment Byte
        Assume  CS: MCode

        Public  getBiosDate

getBiosDate Proc Far
        push    bp                      ;
        mov     bp,sp                   ;
        push    ds                      ;

        xor     AX, AX                  ; assume no valid date
        mov     BX, 0FFFFh              ; put FFFFh in BX
        mov     DS, BX                  ; point DS to BIOS
        mov     SI, 7                   ; BIOS date location
        cmp     Byte Ptr DS: [SI],"/"   ; is it a date?
        je      GoodDate                ;
        cmp     Byte Ptr DS: [SI],"-"   ; is it a date?
        jne     Exit                    ;
        sub     SI, 2                   ; point to start of date
        mov     AX, 8                   ; we need 8 bytes
        push    AX                      ; push it on the stack
        call    Get$Alloc               ; allocate a string
        push    AX                      ; save handle for exit
        push    AX                      ; push it again for Get$Loc
        call    Get$Loc                 ; find it
        mov     ES, DX                  ; put segment in ES
        mov     DI, AX                  ; put offset in DI
        rep     movsb                   ; copy date into string
        pop     AX                      ; restore string handle
        pop     DS                      ;
        pop     BP                      ;
        retf                            ;
getBiosDate EndP
MCode      EndS