CSE3101 Assembly Language Programming Notes

Overview

Introduction
Common instructions
Floating point instructions
MMX instructions
Complete instruction set (NASM)

Examples - Hello World programs

MASM linked to Borland C or MINGW gcc library
MASM + Irvine library (from CDROM) Windows program
MASM + smallwin.inc (from Irvine CDROM) Windows program
MASM + kernel32.lib (no includes) Windows program
MASM MSDOS .com file (23 bytes)
MASM BIOS .com file (no OS needed to run)

NASM program linked to Borland, DJGPP or MINGW C library
NASM MDSOS .com file
YASM AMD64 linked to g++ under Linux

AS program linked to DJGPP or MINGW C library
AMD64 AS program linked to g++ under Linux

Borland/MARS C program using inline assembler. Output from bcc32 -S
DJGPP C program using inline assembler. Output from DJGPP gcc -S and MINGW gcc -S

Other examples

cpuid.asm to identify processor type
rdtsc.asm to count clock cycles
pi.c computes pi to n digits bcc32 -S and gcc -S output
bench.c and copy.asm benchmark array copy speed
portasm.c "semi-portable" inline assembly language in C
Examples from book
Some tiny programs (just for fun)

Software

Free C/C++ compilers: Borland MINGW DJGPP
NASM YASM

References

NASM/YASM documentation
AS documentation
Intel microprocessor history
Pentium 4 datasheets
IA-32 Architecture Optimization
Intel Pentium 4 Optimization Reference
AMD64 Application Programmers Manual (for programming olin.fit.edu)