# I/O ports

This module exposes the "IN" and "OUT" i386 operations.

p@ ( port -- n ) *B*
  Read "port" into "n".

pc@ ( port -- c )
  Shortcut for "8b p@".

p! ( n port -- ) *B*
  Write "n" to "port".

pc! ( c port -- )
  Shortcut for "8b p!".

## ioport

This unit also supplies "ioport" which generates "to-obeying" words
[doc/usage/bind] that access specific I/O ports. Examples:

  42 ioport foo
  54 8b ioport bar
  foo \ 32b fetch of port 42
  bar \ 8b fetch of port 54
  $1234 to foo \ write 32b $1234 to port 42
  to' foo \ yields 42

These generated words only support "to" and "to'". When compiled, they generate
efficient native code for the specified port accesses.

You'll notice that binary width modulation [doc/usage/bmw] is specified when the
port word is created rather than when it is called. That's because I/O port will
pretty much always have the same width for a given system. You're unlikely to
have a port that supports multiple width accesses.

If that's the case, you can define a width-less "ioport" and apply width
modulators in a piecemeal fashion. That's also going to work.
