home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / screen / hercules / scr_off.asm < prev    next >
Assembly Source File  |  1991-09-11  |  4KB  |  118 lines

  1. ;
  2. ;Programm schaltet den Bildschirm dunkel
  3. ;(für Hercules-Bildschirmadapter)
  4. ;in die CONFIG.SYS einbinden mit DEVICE=SCR_OFF.SYS
  5. ;
  6. ;übersetzen mit tasm    scr_off.asm
  7. ;               tlink   scr_off
  8. ;               exe2bin scr_off.exe scr_off.sys
  9. ;
  10. ;Grundlagen siehe Artikel "Dunkelmacher" in CT 6/87 S. 74
  11. ;Struktur des SYS-Treibers aus CT 3/90 S. 346
  12. ;
  13. ;letzte Änderung am 11.09.91 B. Rosenau
  14.  
  15.   code    segment public 'ATCODE'
  16.   atdrive proc    far
  17.           assume  cs:code,ds:code,es:code
  18.           org   0
  19.   header  dd    -1          ;Verbindung zum nächsten
  20.                             ;Treiber = Ende der Liste
  21.           dw    8000h       ;Geräte-Attribut-Wort
  22.           dw    strat       ;Eintrittspunkt für
  23.                             ;Strategie-Routine
  24.           dw    intr        ;Eintrittspunkt für
  25.                             ;Interruptroutine
  26.           db    'SCR_OFF'  ;Gerätetreiber-Name
  27.  
  28. ;
  29. ; Doppelwort-Pointer zum Anforderungskopf
  30. ;
  31. rh_ptr    dd   ?            ;Pointer zum Anforderungskopf
  32. ;
  33. ;Tabelle für nicht-standardgemäße Drive-Parameter
  34. ;
  35. ;Strategie-Routine des Gerätetreibers
  36. ;
  37. strat     proc  far         ;Adresse des Anforderungskopfes
  38.                             ;sichern
  39.           mov   word ptr cs:[rh_ptr],bx
  40.           mov   word ptr cs:[rh_ptr+2],es
  41.           ret
  42. strat     endp
  43. ;
  44. ;Interrupt-Routine des Gerätetreibers
  45. ;
  46. intr      proc  far
  47.           push  ax           ;Sichern der allgemeinen Register
  48.           push  bx
  49.           push  dx
  50.           push  ds
  51.           push  es
  52.           push  di
  53.           push  cs           ;Lokale Daten addressierbar machen
  54.           pop   ds
  55.           les   di,[rh_ptr]  ;ES:DI jetzt = Anforderungskopf
  56.           mov   bl,es:[di+2] ;setze bx = Befehlscode
  57.           xor   bh,bh
  58.           cmp   bx,0         ;Initialisierungsbefehl ?
  59.           je    init_st
  60.           mov   ax,8003h     ;Nein --> Fehler
  61.           je    init_ed
  62.   init_st:
  63.           call  init
  64.           les di,[rh_ptr] ;Anforderungskopf nach ES:DI wiederherstellen
  65.   init_ed:
  66.           or    ax,0100h  ;Flag im Statuswort auf "erledigt"
  67.                           ;setzen
  68.           mov   es:[di+3],ax
  69.           pop   di
  70.           pop   es
  71.           pop   ds
  72.           pop   dx
  73.           pop   bx
  74.           pop   ax
  75.           ret             ;zurück zu DOS
  76.  
  77. ;
  78. ;Initialisierungsroutine
  79. ;
  80. init      proc  near
  81.           push  es         ;Adresse des Anforderungskopfes
  82.                            ;sichern
  83.           push  di
  84.           xor   ax,ax      ;ES auf niedrigsten Speicherbereich
  85.                            ;setzen
  86.           mov   es,ax
  87.           mov   di,1Ch     ;Int-Nummer nach DI
  88.           shl   di,1       ;Multiplikation mit 4
  89.           shl   di,1
  90.  
  91. ;--------------------------------------------------------------------------
  92. ; Bildschirm dunkelschalten
  93.  
  94.           push ax
  95.           push dx
  96.           mov  dx,3B8h
  97.           mov al,0h
  98.           out  dx,al
  99.           pop  ax
  100.           pop  dx
  101.  
  102. ;--------------------------------------------------------------------------
  103.  
  104.           pop   di         ;Adresse des Anführungskopfes
  105.                            ;wiederherstellen
  106.           pop   es
  107.                            ;erste freizugebende Speicherstelle
  108.                            ;angeben
  109.           mov   word ptr es:[di+14],offset init
  110.           mov   word ptr es:[di+16],cs
  111.           xor   ax,ax      ;Rückkehrstatus setzen
  112.           ret
  113. init      endp
  114. intr      endp
  115. atdrive   endp
  116. code      ends
  117.           end
  118.