Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- VGA registers - <b>pel address write mode read 03c8h write 03c8h</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
PEL address write mode read 03C8h  write 03C8h

Layout  b7-b0  ADR  Address during write mode

        This register contains the 8-bit address used to access one of
        the 256 color registers during a write operation. This
        register is similar to the address registers associated with
        the other register groups in that it occupies a location in
        the host I/O address space and that it indexes one of the
        internal registers. It differs from the others in that it
        signifies that a write operation is to occur.

        A write operation consists of 3 byte outputs to the PEL data
        register. These 3 outputs load the red, green, and blue
        components of the indexed color register. The PEL data
        register can be thought of as an 18-bit wide register that
        loads 6 bits during each output operation.

        At the conclusion of the 3rd output to the PEL data register,
        the address in this PEL address write register automatically
        increments. This feature allows the programmer to output up to
        768 consecutive bytes to the PEL data register without having
        to modify the PEL address write register after its initial
        setting.

        The PEL address write register is a read/write register that
        allows the programmer to interrogate its current value. The
        operation of the PEL address write register is identical to
        that of the PEL address read register except that the latter
        is used for read operations and is a write-only register.


        ; Load color registers 20h-2Fh
        mov     dx,03C8h                ; PEL addr write reg.
        mov     al,20h                  ; No. of 1st color reg.
        out     dx,al                   ; Tell VGA
        inc     dx                      ; PEL data reg.
        lea     si,[RGB_array + 20h*3]  ; Point DS:SI to r/g/b values
        mov     cx,(2Fh + 1 - 20h) *3   ; No. of bytes to output
        cld                             ; Clear direction flag
        rep     outsb                   ; Load color reg.s

See Also: PEL data PEL address read

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson