Newsgroups: comp.arch.embedded,comp.robotics,alt.comp.hardware.homebuilt
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!howland.reston.ans.net!news.sprintlink.net!mv!news.imagauto.com!not-for-mail
From: jay@iai.mv.com (Jay Francis)
Subject: Re: Z80 code on a Z80180?
Message-ID: <4127cb$9c27.217@news.imagauto.com>
Date: Tue, 18 Apr 1995 14:12:38 GMT
Organization: Imaging Automation Inc.
X-Newsreader: WinVN 0.93.14
References: <4c7cb$c2531.2d6@news.imagauto.com> <3mjkgq$i6q@hpchase.rose.hp.com>
MIME-Version: 1.0
Lines: 59
Xref: glinda.oz.cs.cmu.edu comp.arch.embedded:616 comp.robotics:19897

In article <3mjkgq$i6q@hpchase.rose.hp.com>, gregh@hprnd.rose.hp.com 
says...
>Since when did the Z180 have the 16 bit I/O intstructions, internal
>or external.  Now there is a special 8 bit I/O instruction for
>on board devices, in0 and out0. For external ports the same old
>in and out works just fine as well as the other fancy I/O instructions.
>Same old 256 I/O address limitations with 8 bit I/Os. Some on board
>devices are arranged in 16 bits but must be accessed with two 8 bit
>read or writes.
>
>The 8 bit I/O instruction will yield good results as I use it exclusivly
>on my projects software, nothing but! :)



From the Z80180/Z180 MPU User's Manual:

(page 3) A0-A19 form a 20-bit address bus. The Address Bus provides the 
address for memory data bus exchanges, up to 1Mbyte, and I/O data bus 
exchanges, up to 64K.

(page 12) I/O Addressing Notes. The internal I/O register addresses are 
located in the I/O address space from 0000H to 00FFH (16-bit I/O 
addresses). Thus, to access the internal I/O registers (using I/O 
instructions), the high-order 8 bits of the 16-bit I/O address must be 0.

The conventional I/O instructions (OUT (m),A/ IN A, (m)/ OUTI/ INI/ etc.) 
place the contents of a CPU register on the high-order 8 bits of the 
address bus, and thus may be difficuly to use for accessing internal I/O 
registers.

For efficient internal I/O register access, a number of new instructions 
have been added, which force the high-order 8 bits of the 16-bit I/O 
address to 0. These instructions are IN0, OUT0, OTIM, OTIMR, OTDM, OTDMR, 
and TSTIO (see instruction set).

----------

So, I stand by what I said in my previous post (about internal accesses 
and 64K I/O addressing):

Just be carefull with the Z180's I/O instructions. It can address 64K of 
I/O space (as opposed to the Z80's 256). You MUST use the Z180's special 
16bit I/O instructions to access internal I/O ports (ie. serial and 
timers), and it's a REALLY good idea to use them for external I/O. The 
standard 8bit I/O instructions may yield unpredictable results.

I take back what I said about external I/O accesses.  Yes, you can use 
standard I/O for external ports, and not care about setting up registers 
for the high 8 bits of address, assuming that you are only accessing 8 
bits (address) worth of I/O space. Just remember that the Z180 can access 
16 bits (address) of I/O space. Look at the IN A,(m) and OUT (m),A Z180 
instructions. m is placed on A0-A7, A is placed on A8-A15... Voila, 16 
bit I/O addresses. 

-- 
Jay Francis -- jay@iai.mv.com
"I bike therefore I am."


