Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01
- ;TITLE E:\projects\cpp\selectionsort\selectionsort\selectionsort\sort.cpp
- ;I DONT NEED (SUB)TITLES
- ;.686P
- .386P ;386P: kleinster 32-Bit Pentium: Instruction Set ist 8086, Registergröße ist 386
- ;.XMM ;XMM-Floating-Register werden nicht benötigt
- ;include listing.inc ;vorgefertigte Makros, werden ebenfalls nicht benötigt
- .model flat
- ;INCLUDELIB MSVCRTD
- ;INCLUDELIB OLDNAMES
- ;PUBLIC ?sort@@YAXQAH@Z ; sort
- ;EXTRN __RTC_Shutdown:PROC
- ;EXTRN __RTC_InitBase:PROC
- ; COMDAT rtc$TMZ
- ; File e:\projects\cpp\selectionsort\selectionsort\selectionsort\sort.cpp
- ;rtc$TMZ SEGMENT
- ;__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
- ;rtc$TMZ ENDS
- ; COMDAT rtc$IMZ
- ;rtc$IMZ SEGMENT
- ;__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
- ; Function compile flags: /Odtp /RTCsu /ZI
- ;rtc$IMZ ENDS
- ; COMDAT ?sort@@YAXAAY06H@Z
- _TEXT SEGMENT
- ;Konstanten / Adressen der Variablen
- ;_temp$ = -56 ; size = 4
- ;_i$ = -44 ; size = 4
- ;_min$ = -32 ; size = 4
- ;_cur$ = -20 ; size = 4
- ;_max$ = -8 ; size = 4 - wird mit Const_Max ersetzt
- Addr_Array$ = 8 ; Anfangsadresse des Arrays
- Const_Max$ = 40 ; Konstante für die Schleifen
- ?sort@@YAXQAH@Z PROC ; sort, COMDAT
- ;=================
- ;REGISTERS IN USE:
- ;=================
- ;_i$ = eax
- ;_min$ = edx
- ;_cur$ = ebx
- ;Adresse von _Array$ = esi
- ;temp1: edi
- ;temp2: ecx
- ;
- ; 5 : {
- push ebp
- mov ebp, esp
- ;sub esp, 252 ; 000000fcH
- ;push ebx
- ;push esi
- ;push edi
- ;lea edi, DWORD PTR [ebp-252]
- ;mov ecx, 63 ; 0000003fH
- ;mov eax, -858993460 ; ccccccccH
- ;rep stosd ;repeat 63x (ecx) store string double-word [ES:EDI] = EAX
- mov esi, Addr_Array$[ebp] ;Adresse von Array in esi, wird nur 1x beim Start ausgeführt
- ; 6 : int max=(sizeof(Array) / sizeof(Array[0]));
- ;mov DWORD PTR _max$[ebp], 7 ;7: Anzahl Elemente im Array
- ; 7 : int cur=0;
- ;mov DWORD PTR _cur$[ebp], 0
- xor ebx,ebx
- $LN6@sort:
- ; 8 : int min,i,temp;
- ; 9 :
- ; 10 : while(cur<max) //cur: äußeres Konstrukt
- ;mov eax, DWORD PTR _cur$[ebp] ;
- ;cmp eax, DWORD PTR _max$[ebp] ;cur<max
- cmp ebx,Const_Max$
- jge SHORT $LN7@sort ;LN7: Ende des Algorithmus
- ; 11 : {
- ; 12 : min=cur; //min: inneres Konstrukt
- ;mov eax, DWORD PTR _cur$[ebp] ;
- ;mov DWORD PTR _min$[ebp], eax ;min=cur
- mov edx,ebx
- ; 13 :
- ; 14 : for(i=cur+1; i < max; i++)
- ;mov eax, DWORD PTR _cur$[ebp] ;
- ;add eax, 1 ;i=cur+1
- ;mov DWORD PTR _i$[ebp], eax ;
- mov eax,ebx
- add eax,1
- jmp SHORT $LN4@sort
- $LN3@sort:
- ;mov eax, DWORD PTR _i$[ebp] ;
- ;add eax, 1 ;i++
- ;mov DWORD PTR _i$[ebp], eax ;
- add eax,1
- $LN4@sort:
- ;mov eax, DWORD PTR _i$[ebp] ;
- ;cmp eax, DWORD PTR _max$[ebp] ;i < max
- cmp eax,Const_Max$
- jge SHORT $LN2@sort
- ; 15 : {
- ; 16 : if(Array[i] < Array[min])
- ;mov eax, DWORD PTR _i$[ebp]
- ;mov ecx, DWORD PTR _Array$[ebp]
- ;mov edx, DWORD PTR _min$[ebp]
- ;mov esi, DWORD PTR _Array$[ebp]
- ;mov eax, DWORD PTR [ecx+eax*4]
- ;cmp eax, DWORD PTR [esi+edx*4]
- mov edi, [esi+eax*4] ;edi als temporäre Ablage
- cmp edi, [esi+edx*4]
- jge SHORT $LN1@sort
- ; 17 : {
- ; 18 : min=i;
- ;mov eax, DWORD PTR _i$[ebp] ;
- ;mov DWORD PTR _min$[ebp], eax ;min=i
- mov edx,eax
- $LN1@sort:
- ; 19 : }
- ; 20 : };
- jmp SHORT $LN3@sort
- $LN2@sort:
- ; 21 : temp = Array[min]; //vertausche die Array-Elemente
- ;mov eax, DWORD PTR _min$[ebp]
- ;mov ecx, DWORD PTR _Array$[ebp]
- ;mov edx, DWORD PTR [ecx+eax*4]
- ;mov DWORD PTR _temp$[ebp], edx
- mov edi,[esi+edx*4] ;temp1=Array[min] (ALT)
- ; 22 : Array[min]=Array[cur];
- ;mov eax, DWORD PTR _min$[ebp]
- ;mov ecx, DWORD PTR _Array$[ebp]
- ;mov edx, DWORD PTR _cur$[ebp]
- ;mov esi, DWORD PTR _Array$[ebp]
- ;mov edx, DWORD PTR [esi+edx*4]
- ;mov DWORD PTR [ecx+eax*4], edx
- mov ecx,[esi+ebx*4] ;temp2=Array[cur] (ALT)
- mov [esi+edx*4],ecx ;Array[min]=temp2 (ALT)
- ; 23 : Array[cur]=temp;
- ;mov eax, DWORD PTR _cur$[ebp]
- ;mov ecx, DWORD PTR _Array$[ebp]
- ;mov edx, DWORD PTR _temp$[ebp]
- ;mov DWORD PTR [ecx+eax*4], edx
- mov [esi+ebx*4],edi ;Array[cur]=temp1 (ALT)
- ;mov edi,[esi+edx*4] ;temp1=Array[min] (NEU)
- ;xchg [esi+ebx*4],edi ;vertausche temp1 und Array[cur] (NEU)
- ;mov [esi+edx*4],edi ;schreibe Array[cur] in Array[min] (NEU)
- ; 24 :
- ; 25 : cur=cur+1;
- ;mov eax, DWORD PTR _cur$[ebp]
- ;add eax, 1
- ;mov DWORD PTR _cur$[ebp], eax
- add ebx,1
- ; 26 : }
- jmp SHORT $LN6@sort
- $LN7@sort: ;LN7: Ende des Algorithmus
- ; 27 : }
- ;pop edi
- ;pop esi
- ;pop ebx
- mov esp, ebp
- pop ebp
- ret 0
- ?sort@@YAXQAH@Z ENDP ; sort
- _TEXT ENDS
- END
Advertisement
Add Comment
Please, Sign In to add comment