Page 2 of 2

Re: New to Assembler Programming

PostPosted: Sun Nov 21, 2010 10:41 pm
by dick scherrer
Hello,

but I guess there is a reason for it.
Yes, because after "it" comes out of the box, people get their hands on "it" :)

Actually, there are many different products and tools available which leads to some dis-similarity. Additionally, some organizations have more structure to their environment. Many create their own tools to meet requirements beyond the vanilla system as it comes out of the box.

After several environments, the "next" one is easier. . . ;)

Re: New to Assembler Programming

PostPosted: Mon Jan 17, 2011 4:49 pm
by stevexff
From my own personal experience, the biggest hurdle was understanding register based addressing; once I'd got my head round that it all fel into place, and the rest was just learning about the various instructions. The Principles of Operation does a great job of describing the what each machine instruction does in excruciating detail. What it is less good at is describing what they should be used for, and under what circumstances...

Re: New to Assembler Programming

PostPosted: Tue Jan 18, 2011 6:16 am
by alexlloyd54
IBM manuals are not a good start if you want to learn Assembly language from scratch, they are meant to be used as a reference

there are a lot (or few) of books regarding assembly language, and i recommend the following:

1) Structured Assembly Language programming for the IBM 370 (by James Silver) ISBN 0-02-411040-x

it's one of the best books, though it's too old and it might be difficult to find :shock:


2) Advanced Assembler Language and MVS Interface (by Carmine Cannatello) ISBN 0-471-36176-3


and of course, don't forget to get a copy of the IBM (Principles of operation) manual as a reference.


The most important thing is to give yourself a lot of time, and the most important ... to love the language

good luck

Re: New to Assembler Programming

PostPosted: Tue Jan 18, 2011 6:58 am
by steve-myers
Personal opinion: it really helps if you are reasonably proficient in a mid-level language, like C. Assembler is not so good as a first language.

Two other manuals are Using Datasets and Macro Instructions for Datasets. The links are for z/OS V1R12, but the material changes very slowly. Using Datasets is somewhere between a reference and a text. Macro Instructions for Datasets is strictly a reference.

Assembler Services Guide and Assembler Services Reference 1 and Assembler Services Reference 2 are also manuals you'll need. The IBM Assemblers have always had an extremely powerful macro language, so all the operating system interfaces are accessed through the macro language rather than through the the System/360 equivalent of the INT instruction. ESA/370 introduced what amounts to the call gate interface in 80x86 PC hardware; some of the macros use that interface.

Re: New to Assembler Programming

PostPosted: Tue Jan 18, 2011 12:07 pm
by steve-myers
By its nature, Assembler is not a "structured programming" language. Something like 30 years ago, my good friend Bill Mosteller wrote a book called "Systems Programmer's Problem Solving Guide." It's been out of print for something like 25 years, and much of its advice is outdated by now, but there was one very important comment about "structuring" Assembler code that goes a long way toward making your code easier to understand:

Do not insert a branch to a lower storage location except to form a loop.

After I thought about it I realized I'd been mostly following Bill's advice anyway; since then I've followed his advice fairly religiously.

Re: New to Assembler Programming

PostPosted: Mon Jan 24, 2011 8:39 am
by alexlloyd54
Steve

the poster is new to Assembly programming, most of the manuals that you've mentioned are too advanced for him

I think he should start with the "Hello World" program first (simple read & print)

then would start doing some data manipulation ... etc etc

later when he finds himself capable to go further, he would start reading about macros and system services.

when someone wants to learn how to drive, he would NEVER start with an expensive car :D

Re: New to Assembler Programming

PostPosted: Mon Jan 24, 2011 10:56 am
by steve-myers
I started doing Assembler for IBM 7040 IBSYS. I did start relatively "simple" in '65, but advanced fairly quickly.

I started OS/360 Assembler in '68. As with 7040 I tried "simple" stuff first, and advanced to more complex stuff rather less quickly than with 7040. As with the 7040 numeric conversions were somewhat difficult. One project in early '69 I still recall with pride was to build a macro set that linked to the Fortran library for reading and writing. The macro set would build "compiled" Fortran formats.

Your proposed Hello World program requires "simple" macros like SAVE and RETURN, as well as some of the "simpler" I/O facilities like OPEN, CLOSE, PUT, and the base parts of the dreaded DCB macro.
WORLD    CSECT                     DEFINE PROGRAM CSECT
         USING *,12                SPECIFY PROGRAM ADDRESSABILITY
         SAVE  (14,12),,*          SAVE REGISTERS
         LR    12,15               COPY ENTRY POINT ADDRESS TO REG 12
         LA    15,SAVEAREA         LOAD ADDRESS OF THE NEW SAVE AREA
         ST    15,8(,13)           ADD THE NEW SAVE AREA TO THE
         ST    13,4(,15)            SAVE AREA CHAIN
         LR    13,15               ESTABLISH THE NEW SAVE AREA POINTER
         OPEN  (PRINT,OUTPUT)      OPEN SYSPRINT
         PUT   PRINT,HITHERE       WRITE HELLO WORLD
         CLOSE PRINT               CLOSE SYSPRINT
         L     13,4(,13)           LOAD ADDR OF THE PREVIOUS SAVE AREA
         RETURN (14,12),T,RC=0     RESTORE REGISTERS AND RETURN
SAVEAREA DC    9D'0'               NEW OS/360 SAVE AREA
PRINT    DCB   DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=FBA,LRECL=121
HITHERE  DC    CL121' HELLO WORLD!'
         END   WORLD

Re: New to Assembler Programming

PostPosted: Tue Feb 22, 2011 3:26 pm
by sensuixel
I started HLASM four month ago with a classic "HELLO WORLD"

Then I read Principle of operation one instruction at a time (started with L, LA, MVC then B,BZ ...).

I quickly bookmarked http://csc.colstate.edu/woolbright/WOOLBRIG.htm which helped me a lot to understand adressing, linkage
and numeric conversion.
This link http://stevenscs.com/notes/HLASM/HLASM.Notes.html was also helpful to understand the basics.

On this basis, I've coded simple program as counting record from file and write the result with WTO or in a file in LOCATE mode or MOVE mode ...

Recently i bought Advanced Advanced Assembler Language and MVS Interfaces, it content a lot of sample and give hint to code properly.
Now i spend more time on principle of operation, IBM HLASM Language reference and IBM HLASM Programmer's guide.

Good luck

Re: New to Assembler Programming

PostPosted: Sat Feb 26, 2011 3:33 am
by steve-myers
stevexff wrote:From my own personal experience, the biggest hurdle was understanding register based addressing...
I came into System/360 from 7040. The concept of base register / displacement addressing was somewhat new, though it was theoretically possible in 7040 it was rarely used. IBM 704/709/704x/709x normally addressed storage by having one or sometimes two 15 bit addresses in each 36-bit instruction. I quickly understood the advantages of the System/360 addressing and 16 registers compared to 2 registers and 3 15-bit "index" registers on the 704x. What I had trouble with, at first, and it still gives me trouble after 40+ years is matching the 4-bit mask in BC instructions with the 2-bit condition code set by many instructions. Thank goodness for extended branch mnemonics!

Re: New to Assembler Programming

PostPosted: Wed Aug 17, 2011 8:42 am
by David Woolbright
My IBM assembler web site address has changed to http://csc.columbusstate.edu/woolbright/WOOLBRIG.htm
I am in the process of recording video lectures for an introductory course in assembler. I have posted a few of the lectures on the site already, so you can get an idea of what I'm up to. I'll be teaching assembler in the spring and I will finish recording the rest of the lectures by next May 2012.