Talk:IBM Basic assembly language and successors: Difference between revisions

Content deleted Content added
Lazyzee (talk | contribs)
No edit summary
Line 47:
 
[[User:Jhlister|Jhlister]] ([[User talk:Jhlister|talk]]) 02:35, 4 July 2012 (UTC)
 
The "Hello World" example is seriously flawed anyway, regardless of whether a savearea is needed or not. Two instructions into the code, registers 12 and 15 will both contain the entry address of the program. However, at this point the Assembler is told to use this position as its assembly base (by the USING *,12 instruction). But we already know that register 12 does not contain this address - it contains the entry point of the program (as above). That is, the base address is incorrect, and the results of this program execution will be unpredictable.
 
Two possible ways of fixing this.....
 
1. Move the USING statement to the beginning of the program (i.e. immediately after the CSECT statement), so that USING will reflect register 12's eventual contents. Or...
2. Replace the LR 12,15 instruction with an instruction that establishes addressability two instructions in e.g. BALR 12,0.
 
This is very basic, I was very surprised indeed to see such a basic programming error in a facility such as Wiki.
 
[[User:Lazyzee|Lazyzee]] ([[User talk:Lazyzee|talk]])
 
==Instruction Format==