

; SetRGB32(vp,n,r,g,b)(a0,d0/d1/d2/d3)
;   vp = viewport
;   n = the number of the color register to set.
;   r = red level   (32 bit left justified fraction)
;   g = green level (32 bit left justified fraction)
;   b = blue level  (32 bit left justified fraction)


SetRGB32:
           movem.l d0-d1/a0-a1,-(a7)
           movea.l        table(pc),a1  ; table = a pointer to a series of records which describe the colors to modify


; Passing a NULL "table" is ignored.
;   The format of the table passed to this function is a series of records,
;   each with the following format:


;           1 Word with the number of colors to load
;           1 Word with the first color to be loaded.
;           3 longwords representing a left justified 32 bit rgb triplet.
;           The list is terminated by a count value of 0.


;      examples:
;           ULONG table[]={1l<<16+0,0xffffffff,0,0,0} loads color register
;                   0 with 100% red.
;           ULONG table[]={256l<<16+0,r1,g1,b1,r2,g2,b2,.....0} can be used
;                   to load an entire 256 color palette.


;   Lower order bits of the palette specification will be discarded,
;   depending on the color palette resolution of the target graphics
;   device. Use 0xffffffff for the full value, 0x7fffffff for 50%,
;   etc. You can find out the palette range for your screen by
;   querying the graphics data base.


           bfclr d0{0:16}    ; this two lines equal to  moveq.l #1,d1
           bset #16,d0       ;                          bfins d1,d0{0:16}
           movem.l d0-d3,(a1)       ;set the table
            jsr        _LVOLoadRGB32(a6)    ; LoadRGB32(vp,table)(a0/a1)
           movem.l (a7)+,d0-d1/a0-a1
         rts
 cnop 0,4

table: ds.l 1
