did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780132383103

Assembly Language for Intel-Based Computers

by
  • ISBN13:

    9780132383103

  • ISBN10:

    0132383101

  • Edition: 5th
  • Format: Hardcover
  • Copyright: 2011-01-01
  • Publisher: Prentice Hall
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $133.00

Summary

This widely used, fully updated assembly language book provides basic information for the beginning programmer interested in computer architecture, operating systems, hardware manipulation, and compiler writing.Uses the Intel IA-32 processor family as its base, showing how to program for Windows and DOS. Is written in a clear and straightforward manner for high readability. Includes a companion CD-ROM with all sample programs, and Microsoftreg; Macro Assembler Version 8, along with an extensive companion Website maintained by the author. Covers machine architecture, processor architecture, assembly language fundamentals, data transfer, addressing and arithmetic, procedures, conditional processing, integer arithmetic, strings and arrays, structures and macros, 32-bit Windows programming, language interface, disk fundamentals, BIOS-level programming, MS-DOS programming, floating-point programming, and IA-32 instruction encoding.For embedded systems programmers and engineers, communication specialists, game programmers, and graphics programmers.

Table of Contents

Preface xxiii
Basic Concepts
1(24)
Welcome to Assembly Language
1(6)
Good Questions to Ask
2(3)
Assembly Language Applications
5(1)
Section Review
6(1)
Virtual Machine Concept
7(2)
History of PC Assemblers
9(1)
Section Review
9(1)
Data Representation
9(11)
Binary Numbers
10(1)
Binary Addition
11(1)
Integer Storage Sizes
12(1)
Hexadecimal Integers
13(1)
Signed Integers
14(2)
Character Storage
16(2)
Section Review
18(2)
Boolean Operations
20(3)
Truth Tables for Boolean Functions
22(1)
Section Review
23(1)
Chapter Summary
23(2)
IA-32 Processor Architecture
25(26)
General Concepts
25(8)
Basic Microcomputer Design
26(1)
Instruction Execution Cycle
27(3)
Reading from Memory
30(1)
How Programs Run
31(1)
Section Review
32(1)
IA-32 Processor Architecture
33(6)
Modes of Operation
33(1)
Basic Execution Environment
34(2)
Floating-Point Unit
36(1)
Intel Microprocessor History
37(1)
Section Review
38(1)
IA-32 Memory Management
39(4)
Real-Address Mode
39(2)
Protected Mode
41(2)
Section Review
43(1)
Components of an IA-32 Microcomputer
43(3)
Motherboard
43(1)
Video Output
44(1)
Memory
45(1)
Input-Output Ports and Device Interfaces
45(1)
Section Review
46(1)
Input-Output System
46(3)
How It All Works
46(2)
Section Review
48(1)
Chapter Summary
49(2)
Assembly Language Fundamentals
51(28)
Basic Elements of Assembly Language
51(7)
Integer Constants
52(1)
Integer Expressions
52(1)
Real Number Constants
53(1)
Character Constants
54(1)
String Constants
54(1)
Reserved Words
54(1)
Identifiers
54(1)
Directives
55(1)
Instructions
55(2)
The NOP (No Operation) Instruction
57(1)
Section Review
58(1)
Example: Adding Three Integers
58(4)
Alternative Version of AddSub
60(1)
Program Template
61(1)
Section Review
61(1)
Assembling, Linking, and Running Programs
62(2)
The Assemble-Link-Execute Cycle
62(2)
Section Review
64(1)
Defining Data
64(8)
Intrinsic Data Types
64(1)
Data Definition Statement
64(2)
Defining Byte and Sbyte Data
66(1)
Defining Word and Sword Data
67(1)
Defining Dword and Sdword Data
68(1)
Defining Qword Data
69(1)
Defining Tbyte Data
69(1)
Defining Real Number Data
69(1)
Little Endian Order
69(1)
Adding Variables to the AddSub Program
70(1)
Declaring Uninitialized Data
71(1)
Section Review
71(1)
Symbolic Constants
72(3)
Equal-Sign Directive
72(1)
Calculating the Sizes of Arrays and Strings
73(1)
EQU Directive
74(1)
Textequ Directive
74(1)
Section Review
75(1)
Real-Address Mode Programming (Optional)
75(1)
Basic Changes
75(1)
Chapter Summary
76(1)
Programming Exercises
77(2)
Data Transfers, Addressing, and Arithmetic
79(32)
Data Transfer Instructions
79(8)
Introduction
79(1)
Operand Types
80(1)
Direct Memory Operands
80(1)
MOV Instruction
81(1)
Zero/Sign Extension of Integers
82(2)
LAHF and SAHF Instructions
84(1)
XCHG Instruction
84(1)
Direct-Offset Operands
84(1)
Example Program (Moves)
85(1)
Section Review
86(1)
Addition and Subtraction
87(7)
INC and DEC Instructions
87(1)
ADD Instruction
87(1)
SUB Instruction
88(1)
NEG Instruction
88(1)
Implementing Arithmetic Expressions
89(1)
Flags Affected by Addition and Subtraction
89(3)
Example Program (AddSub3)
92(1)
Section Review
93(1)
Data-Related Operators and Directives
94(5)
Offset Operator
94(1)
Align Directive
95(1)
PTR Operator
95(1)
Type Operator
96(1)
Lengthof Operator
97(1)
Sizeof Operator
97(1)
Label Directive
97(1)
Section Review
98(1)
Indirect Addressing
99(5)
Indirect Operands
99(1)
Arrays
100(1)
Indexed Operands
101(1)
Pointers
102(1)
Section Review
103(1)
JMP and LOOP Instructions
104(4)
JMP Instruction
104(1)
Loop Instruction
105(1)
Summing an Integer Array
106(1)
Copying a String
106(1)
Section Review
107(1)
Chapter Summary
108(1)
Programming Exercises
109(2)
Procedures
111(39)
Introduction
111(1)
Linking to an External Library
111(2)
Background Information
112(1)
Section Review
112(1)
The Book's Link Library
113(16)
Overview
113(2)
Individual Procedure Descriptions
115(10)
Library Test Programs
125(4)
Section Review
129(1)
Stack Operations
129(5)
Runtime Stack
129(2)
Push and POP Instructions
131(3)
Section Review
134(1)
Defining and Using Procedures
134(9)
Proc Directive
134(2)
Call and RET Instructions
136(3)
Example: Summing an Integer Array
139(1)
Flowcharts
140(1)
Saving and Restoring Registers
140(2)
Section Review
142(1)
Program Design Using Procedures
143(4)
Integer Summation Program (Design)
143(2)
Integer Summation Implementation
145(2)
Section Review
147(1)
Chapter Summary
147(1)
Programming Exercises
148(2)
Conditional Processing
150(43)
Introduction
150(1)
Boolean and Comparison Instructions
151(7)
The CPU Flags
151(1)
And Instruction
152(1)
Or Instruction
153(1)
Xor Instruction
154(1)
Not Instruction
155(1)
Test Instruction
155(1)
CMP Instruction
156(1)
Setting and Clearing Individual CPU Flags
157(1)
Section Review
157(1)
Conditional Jumps
158(11)
Conditional Structures
158(1)
Jcond Instruction
158(1)
Types of Conditional Jump Instructions
159(4)
Conditional Jump Applications
163(4)
Bit Testing Instructions (Optional)
167(1)
Section Review
168(1)
Conditional Loop Instructions
169(1)
Loopz and Loope Instructions
169(1)
Loopnz and Loopne Instructions
169(1)
Section Review
170(1)
Conditional Structures
170(9)
Block-Structured IF Statements
170(3)
Compound Expressions
173(1)
While Loops
174(3)
Table-Driven Selection
177(1)
Section Review
178(1)
Application: Finite-State Machines
179(5)
Validating an Input String
180(1)
Validating a Signed Integer
180(3)
Section Review
183(1)
Decision Directives
184(5)
Signed and Unsigned Comparisons
185(1)
Compound Expressions
186(2)
.Repeat and .While Directives
188(1)
Chapter Summary
189(1)
Programming Exercises
190(3)
Integer Arithmetic
193(31)
Introduction
193(1)
Shift and Rotate Instructions
194(7)
Logical Shifts and Arithmetic Shifts
194(1)
SHL Instruction
195(1)
SHR Instruction
196(1)
SAL and SAR Instructions
196(1)
ROL Instruction
197(1)
ROR Instruction
198(1)
RCL and RCR Instructions
198(1)
Signed Overflow
199(1)
SHLD/SHRD Instructions
199(1)
Section Review
200(1)
Shift and Rotate Applications
201(3)
Shifting Multiple Doublewords
201(1)
Binary Multiplication
202(1)
Displaying Binary Bits
202(1)
Isolating MS-DOS File Date Fields
203(1)
Section Review
203(1)
Multiplication and Division Operations
204(9)
MUL Instruction
204(1)
IMUL Instruction
205(2)
Benchmarking Multiplication Operations
207(1)
DIV Instruction
208(1)
Signed Integer Division
209(2)
Implementing Arithmetic Expressions
211(1)
Section Review
212(1)
Extended Addition and Subtraction
213(2)
ADC Instruction
213(1)
Extended Addition Example
213(1)
SBB Instruction
214(1)
Section Review
215(1)
ASCII and Unpacked Decimal Arithmetic
215(4)
AAA Instruction
216(2)
AAS Instruction
218(1)
AAM Instruction
218(1)
AAD Instruction
218(1)
Section Review
219(1)
Packed Decimal Arithmetic
219(2)
DAA Instruction
219(1)
DAS Instruction
220(1)
Section Review
220(1)
Chapter Summary
221(1)
Programming Exercises
222(2)
Advanced Procedures
224(45)
Introduction
224(1)
Stack Frames
225(17)
Stack Parameters
225(8)
Local Variables
233(3)
Enter and Leave Instructions
236(1)
Local Directive
237(3)
WriteStackFrame Procedure
240(1)
Section Review
241(1)
Recursion
242(4)
Recursively Calculating a Sum
243(1)
Calculating a Factorial
243(2)
Section Review
245(1)
.Model Directive
246(2)
Language Specifiers
247(1)
Section Review
248(1)
Invoke, ADDR, PROC, and Proto (Optional)
248(10)
Invoke Directive
248(1)
ADDR Operator
249(1)
PROC Directive
250(3)
PROTO Directive
253(2)
Parameter Classifications
255(1)
Example: Exchanging Two Integers
256(1)
Debugging Tips
256(1)
Section Review
257(1)
Creating Multimodule Programs
258(9)
Hiding and Exporting Procedure Names
258(1)
Calling External Procedures
258(1)
Using Variables and Symbols Across Module Boundaries
259(1)
Example: ArraySum Program
260(1)
Creating the Modules Using Extern
261(3)
Creating the Modules Using Invoke and PROTO
264(2)
Section Review
266(1)
Chapter Summary
267(1)
Programming Exercises
268(1)
Strings and Arrays
269(30)
Introduction
269(1)
String Primitive Instructions
270(6)
MOVSB, MOVSW, and MOVSD
271(1)
CMPSB, CMPSW, and CMPSD
272(2)
SCASB, SCASW, and SCASD
274(1)
STOSB, STOSW, and STOSD
274(1)
LODSB, LODSW, and LODSD
275(1)
Section Review
275(1)
Selected String Procedures
276(6)
Str_compare Procedure
276(1)
Str_length Procedure
277(1)
Str_copy Procedure
278(1)
Str_trim Procedure
278(1)
Str_ucase Procedure
279(1)
String Library Demo Program
280(2)
Section Review
282(1)
Two-Dimensional Arrays
282(3)
Ordering of Rows and Columns
282(1)
Base-Index Operands
283(2)
Base-Index Displacement Operands
285(1)
Section Review
285(1)
Searching and Sorting Integer Arrays
285(9)
Bubble Sort
286(1)
Binary Search
287(6)
Section Review
293(1)
Chapter Summary
294(1)
Programming Exercises
295(4)
Structures and Macros
299(47)
Structures
299(14)
Defining Structures
300(1)
Declaring Structure Variables
301(1)
Referencing Structure Variables
302(3)
Example: Displaying the System Time
305(2)
Structures Containing Structures
307(1)
Example: Drunkard's Walk
307(3)
Declaring and Using Unions
310(2)
Section Review
312(1)
Macros
313(13)
Overview
313(1)
Defining Macros
313(1)
Invoking Macros
314(1)
Additional Macro Features
315(3)
Using the Book's Macro Library
318(6)
Example Program: Wrappers
324(1)
Section Review
325(1)
Conditional-Assembly Directives
326(12)
Checking for Missing Arguments
326(2)
Default Argument Initializers
328(1)
Boolean Expressions
328(1)
IF, ELSE, and ENDIF Directives
328(1)
The IFIDN and IFIDNI Directives
329(1)
Example: Summing a Matrix Row
330(3)
Special Operators
333(3)
Macro Functions
336(1)
Section Review
337(1)
Defining Repeat Blocks
338(4)
While Directive
338(1)
Repeat Directive
338(1)
For Directive
339(1)
FORC Directive
340(1)
Example: Linked List
340(2)
Section Review
342(1)
Chapter Summary
342(1)
Programming Exercises
343(3)
MS-Windows Programming
346(56)
Win32 Console Programming
346(33)
Background Information
347(3)
Win32 Console Functions
350(2)
Displaying a Message Box
352(2)
Console Input
354(6)
Console Output
360(1)
Reading and Writing Files
361(4)
File I/O in the Irvine32 Library
365(2)
Testing the File I/O Procedures
367(3)
Console Window Manipulation
370(3)
Controlling the Cursor
373(1)
Controlling the Text Color
373(2)
Time and Date Functions
375(4)
Section Review
379(1)
Writing a Graphical Windows Application
379(8)
Necessary Structures
380(1)
The MessageBox Function
381(1)
The WinMain Procedure
382(1)
The WinProc Procedure
382(1)
The ErrorHandler Procedure
383(1)
Program Listing
383(3)
Section Review
386(1)
Dynamic Memory Allocation
387(6)
HeapTest Programs
390(3)
Section Review
393(1)
IA-32 Memory Management
393(6)
Linear Addresses
394(3)
Page Translation
397(1)
Section Review
398(1)
Chapter Summary
399(1)
Programming Exercises
400(2)
High-Level Language Interface
402(30)
Introduction
402(2)
General Conventions
402(1)
Section Review
403(1)
Inline Assembly Code
404(5)
__asm Directive in Microsoft Visual C++
404(2)
File Encryption Example
406(3)
Section Review
409(1)
Linking to C/C++ in Protected Mode
409(14)
Using Assembly Language to Optimize C++ Code
410(5)
Calling C and C++ Functions
415(1)
Multiplication Table Example
416(3)
Calling C Library Functions
419(3)
Directory Listing Program
422(1)
Section Review
423(1)
Linking to C/C++ in Real-Address Mode
423(7)
Linking to Borland C++
424(1)
ReadSector Example
425(3)
Example: Large Random Integers
428(2)
Section Review
430(1)
Chapter Summary
430(1)
Programming Exercises
431(1)
16-Bit MS-DOS Programming
432(32)
MS-DOS and the IBM-PC
432(6)
Memory Organization
433(1)
Redirecting Input-Output
434(1)
Software Interrupts
435(1)
INT Instruction
435(1)
Coding for 16-Bit Programs
436(1)
Section Review
437(1)
MS-DOS Function Calls (INT 21h)
438(11)
Selected Output Functions
439(2)
Hello World Program Example
441(1)
Selected Input Functions
442(4)
Date/Time Functions
446(3)
Section Review
449(1)
Standard MS-DOS File I/O Services
449(12)
Create or Open File (716Ch)
451(1)
Close File Handle (3Eh)
452(1)
Move File Pointer (42h)
452(1)
Get File Creation Date and Time
453(1)
Selected Library Procedures
453(1)
Example: Read and Copy a Text File
454(2)
Reading the MS-DOS Command Tail
456(2)
Example: Creating a Binary File
458(3)
Section Review
461(1)
Chapter Summary
461(2)
Chapter Exercises
463(1)
Disk Fundamentals
464(26)
Disk Storage Systems
464(4)
Tracks, Cylinders, and Sectors
465(1)
Disk Partitions (Volumes)
466(2)
Section Review
468(1)
File Systems
468(4)
FAT12
469(1)
FAT16
469(1)
FAT32
469(1)
NTFS
470(1)
Primary Disk Areas
470(1)
Section Review
471(1)
Disk Directory
472(5)
MS-DOS Directory Structure
473(2)
Long Filenames in MS-Windows
475(1)
File Allocation Table (FAT)
476(1)
Section Review
477(1)
Reading and Writing Disk Sectors (7305h)
477(5)
Sector Display Program
478(4)
Section Review
482(1)
System-Level File Functions
482(5)
Get Disk Free Space (7303h)
483(2)
Create Subdirectory (39h)
485(1)
Remove Subdirectory (3Ah)
486(1)
Set Current Directory (3Bh)
486(1)
Get Current Directory (47h)
486(1)
Get and Set File Attributes (7143h)
486(1)
Section Review
487(1)
Chapter Summary
487(1)
Programming Exercises
488(2)
BIOS-Level Programming
490(46)
Introduction
490(2)
BIOS Data Area
491(1)
Keyboard Input with INT 16h
492(6)
How the Keyboard Works
492(1)
INT 16h Functions
493(4)
Section Review
497(1)
Video Programming with INT 10h
498(14)
Basic Background
498(1)
Controlling the Color
499(2)
INT 10h Video Functions
501(10)
Library Procedure Examples
511(1)
Section Review
512(1)
Drawing Graphics Using INT 10h
512(7)
INT 10h Pixel-Related Functions
513(1)
DrawLine Program
514(1)
Cartesian Coordinates Program
515(2)
Converting Cartesian Coordinates to Screen Coordinates
517(1)
Section Review
518(1)
Memory-Mapped Graphics
519(4)
Mode 13h: 320 x 200, 256 Colors
519(1)
Memory-Mapped Graphics Program
520(3)
Section Review
523(1)
Mouse Programming
523(10)
Mouse INT 33h Functions
523(5)
Mouse Tracking Program
528(4)
Section Review
532(1)
Chapter Summary
533(1)
Chapter Exercises
534(2)
Expert MS-DOS Programming
536(26)
Introduction
536(1)
Defining Segments
537(7)
Simplified Segment Directives
537(1)
Explicit Segment Definitions
538(4)
Segment Overrides
542(1)
Combining Segments
542(1)
Section Review
543(1)
Runtime Program Structure
544(4)
Program Segment Prefix
544(1)
COM Programs
545(1)
EXE Programs
546(1)
Section Review
547(1)
Interrupt Handling
548(10)
Hardware Interrupts
549(1)
Interrupt Control Instructions
550(1)
Writing a Custom Interrupt Handler
551(2)
Terminate and Stay Resident Programs
553(1)
Application: The No_Reset Program
554(3)
Section Review
557(1)
Hardware Control Using I/O Ports
558(2)
Input-Output Ports
558(1)
PC Sound Program
558(2)
Chapter Summary
560(2)
Floating-Point Processing and Instruction Encoding
562(38)
Floating-Point Binary Representation
562(7)
IEEE Binary Floating-Point Representation
563(1)
The Exponent
564(1)
Normalized Binary Floating-Point Numbers
565(1)
Creating the IEEE Representation
565(2)
Converting Decimal Fractions to Binary Reals
567(1)
Section Review
568(1)
Floating-Point Unit
569(19)
FPU Register Stack
569(2)
Rounding
571(2)
Floating-Point Exceptions
573(1)
Floating-Point Instruction Set
573(3)
Arithmetic Instructions
576(3)
Comparing Floating-Point Values
579(3)
Reading and Writing Floating-Point Values
582(1)
Exception Synchronization
583(1)
Code Examples
584(1)
Mixed-Mode Arithmetic
585(1)
Masking and Unmasking Exceptions
586(1)
Section Review
587(1)
Intel Instruction Encoding
588(8)
IA-32 Instruction Format
588(1)
Single-Byte Instructions
589(1)
Move Immediate to Register
590(1)
Register-Mode Instructions
591(1)
IA-32 Processor Operand-Size Prefix
591(1)
Memory-Mode Instructions
592(3)
Section Review
595(1)
Chapter Summary
596(1)
Programming Exercises
597(3)
Appendix A MASM Reference 600(19)
Appendix B The IA-32 Instruction Set 619(31)
Appendix C BIOS and MS-DOS Interrupts 650(9)
Appendix D Answers to Review Questions 659(46)
Index 705

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program