Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include io.asm ;подключение операций ввода-вывода
- stack segment stack
- dw 128 dup (?)
- stack ends
- data segment
- ; место для переменных и констант
- in1 db 'input 1st array','$'
- in2 db 'input 2nd array','$'
- arr1 dw 10 dup (0)
- arr2 dw 10 dup (0)
- yes db 'arrays are similar','$'
- no db 'arrays are not similar','$'
- data ends
- code segment 'code'
- assume ss:stack, ds:data, cs:code
- ; место для описания процедур
- INP PROC
- mov cx,10d
- mov si,0
- L: inint ax
- mov [bx][si],ax
- inc si
- inc si
- loop L
- ret
- INP endp
- SORT PROC
- mov cx,9d
- N: mov dx,cx
- mov si,cx
- sub si,9d
- neg si
- mov ax,[bx][si]
- mov di,si
- N1: inc si
- inc si
- cmp [bx][si],ax
- JLE N2
- mov di,si
- mov ax,[bx][si]
- N2: loop N1
- mov si,dx
- sub si,9d
- neg si
- cmp si,di
- JE N3
- ; xchg [bx][di],[bx][si]
- mov cx,[bx][di]
- xchg cx,[bx][si]
- xchg cx,[bx][di]
- ;
- N3: mov cx,dx
- dec cx
- cmp cx,0
- JE FSRT
- dec cx
- JMP N
- FSRT:ret
- SORT endp
- COMP PROC
- mov cx,10d
- mov si,0
- mov bx,arr1
- mov bp,arr2
- M: mov dx,[bx][si]
- cmp dx,[bp][si]
- JNE BF
- inc si
- inc si
- loop M
- mov dl,yes
- outstr
- newline
- JMP F
- loop M
- BF: mov dl,no
- outstr
- newline
- F: ret
- COMP endp
- start:
- mov ax,data
- mov ds,ax
- ; команды программы должны располагаться здесь
- lea dx,in1
- outstr
- newline
- lea bx,arr1
- call INP
- call SORT
- lea dx,in2
- outstr
- newline
- lea bx,arr2
- call INP
- call SORT
- call COMP
- finish
- code ends
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement