home *** CD-ROM | disk | FTP | other *** search
/ Shareware Compilation 6 / SharewareCD_06.zip / pcspace / s3h.asm < prev    next >
Assembly Source File  |  1993-10-05  |  3KB  |  126 lines

  1.  
  2. ;Pcspace-screen driver S3- 256colors
  3. ;
  4. ;To create a S3h.drv:
  5. ; tasm s3h
  6. ; tlink s3h
  7. ; exe2bin s3h
  8. ; ren s3h.bin s3h.drv
  9. ;
  10. ; Attention: Maximum length of the drv file: 256 Bytes
  11.  
  12. prog  segment para 'code'
  13.  assume cs:prog
  14.  assume ds:prog
  15.  assume ss:prog
  16.  assume es:prog
  17.  
  18. start  proc  far
  19.        ; Initialize entry point for video mode
  20.        jmp short init
  21.  
  22.        ; Set the entry point 64k bank and set the segment address to es
  23.        ; The bank number has been set in al.
  24.        jmp short bank
  25.  
  26.      ;parameter for the driver
  27.        db 255 ;number of colors-1
  28.        ;Table of parameters for initialization
  29.        db 01h ;Mode 0: resolution 640*480
  30.        db 03h ;Mode 1: resolution 800*600
  31.        db 05h ;Mode 2: resolution 1024*768
  32.        db -1  ;Mode 3: resolution 1280*960 (no such resolution)
  33.        db -1  ;Mode 4: resolution 1280*1024 (no such resolution)
  34.  
  35.        db "S3 256colors" ;Identification text for SETUP
  36.        db 0              ;length can be adjustable
  37.  
  38.      ;Initialize video mode
  39.      ;Used registers: ax,bx
  40.      ;al has been set to the value of the parameter table
  41.      ;No such resolution (Par.-1) has been captured already.
  42.  init: push  ax
  43.        mov   bl,al
  44.        mov   bh,2
  45.        mov   ax,4f02h
  46.        int   10h
  47.  
  48.        xor   ax,ax
  49.        mov   es,ax
  50.  
  51.        pop   ax
  52.        mov   ah,al
  53.        mov   al,50h
  54.        cmp   ah,1
  55.        je    inz
  56.        mov   al,64h
  57.        cmp   ah,3
  58.        je    inz
  59.        mov   al,80h
  60.        cmp   ah,5
  61.        je    inz
  62.        mov   al,0a0h
  63.    inz:xor   ah,ah
  64.        mov   es:044ah,ax
  65.  
  66.        mov   ah,al
  67.        mov   dx,3d4h
  68.        mov   al,11h
  69.        out   dx,al
  70.        inc   dx
  71.        in    al,dx
  72.        and   al,07fh
  73.        out   dx,al
  74.  
  75.        dec   dx
  76.        mov   al,13h
  77.        out   dx,al
  78.        inc   dx
  79.        mov   al,ah
  80.        out   dx,al
  81.        retf
  82.  
  83.  
  84.      ;set video bank
  85.      ;Used registers: ax,dx,es
  86.  bank: push  cx
  87.        mov   cl,al
  88.        mov   dx,03d4h
  89.  
  90.        mov   al,38h
  91.        out   dx,al
  92.        inc   dx
  93.        mov   al,48h
  94.        out   dx,al
  95.  
  96.        dec   dx
  97.        mov   al,31h
  98.        out   dx,al
  99.  
  100.        inc   dx
  101.        in    al,dx
  102.        or    al,09h
  103.        out   dx,al
  104.  
  105.        dec   dx
  106.        mov   al,35h
  107.        out   dx,al
  108.        inc   dx
  109.        in    al,dx
  110.  
  111.        and   al,0f0h
  112.        or    al,cl
  113.        out   dx,al
  114.        pop   cx
  115.  
  116.        ;segmentadr. video memory
  117.        mov   ax,0a000h
  118.        mov   es,ax
  119.        retf
  120.  
  121.  
  122. start  endp
  123.  
  124. prog  ends
  125.  
  126.  end  start