CompuServe Thread

Forum unknown · Software

#Lattice C

9 messages in this thread
#4054From: Larry MillerJan 3, 1986 10:03 PM
Bob, shouldn't the loader take care of that? What Jack (and I) are wondering is: do you have to use the pc-relative addressing mode? The loader could (does?) readjust addresses to point to various sections of the program. In CP/M-68k land, you just indicate to the assembler where program is (.text) and initialized data (.data) and uninitialized storage (.bss). The loader adjusts addresses relative to these areas. Of course, since there is no scatter-loading, the loader's job is much simpler; it just adds the current offsets to the bases of the 3 sections to get absolute addresses. Mayhap I am misunderstanding, but the implication you guys are giving is that you MUST use the pc-relative addressing mode (or, more often, an address-register relative mode). Come to think of it, I don't eben know HOW to invoke pc-relative addressing…….. -Larry-
#4062From: Michael MounierJan 3, 1986 10:37 PM
On the Mac you must use pc-relative addressing becuase the memory manager can move your program around whenever you call it. On the amiga the loader works similarly to what you have described for CP/M-68k. -Michael-
#4062From: Michael MounierJan 3, 1986 10:37 PM
On the Mac you must use pc-relative addressing becuase the memory manager can move your program around whenever you call it. On the amiga the loader works similarly to what you have described for CP/M-68k. -Michael-
#4131From: Bob PerezJan 4, 1986 3:25 AM
You've got the same situation here with data, text, etc. (the 68000 is particularly well suited for such distinctions..in fact, it won't let you do a pc-relative write to a destination operand since that's a step in the direction of self-modifying code). Frankly, I don't know whether the loader handles absolute addressing or not. I'm just so used to writing position independent code that I've never thought much about what it would be like _not_ to write code that way. The situation's a bit different on the Mac since your code segments can actually be moved around WHILE EXECUTING, so a loader couldn't handle that much juggling. pea myThing(PC) is one way to invoke pc-relative addressing. There's also pc-relative with an index: pea myThing(pc,d0.l) With the Amiga assembler an instruction of the type move label,d0 also invokes pc-relative addressing. Likewise, the instruction move label(d0),d1 invokes pc-relative with index addressing.
#4395From: Larry MillerJan 6, 1986 2:43 AM
Thanks. Guess it just depends on past experience. The 6809 is quite INefficient for pc-relative code (lotsa extra cycles), but I am told by Russ Wetmore that the 68000 has no speed penalty for pc-relative code. I looked at the Amiga assembler stuff a little; doesn't seem all that rough an environment. *Note – the above statement was made on the EASY side of actually getting something to run (haven't tried yet haha)* -Larry-
#4503From: Bob PerezJan 7, 1986 3:42 AM
Actually, you can do most things *faster* in pc-relative mode. There is no speed penalty (as there shouldn't be) for writing code that's both relocatable and non-self-modifying This is in keeping with modern programming theory, too.
#4503From: Bob PerezJan 7, 1986 3:42 AM
Actually, you can do most things *faster* in pc-relative mode. There is no speed penalty (as there shouldn't be) for writing code that's both relocatable and non-self-modifying This is in keeping with modern programming theory, too.
#4395From: Larry MillerJan 6, 1986 2:43 AM
Thanks. Guess it just depends on past experience. The 6809 is quite INefficient for pc-relative code (lotsa extra cycles), but I am told by Russ Wetmore that the 68000 has no speed penalty for pc-relative code. I looked at the Amiga assembler stuff a little; doesn't seem all that rough an environment. *Note – the above statement was made on the EASY side of actually getting something to run (haven't tried yet haha)* -Larry-
#4131From: Bob PerezJan 4, 1986 3:25 AM
You've got the same situation here with data, text, etc. (the 68000 is particularly well suited for such distinctions..in fact, it won't let you do a pc-relative write to a destination operand since that's a step in the direction of self-modifying code). Frankly, I don't know whether the loader handles absolute addressing or not. I'm just so used to writing position independent code that I've never thought much about what it would be like _not_ to write code that way. The situation's a bit different on the Mac since your code segments can actually be moved around WHILE EXECUTING, so a loader couldn't handle that much juggling. pea myThing(PC) is one way to invoke pc-relative addressing. There's also pc-relative with an index: pea myThing(pc,d0.l) With the Amiga assembler an instruction of the type move label,d0 also invokes pc-relative addressing. Likewise, the instruction move label(d0),d1 invokes pc-relative with index addressing.