Assembly x64 Programming in easy steps shows how to write code to create your own computer programs. It contains separate chapters demonstrating how to store and manipulate data in 64-bit registers, how to control program flow, and how to create reusable blocks of code in program functions. It includes demonstrations of parallel processing with 128-bit Streaming SIMD Extensions (SSE) and 256-bit Advanced Vector Extensions (AVX).
Assembly x64 Programming in easy steps has an easy-to-follow style that will appeal to anyone who wants to begin programming in modern x64 Assembly language on Windows. The code in the listed steps within the book is color-coded, making it easier for beginners to grasp. There are complete step-by-step example programs that demonstrate each aspect of coding, together with screenshots that illustrate the actual output when each program is executed.
Includes free, downloadable source code to get you started straight away!
All compiled programming languages, such as C and C++, get translated into machine code that the computer’s central processing unit (CPU) can understand. The machine code is a set of instructions that the CPU can recognize and execute to perform operations on data. For example, a statement initializing three integer variables in a C++ program might look like this:
int a = 2, b = 8, c = a * b ;
The machine code generated by the C++ compiler for this statement looks like this:
These instructions are written in Assembly language. Assembly language instruction sets are built into all Intel and AMD CPUs. Programming directly in Assembly language allows the program to perform operations on the CPU at lightning fast speed. It is much faster than performing operations on data stored in the computer’s memory (RAM).
Each CPU has a several “registers” that can store data in binary format as a series of ones and zeros. In the machine code above, eax is a 32-bit register. That means it can store a combined total of 32 ones and zeros. Registers of this size can be used for x86 32-bit programming.
Programming for x64 uses 64-bit registers that can store a combined total of 64 ones and zeros. This means that the throughput on each clock cycle of the CPU is greater, so the operations are performed faster.
Modern CPUs support “Streaming SIMD Extensions” (SSE) that use 128-bit registers for greater throughput. Additionally, and importantly, they allow parallel processing with Single Instruction Multiple Data (SIMD). This means that the same operation can be performed simultaneously on multiple items of data.
Latterly, many CPUs also support “Advanced Vector Extensions” (AVX) that use 256-bit registers for even greater throughput, and these also allow parallel SIMD processing. There will likely even be 512-bit registers in the future with AVX-512, but presently there is no standard implementation of this.
In recent years, CPUs have reached some physical and power limitations, so CPU speeds have not increased noticeably in terms of Ghz. As computation requirements continue increasing, to process increasing amounts of data at ever greater speeds, Assembly language programming in machine code has gained in significance. Modern Assembly programming is being taught academically and has gained in popularity on the TIOBE index.
Microsoft’s Visual Studio IDE is a popular development tool for creating Assembly programs on the Windows operating system. The IDE includes the Microsoft Macro Assembler (MASM) and a Linker tool that can, together, produce Assembly programs. Visual Studio is, therefore, an ideal tool for demonstration of Assembly language.
About the author
Mike McGrath now lives in South-east Europe, on the sun-kissed shores of the Aegean Sea. Mike gained his extensive knowledge of computer languages while working as a developer contracting to companies around the world. His interests include coins of ancient Greece, dining-out with friends, and the ongoing evolution of the world wide web.
Table of Contents
Freely download the original source code for checking against your own work from our Downloads page