Advertisement
venik2405

lab2_ass

Mar 15th, 2021
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. org 100h
  2.  
  3. ;âûâîä òåêñòà â êîíñîëü
  4. mov ah, 9h
  5. mov dx, str1
  6. int 21h
  7.  
  8. ;âûâîä òåêñòà â êîíñîëü
  9. mov ah,9h
  10. mov dx, str2
  11. int 21h
  12.  
  13. ;ââîä ñòðîêè ïîëüçîâàòåëåì
  14. mov ah,0Ah
  15. mov dx, my_str
  16. int 21h
  17.  
  18. ;ïåðåõîä íà íîâóþ ñòðîêó
  19. mov ah,9h
  20. mov dx, new_line
  21. int 21h
  22.  
  23. ;ìåíÿåì ïåðâûé è ïîñëåäíèé ýëåìåíòû ñòðîêè
  24. mov bp, my_str+2 ; àäðåñ ïåðâîãî ýëåìåíòà ñòðîêè
  25. mov cl,[bp + 5] ; øåñòîé ýëåìåíò ñòðîêè
  26. mov ch, [bp+2] ; òðåòèé ýëåìåíò ñòðîêè
  27. xchg ch,cl ;ìåíÿåì ýëåìåíòû ìåñòàìè
  28. mov [bp+5],cl ;çàïèñûâàåì â ïàìÿòü èçìåíåííîå çíà÷åíèå
  29. mov [bp+ 2],ch ;çàïèñûâàåì â ïàìÿòü èçìåíåííîå çíà÷åíèå
  30.  
  31. mov al,[bp + 6]
  32. mov ah, [bp + 1]
  33. sub al, ah
  34. mov dh, [bp + 7]
  35. sub dh, al
  36. mov [bp + 4], dh
  37.  
  38.  
  39. ;âûâîä ïðåîáðàçîâàííîé ñòðîêè â êîíñîëü
  40. mov ah,9h
  41. mov dx, bp
  42. int 21h
  43.  
  44. ;îæèäàíèå íàæàòèÿ êëàâèøè
  45. mov ah, 8h
  46. int 21h
  47.  
  48. ret
  49.  
  50. 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, "$"
  51. str2 db "Input string (max. 10 elements)", $0d, $0a, "$"
  52. my_str db 11,0,11 dup('$')
  53. new_line db $0d, $0A, "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement