Switcing amode 24 / 31 dynamically? 
Author Message
 Switcing amode 24 / 31 dynamically?

 Hello.

I would like to know how to switch dynamically between 24 and 31 bit addres
sing mode, and also how can I know in which mode am I.~

I also I'm a little confused about the difference between AMODE and RMODE.
Any help on this subject would be appreciated.

Thanks.o



Thu, 07 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?

Quote:

> Hello.

>I would like to know how to switch dynamically between 24 and 31 bit addres
>sing mode, and also how can I know in which mode am I.~

>I also I'm a little confused about the difference between AMODE and RMODE.
>Any help on this subject would be appreciated.

>Thanks.o

Hi,
The attached macros can be used to set the particular mode you're
interested in - note that this is the "AMODE" that the program is
operating in. AMODE dictates how many bits (24 or 31) participate in
the calculation and execution of the effective address
(Base+Index+Displacement). RMODE is set at link-edit time and
determines whether the load module may reside above (RMODE of ANY) or
must reside  below (RMODE = 24) the 16mb line.

The macros themselves each have a test that determines whether or not
the processor itself is running in Extended Addressing mode, it must
be in XA mode in order for your program to be in 31-bit AMODE. You can
determine if your program is in 24 or 31 bit mode by coding a BASR
instruction and then checking the high-order bit of the save register
for 0 (24-bit) or 1 (31-bit).

I've never tried a post with an attachment before, so let me know if
you experience problems and I'll try some other way.

Good Luck, Paul



Fri, 08 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?
begin 644 modemacs.asm
<uuencoded_portion_removed>

`
end


Fri, 08 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?

Quote:

> Hello.
>Also I'm a little confused about the difference between AMODE and RMODE.
>Any help on this subject would be appreciated.

The Address Mode (AMODE) determines how other instructions behave.
Ex: In AMODE-24 an LA instruction clears the entire top byte, but in
AMODE-31 the same instruction only clears the high-order bit.

The Residence Mode (RMODE) tells the "loader" where to put the program.
If the program is RMODE-31 (or ANY), the AMODE would also have to be 31.
Otherwise the program wouldn't be able to reference it's own code.

Assuming you had an RMODE 24 program, you could switch modes with this
technique:

      BAL  14,SET24
      --
      BAL  14,SET31
      --
SET24 ICM  14,8,=X'00'  CLEAR HIGH ORDER BYTE
      BSM  0,14         RETURN WITH AMODE-24
SET31 ICM  14,8,=X'80'  SET HIGH-ORDER BIT
      BSM  0,14         RETURN WITH AMODE-31

There's lots more ways to do this, but I find this works well
for programs that, due to other restrictions, must be RMODE24.

Regards,
Gary
Advanced Debugging System for CICS
http://www.castle.net/~gbergman



Fri, 08 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?

Quote:

>I would like to know how to switch dynamically between 24 and 31 bit addres
>sing mode, and also how can I know in which mode am I.~

I use something like the following to determine my current AMODE:

         BALR  R15,0               .. Set '1' or ILC in high bit(s)
         LTR   R15,R15             .. ? Amode 31 ?
         BM    amode31_label          Yes - Branch
*                                     No  - Fall thru if Amode 24

This is how it works.  If you are executing in 24-bit addressing
mode BALR will set the left-most two bits of the register to the
instruction length code (ILC) which for BALR will be B'01' since
the BALR instruction is 1 halfword long.  Hence in 24-bit mode the
register will always be positive.  If you are executing in 31-bit
mode, BALR sets the left-most bit to 1 so the register will always
be negative.

Jim



Sat, 09 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?
Quote:

>  Hello.

> I would like to know how to switch dynamically between 24 and 31 bit addres
> sing mode, and also how can I know in which mode am I.~

It's very easy to switch between 24 and 31 bit addressing mode.  Here is some  
code to do that.
*
        BAS     14,SWITCH24    * switch to 24 bit mode
        BAS     14,SWITCH31    * switch to 31 bit mode
*
SWITCH24 ds 0h
        N       14,=X'7FFFFFFF'
        BSM     0,14
SWITCH31 DS 0H
        O       14,=X'80000000'
        BSM     0,14
*

The Branch and Set Mode (BSM  r1,r2) allows you to do this.  With r1 set to
'0', the contents of r2 specifies the addressing mode and branch address.

Another great feature that I think became available in MVS/ESA is the
Branch and Stack command (BAKR  r1,r2).  This is great for setting up
a routine in a program that you can call and when it returns, both your
registers and addressing mode are returned to the state they were in when
the routine was called.
*
        BAS     14,ROUTINE
*
ROUTINE DS 0H
        BAKR    14,0
*
        some code here
*
        PR

Hope this helps you out.



Sat, 09 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?

: Another great feature that I think became available in MVS/ESA is the
: Branch and Stack command (BAKR  r1,r2).  This is great for setting up
: a routine in a program that you can call and when it returns, both your
: registers and addressing mode are returned to the state they were in when
: the routine was called.

Good information, but it sounds like you're saying that the BAKR
instruction came with MVS.  It's part of the system/390 instruction
set, so of course it can be used by an assembler program running
under VM/ESA, VSE/ESA, MVS/ESA, TPF, any other operating system,
the operating system itself, or any standalone program.

-- David Walker

: *
:       BAS     14,ROUTINE
: *
: ROUTINE DS 0H
:       BAKR    14,0
: *
:       some code here
: *
:       PR

: Hope this helps you out.



Tue, 12 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?

Quote:

>Good information, but it sounds like you're saying that the BAKR
>instruction came with MVS.  It's part of the system/390 instruction
>set, so of course it can be used by an assembler program running
>under VM/ESA, ...

  Actually BAKR takes some setup, that CMS does not provide
(not that you couldn't provide it yourself I guess) and has
been removed from the ESA/XC architecture (along with
PROGRAM CALL and others of similar ilk) ... Perry

* * *
Perry Ruiter W131 1 Plum (604)389-3130



Tue, 12 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?

Quote:

> Hello.
>I would like to know how to switch dynamically between 24 and 31 bit addres
>sing mode, and also how can I know in which mode am I.~
>I also I'm a little confused about the difference between AMODE and RMODE.
>Any help on this subject would be appreciated.
>Thanks.o

I've seen a few answers on the first part, so i'll only give it a try at the
second one.

AMODE stands for AdressingMODE, so whether you're able to address above the line
yes or no. ResidingMODE tells MVS where the program is located. So, the AMODE
can be changed within your program, the RMODE is set when linking the module,
and will never change during execution.



Wed, 13 May 1998 03:00:00 GMT  
 Switcing amode 24 / 31 dynamically?
Program Call was removed?  How strange...  I did most of my VM assembler
coding in the CP nucleus, not in CMS, so I have a little different
perspective!  I know most people who write VM assembler code write it
to run under CMS.

-- David Walker



:  
: >Good information, but it sounds like you're saying that the BAKR
: >instruction came with MVS.  It's part of the system/390 instruction
: >set, so of course it can be used by an assembler program running
: >under VM/ESA, ...
:   Actually BAKR takes some setup, that CMS does not provide
: (not that you couldn't provide it yourself I guess) and has
: been removed from the ESA/XC architecture (along with
: PROGRAM CALL and others of similar ilk) ... Perry
:  
: * * *
: Perry Ruiter W131 1 Plum (604)389-3130



Sun, 17 May 1998 03:00:00 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. DATA(31) and AMODE=31

2. 31 bit vs 24 bit - two easy questions

3. Local Storage and DATA(24|31)

4. New Release Info/24 vs. 31 bit

5. Public Tcl/Tk and Expect training, Aug 20-24 and Sep 24-27

6. Workshop on Symbolic and Numeric Computing, Helsinki May 30-31

7. 31-bit Programming Question

8. 31-bit Addressing Problem

9. 31 Bit Addressing

10. Use of ARCHRCAL in 31 bit address spece ?

11. 31 and counting

12. 31-bit addressing in MVS CICS

 

 
Powered by phpBB® Forum Software