Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!midway!gargoyle!chinet!laird From: laird@chinet.chi.il.us (Laird J. Heal) Newsgroups: comp.lang.asm370 Subject: Re: help for new assembly'er Message-ID: <1991Feb27.043234.23995@chinet.chi.il.us> Date: 27 Feb 91 04:32:34 GMT References: <9102261052.AA16278@ucbvax.Berkeley.EDU> Distribution: inet Organization: Chinet - Chicago Public Access UNIX Lines: 40 In article <9102261052.AA16278@ucbvax.Berkeley.EDU> IBM 370 Assembly Programming Discussion List writes: > >My girl friend starts to working with system 370 assembler. >But she don't care syntax and rules of 370 assembly ! There are really very few bad practices in 370 assembler, or perhaps there are really very few good practices in 370 assembler. Now that I sound confused too, let me lay down a few rules, of thumb that is. Since registers zero, one and two can be modified by everything from SVCs to TRTs, use them for scratch areas. R15 is your entry address but you should save it off - R12 is typically used for this and thus as the code base register. R14 is the return address but can be used within your code as can R15, as the OS never really relies on them. R13, on the other hand, should always point to your Register Save Area, unless you are working with DOS/VSE/POWER, in which case I commend your soul to the appropriate power. Always observe register saving and save area chaining scrupulously. That is, use the SAVE and RETURN macros or write code yourself to put R14-R12 at 12(R13), then save the address of your area in the caller's area and save hers in yours. Note: a calling process is generally called the `mother' process. All other registers can be used for base or scratch as you like. Writing reentrant code (use RU-type GETMAIN for all data areas) is good practice but not much good otherwise. Always use DS 0H for all branch labels. There was a much better reason once (in the days of punch-cards) but now it just helps to clarify the scene. Never write self-modifying code - there is always a better way to accomplish the same thing, generally with a table of things to pick up and EXECUTE with, if your program is so constituted. Have fun. -- Laird J. Heal The Usenet is dead! Here: laird@chinet.chi.il.us Long live the Usenet!