Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekgen!tekigm2!phils
From: phils@tekigm2.TEK.COM (Philip E Staub)
Newsgroups: comp.sys.amiga.tech
Subject: Re: 68000 DBcc command
Message-ID: <3195@tekigm2.TEK.COM>
Date: 15 Jul 88 21:54:24 GMT
References: <2911@umd5.umd.edu> <7332@cup.portal.com>
Reply-To: phils@tekigm2.UUCP (Philip E Staub)
Organization: Tektronix, Inc., Beaverton, OR.
Lines: 44

In article <7332@cup.portal.com> Julian@cup.portal.com writes:
>
...
>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?
....
>                   Many thanks in advance,
>                           Julian L Brown
>                           sun!portal!cup.portal.com!julian

Wrongo!

The condition codes most definitely play a role in the operation of all of
the DBxx commands.

To quote (without permission) from the description of the DBcc series of 
commands from the 68000 programmers reference manual:

	"The instruction first tests the condition to determine if the
	termination condition for the loop has been met, and if so, no
	^^^^^^^^^^^^^^^^^^^^^
	operation is performed. If the termination condition is not true,
	the low order 16 bits of the counter data register are decremented
	by one. If the result is -1, the counter is exhausted and execution
	continues at the next instruction. if the result is not equal to -1,
	execution continues at the location indicated by the current value 
	of PC plus the sign-extended 16-bit displacement."

The "termination condition" is based solely upon the contents of the
condition codes, so that a DBEQ instruction will test the zero flag, and if
it is set, the termination condition is met, therefore no operation is
performed. I suspect that you may have really wanted a DBF instruction.
(Many assemblers also will accept DBRA). Thus the condition for this
instruction is never met ("false" is never TRUE), and terminal count is the
only terminator of the instruction.

Hope this helps.

Phil
-- 
------------------------------------------------------------------------------
Phil Staub        
Tektronix, Inc., Vancouver, Washington 98668
phils@tekigm2.MEN.TEK.COM