The Z80 family has separate address spaces for memory and input/output memory. I/O memory is accessed with special instructions, e.g.:
sfr at 0x78 IoPort; /* define a var in I/O space at 78h called IoPort */Writing 0x01 to this variable generates the assembly code:
3E 01 ld a,#0x01
D3 78 out (_IoPort),a
The keyword banked is used to support 16 bit addresses in I/O memory e.g.:
sfr banked at 0x123 IoPort;Writing 0x01 to this variable generates the assembly code:
01 23 01 ld bc,#_IoPort
3E 01 ld a,#0x01
ED 79 out (c),a
The compiler option --portmode=180 (80) and a compiler #pragma portmode z180 (z80) is used to turn on (off) the Z180/HD64180 port addressing instructions in0/out0 instead of in/out. If you include the file z180.h this will be set automatically.