Path: utzoo!attcan!uunet!super!udel!rochester!rutgers!mailrus!ncar!noao!asuvax!fbog!dbk From: dbk@fbog.UUCP (Dave B. Kinzer @ Price Rd. GEG) Newsgroups: comp.sys.amiga.tech Subject: Re: Adjusting the stack pointer Summary: Correct usage Keywords: assembler A7 SP Message-ID: <1667@fbog.UUCP> Date: 22 Dec 88 17:21:37 GMT References: <5047@garfield.MUN.EDU> Reply-To: dbk@fbog.UUCP (Dave B. Kinzer @ Price Rd. GEG) Followup-To: comp.sys.amiga.tech Distribution: na Organization: Motorola Microcomputer Division, Tempe, Az. Lines: 40 In article <5047@garfield.MUN.EDU> john13@garfield.MUN.EDU (John Russell) writes: >Manx-generated code uses the form > >addq.w #(4*N),sp > ^ > >to reset the stack pointer after calling a function with N (long) args on the >stack. Examples which adhere to the syntax of other Amiga assemblers use > >addq.l #(4*N),sp > ^ > >Is the Manx format dangerous if the stack is being incremented past a >64k boundary? Is there a reason to use one and not the other? > >John Hey, something I know about! :-) Whenever the 68000 does anything with an address register as the destination, the source is expanded to 32 bits before the operation is performed, always in 32 bit mode. This is true, for example, for add, load, and subtract. The trick is you need to look in the 68000 manual under ADDA, MOVEA, and SUBA (etc.) Most assemblers will automatically change the instruction generated based upon the destination address. The book doesn't. The Manx generated code is faster (fewer instruction fetches from memory). "The highly regular structure of the M68000 greatly simplifies the effort required to write programs in assembly language as well as high level languages." - M68000 16/32-bit Microprocessor Programmer's Reference Manual, fourth edition -Yea, right. (Note: sarcasm) | // You've heard of CATS and DOGS, I'm from GOATS, Dave Kinzer | | // Gladly Offering All Their Support! noao!nud!fbog!dbk | | \X/ "My employer's machine, my opinion." (602) 897-3085 |