Assembler


- 11


prg27_136

//prg27_136 ( ) - . //: mas[n] - . //: mas[n] - n.


INTJYTE n: // mas[n]

INT_BYTE mas[n]; // (..-1)

INTJYTE ; TEMP: i=0; j=0: 1=0: =0; // i. j. 1. -

INT_WORD M=l // ,

// =1 _

M<N TO _ q9

1 :-1: :=

__ (Offffh) //Offffh - q2: i :-l: j:-r+l: k:=mas[l] q3: i=<j-l TO _ qq3

_ q4 // qq3: i:=i+l

mas[i]<K TO _ q3 q4: j:-j-l

j<1 TO _ q5

K<mas[j] TO _ q4

j>i TO _ q6

Iq2: ;1:-1: j:-r+l: k:-nas[l] movsi.L ;i(si):=L mov di . R incdi ;j(di):=R+l xor ax.ax mov al ,mas[si] mov k.al

q3: : 1-sj-l TO _ qq3 inc si ;i:=i+l cmp si.di :i=<j jleqq3

dec si : i=<j jmp q4 :_ 4// qq3: moval.k ;i:=i+l

cmpmas[si].al : mas[i]<K TO _ q3

jb q3

q4: decdi ;j:=j-l cmpdi.si :j>=i-l jb q5 mov al ,k : K<mas[j] TO _ q4

cmp al ,mas[di]

jb q4 q5: ; j>i TO _ q6 cmpdi.si :j=<i ??? J9 q6 movbx.L :// mas[l]:= mas[j] mov dl ,mas[bx] xchg mas[di].dl xchg mas[bx].dl jmpq7 :_ q7 q6: mov dl.masCsi] ; mas[i]<-> mas[j] xchg mas[di].dl xchg mas[si].dl jmpq3 ;_ q3 q7: ; r-j>j-l>M TO mov ax,

subax.di ;r-j->ax mov bx.di

subbx.l :j-l->bx cmpax.bx :r-j>j-l ??? jl q7_m4

cmpbx.M ;j-l>M ??? jleq7_m3 ;1, r-j>j-l>M - (j+l.r); r:=j-l; q2

mov ax.di inc ax push ax

(push mov r.di dec ::=j -1 q7_m4: ;r-j>M ??? cmp ax.M jg q7_m2 cmp bx. M

jleq8 ;4. j-l>M>r-j - r:=j-l: q2




- -  - -  - -