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

  1. ;init V2.0 / bank V2.0 routines for VESA 16 colors
  2. ;(c) 1993 Christian Wagner (wagner@informatik.tu-muenchen.de)
  3. ; and Peter Liebel
  4. ;for Pcspace from Peter Liebel
  5.  
  6. ;Pcspace-screen driver VESA- 16colors
  7. ;
  8. ;To create a vesal.drv:
  9. ; tasm vesal
  10. ; tlink vesal
  11. ; exe2bin vesal
  12. ; ren vesal.bin vesal.drv
  13. ;
  14. ; Attention: Maximum length of the drv file: 256 Bytes
  15.  
  16. prog  segment dword 'code'
  17.  assume cs:prog
  18.  
  19. start  proc  far
  20.        ; Initialize entry point for video mode
  21.        jmp short init
  22.  
  23.        ; Set the entry point 64k bank and set the segment address to es
  24.        ; The bank number has been set in al.
  25.        jmp short bank
  26.  
  27.      ;parameter for the driver
  28.        db 15 ;number of colors-1
  29.        ;Table of parameters for initialization
  30.        db 12h ;Mode 0: resolution 640*480
  31.        db 02h ;Mode 1: resolution 800*600
  32.        db 04h ;Mode 2: resolution 1024*768
  33.        db -1  ;Mode 3: resolution 1280*960 (no such resolution)
  34.        db 06h ;Mode 4: resolution 1280*1024
  35.  
  36.        db "VESA 16colors" ;Identification text for SETUP
  37.        db 0                ;length can be adjustable
  38.  
  39.      ;Initialize video mode
  40.      ;Used registers: ax,bx
  41.      ;al has been set to the value of the parameter table
  42.      ;No such resolution (Par.-1) has been captured already.
  43.  init:  push    bx              ;offset of the driver
  44.         cmp     al,12h          ;resolution 640*480 ?
  45.         jne     vesa
  46.         xor     ah,ah
  47.         int     10h
  48.   exit: pop     bx
  49.         retf
  50.  
  51.   vesa: push    ax
  52.     mov     bl,al           ;value of the parameter table
  53.         mov     bh,1
  54.         mov     ax,4f02h
  55.         int     10h
  56.  
  57.         pop     ax
  58.         cmp     al,4
  59.         jb      exit
  60.  
  61.         xor     bx,bx
  62.         mov     dx,1
  63.         mov     ax,4f05h
  64.         int     10h
  65.  
  66.         mov     ax,0a000h
  67.         mov     es,ax
  68.         mov     es:0,ah
  69.         push    ax
  70.  
  71.         xor     bx,bx
  72.         xor     dx,dx
  73.         mov     ax,4f05h
  74.         push    ax
  75.         int     10h
  76.         xor     dx,dx
  77.         mov     bx,1
  78.         pop     ax
  79.         int     10h
  80.  
  81.         pop     ax
  82.         mov     bx,100h
  83.         mov     cl,8
  84.    grlp:shl     bx,1
  85.         dec     cl
  86.         jz      grout
  87.         cmp     es:bx,ah
  88.         jne     grlp
  89.  
  90.   grout:pop     bx
  91.         add     bx,1+offset mark
  92.         mov     cs:bx,cl
  93.  
  94.         xor     bx,bx
  95.         mov     dx,1
  96.         mov     ax,4f05h
  97.         int     10h
  98.  
  99.         xor     al,al
  100.         mov     es:0,al
  101.         retf
  102.  
  103.  
  104.      ;set video bank
  105.      ;Used registers: ax,dx,es
  106.  bank:
  107.         push    bx
  108.         push    cx
  109.  
  110.         xor     dx,dx
  111.         mov     dl,al
  112.  
  113.    mark:mov     cl,0
  114.         shl     dx,cl
  115.         push    dx              ;save bank no.
  116.  
  117.         xor     bx,bx           ;set frame no.0
  118.         mov     ax,4f05h        ;VESA frame function
  119.         int     10h
  120.  
  121.         pop     dx              ;restore bank
  122.         mov     bx,01           ;set frame no.1
  123.         mov     ax,4f05h        ;VESA frame function
  124.         int     10h
  125.  
  126.         mov     dx,0a000h       ;segmentadr. video memory
  127.         mov     es,dx
  128.  
  129.         pop     cx
  130.         pop     bx
  131.         retf
  132.  
  133.  
  134. start  endp
  135.  
  136. prog  ends
  137.  
  138.  end  start