How to resolve the algorithm Substring/Top and tail step by step in the 360 Assembly programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Substring/Top and tail step by step in the 360 Assembly programming language

Table of Contents

Problem Statement

The task is to demonstrate how to remove the first and last characters from a string. The solution should demonstrate how to obtain the following results:

If the program uses UTF-8 or UTF-16, it must work on any valid Unicode code point, whether in the Basic Multilingual Plane or above it. The program must reference logical characters (code points), not 8-bit code units for UTF-8 or 16-bit code units for UTF-16. Programs for other encodings (such as 8-bit ASCII, or EUC-JP) are not required to handle all Unicode characters.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Substring/Top and tail step by step in the 360 Assembly programming language

Source code in the 360 programming language

*        Substring/Top and tail    04/03/2017
SUBSTRTT CSECT
         USING  SUBSTRTT,R13       base register
         B      72(R15)            skip savearea
         DC     17F'0'             savearea
         STM    R14,R12,12(R13)    save previous context
         ST     R13,4(R15)         link backward
         ST     R15,8(R13)         link forward
         LR     R13,R15            set addressability
*
         XPRNT  S8,L'S8            print s8
         MVC    S7,S8+1            s7=substr(s8,2,7)
         XPRNT  S7,L'S7            print s7
         MVC    S7,S8              s7=substr(s8,1,7)
         XPRNT  S7,L'S7            print s7
         MVC    S6,S8+1            s6=substr(s8,2,6)
         XPRNT  S6,L'S6            print s6
*         
         L      R13,4(0,R13)       epilog
         LM     R14,R12,12(R13)    restore previous context
         XR     R15,R15            rc=0
         BR     R14                exit
S8       DC     CL8'12345678'
S7       DS     CL7
S6       DS     CL6
         YREGS
         END    SUBSTRTT

  

You may also check:How to resolve the algorithm Tau function step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Permutations step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Elementary cellular automaton/Infinite length step by step in the Tcl programming language
You may also check:How to resolve the algorithm General FizzBuzz step by step in the C programming language
You may also check:How to resolve the algorithm Twelve statements step by step in the AutoHotkey programming language