C445585@UMCVMB.BITNET ("John M. Kelsey") (02/27/91)
One thing I've always done, but have seldom seen other programmers do, is to use some character to separate the assembly language instructions and operands from the line comments by some character--in my case, a semicolon. This seems to make programs a lot more readable, and, with properly written XEDIT macros, is fairly simple.... Something like this: LOOPTOP L R4,0(R5) ; Get ARR1(I) integer A R4,0(R6) ; Add it to ARR2(I) ST R4,0(R5) ; Put it back into ARR1(I) LA R5,4(R4) ; Move ptrs to next locations-- LA R6,4(R6) ; essentially I = I + 1 BCT R3,LOOPTOP ; Bottom of loop Does anyone else do anything similar? (I've seen one person use asterisks instead of semicolons, but I started learning 370 assembly language and 8086 assembly language at the same time, and semicolons somehow look more 'natural.' --John
a10jaa8@mp.cs.niu.edu (Joe Adamo) (02/27/91)
In article <9102262153.AA04320@ucbvax.Berkeley.EDU> IBM 370 Assembly Programming Discussion List <ASM370@OHSTVMA.BITNET> writes: > >XEDIT macros, is fairly simple.... Something like this: > I don't know if this is the correct place to post this, but I haven't found the newsgroup comp.editors.XEDIT :) My question is, how do you write a macro in XEDIT. I've done a lot of work with it, and the use of some macros can make my life a lot easier! Please explain! Thanks, Joe Adamo a10jaa8@mp.cs.niu.edu Northern Illinois University. A nice place to visit but........
a10jaa8@MP.CS.NIU.EDU (Joe Adamo) (02/27/91)
In article <9102262153.AA04320@ucbvax.Berkeley.EDU> IBM 370 Assembly Programming Discussion List <ASM370@OHSTVMA.BITNET> writes: > >XEDIT macros, is fairly simple.... Something like this: > I don't know if this is the correct place to post this, but I haven't found the newsgroup comp.editors.XEDIT :) My question is, how do you write a macro in XEDIT. I've done a lot of work with it, and the use of some macros can make my life a lot easier! Please explain! Thanks, Joe Adamo a10jaa8@mp.cs.niu.edu Northern Illinois University. A nice place to visit but........
FERZAN@TREARN.BITNET (O) (02/27/91)
i never understand why everybody puts their comments to the right hand side of program source, but, me as an experienced programmer, i always put comment as a topic, above the program source. example: ****************************************************************************** * start program * ****************************************************************************** START EQU * don't you have someting more serious to do .. it is waste of time ..
PHILIP@CLEMSON.BITNET (Philip Harshman 3697) (02/27/91)
On Tue, 26 Feb 91 15:27:43 CST "John M. Kelsey" <C445585@UMCVMB.BITNET> said: > One thing I've always done, but have seldom seen other programmers do, > is to use some character to separate the assembly language instructions and > operands from the line comments by some character--in my case, a semicolon. > > LOOPTOP L R4,0(R5) ; Get ARR1(I) integer > > Does anyone else do anything similar? At our shop we use the vertical or bar (|) for the same purpose: LOOPTOP L R4,0(R5) | Get ARR1(I) integer This makes a nice even line separating the code from the comments. And I agree, it does make the code easier to follow.
IQTI400@INDYCMS.BITNET (Phil Paxton) (02/27/91)
On Wed, 27 Feb 91 09:12:01 TUR O said: > i never understand why everybody puts their comments > to the right hand side of program source, > but, me as an experienced programmer, i always put > comment as a topic, above the program source. example: >****************************************************************************** >* start program * >****************************************************************************** >START EQU * > If you can write comments that are short, or stagger them across several lines, it works well because you can read the code straight through and not have to mentally filter out the comments. Otherwise, you are reading interchanged comments and code. It's all a matter of personal preference, unless it's dictated by your workplace.
dbc@palm03.cray.com (Daryl Coulthart) (02/27/91)
I would be interested in seeing anyones standards for assembly language programming. There seems to be a great variance among programmers. Would anyone, who has documented standards, be willing to share them?
SWH@NASVM.BITNET ("Steven W. Huggins") (03/05/91)
On Wed, 27 Feb 91 08:22:00 EST Philip Harshman 3697 said: >On Tue, 26 Feb 91 15:27:43 CST "John M. Kelsey" <C445585@UMCVMB.BITNET> said: >> One thing I've always done, but have seldom seen other programmers do, >> is to use some character to separate the assembly language instructions and >> operands from the line comments by some character--in my case, a semicolon. >> >> LOOPTOP L R4,0(R5) ; Get ARR1(I) integer >> >> Does anyone else do anything similar? > >At our shop we use the vertical or bar (|) for the same purpose: > LOOPTOP L R4,0(R5) | Get ARR1(I) integer >This makes a nice even line separating the code from the comments. And I >agree, it does make the code easier to follow. Hi John and Philip, The history behind, why the special character, includes the following. The MACRO assembler for DOS had a comment placement problem. When code was expanded, comments would float according to the variables pluged in. The solution was to place a "special character" preceeding the comment. This made the comments align properly. If you look at some old IBM code you'll see a "." in front of some generated code. Now on to my personal preferance. I don't use a special character in front of my comments. I do, however, have another ideosyncracy. When the code is to branch somewhere I comment it with a ">". e.i. *--------------------------------------------------------------------* * R O U T I N E T O D O S O M T H I N G * *--------------------------------------------------------------------* ROUTINE EQU * LA R2,45 SET REG.2 TO 45. LA R3,TABLE POINT REG.3 TO TABLE. LOOP EQU * CLI 0(R3),X'FF' CHECK FOR END OF TABLE. BE ENDROUT >YES, BRANCH. ... LA R3,8(,R3) BUMP TO NEXT TABLE ENTRY. BCT R2,LOOP >GO LOOP UNTIL DONE. ENDROUT EQU * We all have personal preferances in the way we code, of course I think my code is the best and only way to code assembler. Which losely translates to don't try to teach this old dog any new tricks, I hate change. Enough for now, Steve
seb1525@mvs.draper.COM ("Stephen E. Bacher") (03/05/91)
Ready for a personal preference flame about assembler comments? Rather than the established style of C R1,FOOLOC Is value equal to FOO? BNE NOTFOO No LA R2,BAR Yes, frobulate with BAR LA R3,BAR+1 Do something else BAR-related B PASTFOO Skip rest of check NOTFOO DS 0H Value is not FOO LA R2,BAZ Frobulate with BAZ LA R3,BAZ+1 Do something else BAZ-related PASTFOO DS 0H Check done which is so prevalent among assembler hackers, why not use C R1,FOOLOC If value is equal to FOO, BNE NOTFOO then... LA R2,BAR frobulate with BAR LA R3,BAR+1 do something else BAR-related B PASTFOO end NOTFOO DS 0H Else (value not equal to FOO)... LA R2,BAZ frobulate with BAZ LA R3,BAZ+1 do something else BAZ-related PASTFOO DS 0H end Doesn't this show better the REAL structure of the code you're trying to write? This can be extended to more complicated logic involving multiple tests, which can be expressed in terms of AND and OR. Here's an example from our TSO SUBMIT exit... EX R4,UIDCOMP1 If jobname matches userid BNE NEWJOBCH and TRT 0(1,R15),JCHARTBL the jobname character is valid BNZ NEWJOBCH then IC R6,0(,R15) use last char of input jobname B NEWJOBNM else... NEWJOBCH DS 0H LA R6,C'$' replace with default char "$" NEWJOBNM DS 0H Generate new job name The logic is clear and readable without having to resort to additional comment blocks. AND, it helps the programmer code correctly. Here's another example - a common looping construct. This one is taken from the "XPROC" program (a CLIST-to-REXX conversion helper) and slightly modified for readability: KVPPLOOP DS 0H Loop to check for duplicates C R0,POSDLEN If lengths don't match, BNE KVPPNEXT then continue L R14,POSDADDR Point to old parameter EX R15,COMPWORD If values are equal, BE ERRORDUP then error KVPPNEXT LA R2,POSDDATL(,R2) Else continue BCT R8,KVPPLOOP until no more positionals KVPPLEND DS 0H End loop to check for duplicates I would like to see more assembler programs try this commenting style. - SEB P.S. Another good reason to use DS 0H instead of EQU * is that TSO TEST knows labels defined with DS, but doesn't know labels defined with EQU.
rickert@CS.NIU.EDU (Neil Rickert) (03/05/91)
In article <9103050128.AA16369@ucbvax.Berkeley.EDU> you write: >Ready for a personal preference flame about assembler comments? > > C R1,FOOLOC If value is equal to FOO, > BNE NOTFOO then... > LA R2,BAR frobulate with BAR > LA R3,BAR+1 do something else BAR-related I have no real objections to this indented comment style. But if you were writing code that I had to maintain I would tell you not to waste too much time with the pretty printing of it. The fact is, if I have to look at the code closely enough to need to know the structuring, I'm probably not going to pay much attention to the comments at all. It is what is to the left of the comments that really tells you what is happening, and when push comes to shove that is what you must rely on. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science <rickert@cs.niu.edu> Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940
LDW@USCMVSA.BITNET (Leonard D Woren) (03/09/91)
> The fact is, if I have to look at the code closely enough to need to > know the structuring, I'm probably not going to pay much attention to > the comments at all. It is what is to the left of the comments that > really tells you what is happening, and when push comes to shove that is > what you must rely on. Yep. I was once reading JES2 source, trying to determine whether something was a feature or a bug. I came to one line where the comment seemed to conflict with the instruction. After staring at it for an hour, I called the support center. The level 2 person checked into it and discovered that the comment was backwards. They wouldn't take an APAR to fix the comment, but said they'd "leave a note on the board for someone to fix that comment the next time that area was touched." Sigh. /Leonard
dandrews@bilver.uucp (Dave Andrews) (03/14/91)
>P.S. Another good reason to use DS 0H instead of EQU * is that > TSO TEST knows labels defined with DS, but doesn't know > labels defined with EQU. I believe that this is a limitation of the assembler, which won't produce "TESTRAN cards" (SYM records) for equates. The SLAC mods address this issue. $ disclaim David Andrews tarpit!bilver!dandrews NOTHING HAPPENS
tabu6@CCVAX.IASTATE.EDU (Adam Goldberg) (03/17/91)
In article <9103150812.AA15270@ucbvax.Berkeley.EDU>, dandrews@bilver.UUCP (Dave Andrews) writes: >>P.S. Another good reason to use DS 0H instead of EQU * is that >> TSO TEST knows labels defined with DS, but doesn't know >> labels defined with EQU. > >I believe that this is a limitation of the assembler, which won't >produce "TESTRAN cards" (SYM records) for equates. The SLAC mods >address this issue. I prefer neither DS 0H nor EQU *. Since I frequently resort to using XPEDITER to debug, and the latest version of XPEDITER doesn't recognize labels on either DS 0H or EQU * lines, I use ANOP's. Of course that wastes a little space, but what they hey? +----------------------------------------------------------------------------+ + Adam Goldberg H:(515)233-5135 + + Iowa State University TABU6@ccvax.iastate.edu + + "It's simple! Even a Pascal programmer could do it!" + +----------------------------------------------------------------------------+
news@ucf1vm.BITNET (03/17/91)
In article <9103150812.AA15270@ucbvax.Berkeley.EDU>, dandrews@bilver.UUCP (Dave Andrews) writes: >>P.S. Another good reason to use DS 0H instead of EQU * is that >> TSO TEST knows labels defined with DS, but doesn't know >> labels defined with EQU. > >I believe that this is a limitation of the assembler, which won't >produce "TESTRAN cards" (SYM records) for equates. The SLAC mods >address this issue. I prefer neither DS 0H nor EQU *. Since I frequently resort to using XPEDITER to debug, and the latest version of XPEDITER doesn't recognize labels on either DS 0H or EQU * lines, I use ANOP's. Of course that wastes a little space, but what they hey? +----------------------------------------------------------------------------+ + Adam Goldberg H:(515)233-5135 + + Iowa State University TABU6@ccvax.iastate.edu + + "It's simple! Even a Pascal programmer could do it!" + +----------------------------------------------------------------------------+