Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ncar!noao!nud!rover!mph
From: mph@rover.UUCP (Mark Huth)
Newsgroups: comp.sys.amiga.tech
Subject: Re: 68000 DBcc command
Message-ID: <789@rover.UUCP>
Date: 15 Jul 88 21:14:43 GMT
References: <2911@umd5.umd.edu> <7332@cup.portal.com>
Reply-To: mph@rover.UUCP (Mark Huth)
Organization: Motorola Microcomputer Division, Tempe, Az.
Lines: 24

In article <7332@cup.portal.com> Julian@cup.portal.com writes:
> [ a description of a "problem" with DBEQ instruction ]
>    Obviously, something was wrong. Then I noticed a difference - the Z flag
>had been set by a previous operand earlier in the program. I ran through
>the code section several times, checking the looping mechanism (DBEQ) with
>the Z flag set and cleared. Strangely, the DBEQ command would only decrement
>d3 whenever the Z flag was cleared. According to the Motorola 68000 reference
>manual, the condition codes play no role in any DBxx command. What is going on?

You're welcome.

This operation is exactly how the DBcc instructions are supposed to
work.

DBEQ first checks the condition code flag Z and if set, goes to the
next instruction.  Else, the counter register is decremented.  If -1,
then the next instruction is executed else the instruction that is the
target of the branch is executed.

See pg 89 of 4th edition or pg 115 of 3rd edition of the 68000 manual.

This instruction allows conditional termination of simple counted for loops -
such as a break condition within the loop.

Mark Huth