Ports - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Ports


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:
03C7h
03C8h
03C9h?
And how do they work?

Thanks for answering.


Comments

  • CroWCroW Posts: 348Member
    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.

    example:

    ; 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
  • blipblip Posts: 756Member
    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.