.
dup.
- . , , .
;-------------------------------------------------------------------------------------------------------------------------------------------
; 2×10
;
data segment
; arr
arr dw 438,4,76,87,34,67,234,90,48,0
dw 34,-15,2451,6125,864,92,238,4769,1237,6281
dw 10,59,251,125,64,2,8,49,37,81
data ends
stack1 segment stack
db 100h dup(?)
stack1 ends
code segment
assume cs:code,ds:data,ss:stack1
begin:
mov ax,data
mov ds,ax; ds data
;
mov ax,2; 0
mov cl,10*type arr;
mul cl; ax
mov bx,ax; bx ax, ax
;
mov ax,arr[bx]; ax
;
mov cx,10-1; 9
L1:
add bx,type arr; 2
cmp ax,arr[bx]; ax
jge no_new_max; ax , ,
mov ax,arr[bx]; ax
no_new_max:
loop L1; , ax
; 251
mov ah,4ch
int 21h;
code ends
end begin
;-------------------------------------------------------------------------------------------------------------------------------------------
;
data segment
array dw 10 dup (4,3,2,5,0)
n dw?
data ends
stack1 segment stack
db 100h dup(?)
stack1 ends
code segment
assume cs:code,ds:data,ss:stack1
begin:
mov ax,data
mov ds,ax
mov n,10
mov bx, offset array
mov cx, n
for_i:
dec cx
xor dx, dx
for_j:
cmp dx, cx
jae exit_for_j
jbe no_swap
mov ah, byte ptr bx[di]
mov byte ptr bx[di], al
mov byte ptr bx[si], ah
no_swap:
inc dx
jmp for_j
exit_for_j:
loop for_i
mov ah,4ch
int 21h
code ends
end begin