home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / VGAKIT60.ZIP / modeset.asm < prev    next >
Assembly Source File  |  1994-01-01  |  2KB  |  138 lines

  1.  
  2.     include model.inc
  3.     include    vesa.inc
  4.  
  5. ;
  6. ;    VGAKIT Version 6.0
  7. ;
  8. ;    Copyright 1988,89,90,91,92,93,94 John Bridges
  9. ;    Free for use in commercial, shareware or freeware applications
  10. ;
  11. ;    MODESET.ASM
  12. ;
  13. ;
  14. .data
  15.     extrn    curbk:word,bksize:word
  16.     extrn    vesafunc:dword
  17.  
  18.     public    maxx,maxy,scanline,ourseg
  19.  
  20. maxx    dw    ?        ;scanline of screen in pixels
  21. maxy    dw    ?        ;height of screen in pixels
  22. scanline dw    ?        ;actual width screen in bytes
  23. ourseg    dw    ?        ;segment of screen buffer
  24.  
  25.     public    justvesa,novesa,nosvga
  26.  
  27. justvesa dw    ?        ;only check for VESA, no chipset tests
  28. novesa    dw    ?        ;disable all VESA VBE checks
  29. nosvga    dw    ?        ;disable all SVGA checks including VESA
  30.  
  31.     public    adrtbl
  32.  
  33. adrtbl    dd    1024 dup (?)    ;offset and bank for each scanline
  34.  
  35. .code
  36.  
  37.     public    mkadrtbl
  38.     public    txtmode
  39.     public    setmany
  40.  
  41. mkadrtbl proc    uses di si
  42.     mov    [curbk],-1
  43.     mov    di,offset adrtbl
  44.     mov    ax,ds
  45.     mov    es,ax
  46.     mov    bx,[maxy]
  47.  
  48.     mov    ax,[bksize]
  49.     cmp    ax,64
  50.     jz    nobnk
  51.     mov    cl,10
  52.     shl    ax,cl
  53.     dec    ax
  54.     mov    si,ax
  55.     mov    cl,9
  56.     mov    ax,[bksize]
  57. shlp:    inc    cl
  58.     shr    ax,1
  59.     jnz    shlp
  60.     xor    ax,ax
  61.     xor    dx,dx
  62. lp:    push    ax
  63.     shr    ax,cl
  64.     add    dx,ax
  65.     pop    ax
  66.     and    ax,si
  67.     stosw
  68.     xchg    ax,dx
  69.     stosw
  70.     xchg    ax,dx
  71.     add    ax,[scanline]
  72.     dec    bx
  73.     jnz    lp
  74.     ret
  75.  
  76. nobnk:    xor    ax,ax
  77.     xor    dx,dx
  78.     mov    si,[scanline]
  79.     mov    cx,bx
  80. nlp:    stosw
  81.     xchg    ax,dx
  82.     stosw
  83.     xchg    ax,dx
  84.     add    ax,si
  85.     adc    dx,0
  86.     loop    nlp
  87.     ret
  88.  
  89. mkadrtbl endp
  90.  
  91. vesaset    proc    near uses di
  92.     local    modebuf[260]:byte    ; extra large to make up for
  93.                     ; bugs in some VESA VBE's
  94.     push    bx
  95.     mov    ax,4f02h        ; set the VESA videomode
  96.     int    10h
  97.     pop    cx
  98.     mov    ax,ss
  99.     mov    es,ax
  100.     lea    di,modebuf[0]        ; get the mode information
  101.     mov    ax,4f01h
  102.     int    10h
  103.     mov    ax,modebuf.vesamode.WinGranularity
  104.     mov    [bksize],ax        ; bank size from vesamode structure
  105.     mov    ax,modebuf.vesamode.BytesPerLine
  106.     mov    [scanline],ax        ; scan line byte width from vesamode
  107.     mov    ax,word ptr modebuf.vesamode.WinFuncPtr
  108.     mov    word ptr [vesafunc],ax
  109.     mov    ax,word ptr modebuf.vesamode.WinFuncPtr+2
  110.     mov    word ptr [vesafunc+2],ax
  111.     ret
  112. vesaset    endp
  113.  
  114. txtmode    proc
  115.     mov    ax,3
  116.     int    10h
  117.     ret
  118. txtmode    endp
  119.  
  120. setmany proc    palbuf:ptr byte,begcol:word,numcol:word
  121. if @Datasize
  122.     les    dx,[palbuf]
  123. else
  124.     mov    ax,ds
  125.     mov    es,ax
  126.     mov    dx,[palbuf]
  127. endif
  128.     mov    bx,[begcol]
  129.     mov    cx,[numcol]
  130.     mov    ax,1012h
  131.     int    10h
  132.     ret
  133. setmany endp
  134.  
  135.     end
  136.  
  137.  
  138.