Advertisement
Guest User

Untitled

a guest
May 11th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ;;;;3_2
  2.     .model  small
  3.     .stack  100h
  4.     .386
  5.     .data
  6. a   db  3, 1, 1, 1
  7.     db  2, 5, 2, 2
  8.     db  2, 2, 4, 2
  9.     db  1, 1, 1, 7
  10.  
  11.     .code
  12. start:
  13.  
  14.     mov ax, @data
  15.     mov ds, ax
  16.     xor ax, ax
  17.  
  18.     mov di, 0
  19.     xor bx, bx
  20.     mov cx, 4
  21.  
  22. firststr:
  23.     mov al, byte ptr a[bx][di]
  24.     rol eax, 8
  25.     add bx, 1
  26.     loop    firststr
  27.     jmp pusd
  28.  
  29. secondstr:
  30.     mov al, byte ptr a[bx][di]
  31.     rol eax, 8
  32.     add bx, 1
  33.     loop    secondstr
  34.     jmp pusd
  35.  
  36. thirdstr:
  37.     mov al, byte ptr a[bx][di]
  38.     rol eax, 8
  39.     add bx, 1
  40.     loop    thirdstr
  41.     jmp pusd
  42.  
  43. fourthstr:
  44.     mov al, byte ptr a[bx][di]
  45.     rol eax, 8
  46.     add bx, 1
  47.     loop    fourthstr
  48.  
  49. pusd:
  50.     rol eax, 24
  51.     push    ax
  52.     ror eax, 16
  53.     push    ax
  54.     xor eax, eax
  55.     xor bx, bx
  56.     mov cx, 4
  57.     add di, 4
  58.     add dx, 1
  59.     cmp dx, 1
  60.     je  secondstr
  61.     cmp dx, 2
  62.     je  thirdstr
  63.     cmp dx, 3
  64.     je  fourthstr
  65.     xor bx, bx
  66. sort:
  67.     pop ax
  68.     rol eax, 16
  69.     pop ax
  70.     cmp bx, 0
  71.     je  fourth
  72.     cmp bx, 1
  73.     je  third
  74.     cmp bx, 2
  75.     je  second
  76.     cmp bx, 3
  77.     je  first
  78.  
  79. fourth:
  80.     mov ebp, eax
  81.     xor eax, eax
  82.     xor ebx, ebx
  83.     add bx, 1
  84.     jmp sort
  85.  
  86. third: 
  87.     mov edi, eax
  88.     add bx, 1
  89.     jmp sort
  90.  
  91. second:
  92.     mov esi, eax
  93.     add bx, 1
  94.     jmp sort
  95.    
  96. first:
  97.     mov edx, eax
  98.     xor eax, eax
  99.     xor bx, bx
  100. ;   xor edx, edx
  101.     xor ecx, ecx
  102.    
  103.     mov eax, edx
  104.     push    ax
  105.     ror eax, 16
  106.     push    ax
  107.     rol eax, 16
  108.  
  109.     mov eax, esi
  110.     push    ax
  111.     ror eax, 16
  112.     push    ax
  113.     rol eax, 16
  114.  
  115.     mov eax, edi
  116.     push    ax
  117.     ror eax, 16
  118.     push    ax
  119.     rol eax, 16
  120.  
  121.     mov eax, ebp
  122.     push    ax
  123.     ror eax, 16
  124.     push    ax
  125.     rol eax, 16     ;matrica v stacke
  126.  
  127. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  128.  
  129.     mov eax, edx
  130.     push    ax
  131.     ror eax, 16
  132.     push    ax
  133.     rol eax, 16     ;pervuy
  134.  
  135.  
  136.     mov eax, ebp
  137.     push    ax
  138.     ror eax, 16
  139.     push    ax
  140.     rol eax, 16     ;chetvertay
  141.  
  142.        
  143.     mov eax, esi
  144.     push    ax
  145.     ror eax, 16
  146.     push    ax
  147.     rol eax, 16     ;vtoru
  148.    
  149.     mov eax, edi
  150.     push    ax
  151.     ror eax, 16
  152.     push    ax
  153.     rol eax, 16     ;tretuy
  154.  
  155.  
  156. ;;;;;;;;sravnenye
  157.  
  158.     xor eax, eax
  159.     xor ebx, ebx
  160.     xor ecx, ecx
  161. ;   xor edx, edx
  162. ;   xor esi, esi
  163. ;   xor edi, edi
  164. ;   xor ebp, ebp
  165.  
  166.     pop ax
  167.     rol ax, 8
  168.     ror eax, 16
  169.     pop ax
  170.     and ax, 0000000011111111b
  171.     ror eax, 16
  172.     mov ecx, eax
  173.     xor eax, eax
  174.  
  175.     pop ax
  176.     and ax, 1111111100000000b
  177.     rol eax, 8
  178.     pop ax
  179.     cmp eax, ecx
  180.     je  spawn
  181.     jmp next
  182. spawn:
  183.     add bx, 1
  184. next:
  185.     xor eax, eax
  186.     xor ecx, ecx
  187.     pop ax
  188.     rol ax, 8
  189.     ror eax, 16
  190.     pop ax
  191.     and     ax, 1111111100000000b
  192.     ror ax, 8
  193.     rol eax, 16
  194.     mov ecx, eax
  195.     xor eax, eax
  196.     pop ax
  197.     and ax, 0000000011111111b
  198.     rol eax, 16
  199.     pop ax
  200.     cmp eax, ecx
  201.     je  swap2
  202.     jmp finish
  203. swap2:
  204.     add bx, 2
  205. finish:
  206.     cmp bx, 1
  207.     je  ret23
  208.     cmp bx, 2
  209.     je  ret14
  210.     cmp bx, 3
  211.     je  ret2314
  212.     jmp funish
  213.  
  214.  
  215. ret23:
  216.     xchg    esi, edi
  217.     jmp funish
  218. ret14:
  219.     xchg    edx, ebp
  220.     jmp funish
  221. ret2314:
  222.     xchg    esi, edi
  223.     xchg    edx, ebp
  224.    
  225. funish:
  226.    
  227.    
  228.  
  229.  
  230.    
  231.    
  232.    
  233.    
  234.     mov ax, 4c00h
  235.     int 21h
  236.     end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement