It does get a little complicated. The Assembler does not care about AMODE and RMODE; it just passes the value to the object code.bobguo wrote:As i understood, RMODE is enough to tell computer where it should be resided, below the line or above? I can not think up the purpose of AMODE.... What's the difference between them? Can AMODE tell computer some information more? ...AMODE is a hint to the Assembler and Linkage Editor to tell the OS to EXECUTE the program in 24/31/64 bit.
RMODE is a hint to the Assembler and Linkage Editor to tell the OS to LOAD the program below 16M or 2G, if needed.
The Binder/Linkage Editor cares about RMODE: it tallies all of the RMODE declarations it sees in its input; the output load module is assigned the most restrictive RMODE in its input, unless, of course, the RMODE is forced by parameters or *PROCESS statements.
The Binder/Linkage Editor assigns the load module the AMODE specified for the section or ENTRY symbol specified as the entry point, unless, of course, the AMODE is forced by parameters or a *PROCESS statement.
Finely, program fetch loads the load module according to the module RMODE.
The AMODE is a little more complicated. If the module is called by the supervisor (in other words by a LINK, XCTL or ATTACH macro) the AMODE is the AMODE defined for the entry point. If the module is loaded into storage by the LOAD macro, the module address returned by the macro provides the expected AMODE, but it is up to the calling program to switch to the specified AMODE before it calls the module, and switch back, if necessary, to the preferred AMODE when the module returns. Originally, the BSM instruction was provided to reset the AMODE; in z/Architecture the TAM (Test Addressing Mode) and SAM (Set Addressing Mode) instructions were provided to support AMODE 64.