Pull out your C language textbook, and learn about the operators '|' (bit-wise OR) and '&' (bit-wise AND), and while you're in the neighborhood, learn about '^' (exclusive-OR) as well. Understanding those operators is the key to knowing how to set & clear specific bits in a word. Since you're already using outb()
to write to the port, consider using inb()
to read from the register. Modify the value that you read from the port using bit-wise logic operators, then write the result back out.
- Don't shout
- Post source code in [CODE] [/CODE] tags to preserve formatting