Programming in Assembler for x64

In this section, we show examples of programs written purely in assembler or alongside other programming languages, including C++ and C#. We assume that the reader is familiar with the coursebook, instructions and directives used to write the assembler programs. We will describe using the integrated development environment (Visual Studio) and methods to assemble programs using the command line only. We will also show how to create static and dynamic libraries written in assembler for use in assembler or in other compilers.

Introduction to x64 Assembler programming in MASM - Microsoft Visual Studio Community Edition

In the following chapter, we explain how to write, assemble, link, and execute assembly-language programs for x64 processors. We assume that the reader is familiar with the most important processor instructions and MASM directives.

To write a program in assembler, it is convenient to use a Visual Studio IDE: either commercial or free (Community Edition). The following section covers installing Visual Studio Community Edition on Windows, along with necessary development packs.

Visual Studio Community, Professional, and Enterprise are suitable for this development. Visual Studio Code is not the case here.

The following sections present three main approaches in assembler development for Windows.

  • Pure assembler coding, so-called Standalone Assembly.
  • Integration of assembler and C++ native - unmanaged code.
  • Integration of assembler and C# and the .NET Framework - managed code.

Installing VS Community

Installation requires the following simple steps:

  1. Download the installer executable from: https://visualstudio.microsoft.com/free-developer-offers/ - Make sure to choose Community Edition (purple), not Code (blue)! as in figure 1.
  2. Run the installer; let it download and install.
  3. Configure components - a minimal set of development platforms for our laboratory exercises requires:
    1. full install of the C++ development platform in native code for Windows (remember to click additional components as in the figure 2),
    2. default install of the C# development platform in managed code for Windows.
Visual Studio downloads page. Options let you choose Visual Studio Community Edition (in purple colours) and Visual Studio Code (in blue).
Figure 1: Choose the correct version of Visual Studio
Visual Studio Installer, Workloads tab: the .NET desktop development and Desktop development with C++ workloads are ticked, and in the Installation details panel on the right all optional components of Desktop development with C++ are ticked; the selections are circled in red
Figure 2: Visual Studio Installer: workloads and optional components to select
en/multiasm/exercisesbook/pc.txt · Last modified: by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0