How to resolve the algorithm Copy a string step by step in the 360 Assembly programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Copy a string step by step in the 360 Assembly programming language

Table of Contents

Problem Statement

This task is about copying a string.

Where it is relevant, distinguish between copying the contents of a string versus making an additional reference to an existing string.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Copy a string step by step in the 360 Assembly programming language

Source code in the 360 programming language

*        Duplicate a string
         MVC    A,=CL64'Hello'     a='Hello'
         MVC    B,A                b=a          memory copy
         MVC    A,=CL64'Goodbye'   a='Goodbye'
         XPRNT  A,L'A              print a
         XPRNT  B,L'B              print b
         ...
*        Make reference to a string a string
         MVC    A,=CL64'Hi!'       a='Hi!'
         LA     R1,A               r1=@a        set pointer
         ST     R1,REFA            refa=@a      store pointer
         XPRNT  A,L'A              print a
         XPRNT  0(R1),L'A          print %refa
         ...
A        DS     CL64               a
B        DS     CL64               b
REFA     DS     A                  @a

  

You may also check:How to resolve the algorithm User input/Text step by step in the Raku programming language
You may also check:How to resolve the algorithm Priority queue step by step in the Action! programming language
You may also check:How to resolve the algorithm Ordered words step by step in the COBOL programming language
You may also check:How to resolve the algorithm Count in octal step by step in the Aime programming language
You may also check:How to resolve the algorithm S-expressions step by step in the TXR programming language