Muutke küpsiste eelistusi

Assembly Language Step-by-Step: Programming with Linux 3rd Edition [Pehme köide]

  • Formaat: Paperback / softback, 656 pages, kõrgus x laius x paksus: 226x185x41 mm, kaal: 862 g
  • Ilmumisaeg: 02-Oct-2009
  • Kirjastus: John Wiley & Sons Inc
  • ISBN-10: 0470497025
  • ISBN-13: 9780470497029
Teised raamatud teemal:
  • Pehme köide
  • Hind: 77,50 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 656 pages, kõrgus x laius x paksus: 226x185x41 mm, kaal: 862 g
  • Ilmumisaeg: 02-Oct-2009
  • Kirjastus: John Wiley & Sons Inc
  • ISBN-10: 0470497025
  • ISBN-13: 9780470497029
Teised raamatud teemal:
The eagerly anticipated new edition of the bestselling introduction to x86 assembly language The long-awaited third edition of this bestselling introduction to assembly language has been completely rewritten to focus on 32-bit protected-mode Linux and the free NASM assembler. Assembly is the fundamental language bridging human ideas and the pure silicon hearts of computers, and popular author Jeff Dunteman retains his distinctive lighthearted style as he presents a step-by-step approach to this difficult technical discipline.

He starts at the very beginning, explaining the basic ideas of programmable computing, the binary and hexadecimal number systems, the Intel x86 computer architecture, and the process of software development under Linux. From that foundation he systematically treats the x86 instruction set, memory addressing, procedures, macros, and interface to the C-language code libraries upon which Linux itself is built.





Serves as an ideal introduction to x86 computing concepts, as demonstrated by the only language directly understood by the CPU itself Uses an approachable, conversational style that assumes no prior experience in programming of any kind Presents x86 architecture and assembly concepts through a cumulative tutorial approach that is ideal for self-paced instruction Focuses entirely on free, open-source software, including Ubuntu Linux, the NASM assembler, the Kate editor, and the Gdb/Insight debugger Includes an x86 instruction set reference for the most common machine instructions, specifically tailored for use by programming beginners Woven into the presentation are plenty of assembly code examples, plus practical tips on software design, coding, testing, and debugging, all using free, open-source software that may be downloaded without charge from the Internet.
Introduction: ``Why Would You Want to Do That?'' xxvii
Another Pleasant Valley Saturday
1(14)
It's All in the Plan
1(3)
Steps and Tests
2(1)
More Than Two Ways?
3(1)
Computers Think Like Us
4(1)
Had This Been the Real Thing...
4(1)
Do Not Pass Go
5(4)
The Game of Big Bux
6(2)
Playing Big Bux
8(1)
Assembly Language Programming As a Board Game
9(6)
Code and Data
10(1)
Addresses
11(1)
Metaphor Check!
12(3)
Alien Bases
15(30)
The Return of the New Math Monster
15(1)
Counting in Martian
16(4)
Dissecting a Martian Number
18(2)
The Essence of a Number Base
20(1)
Octal: How the Grinch Stole Eight and Nine
20(4)
Who Stole Eight and Nine?
21(3)
Hexadecimal: Solving the Digit Shortage
24(4)
From Hex to Decimal and from Decimal to Hex
28(4)
From Hex to Decimal
28(1)
From Decimal to Hex
29(2)
Practice. Practice! Practice!
31(1)
Arithmetic in Hex
32(6)
Columns and Carries
35(1)
Subtraction and Borrows
35(2)
Borrows across Multiple Columns
37(1)
What's the Point?
38(1)
Binary
38(5)
Values in Binary
40(2)
Why Binary?
42(1)
Hexadecimal As Shorthand for Binary
43(2)
Prepare to Compute
44(1)
Lifting the Hood
45(32)
RAXie, We Hardly Knew Ye...
45(2)
Gus to the Rescue
46(1)
Switches, Transistors, and Memory
47(10)
One If by Land...
48(1)
Transistor Switches
48(2)
The Incredible Shrinking Bit
50(2)
Random Access
52(1)
Memory Access Time
53(1)
Bytes, Words, Double Words, and Quad Words
54(1)
Pretty Chips All in a Row
55(2)
The Shop Foreman and the Assembly Line
57(4)
Talking to Memory
58(1)
Riding the Data Bus
59(1)
The Foreman's Pockets
60(1)
The Assembly Line
61(1)
The Box That Follows a Plan
61(5)
Fetch and Execute
63(1)
The Foreman's Innards
64(1)
Changing Course
65(1)
What vs. How: Architecture and Microarchitecture
66(4)
Evolving Architectures
67(1)
The Secret Machinery in the Basement
68(2)
Enter the Plant Manager
70(7)
Operating Systems: The Corner Office
70(1)
BIOS: Software, Just Not as Soft
71(1)
Multitasking Magic
71(2)
Promotion to Kernel
73(1)
The Core Explosion
73(1)
The Plan
74(3)
Location, Location, Location
77(32)
The Joy of Memory Models
77(8)
16 Bits'll Buy You 64K
79(3)
The Nature of a Megabyte
82(1)
Backward Compatibility and Virtual 86 Mode
83(1)
16-Bit Blinders
83(2)
The Nature of Segments
85(5)
A Horizon, Not a Place
88(1)
Making 20-Bit Addresses out of 16-Bit Registers
88(2)
16-Bit and 32-Bit Registers
90(6)
General-Purpose Registers
91(2)
Register Halves
93(2)
The Instruction Pointer
95(1)
The Flags Register
96(1)
The Three Major Assembly Programming Models
96(8)
Real Mode Flat Model
97(2)
Real Mode Segmented Model
99(2)
Protected Mode Flat Model
101(3)
What Protected Mode Won't Let Us Do Anymore
104(2)
Memory-Mapped Video
104(1)
Direct Access to Port Hardware
105(1)
Direct Calls into the BIOS
106(1)
Looking Ahead: 64-Bit ``Long Mode''
106(3)
64-Bit Memory: What May Be Possible Someday vs. What We Can Do Now
107(2)
The Right to Assemble
109(46)
Files and What's Inside Them
110(11)
Binary Files vs. Text Files
111(1)
Looking at File Internals with the Bless Editor
112(4)
Interpreting Raw Data
116(1)
``Endianness''
117(4)
Text In, Code Out
121(7)
Assembly Language
121(3)
Comments
124(1)
Beware ``Write-Only'' Source Code!
124(1)
Object Code and Linkers
125(3)
Relocatability
128(1)
The Assembly Language Development Process
128(11)
The Discipline of Working Directories
129(2)
Editing the Source Code File
131(1)
Assembling the Source Code File
131(1)
Assembler Errors
132(1)
Back to the Editor
133(1)
Assembler Warnings
134(1)
Linking the Object Code File
135(1)
Linker Errors
136(1)
Testing the .EXE File
136(1)
Errors versus Bugs
137(1)
Are We There Yet?
138(1)
Debuggers and Debugging
138(1)
Taking a Trip Down Assembly Lane
139(16)
Installing the Software
139(3)
Edit the Program in an Editor
142(1)
Assemble the Program with NASM
143(3)
Link the Program with LD
146(1)
Test the Executable File
147(1)
Watch It Run in the Debugger
147(6)
Ready to Get Serious?
153(2)
A Place to Stand, with Access to Tools
155(46)
The Kate Editor
157(19)
Installing Kate
157(1)
Launching Kate
158(2)
Configuration
160(2)
Kate Sessions
162(1)
Creating a New Session
162(1)
Opening an Existing Session
163(1)
Deleting or Renaming Sessions
163(1)
Kate's File Management
164(1)
Filesystem Browser Navigation
165(1)
Adding a File to the Current Session
165(1)
Dropping a File from the Current Session
166(1)
Switching Between Session Files in the Editor
166(1)
Creating a Brand-New File
166(1)
Creating a Brand-New Folder on Disk
166(1)
Deleting a File from Disk (Move File to Trash)
166(1)
Reloading a File from Disk
167(1)
Saving All Unsaved Changes in Session Files
167(1)
Printing the File in the Editor Window
167(1)
Exporting a File As HTML
167(1)
Adding Items to the Toolbar
167(1)
Kate's Editing Controls
168(1)
Cursor Movement
169(1)
Bookmarks
169(1)
Selecting Text
170(1)
Searching the Text
171(1)
Using Search and Replace
172(1)
Using Kate While Programming
172(1)
Creating and Using Project Directories
173(2)
Focus!
175(1)
Linux and Terminals
176(10)
The Linux Console
176(1)
Character Encoding in Konsole
177(1)
The Three Standard Unix Files
178(2)
I/O Redirection
180(2)
Simple Text Filters
182(1)
Terminal Control with Escape Sequences
183(2)
So Why Not GUI Apps?
185(1)
Using Linux Make
186(8)
Dependencies
187(2)
When a File Is Up to Date
189(1)
Chains of Dependencies
189(2)
Invoking Make from Inside Kate
191(2)
Using Touch to Force a Build
193(1)
The Insight Debugger
194(7)
Running Insight
195(1)
Insight's Many Windows
195(2)
A Quick Insight Run-Through
197(3)
Pick Up Your Tools...
200(1)
Following Your Instructions
201(36)
Build Yourself a Sandbox
201(3)
A Minimal NASM Program
202(2)
Instructions and Their Operands
204(8)
Source and Destination Operands
204(1)
Immediate Data
205(2)
Register Data
207(2)
Memory Data
209(1)
Confusing Data and Its Address
210(1)
The Size of Memory Data
211(1)
The Bad Old Days
211(1)
Rally Round the Flags, Boys!
212(9)
Flag Etiquette
215(1)
Adding and Subtracting One with INC and DEC
215(1)
Watching Flags from Insight
216(2)
How Flags Change Program Execution
218(3)
Signed and Unsigned Values
221(4)
Two's Complement and NEG
221(3)
Sign Extension and MOVSX
224(1)
Implicit Operands and MUL
225(5)
MUL and the Carry Flag
227(1)
Unsigned Division with DIV
228(1)
The x86 Slowpokes
229(1)
Reading and Using an Assembly Language Reference
230(3)
Memory Joggers for Complex Memories
230(1)
An Assembly Language Reference for Beginners
231(1)
Flags
232(1)
NEG: Negate (Two's Complement;i.e., Multiply by -1)
233(4)
Flags affected
233(1)
Legal forms
233(1)
Examples
233(1)
Notes
233(1)
Legal Forms
234(1)
Operand Symbols
234(1)
Examples
235(1)
Notes
235(1)
What's Not Here...
235(2)
Our Object All Sublime
237(42)
The Bones of an Assembly Language Program
237(9)
The Initial Comment Block
239(1)
The .data Section
240(1)
The .bss Section
240(1)
The .text Section
241(1)
Labels
241(1)
Variables for Initialized Data
242(1)
String Variables
242(2)
Deriving String Length with EQU
244(2)
Last In, First Out via the Stack
246(8)
Five Hundred Plates per Hour
246(2)
Stacking Things Upside Down
248(1)
Push-y Instructions
249(2)
POP Goes the Opcode
251(2)
Storage for the Short Term
253(1)
Using Linux Kernel Services Through INT80
254(10)
An Interrupt That Doesn't Interrupt Anything
254(5)
Getting Home Again
259(1)
Exiting a Program via INT 80h
260(1)
Software Interrupts versus Hardware Interrupts
261(1)
INT 80h and the Portability Fetish
262(2)
Designing a Non-Trivial Program
264(15)
Defining the Problem
264(1)
Starting with Pseudo-code
265(1)
Successive Refinement
266(4)
Those Inevitable ``Whoops!'' Moments
270(1)
Scanning a Buffer
271(2)
``Off By One'' Errors
273(4)
Going Further
277(2)
Bits, Flags, Branches, and Tables
279(48)
Bits Is Bits (and Bytes Is Bits)
279(7)
Bit Numbering
280(1)
``It's the Logical Thing to Do, Jim...''
280(1)
The and Instruction
281(1)
Masking Out Bits
282(1)
The or Instruction
283(1)
The xor Instruction
284(1)
The not Instruction
285(1)
Segment Registers Don't Respond to Logic!
285(1)
Shifting Bits
286(3)
Shift By What?
286(1)
How Bit Shifting Works
287(1)
Bumping Bits into the Carry Flag
287(1)
The Rotate Instructions
288(1)
Setting a Known Value into the Carry Flag
289(1)
Bit-Bashing in Action
289(9)
Splitting a Byte into Two Nybbles
292(1)
Shifting the High Nybble into the Low Nybble
293(1)
Using a Lookup Table
293(2)
Multiplying by Shifting and Adding
295(3)
Flags, Tests, and Branches
298(9)
Unconditional Jumps
298(1)
Conditional Jumps
299(1)
Jumping on the Absence of a Condition
300(1)
Flags
301(1)
Comparisons with CMP
301(1)
A Jungle of Jump Instructions
302(1)
``Greater Than'' Versus ``Above''
303(1)
Looking for 1-Bits with Test
304(2)
Looking for 0 Bits with BT
306(1)
Protected Mode Memory Addressing in Detail
307(11)
Effective Address Calculations
308(1)
Displacements
309(1)
Base + Displacement Addressing
310(1)
Base + Index Addressing
310(2)
Index x Scale + Displacement Addressing
312(1)
Other Addressing Schemes
313(2)
LEA: The Top-Secret Math Machine
315(2)
The Burden of 16-Bit Registers
317(1)
Character Table Translation
318(7)
Translation Tables
318(2)
Translating with MOV or XLAT
320(5)
Tables Instead of Calculations
325(2)
Dividing and Conquering
327(66)
Boxes within Boxes
328(8)
Procedures As Boxes for Code
329(7)
Calling and Returning
336(14)
Calls within Calls
338(2)
The Dangers of Accidental Recursion
340(1)
A Flag Etiquette Bug to Beware Of
341(1)
Procedures and the Data They Need
342(1)
Saving the Caller's Registers
343(3)
Local Data
346(1)
More Table Tricks
347(2)
Placing Constant Data in Procedure Definitions
349(1)
Local Labels and the Lengths of Jumps
350(5)
``Forcing'' Local Label Access
353(1)
Short, Near, and Far Jumps
354(1)
Building External Procedure Libraries
355(12)
Global and External Declarations
356(1)
The Mechanics of Globals and Externals
357(8)
Linking Libraries into Your Programs
365(1)
The Dangers of Too Many Procedures and Too Many Libraries
366(1)
The Art of Crafting Procedures
367(4)
Maintainability and Reuse
367(1)
Deciding What Should Be a Procedure
368(2)
Use Comment Headers!
370(1)
Simple Cursor Control in the Linux Console
371(7)
Console Control Cautions
377(1)
Creating and Using Macros
378(15)
The Mechanics of Macro Definition
379(6)
Defining Macros with Parameters
385(1)
The Mechanics of Invoking Macros
386(1)
Local Labels Within Macros
387(1)
Macro Libraries As Include Files
388(1)
Macros versus Procedures: Pros and Cons
389(4)
Strings and Things
393(46)
The Notion of an Assembly Language String
393(9)
Turning Your ``String Sense'' Inside-Out
394(1)
Source Strings and Destination Strings
395(1)
A Text Display Virtual Screen
395(7)
REP STOSB, the Software Machine Gun
402(5)
Machine-Gunning the Virtual Display
403(1)
Executing the STOSB Instruction
404(1)
STOSB and the Direction Flag (DF)
405(1)
Defining Lines in the Display Buffer
406(1)
Sending the Buffer to the Linux Console
406(1)
The Semiautomatic Weapon: STOSB without REP
407(7)
Who Decrements ECX?
407(1)
The LOOP Instructions
408(1)
Displaying a Ruler on the Screen
409(1)
MUL Is Not IMUL
410(1)
Adding ASCII Digits
411(2)
Adjusting AAA's Adjustments
413(1)
Ruler's Lessons
414(1)
16-bit and 32-bit Versions of STOS
414(1)
MOVSB: Fast Block Copies
414(5)
DF and Overlapping Block Moves
416(2)
Single-Stepping REP String Instructions with Insight
418(1)
Storing Data to Discontinuous Strings
419(5)
Displaying an ASCII Table
419(1)
Nested Instruction Loops
420(1)
Jumping When ECX Goes to O
421(1)
Closing the Inner Loop
421(1)
Closing the Outer Loop
422(1)
Showchar Recap
423(1)
Command-Line Arguments and Examining the Stack
424(8)
Virtual Memory in Two Chunks
424(3)
Anatomy of the Linux Stack
427(2)
Why Stack Addresses Aren't Predictable
429(1)
Setting Command-Line Arguments with Insight
429(1)
Examining the Stack with Insight's Memory View
430(2)
String Searches with SCASB
432(7)
Repne vs. Repe
435(1)
Pop the Stack or Address It?
436(2)
For Extra Credit...
438(1)
Heading Out to C
439(64)
What's GNU?
440(5)
The Swiss Army Compiler
441(1)
Building Code the GNU Way
441(2)
How to Use gcc in Assembly Work
443(1)
Why Not gas?
444(1)
Linking to the Standard C Library
445(7)
C Calling Conventions
446(1)
A Framework to Build On
447(1)
Saving and Restoring Registers
447(1)
Setting Up a Stack Frame
448(2)
Destroying a Stack Frame
450(1)
Characters Out via puts()
451(1)
Formatted Text Output with printf()
452(4)
Passing Parameters to printf()
454(2)
Data In with fgets() and scanf()
456(6)
Using scanf() for Entry of Numeric Values
458(4)
Be a Time Lord
462(8)
The C Library's Time Machine
462(2)
Fetching time_t Values from the System Clock
464(1)
Converting a time_t Value to a Formatted String
464(1)
Generating Separate Local Time Values
465(1)
Making a Copy of glibc's tm Struct with MOVSD
466(4)
Understanding AT&T Instruction Mnemonics
470(5)
AT&T Mnemonic Conventions
470(1)
Examining gas Source Files Created by gcc
471(3)
AT&T Memory Reference Syntax
474(1)
Generating Random Numbers
475(9)
Seeding the Generator with srand()
476(1)
Generating Pseudorandom Numbers
477(5)
Some Bits Are More Random Than Others
482(1)
Calls to Addresses in Registers
483(1)
How C Sees Command-Line Arguments
484(3)
Simple File I/O
487(16)
Converting Strings into Numbers with sscanf()
487(2)
Creating and Opening Files
489(1)
Reading Text from Files with fgets()
490(3)
Writing Text to Files with fprintf()
493(1)
Notes on Gathering Your Procedures into Libraries
494(9)
Conclusion: Not the End, But Only the Beginning
503(4)
Where to Now?
504(2)
Stepping off Square One
506(1)
Appendix A Partial x86 Instruction Set Reference
507(76)
Notes on the Instruction Set Reference
510(2)
AAA: Adjust AL after BCD Addition
512(1)
ADC: Arithmetic Addition with Carry
513(2)
ADD: Arithmetic Addition
515(2)
AND: Logical AND
517(2)
BT: Bit Test
519(2)
CALL: Call Procedure
521(2)
CLC: Clear Carry Flag (CF)
523(1)
CLD: Clear Direction Flag (DF)
524(1)
CMP: Arithmetic Comparison
525(2)
DEC: Decrement Operand
527(1)
DIV: Unsigned Integer Division
528(1)
INC: Increment Operand
529(1)
INT: Software Interrupt
530(1)
IRET: Return from Interrupt
531(1)
J?: Jump on Condition
532(2)
JCXZ: Jump If CX=O
534(1)
JECXZ: Jump If ECX=O
535(1)
JMP: Unconditional Jump
536(1)
LEA: Load Effective Address
537(1)
LOOP: Loop until CX/ECX=O
538(2)
LOOPNZ/LOOPNE: Loop While CX/ECX > 0 and ZF=0
540(1)
LOOPZ/LOOPE: Loop While CX/ECX > 0 and ZF=1
541(1)
MOV: Move (Copy) Right Operand into Left Operand
542(2)
MOVS: Move String
544(2)
MOVSX: Move (Copy) with Sign Extension
546(1)
MUL: Unsigned Integer Multiplication
547(2)
NEG: Negate (Two's Complement; i.e., Multiply by -1)
549(1)
NOP: No Operation
550(1)
NOT: Logical NOT (One's Complement)
551(1)
OR: Logical OR
552(2)
POP: Pop Top of Stack into Operand
554(1)
POPA/POPAD: Pop All GP Registers
555(1)
POPF: Pop Top of Stack into 16-Bit Flags
556(1)
POPFD: Pop Top of Stack into EFlags
557(1)
PUSH: Push Operand onto Top of Stack
558(1)
PUSHA: Push All 16-Bit GP Registers
559(1)
PUSHAD: Push All 32-Bit GP Registers
560(1)
PUSHF: Push 16-Bit Flags onto Stack
561(1)
PUSHFD: Push 32-Bit EFlags onto Stack
562(1)
RET: Return from Procedure
563(1)
ROL: Rotate Left
564(2)
ROR: Rotate Right
566(2)
SBB: Arithmetic Subtraction with Borrow
568(2)
SHL: Shift Left
570(2)
SHR: Shift Right
572(2)
STC: Set Carry Flag (CF)
574(1)
STD: Set Direction Flag (DF)
575(1)
STOS: Store String
576(1)
SUB: Arithmetic Subtraction
577(2)
XCHG: Exchange Operands
579(1)
XLAT: Translate Byte via Table
580(1)
XOR: Exclusive Or
581(2)
Appendix B Character Set Charts
583(4)
Index 587
Jeff Duntemann has been writing about computing for over thirty years, and is the author of numerous books on programming, wireless networking, and system administration. He has been a columnist in Dr. Dobbs Journal, and has edited well-known programming publications like PC Techniques and Visual Developer. After hours, he enjoys blogging, astronomy, amateur radio, and writing science fiction.