TOC PREV NEXT INDEX

Put your logo here!


The Art of Assembly Language


(Full Contents)



The Published Edition is now Available!

The Art of Assembly Language is now available from No Starch Press (http://www.nostarch.com) The professionally edited edition is better organized and much easier to read than ever before. The published edition contains a CD-ROM with HLA, example code, additional documentation, and lots of other extras. For those who prefer the Art of Assembly in hard copy form, your ship has come in! (note that the unedited version of AoA will remain available on Webster in electronic form for those who prefer to read the text on-line.)


1.1 Foreword to the HLA Version of "The Art of Assembly..."

1.2 Intended Audience

1.3 Teaching From This Text

1.4 Copyright Notice

1.5 How to Get a Hard Copy of This Text

1.6 Obtaining Program Source Listings and Other Materials in This Text

1.7 Where to Get Help

1.8 Other Materials You Will Need (Windows Version)

1.9 Other Materials You Will Need (Linux Version)

2.1 Chapter Overview

2.2 Installing the HLA Distribution Package

2.2.1 Installation Under Windows
2.2.2 Installation Under Linux
2.2.3 Installing "Art of Assembly" Related Files

2.3 The Anatomy of an HLA Program

2.4 Some Basic HLA Data Declarations

2.5 Boolean Values

2.6 Character Values

2.7 An Introduction to the Intel 80x86 CPU Family

2.8 Some Basic Machine Instructions

2.9 Some Basic HLA Control Structures

2.9.1 Boolean Expressions in HLA Statements
2.9.2 The HLA IF..THEN..ELSEIF..ELSE..ENDIF Statement
2.9.3 The WHILE..ENDWHILE Statement
2.9.4 The FOR..ENDFOR Statement
2.9.5 The REPEAT..UNTIL Statement
2.9.6 The BREAK and BREAKIF Statements
2.9.7 The FOREVER..ENDFOR Statement
2.9.8 The TRY..EXCEPTION..ENDTRY Statement

2.10 Introduction to the HLA Standard Library

2.10.1 Predefined Constants in the STDIO Module
2.10.2 Standard In and Standard Out
2.10.3 The stdout.newln Routine
2.10.4 The stdout.putiX Routines
2.10.5 The stdout.putiXSize Routines
2.10.6 The stdout.put Routine
2.10.7 The stdin.getc Routine.
2.10.8 The stdin.getiX Routines
2.10.9 The stdin.readLn and stdin.flushInput Routines
2.10.10 The stdin.get Macro

2.11 Putting It All Together

2.12 Sample Programs

2.12.1 Powers of Two Table Generation
2.12.2 Checkerboard Program
2.12.3 Fibonacci Number Generation

3.1 Chapter Overview

3.2 Numbering Systems

3.2.1 A Review of the Decimal System
3.2.2 The Binary Numbering System
3.2.3 Binary Formats

3.3 Data Organization

3.3.1 Bits
3.3.2 Nibbles
3.3.3 Bytes
3.3.4 Words
3.3.5 Double Words

3.4 The Hexadecimal Numbering System

3.5 Arithmetic Operations on Binary and Hexadecimal Numbers

3.6 A Note About Numbers vs. Representation

3.7 Logical Operations on Bits

3.8 Logical Operations on Binary Numbers and Bit Strings

3.9 Signed and Unsigned Numbers

3.10 Sign Extension, Zero Extension, Contraction, and Saturation

3.11 Shifts and Rotates

3.12 Bit Fields and Packed Data

3.13 Putting It All Together

4.1 Chapter Overview

4.2 An Introduction to Floating Point Arithmetic

4.2.1 IEEE Floating Point Formats
4.2.2 HLA Support for Floating Point Values

4.3 Binary Coded Decimal (BCD) Representation

4.4 Characters

4.4.1 The ASCII Character Encoding
4.4.2 HLA Support for ASCII Characters
4.4.3 The ASCII Character Set

4.5 The UNICODE Character Set

4.6 Other Data Representations

4.6.1 Representing Colors on a Video Display
4.6.2 Representing Audio Information
4.6.3 Representing Musical Information
4.6.4 Representing Video Information
4.6.5 Where to Get More Information About Data Types

4.7 Putting It All Together


Volume Two:


System Organization

1.1 Chapter Overview

1.2 The Basic System Components

1.2.1 The System Bus
1.2.1.1 The Data Bus
1.2.1.2 The Address Bus
1.2.1.3 The Control Bus
1.2.2 The Memory Subsystem
1.2.3 The I/O Subsystem

1.3 HLA Support for Data Alignment

1.4 System Timing

1.4.1 The System Clock
1.4.2 Memory Access and the System Clock
1.4.3 Wait States
1.4.4 Cache Memory

1.5 Putting It All Together

Memory Access and Organization

2.1 Chapter Overview

2.2 The 80x86 Addressing Modes

2.2.1 80x86 Register Addressing Modes
2.2.2 80x86 32-bit Memory Addressing Modes
2.2.2.1 The Displacement Only Addressing Mode
2.2.2.2 The Register Indirect Addressing Modes
2.2.2.3 Indexed Addressing Modes
2.2.2.4 Variations on the Indexed Addressing Mode
2.2.2.5 Scaled Indexed Addressing Modes
2.2.2.6 Addressing Mode Wrap-up

2.3 Run-Time Memory Organization

2.3.1 The Code Section
2.3.2 The Static Sections
2.3.3 The Read-Only Data Section
2.3.4 The Storage Section
2.3.5 The @NOSTORAGE Attribute
2.3.6 The Var Section
2.3.7 Organization of Declaration Sections Within Your Programs

2.4 Address Expressions

2.5 Type Coercion

2.6 Register Type Coercion

2.7 The Stack Segment and the Push and Pop Instructions

2.7.1 The Basic PUSH Instruction
2.7.2 The Basic POP Instruction
2.7.3 Preserving Registers With the PUSH and POP Instructions
2.7.4 The Stack is a LIFO Data Structure
2.7.5 Other PUSH and POP Instructions
2.7.6 Removing Data From the Stack Without Popping It
2.7.7 Accessing Data You've Pushed on the Stack Without Popping It

2.8 Dynamic Memory Allocation and the Heap Segment

2.9 The INC and DEC Instructions

2.10 Obtaining the Address of a Memory Object

2.11 Bonus Section: The HLA Standard Library CONSOLE Module

2.11.1 Clearing the Screen
2.11.2 Positioning the Cursor
2.11.3 Locating the Cursor
2.11.4 Text Attributes
2.11.5 Filling a Rectangular Section of the Screen
2.11.6 Console Direct String Output
2.11.7 Other Console Module Routines

2.12 Putting It All Together

Digital Design

3.1 Boolean Algebra

3.2 Boolean Functions and Truth Tables

3.3 Algebraic Manipulation of Boolean Expressions

3.4 Canonical Forms

3.5 Simplification of Boolean Functions

3.6 What Does This Have To Do With Computers, Anyway?

3.6.1 Correspondence Between Electronic Circuits and Boolean Functions
3.6.2 Combinatorial Circuits
3.6.3 Sequential and Clocked Logic

3.7 Okay, What Does It Have To Do With Programming, Then?

3.8 Putting It All Together

CPU Architecture

4.1 Chapter Overview

4.2 The History of the 80x86 CPU Family

4.3 A History of Software Development for the x86

4.4 Basic CPU Design

4.5 Decoding and Executing Instructions: Random Logic Versus Microcode

4.6 RISC vs. CISC vs. VLIW

4.7 Instruction Execution, Step-By-Step

4.8 Parallelism - the Key to Faster Processors

4.8.1 The Prefetch Queue - Using Unused Bus Cycles
4.8.2 Pipelining - Overlapping the Execution of Multiple Instructions
4.8.2.1 A Typical Pipeline
4.8.2.2 Stalls in a Pipeline
4.8.3 Instruction Caches - Providing Multiple Paths to Memory
4.8.4 Hazards
4.8.5 Superscalar Operation- Executing Instructions in Parallel
4.8.6 Out of Order Execution
4.8.7 Register Renaming
4.8.8 Very Long Instruction Word Architecture (VLIW)
4.8.9 Parallel Processing
4.8.10 Multiprocessing

4.9 Putting It All Together

Instruction Set Architecture

5.1 Chapter Overview

5.2 The Importance of the Design of the Instruction Set

5.3 Basic Instruction Design Goals

5.3.1 Addressing Modes on the Y86
5.3.2 Encoding Y86 Instructions
5.3.3 Hand Encoding Instructions
5.3.4 Using an Assembler to Encode Instructions
5.3.5 Extending the Y86 Instruction Set

5.4 Encoding 80x86 Instructions

5.4.1 Encoding Instruction Operands
5.4.2 Encoding the ADD Instruction: Some Examples
5.4.3 Encoding Immediate Operands
5.4.4 Encoding Eight, Sixteen, and Thirty-Two Bit Operands
5.4.5 Alternate Encodings for Instructions

5.5 Putting It All Together

Memory Architecture

6.1 Chapter Overview

6.2 The Memory Hierarchy

6.3 How the Memory Hierarchy Operates

6.4 Relative Performance of Memory Subsystems

6.5 Cache Architecture

6.6 Virtual Memory, Protection, and Paging

6.7 Thrashing

6.8 NUMA and Peripheral Devices

6.9 Segmentation

6.10 Segments and HLA

6.10.1 Renaming Segments Under Windows

6.11 User Defined Segments in HLA (Windows Only)

6.12 Controlling the Placement and Attributes of Segments in Memory (Windows Only)

6.13 Putting it All Together

The I/O Subsystem

7.1 Chapter Overview

7.2 Connecting a CPU to the Outside World

7.3 Read-Only, Write-Only, Read/Write, and Dual I/O Ports

7.4 I/O (Input/Output) Mechanisms

7.4.1 Memory Mapped Input/Output
7.4.2 I/O Mapped Input/Output
7.4.3 Direct Memory Access

7.5 I/O Speed Hierarchy

7.6 System Busses and Data Transfer Rates

7.7 The AGP Bus

7.8 Handshaking

7.9 Time-outs on an I/O Port

7.10 Interrupts and Polled I/O

7.11 Using a Circular Queue to Buffer Input Data from an ISR

7.12 Using a Circular Queue to Buffer Output Data for an ISR

7.13 I/O and the Cache

7.14 Protected Mode Operation

7.15 Device Drivers

7.16 Putting It All Together


Volume Three


Constants, Variables, and Data Types

1.1 Chapter Overview

1.2 Some Additional Instructions: INTMUL, BOUND, INTO

1.3 The QWORD and TBYTE Data Types

1.4 HLA Constant and Value Declarations

1.4.1 Constant Types
1.4.2 String and Character Literal Constants
1.4.3 String and Text Constants in the CONST Section
1.4.4 Constant Expressions
1.4.5 Multiple CONST Sections and Their Order in an HLA Program
1.4.6 The HLA VAL Section
1.4.7 Modifying VAL Objects at Arbitrary Points in Your Programs

1.5 The HLA TYPE Section

1.6 ENUM and HLA Enumerated Data Types

1.7 Pointer Data Types

1.7.1 Using Pointers in Assembly Language
1.7.2 Declaring Pointers in HLA
1.7.3 Pointer Constants and Pointer Constant Expressions
1.7.4 Pointer Variables and Dynamic Memory Allocation
1.7.5 Common Pointer Problems

1.8 Putting It All Together

Character Strings

2.1 Chapter Overview

2.2 Composite Data Types

2.3 Character Strings

2.4 HLA Strings

2.5 Accessing the Characters Within a String

2.6 The HLA String Module and Other String-Related Routines

2.7 In-Memory Conversions

2.8 Putting It All Together

Characters and Character Sets

3.1 Chapter Overview

3.2 The HLA Standard Library CHARS.HHF Module

3.3 Character Sets

3.4 Character Set Implementation in HLA

3.5 HLA Character Set Constants and Character Set Expressions

3.6 The IN Operator in HLA HLL Boolean Expressions

3.7 Character Set Support in the HLA Standard Library

3.8 Using Character Sets in Your HLA Programs

3.9 Low-level Implementation of Set Operations

3.9.1 Character Set Functions That Build Sets
3.9.2 Traditional Set Operations
3.9.3 Testing Character Sets

3.10 Putting It All Together

Arrays

4.1 Chapter Overview

4.2 Arrays

4.3 Declaring Arrays in Your HLA Programs

4.4 HLA Array Constants

4.5 Accessing Elements of a Single Dimension Array

4.5.1 Sorting an Array of Values

4.6 Multidimensional Arrays

4.6.1 Row Major Ordering
4.6.2 Column Major Ordering

4.7 Allocating Storage for Multidimensional Arrays

4.8 Accessing Multidimensional Array Elements in Assembly Language

4.9 Large Arrays and MASM

4.10 Dynamic Arrays in Assembly Language

4.11 HLA Standard Library Array Support

4.12 Putting It All Together

Records, Unions, and Namespaces

5.1 Chapter Overview

5.2 Records

5.3 Record Constants

5.4 Arrays of Records

5.5 Arrays/Records as Record Fields

5.6 Controlling Field Offsets Within a Record

5.7 Aligning Fields Within a Record

5.8 Pointers to Records

5.9 Unions

5.10 Anonymous Unions

5.11 Variant Types

5.12 Namespaces

5.13 Putting It All Together

Dates and Times

6.1 Chapter Overview

6.2 Dates

6.3 A Brief History of the Calendar

6.4 HLA Date Functions

6.4.1 date.IsValid and date.validate
6.4.2 Checking for Leap Years
6.4.3 Obtaining the System Date
6.4.4 Date to String Conversions and Date Output
6.4.5 date.unpack and data.pack
6.4.6 date.Julian, date.fromJulian
6.4.7 date.datePlusDays, date.datePlusMonths, and date.daysBetween
6.4.8 date.dayNumber, date.daysLeft, and date.dayOfWeek

6.5 Times

6.5.1 time.curTime
6.5.2 time.hmsToSecs and time.secstoHMS
6.5.3 Time Input/Output

6.6 Putting It All Together

Files

7.1 Chapter Overview

7.2 File Organization

7.2.1 Files as Lists of Records
7.2.2 Binary vs. Text Files

7.3 Sequential Files

7.4 Random Access Files

7.5 ISAM (Indexed Sequential Access Method) Files

7.6 Truncating a File

7.7 File Utility Routines

7.7.1 Copying, Moving, and Renaming Files
7.7.2 Computing the File Size
7.7.3 Deleting Files

7.8 Directory Operations

7.9 Putting It All Together

Introduction To Procedures

8.1 Chapter Overview

8.2 Procedures

8.3 Saving the State of the Machine

8.4 Prematurely Returning from a Procedure

8.5 Local Variables

8.6 Other Local and Global Symbol Types

8.7 Parameters

8.7.1 Pass by Value
8.7.2 Pass by Reference

8.8 Functions and Function Results

8.8.1 Returning Function Results
8.8.2 Instruction Composition in HLA
8.8.3 The HLA RETURNS Option in Procedures

8.9 Side Effects

8.10 Recursion

8.11 Forward Procedures

8.12 Putting It All Together

Managing Large Programs

9.1 Chapter Overview

9.2 Managing Large Programs

9.3 The #INCLUDE Directive

9.4 Ignoring Duplicate Include Operations

9.5 UNITs and the EXTERNAL Directive

9.5.1 Behavior of the EXTERNAL Directive
9.5.2 Header Files in HLA

9.6 Make Files

9.7 Code Reuse

9.8 Creating and Managing Libraries

9.9 Name Space Pollution

9.10 Putting It All Together

Integer Arithmetic

10.1 Chapter Overview

10.2 80x86 Integer Arithmetic Instructions

10.2.1 The MUL and IMUL Instructions
10.2.2 The DIV and IDIV Instructions
10.2.3 The CMP Instruction
10.2.4 The SETcc Instructions
10.2.5 The TEST Instruction

10.3 Arithmetic Expressions

10.3.1 Simple Assignments
10.3.2 Simple Expressions
10.3.3 Complex Expressions
10.3.4 Commutative Operators

10.4 Logical (Boolean) Expressions

10.5 Machine and Arithmetic Idioms

10.5.1 Multiplying without MUL, IMUL, or INTMUL
10.5.2 Division Without DIV or IDIV
10.5.3 Implementing Modulo-N Counters with AND
10.5.4 Careless Use of Machine Idioms

10.6 The HLA (Pseudo) Random Number Unit

10.7 Putting It All Together

Real Arithmetic

11.1 Chapter Overview

11.2 Floating Point Arithmetic

11.2.1 FPU Registers
11.2.1.1 FPU Data Registers
11.2.1.2 The FPU Control Register
11.2.1.3 The FPU Status Register
11.2.2 FPU Data Types
11.2.3 The FPU Instruction Set
11.2.4 FPU Data Movement Instructions
11.2.4.1 The FLD Instruction
11.2.4.2 The FST and FSTP Instructions
11.2.4.3 The FXCH Instruction
11.2.5 Conversions
11.2.5.1 The FILD Instruction
11.2.5.2 The FIST and FISTP Instructions
11.2.5.3 The FBLD and FBSTP Instructions
11.2.6 Arithmetic Instructions
11.2.6.1 The FADD and FADDP Instructions
11.2.6.2 The FSUB, FSUBP, FSUBR, and FSUBRP Instructions
11.2.6.3 The FMUL and FMULP Instructions
11.2.6.4 The FDIV, FDIVP, FDIVR, and FDIVRP Instructions
11.2.6.5 The FSQRT Instruction
11.2.6.6 The FPREM and FPREM1 Instructions
11.2.6.7 The FRNDINT Instruction
11.2.6.8 The FABS Instruction
11.2.6.9 The FCHS Instruction
11.2.7 Comparison Instructions
11.2.7.1 The FCOM, FCOMP, and FCOMPP Instructions
11.2.7.2 The FTST Instruction
11.2.8 Constant Instructions
11.2.9 Transcendental Instructions
11.2.9.1 The F2XM1 Instruction
11.2.9.2 The FSIN, FCOS, and FSINCOS Instructions
11.2.9.3 The FPTAN Instruction
11.2.9.4 The FPATAN Instruction
11.2.9.5 The FYL2X Instruction
11.2.9.6 The FYL2XP1 Instruction
11.2.10 Miscellaneous instructions
11.2.10.1 The FINIT and FNINIT Instructions
11.2.10.2 The FLDCW and FSTCW Instructions
11.2.10.3 The FCLEX and FNCLEX Instructions
11.2.10.4 The FSTSW and FNSTSW Instructions
11.2.11 Integer Operations

11.3 Converting Floating Point Expressions to Assembly Language

11.3.1 Converting Arithmetic Expressions to Postfix Notation
11.3.2 Converting Postfix Notation to Assembly Language
11.3.3 Mixed Integer and Floating Point Arithmetic

11.4 HLA Standard Library Support for Floating Point Arithmetic

11.4.1 The stdin.getf and fileio.getf Functions
11.4.2 Trigonometric Functions in the HLA Math Library
11.4.3 Exponential and Logarithmic Functions in the HLA Math Library

11.5 Sample Program

11.6 Putting It All Together

12.1 Chapter Overview

12.2 Tables

12.2.1 Function Computation via Table Look-up
12.2.2 Domain Conditioning
12.2.3 Generating Tables

12.3 High Performance Implementation of cs.rangeChar


Volume Four


Advanced High Level Control Structures

1.1 Chapter Overview

1.2 Conjunction, Disjunction, and Negation in Boolean Expressions

1.3 TRY..ENDTRY

1.3.1 Nesting TRY..ENDTRY Statements
1.3.2 The UNPROTECTED Clause in a TRY..ENDTRY Statement
1.3.3 The ANYEXCEPTION Clause in a TRY..ENDTRY Statement
1.3.4 Raising User-Defined Exceptions
1.3.5 Reraising Exceptions in a TRY..ENDTRY Statement
1.3.6 A List of the Predefined HLA Exceptions
1.3.7 How to Handle Exceptions in Your Programs
1.3.8 Registers and the TRY..ENDTRY Statement

1.4 BEGIN..EXIT..EXITIF..END

1.5 CONTINUE..CONTINUEIF

1.6 SWITCH..CASE..DEFAULT..ENDSWITCH

1.7 Putting It All Together

Low Level Control Structures

2.1 Chapter Overview

2.2 Low Level Control Structures

2.3 Statement Labels

2.4 Unconditional Transfer of Control (JMP)

2.5 The Conditional Jump Instructions

2.6 "Medium-Level" Control Structures: JT and JF

2.7 Implementing Common Control Structures in Assembly Language

2.8 Introduction to Decisions

2.8.1 IF..THEN..ELSE Sequences
2.8.2 Translating HLA IF Statements into Pure Assembly Language
2.8.3 Implementing Complex IF Statements Using Complete Boolean Evaluation
2.8.4 Short Circuit Boolean Evaluation
2.8.5 Short Circuit vs. Complete Boolean Evaluation
2.8.6 Efficient Implementation of IF Statements in Assembly Language
2.8.7 SWITCH/CASE Statements

2.9 State Machines and Indirect Jumps

2.10 Spaghetti Code

2.11 Loops

2.11.1 While Loops
2.11.2 Repeat..Until Loops
2.11.3 FOREVER..ENDFOR Loops
2.11.4 FOR Loops
2.11.5 The BREAK and CONTINUE Statements
2.11.6 Register Usage and Loops

2.12 Performance Improvements

2.12.1 Moving the Termination Condition to the End of a Loop
2.12.2 Executing the Loop Backwards
2.12.3 Loop Invariant Computations
2.12.4 Unraveling Loops
2.12.5 Induction Variables

2.13 Hybrid Control Structures in HLA

2.14 Putting It All Together

Intermediate Procedures

3.1 Chapter Overview

3.2 Procedures and the CALL Instruction

3.3 Procedures and the Stack

3.4 Activation Records

3.5 The Standard Entry Sequence

3.6 The Standard Exit Sequence

3.7 HLA Local Variables

3.8 Parameters

3.8.1 Pass by Value
3.8.2 Pass by Reference
3.8.3 Passing Parameters in Registers
3.8.4 Passing Parameters in the Code Stream
3.8.5 Passing Parameters on the Stack
3.8.5.1 Accessing Value Parameters on the Stack
3.8.5.2 Passing Value Parameters on the Stack
3.8.5.3 Accessing Reference Parameters on the Stack
3.8.5.4 Passing Reference Parameters on the Stack
3.8.5.5 Passing Formal Parameters as Actual Parameters
3.8.5.6 HLA Hybrid Parameter Passing Facilities
3.8.5.7 Mixing Register and Stack Based Parameters

3.9 Procedure Pointers

3.10 Procedural Parameters

3.11 Untyped Reference Parameters

3.12 Iterators and the FOREACH Loop

3.13 Sample Programs

3.13.1 Generating the Fibonacci Sequence Using an Iterator
3.13.2 Outer Product Computation with Procedural Parameters

3.14 Putting It All Together

Advanced Arithmetic

4.1 Chapter Overview

4.2 Multiprecision Operations

4.2.1 Multiprecision Addition Operations
4.2.2 Multiprecision Subtraction Operations
4.2.3 Extended Precision Comparisons
4.2.4 Extended Precision Multiplication
4.2.5 Extended Precision Division
4.2.6 Extended Precision NEG Operations
4.2.7 Extended Precision AND Operations
4.2.8 Extended Precision OR Operations
4.2.9 Extended Precision XOR Operations
4.2.10 Extended Precision NOT Operations
4.2.11 Extended Precision Shift Operations
4.2.12 Extended Precision Rotate Operations
4.2.13 Extended Precision I/O
4.2.13.1 Extended Precision Hexadecimal Output
4.2.13.2 Extended Precision Unsigned Decimal Output
4.2.13.3 Extended Precision Signed Decimal Output
4.2.13.4 Extended Precision Formatted I/O
4.2.13.5 Extended Precision Input Routines
4.2.13.6 Extended Precision Hexadecimal Input
4.2.13.7 Extended Precision Unsigned Decimal Input
4.2.13.8 Extended Precision Signed Decimal Input

4.3 Operating on Different Sized Operands

4.4 Decimal Arithmetic

4.4.1 Literal BCD Constants
4.4.2 The 80x86 DAA and DAS Instructions
4.4.3 The 80x86 AAA, AAS, AAM, and AAD Instructions
4.4.4 Packed Decimal Arithmetic Using the FPU

4.5 Sample Program

4.6 Putting It All Together

Bit Manipulation

5.1 Chapter Overview

5.2 What is Bit Data, Anyway?

5.3 Instructions That Manipulate Bits

5.4 The Carry Flag as a Bit Accumulator

5.5 Packing and Unpacking Bit Strings

5.6 Coalescing Bit Sets and Distributing Bit Strings

5.7 Packed Arrays of Bit Strings

5.8 Searching for a Bit

5.9 Counting Bits

5.10 Reversing a Bit String

5.11 Merging Bit Strings

5.12 Extracting Bit Strings

5.13 Searching for a Bit Pattern

5.14 The HLA Standard Library Bits Module

5.15 Putting It All Together

The 80x86 String Instructions

6.1 Chapter Overview

6.2 The 80x86 String Instructions

6.2.1 How the String Instructions Operate
6.2.2 The REP/REPE/REPZ and REPNZ/REPNE Prefixes
6.2.3 The Direction Flag
6.2.4 The MOVS Instruction
6.2.5 The CMPS Instruction
6.2.6 The SCAS Instruction
6.2.7 The STOS Instruction
6.2.8 The LODS Instruction
6.2.9 Building Complex String Functions from LODS and STOS

6.3 Putting It All Together

The HLA Compile-Time Language

7.1 Chapter Overview

7.2 Introduction to the Compile-Time Language (CTL)

7.3 The #PRINT and #ERROR Statements

7.4 Compile-Time Constants and Variables

7.5 Compile-Time Expressions and Operators

7.6 Compile-Time Functions

7.6.1 Type Conversion Compile-time Functions
7.6.2 Numeric Compile-Time Functions
7.6.3 Character Classification Compile-Time Functions
7.6.4 Compile-Time String Functions
7.6.5 Compile-Time Pattern Matching Functions
7.6.6 Compile-Time Symbol Information
7.6.7 Compile-Time Expression Classification Functions
7.6.8 Miscellaneous Compile-Time Functions
7.6.9 Predefined Compile-Time Variables
7.6.10 Compile-Time Type Conversions of TEXT Objects

7.7 Conditional Compilation (Compile-Time Decisions)

7.8 Repetitive Compilation (Compile-Time Loops)

7.9 Putting It All Together

Macros

8.1 Chapter Overview

8.2 Macros (Compile-Time Procedures)

8.2.1 Standard Macros
8.2.2 Macro Parameters
8.2.2.1 Standard Macro Parameter Expansion
8.2.2.2 Macros with a Variable Number of Parameters
8.2.2.3 Required Versus Optional Macro Parameters
8.2.2.4 The "#(" and ")#" Macro Parameter Brackets
8.2.2.5 Eager vs. Deferred Macro Parameter Evaluation
8.2.3 Local Symbols in a Macro
8.2.4 Macros as Compile-Time Procedures
8.2.5 Multi-part (Context-Free) Macros
8.2.6 Simulating Function Overloading with Macros

8.3 Writing Compile-Time "Programs"

8.3.1 Constructing Data Tables at Compile Time
8.3.2 Unrolling Loops

8.4 Using Macros in Different Source Files

8.5 Putting It All Together

Domain Specific Languages in HLA

9.1 Chapter Overview

9.2 Introduction to DSELs in HLA

9.2.1 Implementing the Standard HLA Control Structures
9.2.1.1 The FOREVER Loop
9.2.1.2 The WHILE Loop
9.2.1.3 The IF Statement
9.2.2 The HLA SWITCH/CASE Statement
9.2.3 A Modified WHILE Loop
9.2.4 A Modified IF..ELSE..ENDIF Statement

9.3 Sample Program: A Simple Expression Compiler

9.4 Putting It All Together

Classes And Objects

10.1 Chapter Overview

10.2 General Principles

10.3 Classes in HLA

10.4 Objects

10.5 Inheritance

10.6 Overriding

10.7 Virtual Methods vs. Static Procedures

10.8 Writing Class Methods, Iterators, and Procedures

10.9 Object Implementation

10.9.1 Virtual Method Tables
10.9.2 Object Representation with Inheritance

10.10 Constructors and Object Initialization

10.10.1 Dynamic Object Allocation Within the Constructor
10.10.2 Constructors and Inheritance
10.10.3 Constructor Parameters and Procedure Overloading

10.11 Destructors

10.12 HLA's "_initialize_" and "_finalize_" Strings

10.13 Abstract Methods

10.14 Run-time Type Information (RTTI)

10.15 Calling Base Class Methods

10.16 Sample Program

10.17 Putting It All Together

The MMX Instruction Set

11.1 Chapter Overview

11.2 Determining if a CPU Supports the MMX Instruction Set

11.3 The MMX Programming Environment

11.3.1 The MMX Registers
11.3.2 The MMX Data Types

11.4 The Purpose of the MMX Instruction Set

11.5 Saturation Arithmetic and Wraparound Mode

11.6 MMX Instruction Operands

11.7 MMX Technology Instructions

11.7.1 MMX Data Transfer Instructions
11.7.2 MMX Conversion Instructions
11.7.3 MMX Packed Arithmetic Instructions
11.7.4 MMX Logic Instructions
11.7.5 MMX Comparison Instructions
11.7.6 MMX Shift Instructions

11.8 The EMMS Instruction

11.9 The MMX Programming Paradigm

11.10 Putting It All Together

Mixed Language Programming

12.1 Chapter Overview

12.2 Mixing HLA and MASM/Gas Code in the Same Program

12.2.1 In-Line (MASM/Gas) Assembly Code in Your HLA Programs
12.2.2 Linking MASM/Gas-Assembled Modules with HLA Modules

12.3 Programming in Delphi/Kylix and HLA

12.3.1 Linking HLA Modules With Delphi Programs
12.3.2 Register Preservation
12.3.3 Function Results
12.3.4 Calling Conventions
12.3.5 Pass by Value, Reference, CONST, and OUT in Delphi
12.3.6 Scalar Data Type Correspondence Between Delphi and HLA
12.3.7 Passing String Data Between Delphi and HLA Code
12.3.8 Passing Record Data Between HLA and Delphi
12.3.9 Passing Set Data Between Delphi and HLA
12.3.10 Passing Array Data Between HLA and Delphi
12.3.11 Delphi Limitations When Linking with (Non-TASM) Assembly Code
12.3.12 Referencing Delphi Objects from HLA Code

12.4 Programming in C/C++ and HLA

12.4.1 Linking HLA Modules With C/C++ Programs
12.4.2 Register Preservation
12.4.3 Function Results
12.4.4 Calling Conventions
12.4.5 Pass by Value and Reference in C/C++
12.4.6 Scalar Data Type Correspondence Between C/C++ and HLA
12.4.7 Passing String Data Between C/C++ and HLA Code
12.4.8 Passing Record/Structure Data Between HLA and C/C++
12.4.9 Passing Array Data Between HLA and C/C++

12.5 Putting It All Together


Web Site Hits Since
Jan 1, 2000

TOC PREV NEXT INDEX