Guest User

Untitled

a guest
Oct 2nd, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01
  2.  
  3.     ;TITLE  E:\projects\cpp\selectionsort\selectionsort\selectionsort\sort.cpp
  4.     ;I DONT NEED (SUB)TITLES
  5.     ;.686P         
  6.     .386P           ;386P: kleinster 32-Bit Pentium: Instruction Set ist 8086, Registergröße ist 386
  7.     ;.XMM           ;XMM-Floating-Register werden nicht benötigt
  8.     ;include listing.inc    ;vorgefertigte Makros, werden ebenfalls nicht benötigt
  9.     .model  flat
  10.  
  11. ;INCLUDELIB MSVCRTD
  12. ;INCLUDELIB OLDNAMES
  13.  
  14. ;PUBLIC ?sort@@YAXQAH@Z             ; sort
  15. ;EXTRN  __RTC_Shutdown:PROC
  16. ;EXTRN  __RTC_InitBase:PROC
  17. ;   COMDAT rtc$TMZ
  18. ; File e:\projects\cpp\selectionsort\selectionsort\selectionsort\sort.cpp
  19. ;rtc$TMZ    SEGMENT
  20. ;__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
  21. ;rtc$TMZ    ENDS
  22. ;   COMDAT rtc$IMZ
  23. ;rtc$IMZ    SEGMENT
  24. ;__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
  25. ; Function compile flags: /Odtp /RTCsu /ZI
  26. ;rtc$IMZ    ENDS
  27. ;   COMDAT ?sort@@YAXAAY06H@Z
  28. _TEXT   SEGMENT
  29. ;Konstanten / Adressen der Variablen
  30. ;_temp$ = -56                   ; size = 4
  31. ;_i$ = -44                      ; size = 4
  32. ;_min$ = -32                    ; size = 4
  33. ;_cur$ = -20                    ; size = 4
  34. ;_max$ = -8                     ; size = 4    -    wird mit Const_Max ersetzt
  35. Addr_Array$ = 8                 ; Anfangsadresse des Arrays
  36. Const_Max$ = 40             ; Konstante für die Schleifen
  37. ?sort@@YAXQAH@Z PROC            ; sort, COMDAT
  38. ;=================
  39. ;REGISTERS IN USE:
  40. ;=================
  41. ;_i$ = eax
  42. ;_min$ = edx
  43. ;_cur$ = ebx
  44. ;Adresse von _Array$ = esi
  45. ;temp1: edi
  46. ;temp2: ecx
  47. ;
  48. ; 5    : {
  49.  
  50.     push    ebp
  51.     mov ebp, esp
  52.     ;sub    esp, 252                ; 000000fcH
  53.     ;push   ebx
  54.     ;push   esi
  55.     ;push   edi
  56.     ;lea    edi, DWORD PTR [ebp-252]
  57.     ;mov    ecx, 63                 ; 0000003fH
  58.     ;mov    eax, -858993460             ; ccccccccH
  59.     ;rep stosd      ;repeat 63x (ecx) store string double-word [ES:EDI] = EAX
  60.    
  61.     mov esi, Addr_Array$[ebp]       ;Adresse von Array in esi, wird nur 1x beim Start ausgeführt
  62.  
  63. ; 6    :    int max=(sizeof(Array) / sizeof(Array[0]));
  64.  
  65.     ;mov    DWORD PTR _max$[ebp], 7     ;7: Anzahl Elemente im Array
  66.  
  67. ; 7    :    int cur=0;
  68.  
  69.     ;mov    DWORD PTR _cur$[ebp], 0
  70.     xor ebx,ebx
  71.  
  72. $LN6@sort:
  73.  
  74. ; 8    :    int min,i,temp;
  75. ; 9    :
  76. ; 10   :    while(cur<max)          //cur: äußeres Konstrukt
  77.  
  78.     ;mov    eax, DWORD PTR _cur$[ebp]   ;
  79.     ;cmp    eax, DWORD PTR _max$[ebp]   ;cur<max
  80.     cmp ebx,Const_Max$
  81.     jge SHORT $LN7@sort                 ;LN7: Ende des Algorithmus
  82.  
  83. ; 11   :    {
  84. ; 12   :        min=cur;                //min: inneres Konstrukt
  85.  
  86.     ;mov    eax, DWORD PTR _cur$[ebp]   ;
  87.     ;mov    DWORD PTR _min$[ebp], eax   ;min=cur
  88.     mov edx,ebx
  89. ; 13   :
  90. ; 14   :        for(i=cur+1; i < max; i++)
  91.  
  92.     ;mov    eax, DWORD PTR _cur$[ebp]   ;
  93.     ;add    eax, 1                      ;i=cur+1
  94.     ;mov    DWORD PTR _i$[ebp], eax     ;
  95.     mov eax,ebx
  96.     add eax,1
  97.     jmp SHORT $LN4@sort
  98. $LN3@sort:
  99.     ;mov    eax, DWORD PTR _i$[ebp]     ;
  100.     ;add    eax, 1                      ;i++
  101.     ;mov    DWORD PTR _i$[ebp], eax     ;
  102.     add eax,1
  103. $LN4@sort:
  104.     ;mov    eax, DWORD PTR _i$[ebp]     ;
  105.     ;cmp    eax, DWORD PTR _max$[ebp]   ;i < max
  106.     cmp eax,Const_Max$
  107.     jge SHORT $LN2@sort
  108.  
  109. ; 15   :        {
  110. ; 16   :            if(Array[i] < Array[min])
  111.  
  112.     ;mov    eax, DWORD PTR _i$[ebp]
  113.     ;mov    ecx, DWORD PTR _Array$[ebp]
  114.     ;mov    edx, DWORD PTR _min$[ebp]
  115.     ;mov    esi, DWORD PTR _Array$[ebp]
  116.     ;mov    eax, DWORD PTR [ecx+eax*4]
  117.     ;cmp    eax, DWORD PTR [esi+edx*4]
  118.    
  119.     mov edi, [esi+eax*4]        ;edi als temporäre Ablage
  120.     cmp edi, [esi+edx*4]
  121.    
  122.     jge SHORT $LN1@sort
  123.  
  124. ; 17   :            {
  125. ; 18   :                min=i;
  126.  
  127.     ;mov    eax, DWORD PTR _i$[ebp]     ;
  128.     ;mov    DWORD PTR _min$[ebp], eax   ;min=i
  129.     mov edx,eax
  130.    
  131. $LN1@sort:
  132.  
  133. ; 19   :            }
  134. ; 20   :        };
  135.  
  136.     jmp SHORT $LN3@sort
  137. $LN2@sort:
  138.  
  139. ; 21   :        temp = Array[min];          //vertausche die Array-Elemente
  140.  
  141.     ;mov    eax, DWORD PTR _min$[ebp]
  142.     ;mov    ecx, DWORD PTR _Array$[ebp]
  143.     ;mov    edx, DWORD PTR [ecx+eax*4]
  144.     ;mov    DWORD PTR _temp$[ebp], edx
  145.  
  146.     mov edi,[esi+edx*4]         ;temp1=Array[min] (ALT)
  147.  
  148. ; 22   :        Array[min]=Array[cur];
  149.  
  150.     ;mov    eax, DWORD PTR _min$[ebp]
  151.     ;mov    ecx, DWORD PTR _Array$[ebp]
  152.     ;mov    edx, DWORD PTR _cur$[ebp]
  153.     ;mov    esi, DWORD PTR _Array$[ebp]
  154.     ;mov    edx, DWORD PTR [esi+edx*4]
  155.     ;mov    DWORD PTR [ecx+eax*4], edx
  156.    
  157.     mov ecx,[esi+ebx*4]         ;temp2=Array[cur] (ALT)
  158.     mov [esi+edx*4],ecx         ;Array[min]=temp2 (ALT)
  159.  
  160. ; 23   :        Array[cur]=temp;
  161.  
  162.     ;mov    eax, DWORD PTR _cur$[ebp]
  163.     ;mov    ecx, DWORD PTR _Array$[ebp]
  164.     ;mov    edx, DWORD PTR _temp$[ebp]
  165.     ;mov    DWORD PTR [ecx+eax*4], edx
  166.    
  167.     mov [esi+ebx*4],edi         ;Array[cur]=temp1 (ALT)
  168.  
  169.     ;mov edi,[esi+edx*4]        ;temp1=Array[min] (NEU)
  170.     ;xchg [esi+ebx*4],edi       ;vertausche temp1 und Array[cur] (NEU)
  171.     ;mov [esi+edx*4],edi        ;schreibe Array[cur] in Array[min] (NEU)
  172.  
  173. ; 24   :
  174. ; 25   :        cur=cur+1;
  175.  
  176.     ;mov    eax, DWORD PTR _cur$[ebp]
  177.     ;add    eax, 1
  178.     ;mov    DWORD PTR _cur$[ebp], eax
  179.     add ebx,1
  180.  
  181. ; 26   :    }
  182.  
  183.     jmp SHORT $LN6@sort
  184. $LN7@sort:          ;LN7: Ende des Algorithmus
  185.  
  186. ; 27   : }
  187.  
  188.     ;pop    edi
  189.     ;pop    esi
  190.     ;pop    ebx
  191.     mov esp, ebp
  192.     pop ebp
  193.     ret 0
  194. ?sort@@YAXQAH@Z ENDP                    ; sort
  195. _TEXT   ENDS
  196. END
Advertisement
Add Comment
Please, Sign In to add comment