David Staudacher added a great comment about the “standard” entry code I posted. His assembly listing was mangled by the WordPress comment handler. I’m including an image of what he had in mind here.

<

# Category Archives: IBM Mainframe Assembler

## Staudacher Comment Posted

Filed under IBM Mainframe Assembler

## Standard Entry and Exit Video

How do we get in and out of a program? I call it my standard entry and exit code, but in fact, there are multiple ways of getting the job done while following IBM’s linkage conventions. Here’s a video explanation of the way I do it, line-by-line, with visuals. It’s also #24 on the IBM Mainframe Assembler page.

Filed under IBM Mainframe Assembler

## Available Now: The Big Blue Assembler Book

My new assembler book is available in paperback now on Amazon. A hardback version will appear shortly. This is an introductory text. After chapters covering the z Series architecture, the book is organized into topics that are covered in an order that I worked out over 40 years of teaching assembler to students and professional programmers.

Here are some of the chapter topics:

- Character Data
- Zoned Decimal and Packed Decimal
- Binary Data
- DSECTs
- Locate and Move Mode I/O
- Subprograms
- Bit processing
- Exotic Instructions

Book Features:

- Each of the 12 Chapters begins with a newly written introduction to a topic followed by a list of the instructions that are required to master it. Each chapter ends with detailed discussions of each instruction and one or more programming assignments.
- The book has 5 Appendices
- I’ve added 18 programming assignments designed to turn you into an assembler programmer. Each programming assignment is limited in scope but targets the fundamental skills you need to become an accomplished assembler programmer.
- The book has 393 Pages.

I’ve always given away my teaching materials on this site. I’ll continue to do that because it makes me happy to know that someone out there finds the information helpful. Much of the information in the book is available on the website, including the preliminary chapters of the book. What’s available in the book that you might not find on the site is an organization of topics that makes the material accessible, some newly written introductions to various topics, and a collection of programming assignments that lead to programming mastery. You will also have a book you can hold.

I love books. I still have a copy of Programming Assembler Language by Peter Abel – the book I sweated my way through (on my own) some 40 years ago when I was trying to learn assembly language. I hope you will buy this new book and enjoy using it.

Filed under IBM Mainframe Assembler

## What’s the Difference Between LCR and LNR?

My only assembler joke is this,

Newbie: What’s the difference between L and LA?

Old Hand: About a week of debugging.

I earned the right to use that joke (over and over by the way) because it happened to me. Ever since then, I pay special attention whenever I code L or LA. The same might be said of Load Complement Register (LCR) and Load Negative Register (LNR).

If we code LCR, what are we expecting? In this context, “complement” really means “additive complement”. We say that X is the additive complement of Y if X + Y = 0. We also note that if X is the complement of Y, Y is also the complement of X. So, the complement of 7 is -7, the complement of -3 is 3, and the complement of 0 is 0.

There is one complicating factor concerning any two’s complement representation we choose: There is always one more negative integer than there are positive integers. For example, in 3-bit two’s complement, the range of numbers is -4, -3, -2, -1, 0, 1, 2, 3. There are four negative integers but only three positive integers because zero has a positive sign. If we ask for the complement of -4, the answer is 4 which can’t be represented with three bits. An overflow will occur. There are two integers which remain the same when complemented: the maximum negative integer and 0. If we complement the maximum negative integer, it remains unchanged and an overflow is signaled. In fact, this is the only way to get an overflow with LCR.

Here are the condition codes you can get with LCR.

Code Meaning

0 Result zero, no overflow

1 Result less than zero, no overflow

2 Result greater than zero, no overflow

3 Overflow

What about Load Negative Register (LNR) and for that matter, Load Positive Register (LPR)? Perhaps the way to keep all three instructions straight is to remember that **“You get what you ask for.” **If you code LNR, the result will be negative. If you code LPR, the result will be positive. If you code LCR, you will get the additive complement which can be positive or negative.

So, what does LNR do? If the integer in operand 2 is negative, it is placed into operand 1 unchanged. If the integer in operand 2 is positive, it is complemented and placed in operand 1. We will always produce a negative result with LNR. Since all positive integers have complements, no overflow can occur. Here are the condition codes for LNR.

Code Meaning

0 Result zero

1 Result less than zero

2 —

3 —

What does LPR do? If the integer in operand 2 is positive, it is placed in operand 1. If the integer in operand 2 is negative, it is complemented and placed in operand 1. We will always produce a positive result (except for the maximum negative integer). If you complement the maximum negative integer, an overflow occurs. Here are the condition codes for LPR.

Code Meaning

0 Result zero, no overflow

—

2 Result greater than zero, no overflow

3 Overflow

The moral to this tale is *you get what you ask for*. LPR produces positive results. LNR produces negative results. LCR produces complements which are sometimes positive and sometimes negative.

Now you can spend that week doing something really productive.

Filed under IBM Mainframe Assembler

## Two’s Complement for Programmers

Are you new to two’s complement data? Need to brush up your skills? I’ve posted a new article on the website that might help – Two’s Complement for Programmers. It’s not heavy on mathematics, but long on the basic skills you need as an assembler programmer.

It will become an appendix in my new book * The Big Blue Assembler Book*. I decided to change the title when the book grew longer – +300 pages. Then I realized that “Big Blue” is a nickname for IBM and the title was fixed!

I’ll be building a few more programming exercises and an index (any suggestions?). Then I’ll read the whole thing again looking for errors before publishing it on Amazon.

Filed under IBM Mainframe Assembler

## VisibleZ Available for Download

The link for downloading VisibleZ is working again. You will get the VisibleZ jar file and a Codes directory that has hundreds of small programs that demostrate a variety of instructions.

Filed under IBM Mainframe Assembler

## Content Moved

I’ve moved 99% of the content that was on my university site to this one. Almost all the links should reference punctiliousprogrammer now. If you have trouble with any of the links, let me know and I’ll provide you the material individually. I am still working on providing a download of VisbleZ.

Filed under IBM Mainframe Assembler

## Chasing Bad Links

The university where I store about half of the material on this site has changed something. I’ll talk with them today to find out what has happened. In any case, I’ll get the bad links fixed somehow, but it may take a few days. Sorry for the inconvenience.

Filed under IBM Mainframe Assembler

## IBM Z Day Tomorrow!

It’ free, it’s here, and well worth your time. Starts September 15 at 8 AM EST. Here’s a link to the agenda:

Filed under IBM Mainframe Assembler