waterfal@vger.UUCP (Douglas Waterfall) (08/31/86)
Help! I am porting a large (100k) program written in another dialect of 68k assembly language using the assembler from the Manx C package. The Manx assembler and/or the linker seems to have problems whith PC relative addressing. The following code fragment shows the problem. The assembler will assemble the code without any errors but the linker reports the following message: file filename: Branch out of range @pc=xx (xx varies) What is strange about the error is that it depends on the amount of code preceding the instruction. If the constant block is 96 hex or less the linker does not report an error. If the size is 97 hex or greater the linker reports the error. Using the constant block makes demonstrating the error simpler, placing code there has the same effect. Even stranger the error occurs regardless of the opcode used (and, jmp, move). Since the code works correctly with other machines using different assemblers (4.2BSD) the problem seems to be with the Manx package. Is there something wrong or am I missing something obvious? Thanks assemble with as -c -d filename link with ln filename ######cut###### cseg ; $96 & down works ; $97 & up does not work dcb.b $97 and.l $20(PC,D1) ; pc@($20,D1) ######cut######
higgin@cbmvax.cbm.UUCP (Paul Higginbottom) (09/02/86)
In article <436@vger.UUCP> waterfal@vger.UUCP (Douglas Waterfall) writes: >Help! > > I am porting a large (100k) program written in another dialect of 68k >assembly language using the assembler from the Manx C package. The Manx >assembler and/or the linker seems to have problems whith PC relative >addressing. The following code fragment shows the problem. The assembler >will assemble the code without any errors but the linker reports the following >message: > > file filename: Branch out of range @pc=xx (xx varies) > > What is strange about the error is that it depends on the amount of >code preceding the instruction. If the constant block is 96 hex or less the >linker does not report an error. If the size is 97 hex or greater the linker >reports the error. Using the constant block makes demonstrating the error >simpler, placing code there has the same effect. Even stranger the error >occurs regardless of the opcode used (and, jmp, move). > Since the code works correctly with other machines using different >assemblers (4.2BSD) the problem seems to be with the Manx package. Is there >something wrong or am I missing something obvious? > >assemble with > as -c -d filename > >link with > ln filename > >######cut###### > cseg >; $96 & down works >; $97 & up does not work > dcb.b $97 > and.l $20(PC,D1) ; pc@($20,D1) > >######cut###### I expect the problem is something to do with the optimization of the assembler turning something into a short offset. You can turn off the optimization with the -n option. Try this. Alternatively, try putting the data in a dseg, or bss. Hope this helps, Paul Higginbottom Disclaimer: The above reflects only my own opinions.