x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4563
Number of posts: 16029

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Ports Posted by mr_biology on 29 Sept 2002 at 11:17 AM

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.


Report
Re: Ports Posted by CroW on 29 Sept 2002 at 12:34 PM
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
Report
Re: Ports Posted by blip on 29 Sept 2002 at 6:41 PM
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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.