Newsgroups: comp.sys.sinclair
Path: ulke.hiMolde.no!nntp-trd.UNINETT.no!Norway.EU.net!EU.net!CERN.ch!hpoprb!allan
From: allan@hpoprb.cern.ch (Allan Skillman)
Subject: z80 block io instructions
X-Nntp-Posting-Host: hpoprb.cern.ch
Message-ID: <DFtHr0.E2w@news.cern.ch>
Summary: Interesting odities in the z80 block io instructions
Keywords: z80
Sender: news@news.cern.ch (USENET News System)
Organization: CERN European Lab for Particle Physics
Date: Mon, 2 Oct 1995 10:42:36 GMT
Lines: 22

as anyone noticed that several of the spectrum emulators around at the moment
treat the block io instructions OUTI OUTD OTIR and OTDR incorrectly. Whilst
`playing around with xzx' I was trying to work out why the wrong ports were
being addressed and looked at the code for OTDR :

case 0xBB:
        do {
                out_byte(*bc, read_byte(*hl));
                (*b)--; (*hl)--;
        } while (*b);

        Set(zeroFlag); Set(addsubFlag);
        break;

However, check in Zaks I discovered that the address of the port is given by
bc AFTER it is decremented! This is true for all the block out instructions.
However Zaks doesn't say whether it is true for the block input instructions
. Anyone have an idea?

I suppose this hasn't been spotted before because these instructions are
rarely used on the spectrum, but it might be important to other emulator writerswho are using the xzx source as their base.

