The "yonder" (long displacement) instructions take negative displacements.

-- 
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר




________________________________________
From: IBM Mainframe Assembler List <[email protected]> on behalf 
of Charles Mills <[email protected]>
Sent: Tuesday, February 10, 2026 7:48 PM
To: [email protected] <[email protected]>
Subject: Re: Move data to a location prior to a given (based) address


External Message: Use Caution


I don't know of any instructions that accept a hard-coded negative
displacement. You can't do MVI 0,-6(R3)

The closest you can come is a negative index. For the indexed
instructions, the following will work.

LHI  R2,-6

STH R0,0(R2,R3)  Store R0 -6 from R3

Probably not worth the bother for your situation.

/CM/

On 2/10/2026 2:41 PM, David Clark wrote:
> Let me preface this by saying I'm not really that familiar with newer
> instructions.  But, I have a 40-year old subroutine that provided 15 string
> manipulation functions for COBOL programs.  Now I am adding three more (one
> of which came up in my previous post).  At the same time...
>
> The previous support was for one function at a time, even though multiple
> input strings were supported (i.e., a variable-length parm list; with the
> first for a header work area [R8], the second for a large "master" buffer
> [R9], and the third for the beginning of one or more "working"
> string parameters[R10]; where R11 is the code base register but only needed
> for the fixed storage area LOCTR'd to the beginning of the subroutine).
>
> I would like to add a "mini-scripting" feature that allows one of 16
> different functions to be performed on a string-by-string basis and in a
> single CALL.  Naturally, this would have to be backward-compatible.  To do
> this I changed the string DSECT to have a "redefined" layout--as follows:
>
> TXTINPT  DSECT
>           USING TXTINPT,R10        ESTABLISH REG 10 AS BASE
> TXTSREQU DS    CL1                SCRIPTING REQUEST CODE
> TXTSRETN DS    CL1                SCRIPTING RETURN CODE
> TXTSSTRL DS    H                  SCRIPTING INPUT/OUTPUT STRING LENGTH
> TXTSSTRG DS    256CL1             SCRIPTING INPUT/OUTPUT STRING
>           ORG   TXTINPT
> TXTSTRL  DS    H                  LEGACY INPUT/OUTPUT STRING LENGTH
> TXTSTRG  DS    256CL1             LEGACY INPUT/OUTPUT STRING
>
> So as not to have to duplicate *all* of the code, I figured I would just
> save off the first two bytes and then increment R10 by 2 such that the last
> two fields would work for both modes (and the last two fields are the ones
> that are referenced by the remainder of the subroutine).
>
> That is fine, but when I want to save the return code for the current
> string and function, I initially coded it this way (I presume it is OK to
> use regular arithmetic on an address)--and then continue on with whatever
> else needs to be done next.
>
> IF    TXTREQU,EQ,C'S'    IF IN SCRIPTING MODE
>   SHI  R10,2               POINT TO SCRIPTING PARM AREA
>   MVC  TXTSRETN,HOLDRETN   SAVE STRING RETURN CODE
>   AHI  R10,2               POINT TO LEGACY LENGTH AND STRING
> ENDIF                    ENDIF
>
> But then I had a thought...  Is there any instruction that will let you
> move (and examine) data to/in a location prior to a given address?  Now, I
> saw where an AI generated a sample MVC instruction that used a negative
> displacement, but I didn't know if that was legitimate?  Recommendations?
>
> Sincerely,
>
> Dave Clark
> --
> int.ext: 91078
> direct: (937) 531-6378
> home: (937) 751-3300
>
> Winsupply Group Services
> 3110 Kettering Boulevard
> Dayton, Ohio  45439  USA
> (937) 294-5331


Reply via email to