On 17 December 2010 15:22, Bodoh John Robert <[email protected]> wrote:
> I am new to this list so excuse me if this has been asked before. Welcome. > When a macro receives an ordinary symbol as a parameter it may need to > reference the symbol (get the address of the storage location > represented by the symbol). If the symbol is within the current CSECT > and the program is using baseless coding, a relative addressing op code > must be used to get the address of the storage referenced by the symbol. > Otherwise, a base/displacement op code must be used. What are the circumstances that would *require* a base/displacement instruction to be used? Of course if you have to run on sufficiently old hardware, then you can't use LAY and such. But then, unless you are targetting multiple and far apart generations of hardware, you don't need to ask the question in the first place. > My question is how is the macro to determine which op codes to use? The > assembler knows where the symbol is but I can't find any way for the > macro to make the determination. Does anybody know how to do this? If your macro really has to know, then I think you'll have to implement a bit of macro infrastructure that allows you to set the mode to be used, perhaps in your entry macro, and of course stores it in a suitable GBLB or the like. There is no formal way in which you tell the assembler that your program operates in based or baseless mode, though inferences can be drawn. One could stretch this rather a long way, but it's getting into the realm of idle speculation... For instance the assembler could somehow let you know if there is an active USING that covers any part of CSECT space, and you could base your decision on that. But that's full of holes, I'm sure. Tony H.
