




























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!





























































































Foreword by Daniel Jebaraj
The Story behind the Succinctly Series of Books
Daniel Jebaraj, Vice President Syncfusion, Inc. taying on the cutting edge
Information is plentiful but harder to digest
The Succinctly series
The best authors, the best content
Free forever
Free? What is the catch?
Let us know what you think
Introduction
Assembly Language
Why Learn Assembly?
Intended Audience
Native Assembly Files in C++
Note: If you are using Visual C++ Express, download and install the latest Windows 7 SDK (version 7.1 or higher for .NET 4).
Figure 1
Figure 2
cout<<"Smallest is "<<FindSmallest(arr, 10)<<endl;
cin.get();
return 0;
}
; asmfunctions.asm
.xmm
.model flat, c
.data
.code
FindSmallest proc export
mov edx, dword ptr [esp+4] ; edx = *int mov ecx, dword ptr [esp+8] ; ecx = Count
mov eax, 7fffffffh ; eax will be our answer
cmp ecx, 0 ; Are there 0 items? jle Finished ; If so we're done
MainLoop:
cmp dword ptr [edx], eax ; Is *edx < eax? cmovl eax, dword ptr [edx] ; If so, eax = edx
add edx, 4 ; Move *edx to next int
dec ecx ; Decrement counter jnz MainLoop ; Loop if there's more
Finished:
ret ; Return with lowest in eax
FindSmallest endp
end
Additional Steps for x
Figure 4