Yes, DOS-style code. DOS did not load R15 with the entry point, or at least was
not documented to do so. Also you should see no STM at the beginning: DOS gave
you your own registers. End-of -program was by SVC, not BR R14. (The EOJ macro
if memory serves.)
DOS used "core image" executable libraries which was static and not relocated
by the OS. You specified the load address at linkedit time. Folks who wrote
software that was intended to run in any partition (there was only one address
space in the hardware, so each partition (like an MVS region) was at a
different address) wrote "self-relocating" code with techniques such as you see
below. The program would have been linkedited as though it were to be loaded at
address 0, and then relocated all addresses by the actual load address. That
restriction would apply to any address, not just the address of an external
subroutine. It's similar to what you have to do now if you copy a DCB and EXLST
into LOC=BELOW GETMAIN.
V constants are basically a combination of an A constant plus an EXTRN
statement. OS/360 supported them also. You could use V constants for overlay
programs. The link editor put an address in 24 bits and a code number in the
high 8 bits. The loader would load the appropriate overlay segment and branch
to it automatically when you called the address in the V constant. (DOS did not
do that, but we still used V constants for external addresses -- a separate
problem from the lack of relocation.)
That was a common way of addressing CSECTs larger than 4K: multiple USING
instructions. We sometimes used an offset of 4095 because it could be
accomplished with LA as you see in your snippet.
Charles
-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On
Behalf Of Tony Thigpen
Sent: Saturday, March 11, 2017 4:53 AM
To: [email protected]
Subject: 50 year old assembler code still running.
I am working on some REALLY old code. Some of the code has dates back in
1967! The oldest date found is 5/9/67.
This code is still running daily. That's as good as 50 years later. The
only reason we are touching the code is because we are migrating this
application from z/VSE to z/OS.
I don't know the original operating system, but I expect it was DOS/360.
But, it could have been an early OS/360.
Anyway, I am seeing some code that am interested to know about,
historically.
For instance, it appears that USING could not support multiple
registers. I see this code sequence in the 'start' macro:
USING *,3 ESTABLISH REG 3
USING *+4095,4 AND REG 4
USING *+2*4095,5 AND REG 5 AS BASE REGS
Also, it appears that R15 was not standardized to have the programs
entry address because they used:
&NAME BALR 3,0 INITALIZE REG 3
LA 3,0(3)
BCTR 3,0
BCTR 3,0
LA 4,4095(3) AND REG 4
LA 5,4095(4) AND REG 5
(FYI: The above code snippets were contiguous.)
Also, when they needed to call a subroutine, it appears they did not yet
have =A(xxx) constants, because they had to manually adjust the address:
L 15,=V(UPSI) LOAD REG 15 WITH UPSI ROUTINE ADDRESS
AR 15,3 ADD RELOCATION FACTIR FROM REG 3
BAL 14,4(15) BRANCH TO UPSI RETURN IN REG 14