Wrong!
You must write the
same register but
different bits bit 0 = I/O nr. 1
bit 1 = I/O nr. 2
...
bit 7 = I/O nr. 8
For example:
IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_DATA_BASE, 0x43);
sets I/O 1,2 and 7 as outputs and all the others as inputs, since
0x43 is binary 01000011
The same applies for writing output values or reading inputs
In Qsys you have the option "Enable individual bit set/clear output register"; if you selected it, you can set/clear a single output through outset/outclear registers, otherwise you must write all of them jointly.
i.e. IOWR_ALTERA_AVALON_PIO_DATA(PIO_DATA_BASE, 0x42)
sets an high level on lines 2 and 7 (clearly they must have been previously set as outputs)
Reading is simpler: you call data = IORD_ALTERA_AVALON_PIO_DATA(PIO_DATA_BASE)
and simply test the required bits of data.