home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c010 / 1.ddi / FLILIB3.ZIP / FLISRC3.ZIP / CSETCOLO.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-08-29  |  1.5 KB  |  75 lines

  1. ;csetcolo.asm - contains fii_reg_fcuncomp().
  2.  
  3.     dosseg
  4.     .model    large
  5.     .code
  6.  
  7.  
  8.     ;fii_reg_fcuncomp(csource)
  9.     ;set the color palette hardware from a compressed source 
  10.     ;of format:
  11.     ;WORD # of runs, run1, run2, ...,runn
  12.     ;each run is of form:
  13.     ;BYTE colors to skip, BYTE colors to set, r1,g1,b1,r2,g2,b2,...,rn,gn,bn
  14.     public _fii_reg_fcuncomp
  15. _fii_reg_fcuncomp proc far
  16.     push bp
  17.     mov bp,sp
  18.     push ds
  19.     push si
  20.     push di
  21.     push cx
  22.     push bx
  23.     cld
  24.  
  25.     lds si,[bp+4+2] ;load the source compressed color data
  26.     mov di,0        ;clear dest color index 
  27.     lodsw
  28.     mov bx, ax    ;get the count of color runs
  29.     test bx,bx
  30.     jmp endcu
  31. cu:
  32.     lodsb        ;get the colors to skip
  33.     add di,ax    ;add to color index
  34.     lodsb        ;get the count of colors to set
  35.     mov cx,ax    ;use it as a loop counter
  36.     or  cx,cx    ;test for zero
  37.     jnz    set1c
  38.     mov cx,256
  39. set1c:
  40.     mov    dx,3c8h ;point dx to vga color control port
  41.     mov ax,di
  42.     out dx,al    ;say which color index to start writing to
  43.     inc di        ;bump color index
  44.     inc dx        ;point port to vga color data
  45.     ;jmp s1     ;stall as per IBM VGA tech spec to give hardware time to settle
  46. s1:
  47.     lodsb        ;get red component
  48.         out dx,al       ;tell the video DAC where it's at
  49.     ;jmp s2     ;stall some more for poor slow hardware
  50. s2:
  51.     lodsb        ;same same with green component
  52.     out dx,al
  53.     ;jmp s3
  54. s3:
  55.     lodsb        ;same with blue
  56.     out dx,al
  57.     loop set1c
  58.  
  59.     dec bx
  60. endcu:
  61.     jnz cu
  62.  
  63.     pop bx
  64.     pop cx
  65.     pop di
  66.     pop si
  67.     pop ds
  68.     pop    bp
  69.     ret    
  70.  
  71. _fii_reg_fcuncomp endp
  72.  
  73.  
  74. END
  75.