home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / UTMODEL.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-03-31  |  2.8 KB  |  114 lines

  1. ;
  2. ; Name        UTMODEL -- Report IBM model code
  3. ;
  4. ; Synopsis    model = utmodel();
  5. ;
  6. ;        char model     IBM model code:
  7. ;                  IBM_PC (0xff) if IBM PC.
  8. ;                  IBM_XT (0xfe) if IBM PC-XT or Portable
  9. ;                  IBM_JR (0xfd) if IBM PC-JR.
  10. ;                  IBM_AT (0xfc) if IBM PC-AT, XT model
  11. ;                           286, PS/2 models 50, 60
  12. ;                  IBM_X2 (0xfb) if IBM PC-XT with
  13. ;                           256/640 motherboard.
  14. ;                  IBM_CV (0xf9) if IBM PC Convertible.
  15. ;                  IBM_30 (0xfa) if IBM PS/2 model 25 or
  16. ;                           30.
  17. ;                  IBM_80 (0xf8) if IBM PS/2 model 80.
  18. ;
  19. ; Description    This function returns a code indicating which IBM PC
  20. ;        model the program is running on.  It also saves the
  21. ;        model code in b_pcmodel, the submodel code (if
  22. ;        available) in b_submod, and the BIOS revision number (if
  23. ;        available) in b_biosrev.
  24. ;
  25. ;        Note:  Model codes other than those listed above are not
  26. ;        recognized as valid IBM models.  If an unknown model
  27. ;        code is encountered, the submodel and BIOS revision
  28. ;        number will not be valid.
  29. ;
  30. ; Returns    model          IBM model code
  31. ;        b_pcmodel      IBM model code
  32. ;        b_submod      IBM submodel code, or 0 if unavailable
  33. ;        b_biosrev      IBM BIOS revision number, or 0 if
  34. ;                    unavailable
  35. ;
  36. ; Version    6.00 (C)Copyright Blaise Computing Inc.  1987-1989
  37. ;
  38.  
  39.     include beginasm.mac
  40.  
  41.     beginMod utmodel
  42.  
  43.                 ; IBM model codes:
  44. IBM_PC    equ  0ffh        ; IBM PC.
  45. IBM_XT    equ  0feh        ; IBM PC-XT or Portable
  46. IBM_JR    equ  0fdh        ; IBM PC-JR.
  47. IBM_AT    equ  0fch        ; IBM PC-AT, XT model 286,
  48.                 ;   PS/2 models 50, 60
  49. IBM_X2    equ  0fbh        ; IBM PC-XT with 256/640 motherboard.
  50. IBM_CV    equ  0f9h        ; IBM PC Convertible.
  51. IBM_30    equ  0fah        ; IBM PS/2 model 25 or 30.
  52. IBM_80    equ  0f8h        ; IBM PS/2 model 80.
  53.  
  54. BIOSREV struc
  55.     BIOSREV_length    dw  ?
  56.     BIOSREV_model    db  ?
  57.     BIOSREV_submodel    db  ?
  58.     BIOSREV_rev     db  ?
  59.     BIOSREV_feature    db  5 dup (?)
  60. BIOSREV ends
  61.  
  62.  
  63.     beginDSeg        ; Define & initialize global variables.
  64.     pubSym b_pcmodel,<db 0>
  65.     pubSym b_submod, <db 0ffh>
  66.     pubSym b_biosrev,<db 0ffh>
  67.     endDSeg
  68.  
  69.     beginCSeg utmodel
  70.     beginProc utmodel
  71.  
  72.     push    bp
  73.     mov    bp,sp
  74.  
  75.     push    ds
  76.     mov    ax,seg b_pcmodel@
  77.     mov    ds,ax
  78.  
  79.     cmp    ds:b_pcmodel@,0     ; Skip if we've already done this.
  80.     jne    done
  81.  
  82.     mov    ax,0ffffh        ; Fetch model code from 0ffffh:0eh.
  83.     mov    es,ax
  84.     assume    es:nothing
  85.     mov    al,es:[byte ptr 0eh]
  86.     mov    ds:b_pcmodel@,al
  87.  
  88.     cmp    al,IBM_80        ; Skip if model code is outside known
  89.     jb    done            ;  range.
  90.  
  91.     mov    ah,0c0h         ; Request further BIOS version info.
  92.     int    15h
  93.     jc    done            ; Quit if function unavailable.
  94.  
  95.     mov    al,es:[bx.BIOSREV_submodel]    ; Fetch submodel.
  96.     mov    ds:b_submod@,al
  97.  
  98.     mov    al,es:[bx.BIOSREV_rev]        ; Fetch BIOS release.
  99.     mov    ds:b_biosrev@,al
  100.  
  101. done:
  102.     mov    al,ds:b_pcmodel@    ; Return model code
  103.     cbw                ;  as a signed char.
  104.  
  105.     pop    ds
  106.     pop    bp
  107.     ret
  108.  
  109.     endProc utmodel
  110.     endCseg utmodel
  111.     endMod    utmodel
  112.  
  113.     end
  114.