Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,59 @@
|
|||
* Bubble Sort 01/11/2014 & 23/06/2016
|
||||
BUBBLE CSECT
|
||||
USING BUBBLE,R13,R12 establish base registers
|
||||
SAVEAREA B STM-SAVEAREA(R15) skip savearea
|
||||
DC 17F'0' my savearea
|
||||
STM STM R14,R12,12(R13) save calling context
|
||||
ST R13,4(R15) link mySA->prevSA
|
||||
ST R15,8(R13) link prevSA->mySA
|
||||
LR R13,R15 set mySA & set 4K addessability
|
||||
LA R12,2048(R13) .
|
||||
LA R12,2048(R12) set 8K addessability
|
||||
L RN,N n
|
||||
BCTR RN,0 n-1
|
||||
DO UNTIL=(LTR,RM,Z,RM) repeat ------------------------+
|
||||
LA RM,0 more=false |
|
||||
LA R1,A @a(i) |
|
||||
LA R2,4(R1) @a(i+1) |
|
||||
LA RI,1 i=1 |
|
||||
DO WHILE=(CR,RI,LE,RN) for i=1 to n-1 ------------+ |
|
||||
L R3,0(R1) a(i) | |
|
||||
IF C,R3,GT,0(R2) if a(i)>a(i+1) then ---+ | |
|
||||
L R9,0(R1) r9=a(i) | | |
|
||||
L R3,0(R2) r3=a(i+1) | | |
|
||||
ST R3,0(R1) a(i)=r3 | | |
|
||||
ST R9,0(R2) a(i+1)=r9 | | |
|
||||
LA RM,1 more=true | | |
|
||||
ENDIF , end if <---------------+ | |
|
||||
LA RI,1(RI) i=i+1 | |
|
||||
LA R1,4(R1) next a(i) | |
|
||||
LA R2,4(R2) next a(i+1) | |
|
||||
ENDDO , end for <------------------+ |
|
||||
ENDDO , until not more <---------------+
|
||||
LA R3,PG pgi=0
|
||||
LA RI,1 i=1
|
||||
DO WHILE=(C,RI,LE,N) do i=1 to n -------+
|
||||
LR R1,RI i |
|
||||
SLA R1,2 . |
|
||||
L R2,A-4(R1) a(i) |
|
||||
XDECO R2,XDEC edit a(i) |
|
||||
MVC 0(4,R3),XDEC+8 output a(i) |
|
||||
LA R3,4(R3) pgi=pgi+4 |
|
||||
LA RI,1(RI) i=i+1 |
|
||||
ENDDO , end do <-----------+
|
||||
XPRNT PG,L'PG print buffer
|
||||
L R13,4(0,R13) restore caller savearea
|
||||
LM R14,R12,12(R13) restore context
|
||||
XR R15,R15 set return code to 0
|
||||
BR R14 return to caller
|
||||
A DC F'4',F'65',F'2',F'-31',F'0',F'99',F'2',F'83',F'782',F'1'
|
||||
DC F'45',F'82',F'69',F'82',F'104',F'58',F'88',F'112',F'89',F'74'
|
||||
N DC A((N-A)/L'A) number of items of a *
|
||||
PG DC CL80' '
|
||||
XDEC DS CL12
|
||||
LTORG
|
||||
REGEQU
|
||||
RI EQU 6 i
|
||||
RN EQU 7 n-1
|
||||
RM EQU 8 more
|
||||
END BUBBLE
|
||||
Loading…
Add table
Add a link
Reference in a new issue