Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
43
Task/Repeat-a-string/360-Assembly/repeat-a-string.360
Normal file
43
Task/Repeat-a-string/360-Assembly/repeat-a-string.360
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
* Repeat a string - 19/04/2020
|
||||
REPEATS CSECT
|
||||
USING REPEATS,R13 base register
|
||||
B 72(R15) skip savearea
|
||||
DC 17F'0' savearea
|
||||
SAVE (14,12) save previous context
|
||||
ST R13,4(R15) link backward
|
||||
ST R15,8(R13) link forward
|
||||
LR R13,R15 set addressability
|
||||
XPRNT C24,24 print c24
|
||||
LA R1,PARMLST pg=repeat(cx,ii) - repeat('abc ',6)
|
||||
BAL R14,REPEAT call repeat
|
||||
XPRNT PG,L'PG print pg
|
||||
L R13,4(0,R13) restore previous savearea pointer
|
||||
RETURN (14,12),RC=0 restore registers from calling save
|
||||
REPEAT CNOP 0,4 procedure repeat(b,a,i)
|
||||
STM R2,R8,REPEATSA save registers
|
||||
L R2,0(R1) @b=%r1
|
||||
L R3,4(R1) @a=%(r1+4)
|
||||
L R4,8(R1) @i=%(r1+8)
|
||||
LR R5,R3 length(a) before a
|
||||
SH R5,=H'2' @lengh(a)
|
||||
LH R6,0(R5) l=length(a)
|
||||
LR R7,R6 l
|
||||
BCTR R7,0 l-1
|
||||
L R8,0(R4) i=%r4
|
||||
LTR R8,R8 if i<=0
|
||||
BNP RET then return
|
||||
LOOP EX R7,MVCX move a to b len R6
|
||||
AR R2,R6 @b+=l
|
||||
BCT R8,LOOP loop i times
|
||||
RET LM R2,R8,REPEATSA restore registers
|
||||
BR R14 return
|
||||
PARMLST DC A(PG,CX,II) parmlist
|
||||
REPEATSA DS 7F local savearea
|
||||
MVCX MVC 0(0,R2),0(R3) move @ R3 to @ R2
|
||||
C24 DC 6C'xyz ' constant repeat - repeat('xyz ',6)
|
||||
LCX DC AL2(L'CX) lengh(cc)
|
||||
CX DC CL4'abc ' cx
|
||||
II DC F'6' ii
|
||||
PG DC CL80' ' pg
|
||||
REGEQU
|
||||
END REPEATS
|
||||
Loading…
Add table
Add a link
Reference in a new issue