kur sheit ir kljuuda (ja ir…)
APAR CSECT
using *,15
SAVE (14,12),,*
st 13,savearea+4 save link to the old savearea (backward)
lr 14,13 address of the old save area
cnop 0,4
bal 13,codestrt
drop 15
using *,13
savearea dc 18F'0'
codestrt equ *
st 13,8(14) set link to the new save area (forward)
* here comes your code
* register 1 contains address of the address list of parameters
LM 3,4,0(1) 3=A(arr),4=L
LTR 4,4 vai kautkas tur ir?
BC 12,schluss
LA 7,4 j=1
LR 5,4 garumu pareizinam ar sizeof(int)
M 4,=F'4' skat. iepr.
forstrt EQU *
LR 4,7 4reg samaitaats tagad tur buus i
S 4,=F'4' i=j-1
L 6,0(3,7) ieksh r6 = k
LA 7,4(7) j++
ciklis EQU *
LTR 4,4 ja i ir < 0
BC 6,eocikl ejam aaraa no ciklis eku kljuuda!!!
L 9,0(3,4) r9 = arr i
CR 6,9 k<arr i ?
BC 12,else
ST 9,4(3,4) arr i+1 = arr i
S 4,=F'4' i--
LTR 4,4
BC 10,ciklis
ST 6,0(3) arr 0 = k
B ciklis
else EQU *
ST 6,4(3,4) arr i+1 = k
LA 4,0
S 4,=F'1'
B ciklis
eocikl EQU *
CR 7,5 j=l?
BNE forstrt nav? tad turpinam ciklu
* here ends your code
schluss l 13,4(13) get pointer to the old save area
RETURN (14,12),RC=(15)
*
* here start your data
VARSTART equ *
VAREND EQU *
END