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.

9780471375234

Assembly Language Step-by-Step: Programming with DOS and Linux, 2nd Edition

by
  • ISBN13:

    9780471375234

  • ISBN10:

    0471375233

  • Edition: 2nd
  • Format: Paperback
  • Copyright: 2000-06-01
  • Publisher: Wiley
  • 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: $55.00

Summary

The bestselling guide to assembly language-now updated and expanded to include coverage of Linux This new edition of the bestselling guide to assembly programming now covers DOS and Linux! The Second Edition begins with a highly accessible overview of the internal operations of the Intel-based PC and systematically covers all the steps involved in writing, testing, and debugging assembly programs. Expert author Jeff Duntemann then presents working example programs for both the DOS and Linux operating systems using the popular free assembler NASM. He also includes valuable information on how to use procedures and macros, plus rare explanations of assembly-level coding for Linux, all of which combine to offer a comprehensive look at the complexities of assembly programming for Intel processors. Providing you with the foundation to create executable assembly language programs, this book: * Explains how to use NASM-IDE, a simple program editor and assembly-oriented development environment * Details the most used elements of the 86-family instruction set * Teaches about DEBUG, the single most useful tool you have as an assembly language programmer * Examines the operations that machine instructions force the CPU to perform * Discusses the process of memory addressing * Covers coding for Linux The CD-ROM includes: * Net-Wide Assembler (NASM) for both DOS and Linux * NASM-IDE, a command shell and code editor for DOS * ALINK, a free linker for DOS programming * All program code examples from the book

Author Biography

JEFF DUNTEMANN is the Editor-in-Chief of Visual Developer magazine, former editor of Turbo Technix and PC Techniques, the "Structured Programming"columnist for Dr. Dobb’s Journal, and has written and edited more than twenty programming books.

Table of Contents

Acknowledgments xvii
Foreword xix
Introduction xxi
Another Pleasant Valley Saturday
1(14)
It's All in the Plan
1(4)
Steps and Tests
3(1)
More than Two Ways?
3(2)
Computers Think Like Us
5(1)
Had This Been the Real Thing...
5(1)
Do Not Pass Go
6(9)
The Game of Big Bux
6(1)
Playing Big Bux
7(2)
Assembly Language Programming as a Board Game
9(2)
Code and Data
11(1)
Addresses
12(1)
Metaphor Check!
12(3)
Alien Bases
15(32)
The Return of the New Math Monster
15(1)
Counting in Martian
16(5)
Dissecting a Martian Number
17(3)
The Essence of a Number Base
20(1)
Octal: How the Grinch Stole Eight and Nine
21(5)
Who Stole Eight and Nine?
21(4)
Living Fossils
25(1)
Hexadecimal: Solving the Digit Shortage
26(2)
From Hex to Decimal and from Decimal to Hex
28(6)
From Hex to Decimal
29(2)
From Decimal to Hex
31(2)
Practice. Practice! Practice!
33(1)
Arithmetic in Hex
34(6)
Columns and Carries
36(1)
Subtraction and Borrows
37(2)
Borrows across Multiple Columns
39(1)
What's the Point?
40(1)
Binary
40(5)
Values in Binary
42(2)
Why Binary?
44(1)
Hexadecimal as Shorthand for Binary
45(2)
Prepare to Compute
46(1)
Lifting the Hood
47(26)
RAXie, We Hardly Knew Ye...
47(3)
Gus to the Rescue
48(2)
Switches, Transistors, and Memory
50(10)
One if by Land...
50(1)
Transistor Switches
51(2)
The Incredible Shrinking Bit
53(2)
Random Access
55(2)
Memory Access Time
57(1)
Bytes, Words, Double Words, and Quad Words
57(2)
Pretty Chips All in a Row
59(1)
The Shop Foreman and the Assembly Line
60(6)
The Honcho Chip
61(2)
Talking to Memory
63(1)
Riding the Bus
64(1)
The Foreman's Pockets
65(1)
The Assembly Line
66(1)
The Box That Follows a Plan
66(7)
Fetch and Execute
67(1)
The Foreman's Innards
68(2)
Changing Course
70(1)
The Plan
71(2)
The Right to Assemble
73(46)
Nude with Bruises and Other Perplexities
73(2)
Sweet Blindness: The Software Components Conundrum
74(1)
Dos and Dos files
75(9)
The God Above, the Troll Below
76(1)
Dos Files: Magnetic Memory
77(2)
Binary Files
79(1)
Text Files
79(1)
Living Fossils
80(2)
Text Editors
82(2)
Compilers and Assemblers
84(10)
Assembly Language
84(2)
Comments
86(1)
Beware ``Write-Only'' Source Code!
87(1)
Object Code and Linkers
88(2)
Executable Program Files
90(2)
Setting Up a Working Directory
92(2)
The Assembly Language Development Process
94(12)
Assembling the Source Code File
96(1)
Assembler Errors
96(2)
Back to the Editor
98(1)
Assembler Warnings
99(3)
Linker Errors
102(1)
Testing the .EXE File
103(1)
Errors versus Bugs
104(1)
Debuggers and Debugging
104(2)
DEBUG and How to Use It
106(13)
DEBUG's Bag of Tricks
106(2)
Taking Debug for a Spin
108(1)
Looking at a Hex Dump
108(3)
Changing Memory with Debug
111(1)
The Dangers of Modifying Files
112(2)
Examining and Changing Registers
114(4)
The Hacker's Best Friend
118(1)
NASM-IDE: A Place to Stand
119(32)
Access to Tools
119(2)
Nasm-Ide
120(1)
Nasm-Ide's Place to Stand
121(5)
Telling Nasm-Ide Where Nasm Is
122(1)
The Edit Window
123(1)
The Menu Bar
124(1)
The Prompt Bar
125(1)
Other Windows
125(1)
Using Nasm-Ide's Tools
126(7)
Invoking Nasm-Ide
127(2)
Moving Around the Edit Window
129(1)
Making Changes to the File
129(1)
Saving Changes to a File
130(1)
Assembling the Current File
131(2)
Running the Executable File
133(1)
Nasm-Ide's Editor in Detail
133(15)
Loading Files into the Editor
134(2)
Moving the Cursor
136(1)
One Character at a Time
137(1)
One Word at a Time
138(1)
One Screen at a Time
138(1)
Moving the Cursor by Scrolling the Screen
138(1)
Moving to the Ends of the Line
139(1)
Moving to the Ends of the File
139(1)
Insert Mode and Cursor Coordinates
139(1)
The Indent Toggle
140(1)
Deleting Text
141(1)
Undoing Changes to a Line
142(1)
Marking Text Blocks
142(1)
The Clipboard and Block Commands
143(2)
Searching for Text
145(1)
Searching for Additional Instances
146(1)
Replacing Found Text
147(1)
Saving Your Work
148(1)
Other Nasm-Ide Features
148(3)
Exiting Nasm-Ide
149(1)
Changing the Display Size
149(1)
Dos Shell
150(1)
An Uneasy Alliance
151(42)
The Joy of Memory Models
151(9)
16 Bits'll Buy You 64K
153(4)
The Nature of a Megabyte
157(1)
Backward Compatibility
158(1)
16-Bit Blinders
159(1)
The Nature of Segments
160(7)
A Horizon, Not a Place
164(1)
Making 20-Bit Addresses out of 16-Bit Registers
164(3)
16-Bit and 32-Bit Registers
167(7)
General-Purpose Registers
168(3)
Register Halves
171(1)
The Instruction Pointer
172(2)
The Flags Register
174(1)
The Three Major Assembly Programming Models
174(8)
Real Mode Flat Model
175(2)
Real Mode Segmented Model
177(3)
Protected Mode Flat Model
180(2)
Reading and Changing Registers with Debug
182(11)
Inspecting the Video Refresh Buffer with Debug
184(4)
Reading the Basic Input/Output System Revision Date
188(1)
Transferring Control to Machine Instructions in Read-Only Memory
189(4)
Following Your Instruction
193(34)
Assembling and Executing Machine Instructions with Debug
194(4)
Assembling a MOV Instruction
194(2)
Executing a MOV Instruction with the Trace Command
196(2)
Machine Instructions and Their Operands
198(12)
Source and Destination Operands
198(1)
Immediate Data
199(1)
Register Data
200(2)
Memory Data
202(1)
BX's Hidden Agenda
203(1)
Using Memory Data
204(1)
Segment Register Assumptions
205(1)
Overriding Segment Assumptions for Memory Data
205(2)
Real Mode Memory Data Summary
207(1)
Limitations of the MOV Instruction
207(2)
Some Notes on Assembler Syntax
209(1)
Reading and Using an Assembly Language Reference
210(7)
Blue Cards
211(1)
An Assembly Language Reference for Beginners
211(1)
Flags
212(2)
Legal Forms
214(1)
Operand Symbols
215(1)
Examples
215(1)
Notes
216(1)
What's Not Here...
216(1)
Rally Round the Flags, Boys!
217(6)
Check That Reference Page!
219(1)
Adding and Subtracting One with INC and DEC
219(2)
Using Debug to Watch the Flags
221(2)
Using Type Specifiers
223(4)
Types in Assembly Language
224(3)
Our Object All Sublime
227(40)
The Bones of an Assembly Language Program
228(9)
The Simplicity of Flat Model
229(2)
Labels
231(1)
Variables for Initialized Data
232(1)
String Variables
232(2)
Directives versus Instruction Mnemonics
234(1)
The Difference between a Variable's Address and Its Contents
235(1)
Making Dos Calls
236(1)
Exiting the Program and Setting Errorlevel
236(1)
Assembling and Running EAT.ASM
237(3)
Assembler and Internactive Development Environment
237(2)
What Happens When a .COM File Runs
239(1)
One Program, Three Segments
240(7)
Three Segments
242(1)
Don't Assume...
243(2)
Naming the Stack Segment
245(1)
Choosing a Starting Point
245(1)
Assembling and Linking EATSEG.ASM
246(1)
Last In, First Out via the Stack
247(8)
Five Hundred Plates an Hour
247(1)
An Upside-Down Segment
248(3)
Pushing Data
251(2)
POP Goes the Opcode
253(2)
Storage for the Short Term
255(1)
Using Dos Services through Int
255(12)
An Interrupt That Doesn't Interrupt Anything
256(6)
Getting Home Again
262(2)
Software Interrupts versus Hardware Interrupts
264(3)
Dividing and Conquering
267(48)
Programming in Martian
267(1)
Boxes within Boxes
268(8)
Procedures as Boxes for Code
269(2)
Calling and Returning
271(1)
Calls within Calls
272(3)
When to Make Something a Procedure
275(1)
Using Bios Services
276(12)
Positioning the Hardware Cursor
277(2)
Using Video Service 6
279(1)
Procedures with Multiple Entry Points
279(3)
Memory Data or Immediate Data?
282(1)
Use Comment Headers!
282(6)
Building External Libraries of Procedures
288(13)
Public and External Declarations
288(3)
The Mechanics of Globals and Externals
291(5)
Dividing a Segment across Module Boundaries
296(1)
Your Main Program Module
296(3)
Linking Multiple Modules
299(1)
Batch Files for Building Modular Programs
300(1)
External Module Summary
301(1)
Creating and Using Macros
301(14)
Macros versus Procedures: Pro and Con
302(2)
The Mechanics of Macro Definition
304(1)
Defining Macros with Parameters
305(1)
The Mechanics of Macro Parameters
306(1)
Local Labels within Macros
306(2)
Macro Libraries
308(7)
Bits, Flags, Branches, and Tables
315(54)
Bits Is Bits (and Bytes Is Bits)
316(7)
Bit Numbering
316(1)
``It's the Logical Thing to Do, Jim...''
316(2)
The and Instruction
318(1)
Masking Out Bits
318(2)
The OR Instruction
320(1)
The XOR Instruction
320(322)
The NOT Instruction
322(1)
Segment Registers Don't Respond to Logic!
322(1)
Shifting Bits
323(8)
Shift by What?
323(1)
How Bit Shifting Works
323(1)
Bumping Bits into the Carry Flag
324(1)
Byte2Str: Converting Numbers to Displayable Strings
324(2)
Splitting a Byte into Two Nybbles
326(1)
Using a Lookup Table
326(1)
Shifting the High Nybble into the Low Nybble
327(2)
Converting Words to Their String Form
329(2)
Flags, Tests, and Branches
331(16)
Unconditional Jumps
332(1)
Conditional Jumps
332(1)
Beware Endless Loops!
333(1)
Jumping on the Absence of a Condition
334(1)
Flags
335(1)
Comparisons with CMP
336(1)
A Jungle of Jump Instructions
336(1)
Greater Than versus Above
337(2)
Detecting the Installed Display Adapter
339(5)
Testing Bits with TEST
344(1)
The Phantoms of the Opcodes
344(2)
TEST Pointers
346(1)
Assembly Odds'n Ends
347(22)
Yet Another Lookup Table
347(2)
Using Shift Instructions to Multiply by Powers of Two
349(1)
Tables within Tables
350(5)
Base-Indexed-Displacement Memory Addressing
355(2)
Finding the Number of Lines in the Screen
357(1)
Equates and the Current Location Counter
358(11)
Stringing Them Up
369(30)
The Notion of an Assembly Language String
370(2)
Turning Your ``String Sense'' Inside-Out
370(1)
Source Strings and Destination Strings
371(1)
REP STOSW, the Software Machine Gun
372(5)
Machine-Gunning the Video Display Buffer
372(1)
Executing the STOSW Instruction
373(2)
STOSW and the Direction Flag DF
375(2)
The Semiautomatic Weapon: STOSW without REP
377(10)
Who Decrements CX?
377(1)
The Loop Instructions
378(1)
Displaying a Ruler on the Screen
379(1)
Simple Multiplies with IMUL
380(2)
The Limitations of Macro Arguments
382(2)
Adding ASCII Digits
384(2)
Adjusting AAA's Adjustments
386(1)
Ruler's Lessons
387(1)
Storing Data to Discontinuous Strings
387(12)
Displaying an ASCII Table in a Big Hurry
388(1)
The Nature of Equates
389(2)
Assembly-Time Calculations
391(1)
Nested Instruction Loops
392(1)
Jumping When CX Goes to 0
393(1)
Closing the Inner Loop
394(1)
Closing the Outer Loop
395(1)
SHOWCHAR.ASM Recap
396(1)
The Other String Instructions
396(1)
Further Research: Building Your Assembly Language Video Toolkit
397(2)
The Programmer's View of Linux
399(52)
Where to Now?
399(3)
Why Not Windows?
400(1)
And Why Linux?
401(1)
Prerequisites---Yukkh!
402(3)
Linux Is Not Dos!
403(1)
EMACS: More than an Editor
404(1)
It's a C World
405(1)
NASM for Linux
405(3)
Installing NASM's Source Code
406(1)
Rebuilding NASM
407(1)
What's GNU?
408(5)
The Swiss Army Compiler
409(1)
Building Code the GNU Way
409(3)
How We Use gcc in Assembly Work
412(1)
Why Not gas?
413(1)
The make Utility and Dependencies
413(7)
Dependencies
414(2)
When a File Is Up to Date
416(1)
Chains of Dependencies
417(2)
Using make from within EMACS
419(1)
Understanding AT&T Instruction Mnemonics
420(7)
Examining gas Source Files Created by gcc
423(2)
AT&T Memory Reference Syntax
425(2)
Using the GNU Debugger
427(21)
Your Code, My Code, and Our Code
427(2)
Spotting Symbols in an Executable File
429(2)
Stripping Symbols out of an Executable File
431(1)
Loading a Program for Debugging
432(1)
Setting Breakpoints in gdb
433(3)
Providing Command-Line Arguments
436(1)
Examining Registers
437(1)
Examining Program Variables and Individual Registers
438(4)
Changing Register and Program Variable Values
442(1)
Single-Stepping Your Programs
443(5)
Your Work Strategy
448(3)
Put Only One Project in One Directory
448(1)
Consider EMACS Home
449(1)
Opening a Shell from inside EMACS
450(1)
Coding for Linux
451(80)
Genuflecting to the C Culture
452(3)
The Primacy of Libraries
452(1)
The INT 80H Kernel Function Interface
453(1)
C Calling Conventions
454(1)
A Framework to Build On
455(6)
Saving and Restoring Registers
457(1)
Setting Up a Stack Frame
458(2)
Destroying a Stack Frame
460(1)
The Perks of Protected Mode
461(8)
You Know Have a 386 or Better
461(1)
No Segments!
461(1)
More Versatile Registers and Addressing
462(2)
More Instructions
464(3)
Crash Protection
467(2)
Characters Out
469(7)
The Three Standard Files
471(1)
Formatted Text with printf
472(2)
Passing Arguments to printf
474(2)
Characters In
476(6)
String Input with fgets
476(2)
Using scanf for Entry of Numeric Values
478(4)
Be a Time Lord
482(9)
The C Library's Time Machine
482(1)
Fetching time_t Values from the System Clock
483(1)
Converting a time_t Value to a Formatted String
484(1)
Generating Separate Local Time Values
485(1)
Uninitialized Storage and [.bss]
486(1)
Making a Copy of clib's tm Struct with MOVSD
487(4)
Generating Random Numbers
491(13)
Seeding the Generator with srand
492(1)
Generating Pseudorandom Numbers
493(4)
Some Bits Are More Random than Others
497(2)
Calls to Addresses in Registers
499(1)
Local Labels
500(3)
Placing Constant Data in a Subroutine
503(1)
Accessing Command-Line Arguments
504(5)
Addressing the Stack Relative to EBP
505(1)
Scaled Addressing
506(3)
Simple File I/O
509(16)
Converting Strings into Numbers with sscanf
510(1)
Creating and Opening Files
511(2)
Reading Text from Files with fgets
513(3)
Writing Text to Files with fprintf
516(2)
Gathering Your Subroutines into Libraries
518(7)
Conclusion Not the End, But Only the Beginning
525(6)
Where to Now?
527(2)
Stepping off Square One
529(2)
Appendix A Partial 8086/8088 Instruction Set Reference 531(64)
Appendix B Segment Register Assumptions for Real Mode Segmented Model 595(2)
Appendix C Web URLs for Assembly Programmers 597(2)
Appendix D Segment Register Assumptions 599(2)
Appendix E What's on the CD-ROM? 601(2)
Index 603

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