home *** CD-ROM | disk | FTP | other *** search
/ Die ASC Mega 2 / ASC-Mega2-CD-ROM.iso / SPIELE / KAISER / VIDADAPT.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-02-24  |  1.7 KB  |  115 lines

  1. ; VIDADAPT.ASM
  2. ;
  3. ; aus DOS 7'90  S.140ff
  4. ;
  5. ; function video_adapter: byte;
  6.  
  7. code        segment word public
  8.         assume    cs:code
  9.  
  10. video_adapter    proc far
  11.         public    video_adapter
  12.  
  13. ; Prüfung auf MCGA und VGA:
  14.     mov    ax,1A00h    ; Die Funktion $1A des Int. $10 wird nur
  15.     int    10h        ; vom PS/2- und VGA-BIOS unterstützt
  16.     cmp    al,1Ah
  17.     jne    kein_ps2
  18.     cmp    bl,0FFh        ; unbekannte Karte
  19.     je    kein_ps2
  20.     cmp    bl,0        ; keine Karte
  21.     je    kein_ps2
  22.  
  23.     cmp    bl,3
  24.     je    kein_ps2
  25.     cmp    bl,6
  26.     je    kein_ps2
  27.     cmp    bl,9
  28.     je    kein_ps2
  29.     xor    bh,bh
  30.     mov    al,cs:tabelle[bx]
  31.         ret
  32.  
  33. kein_ps2:
  34. ; Prüfung auf EGA:
  35.     mov    bl,10h        ; Die Funktion $12 des Int. $10 wird nur
  36.     mov    ah,12h        ; vom EGA-BIOS unterstützt
  37.     int    10h
  38.     cmp    bl,10h
  39.     je    kein_ega
  40.     mov    al,4
  41.         ret
  42.  
  43. kein_ega:
  44. ; Prüfung auf CGA:
  45.     mov    ah,0Fh
  46.     int    10h
  47.     cmp    al,7
  48.     je    hgc_mda_moeglich
  49.     mov    dx,3D4h
  50.     call    suche_crtc
  51.     cmp    al,0
  52.     je    hgc_mda_moeglich
  53.     mov    al,2
  54.         ret
  55.  
  56. hgc_mda_moeglich:
  57. ; Prüfung auf HGC / MDA:
  58.     mov    dx,3B4h
  59.     call    suche_crtc
  60.     cmp    al,0
  61.     je    unbekannt
  62.     mov    dx,3BAh
  63.     in    al,dx
  64.     and    al,80h
  65.     mov    ah,al
  66.     mov    cx,9000h
  67. bit_7_loop:
  68.     in    al,dx
  69.     and    al,80h
  70.     cmp    ah,al
  71.     loope    bit_7_loop
  72.     cmp    ah,al
  73.     je    mda_da
  74.     mov    al,3
  75.         ret
  76. mda_da:
  77.     mov    al,1
  78.         ret
  79.  
  80. unbekannt:
  81.     mov    al,0FFh
  82.         ret
  83.  
  84. suche_crtc      proc near
  85.  
  86. register    equ 0Eh
  87. pruef_wert    equ 8
  88.  
  89.     mov    al,register
  90.     out    dx,al
  91.     inc    dx
  92.     in    al,dx
  93.     mov    ah,al
  94.     mov    al,pruef_wert
  95.     out    dx,al
  96.     mov    cx,3000
  97. warte:    loop    warte
  98.     in    al,dx
  99.     xchg    al,ah
  100.     out    dx,al
  101.     mov    al,0
  102.     cmp    ah,pruef_wert
  103.     je    crtc_da
  104.     ret
  105. crtc_da:
  106.     mov    al,1
  107.     ret
  108. suche_crtc    endp
  109.  
  110. tabelle        db 0,1,2,0,4,4,0,6,6,0,5,5,5
  111.  
  112. video_adapter    endp
  113.  
  114. code        ends
  115.                 end