home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Name UTMODEL -- Report IBM model code
- ;
- ; Synopsis model = utmodel();
- ;
- ; char model IBM model code:
- ; IBM_PC (0xff) if IBM PC.
- ; IBM_XT (0xfe) if IBM PC-XT or Portable
- ; IBM_JR (0xfd) if IBM PC-JR.
- ; IBM_AT (0xfc) if IBM PC-AT, XT model
- ; 286, PS/2 models 50, 60
- ; IBM_X2 (0xfb) if IBM PC-XT with
- ; 256/640 motherboard.
- ; IBM_CV (0xf9) if IBM PC Convertible.
- ; IBM_30 (0xfa) if IBM PS/2 model 25 or
- ; 30.
- ; IBM_80 (0xf8) if IBM PS/2 model 80.
- ;
- ; Description This function returns a code indicating which IBM PC
- ; model the program is running on. It also saves the
- ; model code in b_pcmodel, the submodel code (if
- ; available) in b_submod, and the BIOS revision number (if
- ; available) in b_biosrev.
- ;
- ; Note: Model codes other than those listed above are not
- ; recognized as valid IBM models. If an unknown model
- ; code is encountered, the submodel and BIOS revision
- ; number will not be valid.
- ;
- ; Returns model IBM model code
- ; b_pcmodel IBM model code
- ; b_submod IBM submodel code, or 0 if unavailable
- ; b_biosrev IBM BIOS revision number, or 0 if
- ; unavailable
- ;
- ; Version 6.00 (C)Copyright Blaise Computing Inc. 1987-1989
- ;
-
- include beginasm.mac
-
- beginMod utmodel
-
- ; IBM model codes:
- IBM_PC equ 0ffh ; IBM PC.
- IBM_XT equ 0feh ; IBM PC-XT or Portable
- IBM_JR equ 0fdh ; IBM PC-JR.
- IBM_AT equ 0fch ; IBM PC-AT, XT model 286,
- ; PS/2 models 50, 60
- IBM_X2 equ 0fbh ; IBM PC-XT with 256/640 motherboard.
- IBM_CV equ 0f9h ; IBM PC Convertible.
- IBM_30 equ 0fah ; IBM PS/2 model 25 or 30.
- IBM_80 equ 0f8h ; IBM PS/2 model 80.
-
- BIOSREV struc
- BIOSREV_length dw ?
- BIOSREV_model db ?
- BIOSREV_submodel db ?
- BIOSREV_rev db ?
- BIOSREV_feature db 5 dup (?)
- BIOSREV ends
-
-
- beginDSeg ; Define & initialize global variables.
- pubSym b_pcmodel,<db 0>
- pubSym b_submod, <db 0ffh>
- pubSym b_biosrev,<db 0ffh>
- endDSeg
-
- beginCSeg utmodel
- beginProc utmodel
-
- push bp
- mov bp,sp
-
- push ds
- mov ax,seg b_pcmodel@
- mov ds,ax
-
- cmp ds:b_pcmodel@,0 ; Skip if we've already done this.
- jne done
-
- mov ax,0ffffh ; Fetch model code from 0ffffh:0eh.
- mov es,ax
- assume es:nothing
- mov al,es:[byte ptr 0eh]
- mov ds:b_pcmodel@,al
-
- cmp al,IBM_80 ; Skip if model code is outside known
- jb done ; range.
-
- mov ah,0c0h ; Request further BIOS version info.
- int 15h
- jc done ; Quit if function unavailable.
-
- mov al,es:[bx.BIOSREV_submodel] ; Fetch submodel.
- mov ds:b_submod@,al
-
- mov al,es:[bx.BIOSREV_rev] ; Fetch BIOS release.
- mov ds:b_biosrev@,al
-
- done:
- mov al,ds:b_pcmodel@ ; Return model code
- cbw ; as a signed char.
-
- pop ds
- pop bp
- ret
-
- endProc utmodel
- endCseg utmodel
- endMod utmodel
-
- end