Joe Developer had an astute comment about “Lots of Code on One Base Register” when he reminded me that lots of long programs have been written that use one base register, and without resorting to relative branches. By modularizing the program into sections of < 4k, you can write as much code as you like on one base register. There are some real benefits in his reminders. When designing programs, small is always a beautiful way to think. I thought it might be helpful to have an example program that illustrates the ideas. I’ve placed a copy of it here.
At 13k+, you have to admit it’s relatively long for a program that doesn’t do much of anything. I threw in a few odds and ends to illustrate some related ideas and concepts that might be of interest to someone learning assembler. Let me point out a few:
- The program is one source module organized into four control sections.
- Each control section can call the others. In this case, MAIN1 calls SUBR1 and SUBR2, and SUBR2 calls SUBR3.
- MAIN1 uses the CALL macro and passes parameters.
- SUBR2 invokes SUBR3 and passes parameters without using a CALL.
- SUBR1 illustrates passing parameters by content and by reference.
- MAIN1 passes a DCB which is used in SUBR1.
- Each routine is < 4k and uses standard linkage techniques (save and restore registers in save areas, parameter passing).
- Each routine uses a single base register.
- Each routine avoids the use of relative branching (although this would be fine, too).
- We could easily add more routines and make this arbitrarily large.
- Passing large amounts of data could be handled with different techniques.
There are other ways to write large programs and perhaps Joe had a different idea in mind, but I think this is close to what he was driving at. And as Joe points out, 4k is not much of a constraint in most cases. You can write a lot of assembler code in a 4k space – plenty of room for most well-designed modules.
Some colleagues and I recently published an academic article about VisibleZ in a Bulgarian computing journal. If the journal releases the article, I will post it on the site. For the record, here are the details:
David Woolbright, Vladimir Zanev, Neal Rogers, “VisibleZ: A Mainframe Architecture Emulator for Computing Education”, Serdica Journal of Computing-Volume 8, No 4, 2015.
I’m still cleaning things up and repairing some broken links on the assembler site as well as my academic site. I’ve about got them under control again after my sites went through a major server move at school.
I’ve added lessons on two relative branch operands that have become fundamental tools for “baseless” programs: Branch Relative on Condition and Branch Relative on Condition Long. You can try out these instructions in VisibleZ as well. Upload the new Codes directory for some sample object code programs, or build your own.
Along with these lessons, I cleaned up some links on the assembler page and added links to all the lessons in three formats (PDF, DOCX, HTM).
I’m working on an assembler book that will organize and combine the information you can find on the site. I hope to complete it over the next few months. If you have special requests for topics you would like me to include, email me your suggestions. I’d like to know the instructions you’re using that aren’t represented here.
It’s been a while since I updated the copy of VisibleZ on the server. Tonight I uploaded a fresh copy of it along with an updated Codes directory which contains more sample programs than before.
Study assembler programming with me this fall through the Enterprise Systems Education program offered by Marist College. Classes begin August 31. Follow this link for more information. Marist also offers other online enterprise courses including z/OS, Cobol, DB2, and IMS. For further information, contact:
Roberta Diggins|Marist College | 845-575-3601 | Roberta.Diggins@marist.edu
Here’s your chance to learn many new assembler instructions!
I just published the latest version of VisualZ which represents a significant improvement over the previous one.
New Features include:
- Improved interface
- Settings tab for specifying the CODES path
- Stop points
- Fully functional 64 bit registers
- Many new instructions that access the 64 bit general purpose registers
- A more extensive CODES directory containing many new sample programs
- More detailed highlighting for registers
- One click download for VisibleZ and CODES
You can download the latest version by clicking on the “Download VisibleZ” tab from the home page. VisibleZ is distributed as an executable Jar file. The source code is included inside the Jar if you prefer to compile it yourself.
After a few years of keeping this private, I’ve opened the Enterprise COBOL Course link on the homepage to anyone who is interested in watching a collection of COBOL videos I created. The collection represents a complete course for a beginning COBOL programmer. It comes with some suggested programming assignments and an extensive set of powerpoints. While this is designed for beginners, the course includes some topics that explore the limits of what you can do with COBOL these days. Even an experienced programmer may stumble across a number of interesting wrinkles! Let me know what you think. The Punctilious Programmer site has a link to this course or you can bookmark this link