Tag Archives: jumps

Lots of Code On One Base Register

Do your assembler programs look like they were written in 1970?  Are you still using the instruction set your dad learned back in college?  There are lots of new instructions you can master with minimal effort.  Consider branching.  The old-fashioned BC and all the related extended mnemonics (BL,BH, …) all use base/displacement addresses to satisfy your desire to change locations.  But there is a host of newer, relative-branch instructions that determine the target location by adding a signed binary integer to the beginning instruction address instead.  What’s the difference?  The old BC-based instructions require that you have a base register covering up the target address, so if you have lots of executable code, you’ll need more base registers.  The new relative branch instructions don’t need a base register at all – they jump forward and backward from the current instruction’s address.

So … if you put all the static storage fields together and keep them separate from your executable code, one base register might be sufficient.

I’ve put together a sample program at http://csc.columbusstate.edu/woolbright/relative/relative.txt  that demonstrates how this can happen.  There’s also a new video in the video course that walks you through it at  http://csc.columbusstate.edu/woolbright/relative/relative.html .  The program uses a newer linkage technique but its not a requirement for this idea to work for you.

It’s time to show your daddy a thing or two…

1 Comment

Filed under IBM Mainframe Assembler