Re: Re: Where do I start?

Gerhard Postpischil <[email protected]> Wed, 26 May 2010 21:11:42 -0400
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
On 5/26/2010 6:59 PM, Ron Hudson wrote:
> Well actually I know of the concepts - but the implementation gets me in
> trouble with
> "G" : ^ ) .. I know what I want to tell the machine - I just don't know
> how to say it.
>
> For Example: A base register is a register holding an address that is
> modified by an index or indexes to form a pointer. Usually a base
> register points to the zero'th array element or the first element in a
> buffer. A changeable index is added to the base register to access other
> parts of the buffer or elements in the array.

Yes and no. If you recall the reserved registers used for 
standard linkage, you'll note that R15 should contain the 
address of the invoked program. In order for your program to use 
branch instructions, it needs a base and offset, as you have 
above. However, in order to have branch instructions resolve 
correctly, you also need to tell the Assembler what to use for 
the base. A simple program might look like:

MYCODE	TITLE	'This is a test of the TPUT/TGET service'
MYCODE	CSECT	, tells Assembler you're starting something	
	USING *,15	caller's set base
	B	BEGIN	branch around program id
	DC	AL1(17),CL17'progname &SYSDATE'
BEGIN	STM	14,12,12(13)	SAVE IN CALLER'S AREA
	LR	12,15	COPY TO LESS VOLATILE REGISTER
	DROP	15	NO LONGER NEEDED
	USING   MYCODE,12	NEW BASE FOR BRANCHES
	LA	9,LOCSAVE	IF NEEDED
	ST	9,8(,13)	DOWNLINK
	ST	13,4(,9)	UPLINK
	LR	13,9	PROGRAM'S SAVE AREA
	...		your code

pgmexit	L	13,4(,13) USER'S AREA
	LM	14,12,12(13)  RESTORE
	DROP	12
	LA	15,0 return code 0-up				
	BR	14	exit pgm
	SPACE 1
LOCSAVE DC	18F'0'
	LTORG ,		for =C'###' etc.
	END

There are other ways of doing everything, but that's the basic 
linkage and base code.

Also note that when TSO gives an error message with a ?, hitting 
enter will produce one or more additional messages.


Gerhard Postpischil
Bradford, VT