Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!cornell!rbrown
From: rbrown@svax.cs.cornell.edu (Russell Brown)
Newsgroups: comp.sys.m68k
Subject: Re: Why does addq.w #n,sp work?
Keywords: C asm addq
Message-ID: <23329@cornell.UUCP>
Date: 9 Dec 88 18:10:31 GMT
References: <5005@bsu-cs.UUCP> <5460@cbmvax.UUCP> <1100@ncar.ucar.edu>
Sender: nobody@cornell.UUCP
Reply-To: rbrown@svax.cs.cornell.edu (Russell Brown)
Distribution: na
Organization: Cornell Univ. CS Dept, Ithaca NY
Lines: 16

In article <1100@ncar.ucar.edu> cruff@handies.UCAR.EDU (Craig Ruff) writes:
>>
>>Under "addq" in the 68020 manual:  "When adding to address registers,
>>the entire destination address register is used, regardless of the
>>operation size."  (It should be the same for any 68000-family CPU.)
>
>The other reason that everyone seemed to miss is that this method saves
>2 bytes.  If you think about it, this instruction is used commonly to
>pop arguments off the stack after a function call (for C).  If you have
>many function calls, the savings can add up.
>
	Untrue.  The addq instruction has its data in the instruction word.
It can only be used to add values 1 thru 8, so it only needs 3 bits.  That's
why people use it.

Russell G. Brown					Cornell Computer Science