beautypg.com

Acccesing i/o address space – Zilog Z80380 User Manual

Page 38

background image

I/O ADDRESS SPACES

C-Compiler Overview

2–4

UM004001-COR1103

A

CCCESING

I/O A

DDRESS

S

PACE

The Z380 instruction set does not allow indirect acess of the internal I/O address space
through a register.

To acess the I/O adress space use the on-chip peripheral-addresses as operands to the
IN0/OUT0 machine instructions. Variable pointers can not be used to access the internal I/O
address space and address constants must be used.

The recommended usage the I/O adress space is hown in the below example.

typedef volatile unsigned char __INTIO *PBINTIO;

#defineIO_ADDR((PBINTIO)0x0002)

// …

unsigned char ch;

// …

IO_ADDR[0] = ch;// store to I/O address 2

// …

ch = IO_ADDR[0];// load from I/O address 2

// …