On Thu, 9 Nov 2023 at 12:54, Steve Thompson <ste...@wkyr.net> wrote: > To get to relative operations, there is an IBM supplied macro > that one can include right at the top of your source and it can > be turned on/off as needed. > > As I recall, it does OPSYN to get rid of based branch (jump) and > uses the relative version. >
I find the generated code to be unnecessarily annoying, because it generates the basic BRC instruction with a numeric condition, rather than the extended opcode. But it's just ugliness - it works fine. You can write your own better version. Just replacing base/displacement BCs in structured macros with relative BRCs is usually a no-brainer, unless your macro can for some reason generate a branch table or the like that has explicit base/displacement as an operand. If you're using the relative branch instructions directly, do pay attention to the mnemonics. Gone are the days when an experienced programmer knew *all* the instruction names and all the abbreviations for the branches. The basic branch on condition instruction names map easily to relative. In theory BC, BRC, and BRCL (and of course BCR, but we're not going there) are all you ever need. But people like the convenience of having the condition encoded in the mmnemonic rather than having to specify the numeric CC test value explicitly, e.g. BC 8,... So: *B/D Rel RL Cond* BC BRC BRCL - NOP JNOP JLNOP 0 BO JO JLO 1 BH JH JLH 2 BL JL JLL 4 BE JE JLE 8 The above specify just one test bit. But we can have others with more bits - the most common are the negations of those above, i.e. 15-cond: B J JLU 15 BNO JNO JLNO 14 BNP JNP JLNP 13 BNM JNM JLNM 11 BNZ JNZ JLNZ 7 and there are many more - too many, I think. The thing to watch for is that you can't just make these up. What's caught some people is writing JLE thinking it means "Jump on Low or Equal". If you wrote BLE you'd get an error, but JLE is Jump Long on Equal, and will assemble without error but is Very Different! Similarly JL is not JLU, but at least this will probably produce a message if you mistake the two. There is a complete table in the back of the PofO, and also in the HLASM reference. What chance I don't have a typo in the above...? Someone will let me know. Tony H.