Link To Content
The tutorial has extensive coverage of interfacing assembly and C code and so might be of interest to C programmers who want to learn about how C works under the hood. All the examples use the free NASM (Netwide) assembler. The tutorial only covers programming under 32-bit protected mode and requires a 32-bit protected mode compiler.
I have example code files for: DJGPP, Borland, Microsoft, Open Watcom and Linux C compilers. The examples in the text of the tutorial are for DJGPP only, but how to interface with the other compilers is discussed as well. The example files also include macros that allow easy input/output and debugging (register dumps, memory dumps, coprocessor dumps and stack dumps). If you plan on running the examples inthe tutorial, you must download the appropriate example code file. It contains support files used by the examples in the tutorial (such as asm_io.inc).
Table of Contents
1. Introduction
2. Basic Assembly Language
3. Bit Operations
4. Subprograms
5. Arrays
6. Floating Point
7. Structures and C++
The purpose of this book is to give the reader a better understanding of how computers really work at a lower level than in programming languages like Pascal. By gaining a deeper understanding of how computers work, the reader can often be much more productive developing software in higher level languages such as C and C++. Learning to program in assembly language is an excellent way to achieve this goal. Other PC assembly language books still teach how to program the 8086 processor that the original PC used in
1981! The 8086 processor only supported real mode. In this mode, any program may address any memory or device in the computer. This mode is not suitable for a secure, multitasking operating system. This book instead discusses how to program the 80386 and later processors in protected mode
(the mode that Windows and Linux runs in). This mode supports the features that modern operating systems expect, such as virtual memory and memory protection. There are several reasons to use protected mode:
1. It is easier to program in protected mode than in the 8086 real mode that other books use.
2. All modern PC operating systems run in protected mode.
3. There is free software available that runs in this mode.
The lack of textbooks for protected mode PC assembly programming is the main reason that the author wrote this book.
As alluded to above, this text makes use of Free/Open Source software: namely, the NASM assembler and the DJGPP C/C++ compiler. Both of these are available to download from the Internet. The text also discusses how to use NASM assembly code under the Linux operating system and with Borland’s and Microsoft’s C/C++ compilers under Windows. Examples for all of these platforms can be found on my web site: http://www.drpaulcarter.com/pcasm. You must download the example code if you wish to assemble and run many of the examples in this tutorial.
Be aware that this text does not attempt to cover every aspect of assembly programming. The author has tried to cover the most important topics that all programmers should be acquainted with.
The tutorial has extensive coverage of interfacing assembly and C code and so might be of interest to C programmers who want to learn about how C works under the hood. All the examples use the free NASM (Netwide) assembler. The tutorial only covers programming under 32-bit protected mode and requires a 32-bit protected mode compiler.
I have example code files for: DJGPP, Borland, Microsoft, Open Watcom and Linux C compilers. The examples in the text of the tutorial are for DJGPP only, but how to interface with the other compilers is discussed as well. The example files also include macros that allow easy input/output and debugging (register dumps, memory dumps, coprocessor dumps and stack dumps). If you plan on running the examples inthe tutorial, you must download the appropriate example code file. It contains support files used by the examples in the tutorial (such as asm_io.inc).
Table of Contents
1. Introduction
2. Basic Assembly Language
3. Bit Operations
4. Subprograms
5. Arrays
6. Floating Point
7. Structures and C++
The purpose of this book is to give the reader a better understanding of how computers really work at a lower level than in programming languages like Pascal. By gaining a deeper understanding of how computers work, the reader can often be much more productive developing software in higher level languages such as C and C++. Learning to program in assembly language is an excellent way to achieve this goal. Other PC assembly language books still teach how to program the 8086 processor that the original PC used in
1981! The 8086 processor only supported real mode. In this mode, any program may address any memory or device in the computer. This mode is not suitable for a secure, multitasking operating system. This book instead discusses how to program the 80386 and later processors in protected mode
(the mode that Windows and Linux runs in). This mode supports the features that modern operating systems expect, such as virtual memory and memory protection. There are several reasons to use protected mode:
1. It is easier to program in protected mode than in the 8086 real mode that other books use.
2. All modern PC operating systems run in protected mode.
3. There is free software available that runs in this mode.
The lack of textbooks for protected mode PC assembly programming is the main reason that the author wrote this book.
As alluded to above, this text makes use of Free/Open Source software: namely, the NASM assembler and the DJGPP C/C++ compiler. Both of these are available to download from the Internet. The text also discusses how to use NASM assembly code under the Linux operating system and with Borland’s and Microsoft’s C/C++ compilers under Windows. Examples for all of these platforms can be found on my web site: http://www.drpaulcarter.com/pcasm. You must download the example code if you wish to assemble and run many of the examples in this tutorial.
Be aware that this text does not attempt to cover every aspect of assembly programming. The author has tried to cover the most important topics that all programmers should be acquainted with.