home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-ASM_VI.ARJ / PROGASM.ZIP / PROG031.ASM < prev    next >
Assembly Source File  |  1988-04-10  |  1KB  |  29 lines

  1.  
  2. ;************************************************************************
  3. ; Determine primary adapter from BIOS variable in segment               *
  4. ; zero and return value in AX                                           *
  5. ; Exit: AX - Primary adapter type                                       *
  6. ;       1 => EGA is primary                                             *
  7. ;       2 => CGA is primary                                             *
  8. ;       3 => MDA or Hercules is primary                                 *
  9. ;************************************************************************
  10.  
  11.         PUBLIC  _Get_Primary
  12.  
  13. _Get_Primary    PROC NEAR
  14.         PUSH    ES                      ;Preserve ES
  15.         XOR     AX,AX                   ;Move segment zero into ES
  16.         MOV     ES,AX
  17.         MOV     BL,ES:[BIOS_Equipment]  ;Fetch info byte
  18.         MOV     AX,1                    ;Assume EGA is primary
  19.         TEST    BL,08H                  ;Is EGA primary?
  20.         JZ      Primary_Found           ;...Yes, we are done
  21.         MOV     AX,2                    ;...No, assume CGA is primary
  22.         TEST    BL,02H                  ;Is mono attached to EGA?
  23.         JNZ     Primary_Found           ;...Yes, we are done
  24.         MOV     AX,3                    ;...No, must set AX to MDA
  25. Primary_Found:
  26.         POP     ES                      ;Restore ES
  27.         RET
  28. _Get_Primary    ENDP
  29.