Learn or review instruction LOC today with some new notes that cover the basics, and a VisibleZ video that demonstrates the instruction in action. The notes include a list of suffixes that can be added to LOC to make coding the instruction easier. You can also find the new instructional materials on the IBM Mainframe Assembler tab.

# Category Archives: IBM Mainframe Assembler

## Adding Binary Fields Without a Register

John Dravnieks kindly suggested adding ASI and AGSI to VisibleZ. David Staudacher suggested using LARL to load a base register in a few VisibleZ programs. Thanks to both of you for the great suggestions. You can watch ASI in action with LARL in the following video (and in the last table on the IBM Mainframe Assembler tab). The video illustrates adding a binary immediate constant to a binary fullword without using a register. AGSI, a sister instruction, works in a similar fashion on doubleword and can be viewed here and on the IBM Mainframe Assembler tab. I haven’t released the latest VisibleZ code which contains these instructions. I’m working on that.

Filed under IBM Mainframe Assembler

## Adding Away (AFI, AG, AGF)

I’m adding more short instruction videos that can be found on the IBM Mainframe Assembler tab (last table). Each video addresses a particular Add instruction using VisibleZ as a teaching tool. You don’t have to have VisibleZ installed to benefit from the videos. Today’s new videos are Add Fullword Immediate, Add Grande, and Add Grande Fullword. Review an instruction you already know, or learn a new one. Stay tuned, more videos are on the way!

Filed under IBM Mainframe Assembler

## IBM Champion for Z

I was honored to be renewed in 2023 as an IBM Champion for Z. It is an honor I take seriously, and I hope to produce new posts, articles, and teaching videos all year long.

Filed under IBM Mainframe Assembler

## Staudacher Comment Posted

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.

<

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