Advertisement
YauhenMardan

asm_9.3_r

May 20th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int n = 8;
  6.  
  7. int main() {
  8. char r1[n] = "1236321";
  9. char r2[n] = { 0 };
  10. __asm
  11. {
  12. mov ecx, n //ecx=n-1
  13. sub ecx, 1
  14. lea esi, r1 //esi=*r1
  15. add esi, ecx
  16. dec esi
  17. lea edi, r2 //edi=*r2
  18. std //<-
  19. r_beg : //reverse r1
  20. lodsb
  21. mov byte ptr[edi], al
  22. inc edi
  23. loop r_beg
  24.  
  25. cld //->
  26. mov ebx, 0
  27. mov ecx, n //ecx=n-1
  28. sub ecx, 1
  29. lea esi, r1//esi=*r1
  30. lea edi, r2//edi=*r2
  31. repe cmpsb //cmp
  32. jne N_EQL
  33. jmp EQL
  34. r2_end:
  35. }
  36. EQL:
  37. cout << "YES" << endl;
  38. goto NEXT;
  39. N_EQL:
  40. cout << "NO" << endl;
  41. NEXT:
  42. system("pause");
  43. return 0;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement