hi again..

I've been trying to learn ports. I read a tutorial about VGA graphics thing and there was something about ports and ins and outs.
Now, what are these:
And how do they work?

Thanks for answering.


  • dont know exactly what 3c7h is,but the other are used for access to the palette of the VGA-chip in most graphic-modes.in a 256-color mode for example (like 13h) you have 256 possible colors.each color is a entry to the palette which holds the RGB components of the color.you write the palette-index to 3c8h and could use 3c9h in 3reads or 3writes to get/change the contents of this register.


    ; color #0 is black by default
    mov dx,3c8h
    out dx,0
    mov dx,3c9h
    mov al,63 ; the 2 highest bits arent used
    out dx,al
    out dx,al
    out dx,al
    ; now color #0 is white
  • All three of those are used to access the palette data, whether it be a read or write. Port 3C7h is the read index, port 3C8h is the write index, and port 3C9h is the palette data register. After specifying an index on either of the index registers, read or write three bytes of data to/from the data port that corresponds to the red, green, and blue values of that palette index. You can easily specify more values without specifying a new index because the indices automatically increment after three reads or writes.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!