Path: utzoo!attcan!uunet!mcvax!enea!tut!pl From: pl@tut.fi (Pertti Lehtinen) Newsgroups: comp.sys.amiga.tech Subject: Re: 68000 DBcc command Message-ID: <4210@korppi.tut.fi> Date: 19 Jul 88 00:53:32 GMT References: <7332@cup.portal.com> Organization: Tampere University of Technology, Finland Lines: 40 From article <7332@cup.portal.com>, by Julian@cup.portal.com: > 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? As read from manual: If condition false then (Dn - 1 => Dn; If Dn != -1 then PC+d => PC Condition is termination condition which is tested first if it doesn't terminate loop, counter is decremented and tested this operation does not alter flags. For pure counter controlled loop use dBRA, because condition has nothing to do with counting, it is alternate exit condition based on flags set by previous instructions. As we can see, decrement is done only when condition is false. ( This case Z is cleared ), but in that case we don't branch either. Odd thing is that only low 16-bit are used as counter. So C strncpy could be something like LEA str1, A1 LEA str2, A2 MOVE.W max,D0 Loop: MOVE.B (A2)+,(A1)+ ; sets/clears zero flag (I hope) DBEQ D0,Loop ; loop until count or NULL moved I hope this helps. -- pl@tut.fi ! All opinions expressed above Pertti Lehtinen ! are preliminary and in subject N 61 26' E 23 50' ! to change without any further notice.