,

( ). , .

1 . .

ideal

p686

model flat

extrn ExitProcess:proc

dataseg

matr dd 1, 1, 1, 1

dd 2, 2, 2, 2

dd 3, 3, 3, 3

value dd 4

col dd 1

n dd 4;

m dd 3; ꠠ

codeseg

begin:

push offset matr [n] [m] [value] [col]; ebp 0

call mc_mul; eip 4

call ExitProcess; col 8

proc mc_mul; value 12

push ebp; m 16

mov ebp, esp; n 20

; matr 24

;for(i=0; i<m; i++)

; matr[i][col]*=value;

push eax ebx ecx esi

mov ecx, [ebp+16]

mov esi, [ebp+24]

mov ebx, [ebp+8]; col

lea esi, [esi+ebx*4]; &

mov ebx, [ebp+20]

shl ebx, 2;

mov edi, [ebp+12]

for1:

mov eax, [esi]

mul edi

mov [esi], eax

add esi, ebx

loop for1

pop esi ecx ebx eax ebp

Ret 5*4

Endp

end begin

2.

ideal

p686

model flat

extrn ExitProcess:proc

dataseg

s1 db 'a', 0

s2 db 'bb', 0

s3 db 'ccc', 0

s4 db 'dddd', 0

array dd s1, s2, s3, s4

n dd (n-array)/4


len dd 4 dup (?)
codeseg
begin:
push offset array [n] offset len
call TextLen
call ExitProcess;
proc TextLen;
push ebp
mov ebp, esp; TT+
;for (i=0; i<n; i++ ){ ebp 0
; for (j=0; array[i][j]; j++); eip 4
; len[i]=j; len 8
;} n 12
; array 16
pushad
mov ecx, [ebp+12]
mov eax, [ebp+16]
mov edi, [ebp+8]
fori:
sub edx, edx
lea ebx, [eax+ecx*4-4]
mov esi, [ebx]
forj:
mov bl, [esi+edx]
test bl, bl
je short breakj
inc edx
jmp forj
breakj:
mov [edi+ecx*4-4], edx
loop fori
popad
pop ebp
Ret 3*4
Endp
end begin
+ !
3. L v .
ideal
p686
model flat
extrn ExitProcess:proc
dataseg
s1 db 'a', 0
s2 db 'bb', 0
s3 db 'ccc', 0
s4 db 'dddd', 0
array dd s1, s2, s3, s4
n dd (n-array)/4
len dd 4 dup (?)
codeseg
begin:
push offset array [n] offset len
call TextLen
push offset array [n] offset len
call SortLen
call ExitProcess;
proc TextLen;
push ebp;
mov ebp, esp;
;for (i=0; i<n; i++ ){ ebp 0
; for (j=0; array[i][j]; j++); eip 4
; len[i]=j; len 8
;} n 12
; array 16
pushad
mov ecx, [ebp+12]
mov eax, [ebp+16]
mov edi, [ebp+8]


fori:
sub edx, edx
lea ebx, [eax+ecx*4-4]
mov esi, [ebx]
forj:
mov bl, [esi+edx]
test bl, bl
je short breakj
inc edx
jmp forj
breakj:
mov [edi+ecx*4-4], edx
loop fori
popad
pop ebp
Ret 3*4
Endp
proc SortLen
push ebp
mov ebp, esp
pushad
;for (i=1; i<n; i++){ ebp 0
; r=x[i]; eip 4
; for (j=i-1; j>=0; j--) array 8
; if (x[j]<r)x[j+1]=x[j]; else break; n 12
; x[j+1]=r; len 16
;}
mov eax, 1; i
mov ebx, [ebp+8]; array
mov edx, [ebp+16]; len
@@fori:
push ebp
mov esi, [ebx+eax*4]; r1
mov edi, [edx+eax*4]; r2
mov ecx, eax; j
@@forj:
dec ecx
js short @@breakj
cmp [edx+ecx*4], edi
jae short @@breakj
mov ebp, [edx+ecx*4]
mov [edx+ecx*4+4], ebp
mov ebp, [ebx+ecx*4]
mov [ebx+ecx*4+4], ebp
jmp @@forj
@@breakj:
mov [ebx+ecx*4+4], esi
mov [edx+ecx*4+4], edi
pop ebp
inc eax
cmp eax, [ebp+12]
jbe @@fori
popad
pop ebp
ret 12
endp
end begin
+ @@. vv v , . +𸪹 𸪹 vv .
, v. v , v.

T v v v v v, v v ,