home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-ASM_VI.ARJ / PROGASM.ZIP / PROG027P.ASM < prev    next >
Assembly Source File  |  1988-05-25  |  2KB  |  45 lines

  1.  
  2. ;************************************************************************
  3. ; Determine display type from BIOS variables in segment zero            *
  4. ; and return value in AX                                                *
  5. ; Exit: AX - Display type                                               *
  6. ;       0 => None                                                       *
  7. ;       3 => Enhanced Display (or Multi-scan)                           *
  8. ;       4 => Color Display                                              *
  9. ;       5 => Monochrome Display                                         *
  10. ;       7 => VGA Monochrome                                             *
  11. ;       8 => VGA Color (or Multi-scan)                                  *
  12. ;************************************************************************
  13.  
  14.         PUBLIC  Get_Display_Type
  15.  
  16. Get_Display_Type       PROC FAR
  17.         PUSH    ES                      ;Preserve ES
  18.         MOV     AX,1A00H                ;First look for VGA by trying fn=1A
  19.         INT     10H
  20.         CMP     AL,1AH                  ;There is no VGA if AL not 1A
  21.         JNE     VGA_Not_There           ;...so go look for EGA
  22.         MOV     AL,BL                   ;Return primary display info
  23.         JMP     Found_Type
  24.  
  25. VGA_Not_There:
  26.         XOR     AX,AX                   ;Move segment zero into ES
  27.         MOV     ES,AX
  28.         MOV     AL,5                    ;Assume monochrome display
  29.         TEST    BYTE PTR ES:[BIOS_Equipment],2   ;Test if mono bit is ON
  30.         JNZ     Found_Type              ;...Yes, we are done
  31.                                         ;...No, must look at switches
  32.         MOV     CL,ES:[BIOS_Switch]     ;Fetch switch settings
  33.         AND     CL,0FH                  ;Isolate config switches
  34.         MOV     AL,3                    ;Assume Enhanced display
  35.         CMP     CL,9H                   ;Is switch 'off on on off'?
  36.         JE      Found_Type              ;...Yes, we are done
  37.         CMP     CL,3                    ;Is switch 'off off on on'?
  38.         JE      Found_Type              ;...Yes, we are done
  39.         MOV     AL,4                    ;...No, must be color display
  40. Found_Type:
  41.         XOR     AH,AH                   ;Clear AH
  42.         POP     ES                      ;Restore ES
  43.         RET
  44. Get_Display_Type       ENDP
  45.