Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- ;âûâîä òåêñòà â êîíñîëü
- mov ah, 9h
- mov dx, str1
- int 21h
- ;âûâîä òåêñòà â êîíñîëü
- mov ah,9h
- mov dx, str2
- int 21h
- ;ââîä ñòðîêè ïîëüçîâàòåëåì
- mov ah,0Ah
- mov dx, my_str
- int 21h
- ;ïåðåõîä íà íîâóþ ñòðîêó
- mov ah,9h
- mov dx, new_line
- int 21h
- ;ìåíÿåì ïåðâûé è ïîñëåäíèé ýëåìåíòû ñòðîêè
- mov bp, my_str+2 ; àäðåñ ïåðâîãî ýëåìåíòà ñòðîêè
- mov cl,[bp + 5] ; øåñòîé ýëåìåíò ñòðîêè
- mov ch, [bp+2] ; òðåòèé ýëåìåíò ñòðîêè
- xchg ch,cl ;ìåíÿåì ýëåìåíòû ìåñòàìè
- mov [bp+5],cl ;çàïèñûâàåì â ïàìÿòü èçìåíåííîå çíà÷åíèå
- mov [bp+ 2],ch ;çàïèñûâàåì â ïàìÿòü èçìåíåííîå çíà÷åíèå
- mov al,[bp + 6]
- mov ah, [bp + 1]
- sub al, ah
- mov dh, [bp + 7]
- sub dh, al
- mov [bp + 4], dh
- ;âûâîä ïðåîáðàçîâàííîé ñòðîêè â êîíñîëü
- mov ah,9h
- mov dx, bp
- int 21h
- ;îæèäàíèå íàæàòèÿ êëàâèøè
- mov ah, 8h
- int 21h
- ret
- str1 db "This program swaps six and third elements of the string and puts the difference of eighth with the difference of seven and second on fifth place ",$0d,$0a, "$"
- str2 db "Input string (max. 10 elements)", $0d, $0a, "$"
- my_str db 11,0,11 dup('$')
- new_line db $0d, $0A, "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement