Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ncar!cruff
From: cruff@ncar.ucar.edu (Craig Ruff)
Newsgroups: comp.sys.m68k
Subject: Re: Why does addq.w #n,sp work?
Keywords: C asm addq
Message-ID: <1110@ncar.ucar.edu>
Date: 9 Dec 88 19:00:26 GMT
References: <5005@bsu-cs.UUCP> <5460@cbmvax.UUCP> <1100@ncar.ucar.edu> <23329@cornell.UUCP>
Reply-To: cruff@handies.UCAR.EDU (Craig Ruff)
Distribution: na
Organization: Scientific Computing Division/NCAR, Boulder CO
Lines: 20

In article <23329@cornell.UUCP> rbrown@svax.cs.cornell.edu (Russell Brown) writes:
>>The other reason that everyone seemed to miss is that this method saves
>>2 bytes.  ...
 
>	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.


No, it is true.  Compare:

	addq.w	#8, a7		(2 bytes)
	add.w	#8, a7		(4 bytes)
	add.l	#8, a7		(6 bytes)

That's also why you'll see values > 8 using add.w instead of add.l.
-- 
Craig Ruff      NCAR                         INTERNET: cruff@ncar.UCAR.EDU
(303) 497-1211  P.O. Box 3000                   CSNET: cruff@ncar.CSNET
		Boulder, CO  80307               UUCP: cruff@ncar.UUCP