Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pacbell!att-ih!alberta!ubc-cs!van-bc!root From: lphillips@lpami.van-bc.UUCP (Larry Phillips) Newsgroups: comp.sys.amiga Subject: Re: PC-relative addressing Message-ID: <1699@van-bc.UUCP> Date: 29 Mar 88 19:08:55 GMT Sender: root@van-bc.UUCP Lines: 41 >I'm having a discussion with some co-workers about what an assembler should >do with an effective address of, for example, $20(PC). I think an assembler >should treat $20 as an offset, a co-worker thinks that an assembler should >treat $20 as an address. $20(pc) is defined by the blue Motorola book as a displacement added to the contents of the pc. From the Programmer's Ref manual, Fourth Edition, Page 20: This address mode requires one word of extension. The address of the operand is the sum of the address in the program counter and the sign-extended 16 bit displacement integer in the extension word. The value in the program counter is the address of the extension word. Sounds like an offest to me. That having been said, does it matter? In the example given, > tag equ $20 > move tag(pc),d0 tag is merely a value, without regard to type or purpose until it is used in an instruction. Used as it is, it becomes a displacement from the current pc of +$20, but it could have just as easily been used as part of an ASCII string to produce a space. Used as above, and considering it an address will produce exactly the same result as considering it a displacement. In both cases, the result will be the current pc contents added to $20. Sometimes you have to squint a little. -larry -- The transistor is a curiosity, and will never amount to much. -- Mr. Stringer, Basic Electronic Instructor, RCAF, 1962. +--------------------------------------------------------------------+ | // Larry Phillips UUCP: lphillips@lpami.van-bc.UUCP | | \X/ or: {ihnp4!alberta!ubc-vision,uunet}!van-bc!lpami!lphillips | | COMPUSERVE: 76703,4322 | +--------------------------------------------------------------------+