图书介绍

Intel汇编语言程序设计 第4版PDF|Epub|txt|kindle电子书版本网盘下载

Intel汇编语言程序设计 第4版
  • (美)欧文(Irvine,K.R.)著 著
  • 出版社: 北京:清华大学出版社
  • ISBN:7302112614
  • 出版时间:2005
  • 标注页数:688页
  • 文件大小:55MB
  • 文件页数:719页
  • 主题词:汇编语言-程序设计-高等学校-教材-英文

PDF下载


点此进入-本书在线PDF格式电子书下载【推荐-云解压-方便快捷】直接下载PDF格式图书。移动端-PC端通用
种子下载[BT下载速度快]温馨提示:(请使用BT下载软件FDM进行下载)软件下载地址页直链下载[便捷但速度慢]  [在线试读本书]   [在线获取解压码]

下载说明

Intel汇编语言程序设计 第4版PDF格式电子书版下载

下载的文件为RAR压缩包。需要使用解压软件进行解压得到PDF格式图书。

建议使用BT下载工具Free Download Manager进行下载,简称FDM(免费,没有广告,支持多平台)。本站资源全部打包为BT种子。所以需要使用专业的BT下载软件进行下载。如BitComet qBittorrent uTorrent等BT下载工具。迅雷目前由于本站不是热门资源。不推荐使用!后期资源热门了。安装了迅雷也可以迅雷进行下载!

(文件页数 要大于 标注页数,上中下等多册电子书除外)

注意:本站所有压缩包均有解压码: 点击下载压缩包解压工具

图书目录

1 Basic Concepts1

1.1 Welcome to Assembly Language1

1.1.1 Some Good Questions to Ask2

1.1.2 Assembly Language Applications7

1.1.3 Section Review8

1.2 Virtual Machine Concept8

1.2.1 The History of PC Assemblers11

1.3 Data Representation12

1.2.2 Section Review12

1.3.1.1 Unsigned Binary Integers13

1.3.1 Binary Numbers13

1.3.1.2 Translating Unsigned Binary Integers to Decimal14

1.3.1.3 Translating Unsigned Decimal Integers to Binary14

1.3.2 Binary Addition15

1.3.3 Integer Storage Sizes16

1.3.4 Hexadecimal Integers16

17.2.2 Immediate Operands17

17 Advanced Topics17

17.2.4 Memory-Mode Instructions17

17.3.6 IA-32 Floating Point Architecture17

1.3.4.1 Converting Unsigned Hexadecimal to Decimal17

17.1.1 Input-Output Ports17

17.1.1.1 PC Sound Program17

17.2.3 Register-Mode Instructions17

17.2.4.1 MOV Instruction Examples17

17.2.5 Section Review17

17.3 Floating-Point Arithmetic17

17.3.1 IEEE Binary Floating-Point Representation17

17.3.1.2 The Mantissa17

17.3.2 The Exponent17

17.3.3 Normalizing the Mantissa17

17.3.4 Creating the IEEE Bit Representation17

17.3.5 Converting Decimal Fractions to Binary Reals17

17.3.7 Instruction Formats17

17.3.8 Floating-Point Code Examples17

17.3.8.1 Example 1:Evaluating an Expression17

17.1 Hardware Control Using I/O Ports17

17.2 Intel Instruction Encoding17

17.2.1 Single-Byte Instructions17

17.3.1.1 The Sign17

1.3.4.2 Converting Unsigned Decimal to Hexadecimal18

1.3.5 Signed Integers18

1.3.5.1 Two's Complement Notation19

1.3.5.2 Maximum and Minimum Values21

1.3.6 Character Storage21

Contents23

Preface23

1.3.7 Section Review23

1.4 Boolean Operations25

1.4.1 Truth Tables for Boolean Functions27

1.4.2 Section Review29

1.5 Chapter Summary29

2 IA-32 Processor Architecture31

2.1 General Concepts31

2.1.1 Basic Microcomputer Design32

2.1.2 Instruction Execution Cycle33

2.1.2.1 Multi-Stage Pipeline34

2.1.2.2 Superscalar Architecture36

2.1.3 Reading from Memory37

2.1.4 How Programs Run38

2.1.4.1 Load and Execute Process38

2.1.4.2 Multitasking39

2.1.5 Section Review40

2.2 IA-32 Processor Architecture41

2.2.1 Modes of Operation41

2.2.2 Basic Execution Environment41

2.2.2.1 Address Space41

2.2.2.1 Basic Program Execution Registers42

2.2.3 Floating-Point Unit44

2.2.3.1 Other Registers44

2.2.4 Intel Microprocessor History45

2.2.4.1 IA-32 Processor Family46

2.2.4.2 P6 Processor Family46

2.2.4 3 CISC and RISC46

2.2.5 Section Review47

2.3 lA-32 Memory Management48

2.3.1 Real-address Mode48

2.3.1.1 20-bit Linear Address Calculation49

2.3.2 Protected Mode50

2.3.2.1 Flat Segmentation Model50

2.3.2.2 Multi-Segment Model51

2.3.2.3 Paging52

2.4 Components of an IA-32 Microcomputer53

2.4.1 Motherboard53

2.3.3 Section Review53

2.4.1.1 PCI Bus Architecture54

2.4.1.2 Motherboard Chipset54

2.4.2 Video Output55

2.4.3 Memory55

2.4.4 Input-Output Ports56

2.4.5 Section Review57

2.5 Input-Output System57

2.5.1 How It All Works57

2.5.2 Section Review60

2.6 Chapter Summary60

3 Assembly Language Fundamentals63

3.1 Basic Elements of Assembly Language64

3.1.1 Integer Constants64

3.1.2 Integer Expressions65

3.1.3 Real Number Constants66

3.1.4 Character Constants67

3.1.5 String Constants67

3.1.6 Reserved Words67

3.1.7 Identifiers67

3.1.8 Directives68

3.1.9 Instructions68

3.1.9.1 Label69

3.1.9.2 Instruction Mnemonic70

3.1.9.3 Operands70

3.1.9.4 Comments71

3.1.10 Section Review71

3.2 Example:Adding Three Integers72

3.2.1 Program Listing72

3.2.2 Program Output72

3.2.3 Program Description73

3.2.3.1 AItemative Version of AddSub74

3.2.4 Program Template76

3.2.5 Section Review76

3.3 Assembling,Linking,and Running Programs77

3.3.1 The Assemble-Link-Execute Cycle77

3.3.1.1 Listing File78

3.3.1.2 Files Created or Updated by the Linker79

3.3.2 Section Review80

3.4 Defining Data80

3.4.1 Intrinsic Data Types80

3.4.3 Defining BYTE and SBYTE Data81

3.4.2 Data Definition Statement81

3.4.3.1 Multiple Initializers82

3.4.3.3 Using the DUP Operator83

3 4.3.2 Defining Strings83

3.4.4 Defining WORD and SWORD Data84

3.4 5 Defining DWORD and SDWORD Data84

3.4.7 Defining TBYTE Data85

3.4.8 Defining Real Number Data85

3.4.6 Defining QWORD Data85

3.4.9 Little Endian Order86

3.4.10 Adding Variables to the AddSub Program87

3.4.11 Declaring Uninitialized Data87

3.4.12 Section Review88

3.5 Symbolic Constants89

3.5.1 Equal-Sign Directive89

3.5.2 Calculating the Sizes of Arrays and Strings90

3.5.3 EQU Directive91

3.5.4 TEXTEQU Directive92

3.5.5 Section Review93

3.6 Real-Address Mode Programming(Optional)93

3.6.1.1 The AddSub2 Program94

3.6.1 Basic Changes94

3.7 Chapter Summary95

3.8 Programming Exercises96

4 Data Transfers,Addressing,and Arithmetic97

4.1.1 Introduction98

4.1.2 Operand Types98

4.1 Data Transfer Instructions98

4.1.3 Direct Memory Operands99

4.1.4 MOV Instruction100

4.1.5 Zero/Sign Extension of Integers101

4.1.5.1 Copying Smaller Values to Larger Ones101

4.1.5.2 MOVZX Instruction102

4.1.5.3 MOVSX Instruction103

4.1.6 LAHF and SAHF Instructions103

4.1.7 XCHG Instruction104

4.1.8 Direct-Offset Operands104

4.1.9 Example Program(Moves)105

4.1.10 Section Review106

4.2 Addition and Subtraction107

4.2.1 INC and DEC Instructions107

4.2.3 SUB Instruction108

4.2.2 ADD Instruction108

4.2.4 NEG Instruction109

4.2.5 Implementing Arithmetic Expressions109

4.2.6 Flags Affected by Arithmetic110

4.2.6.1 Zero and Sign Flags110

4.2.6.2 Carry Flag(unsigned arithmetic)110

4.2.6.3 Overflow Flag(signed arithmetic)111

4.2.7 Example Program(AddSub3)113

4.2.8 Section Review114

4.3 Data-Related Operators and Directives115

4.3.1 OFFSET Operator115

4.3.1.1 OFFSET Example115

4.3.2 ALIGN Directive116

4.3.3 PTR Operator117

4.3.4 TYPE Operator118

4.3.5 LENGTHOF Operator118

4.3.6 SIZEOF Operator119

4.3.7 LABEL Directive119

4.3.8 Section Review120

4.4 Indirect Addressing120

4.4.1 Indirect Operands121

4.4.2 Arrays122

4.4.3 Indexed Operands123

4.4.4 Pointers124

4.4.4.1 Using the TYPDEF Operator125

4.4.5 Section Review126

4.5 JMP and LOOP Instructions127

4.5.1 JMP Instruction127

4.5 2 LOOP Instruction128

4.5.3 Summing an Integer Array129

4.5.4 Copying a String130

4.5.5 Section Review131

4.6 Chapter Summary132

4.7 Programming Exercises133

5 Procedures137

5.1 Introduction137

5.2 Linking to an External Library138

5.2.1 Background Information138

5.2.2 Section Review139

5.3 The Book's Link Library140

5.3.1 Overview140

5.3.2 Individual Procedure Descriptions141

5.3.2.1 The Irvine32.inc Include File147

5 3.3 Library Test Program148

5.3.4 Section Review152

5.4 Stack Operations153

5.4.1 Runtime Stack153

5.4.1.1 Push Operation154

5.4.1.2 Pop Operation155

5.4.1.3 Stack Applications155

5.4.2.2 POP Instruction156

5.4.2.3 PUSHFD and POPFD Instructions156

5.4.2 PUSH and POP Instructions156

5.4.2.1 PUSH Instruction156

5.4.2.4 PUSHAD,PUSHA,POPAD,and POPA157

5.4.2.5 Example:Reversing a String157

5.4.3 Section Review158

5.5 Defining and Using Procedures159

5.5.1 PROC Directive159

5.5.1.1 Defining a Procedure159

5.5.1.2 Example:Sum of Three Integers160

Documenting Procedures160

5.5.2 CALL and RET Instructions161

5.5.2.1 Call and Retum Example161

5.5.2.2 Nested Procedure Calls162

5.5.2.3 Local Labels and Global Labels163

5.5.2.4 Passing Register Arguments to Procedures164

5.5.3 Example:Summing an Integer Array164

5.5.4 Flowcharts165

5.5.5 Saving and Restoring Registers166

5.5.5.1 USES Operator166

5.5.6 Section Review168

5.6 Program Design Using Procedures169

5.6.1 Integer Summation Program(Design)170

5.6.1.1 Integer Summation Implementation172

5.7 Chapter Summary175

5.6.2 Section Review175

5.8 Programming Exercises176

6 Conditional Processing179

6.1 Introduction180

6.2 Boolean and Comparison Instructions180

6.2.1 The CPU Flags181

6.2.2 AND Instruction181

6.2.2.1 Converting Characters to Upper Case182

6.2.3 OR Instruction183

6.2.4 XOR Instruction184

6.2.6 TEST Instruction186

6.2.5 NOT Instruction186

6.2.7 CMP Instruction186

6.2.8 Setting and Clearing Individual CPU Flags188

6.2.9 Section Review188

6.3 Conditional Jumps189

6.3.1 Conditional Structures189

6.3.2 Jcond Instruction190

6.3.3 Types of Conditional Jump Instructions191

6.3 3.1 Equality Comparisons192

6.3.3.2 Unsigned Comparisons192

6.3.3.3 Signed Comparisons192

6.3.4.1 Testing Status Bits193

6.3.4 Conditional Jump Applications193

6.3.4.2 Application:Scanning an Array194

6.3.4.3 Application:String Encryption195

6.3.5 Bit Testing Instructions(Optional)198

6.3.5.1 BT Instruction198

6.3.5.2 BTC Instruction199

6.3.5.3 BTR Instruction199

6.3.5.4 BTS Instruction199

6.4 Conditional Loop Instructions200

6.3.6 Section Review200

6.4.1 LOOPZ and LOoPE Instructions200

6.4.2 LOOPNZ and LOOPNE Instructions201

6.5.1 Block-Structured IF Statements202

6.4.3 Section Review202

6.5 Conditional Structures202

6.5.2 Compound Expressions204

6.5.2.1 Logical AND Operator204

6.5.2.2 Logical OR Operator205

6.5.3 WHILE Loops205

6.5.3.1 Example:IF statement Nested in a Loop206

6.5.4 Table-Driven Selection208

6.5.5 Section Review210

6.6 Application:Finite-State Machines211

6.6.1 Validating an Input String212

6.6.2 Validating a Signed Integer213

6.6.3 Section Review216

6.7 Using the.IF Directive(Optional)217

6.7.1 Signed and Unsigned Comparisons219

6.7.2 Compound Expressions220

6.7.2.1 SetCursorPosition Example220

6.7.2.2 College Registration Example221

6 7.3 REPEAT and.WHILE Directives222

6.7.3.1 Example:Loop Containing an IF Statement222

6.8 Chapter Summary223

6.9 Programming Exercises224

7 Integer Arithmetic227

7.2 Shift and Rotate Instructions228

7.1 Introduction228

7.2.2 SHL Instruction229

7.2.1 Logical Shifts versus Arithmetic Shifts229

7.2.3 SHR Instruction230

7.2.4 SAL and SAR Instructions231

7.2.5 ROL Instruction231

7.2.6 ROR Instruction232

7.2.7 RCL and RCR Instructions232

7.2.8 SHLD/SHRD Instructions233

7.2.9 Section Review235

7.3 Shift and Rotate Applications236

7.3.1 Shifting Multiple Doublewords236

7.3.2 Binary Multiplication237

7.3.3 Displaying Binary Bits237

7.3.4 Isolating a Bit String238

7.3.5 Section Review239

7.4 Multiplication and Division Instructions239

7.4.1 MUL Instruction240

7.4.2 IMUL Instruction241

7.4.3 DIV Instruction242

7.4.4.1 CBW,CWD,CDQ Instructions243

7.4.4 Signed Integer Division243

7.4.4.2 The IDIV Instruction243

7.4.4.3 Divide Overflow244

7.4.5 Implementing Arithmetic Expressions245

7.4.6 Section Review247

7.5 Extended Addition and Subtraction248

7.5.1 ADC Instruction248

7.5.2 Extended Addition Example249

7.5.4 Section Review250

7.5.3 SBB Instruction250

7.6 ASCll and Packed Decimal Arithmetic(Optlonal)251

7.6.1 AAA Instruction252

7.6.2 AAS Instruction253

7.6.3 AAM Instruction253

7.6.4 AAD Instruction253

7.6.5.1 DAA Instruction254

7.6.5 Packed Decimal Integers254

7.6.5.2 DAS Instruction254

7.7 Chapter Summary255

7.8 Programming Exercises256

8 Advanced Procedures259

8.1 Introduction259

8.2 Local Variables260

8.2.1 LOCAL Directive261

8.3 Stack Parameters263

8.2.2 Section Review263

8.3.1 INVOKE Directive264

8.3.1.1 DDR Operator265

8.3.2 PROC Directive266

8.3.2.1 Examples267

8.3.3 PROTO Directive268

8.3.4 Passing by Value or by Reference269

8.3.3.1 ArraySum Example269

8.3.6 Example:Exchanging Two Integers271

8.3.5 Parameter Classifications271

8.3.7 Trouble-Shooting Tips272

8.3.7.1 Saving and Restoring Registers272

8.3.7.2 Wrong Operand Sizes273

8.3.7.4 Passing Immediate Values274

8.3.8 Section Review274

8.3.7.3 Passing the Wrong Type of Pointer274

8.4 Stack Frames275

8.4.1 Memory Models276

8.4.2 Language Specifiers277

8.4.2.1 STDCALL Specifier277

8.4.2.2 C Specifier278

8.4.2.3 PASCAL Specifier278

8.4.3 Explicit Access to Stack Parameters278

8.4.4 Passing Arguments by Reference280

8.4.2.1 Saving and Restoring Registers280

8.4.4.1 ArrayFill Example281

8.4.4.2 LEA Instruction282

8.4.5 Creating Local Variables282

8.4.6 ENTER and LEAVE Instructions(Optional)283

8.5 Recursion285

8.4.7 Section Review285

8.5.1 Recursively Calculating a Sum286

8.5.2 Calculating a Factorial288

8.6 Creating Multimodule Programs290

8.5.3 Section Review290

8.6.1 Example:ArraySum Program291

8.6.1.1 Include File:Function Prototypes292

8.6.1.2 Main Module292

8.6.1.3 PromptForIntegers Module293

8.6.1.4 ArraySum Module294

8.6.1.5 DisplaySum Module295

8.6.1.6 Batch File for Assembling and Linking295

8.6.2 Section Review296

8.7 Chapter Summary296

8.8 Programming Exercises298

9 Strings and Arrays301

9.1 Introduction301

9.2 String Primitive Instructions302

9.2.1 MOVSB,MOVSW,and MOVSD304

9.2.2 CMPSB,CMPSW,and CMPSD304

9.2.2.1 Example:Comparing Two Strings306

9.2.3 SCASB,SCASW,and SCASD307

9.2.4 STOSB,STOSW,and STOSD308

9.2.5 LODSB,LODSW,and LODSD308

9.2.6 Section Review309

9.3 Selected String Procedures309

9.3.1 Str_compare Procedure310

9.3.2 Str_length Procedure311

9.3.3 Str_copy Procedure311

9.3.4 Str_trim Procedure312

9.3.5 Str_ucase Procedure314

9.3.6 Section Review315

9.4 Two-Dimensional Arrays315

9.4.1 Base-Index Operands315

9.4.2 Base-Index Displacement317

9.4.3 Section Review318

9.5 Searching and Sorting Integer Arrays318

9.5.1 Bubble Sort319

9.5.2 Binary Search321

9.5.2.1 Test Program324

9.5.3 Section Review328

9.6 Chapter Summary328

9.7 Programming Exercises330

10 Structures and Macros333

10.1 Structures334

10.1.1 Defining Structures334

10.1.2 Declaring Structure Variables335

10.1.3 Referencing Structure Variables336

10.1.4 Example:Displaying the System Time338

10.1.5 Nested Structures340

10.1.6 Example:Drunkard's Walk341

10.1.7 Declaring and Using Unions344

10.1.8 Section Review346

10.2 Macros347

10.2.1 Overview347

10.2.2 Defining Macros348

10.2.3 Invoking Macros349

10.2.4 Macro Examples350

10.2.4.1 mWriteStr Macro351

10.2.4.2 mReadStr Macro352

10.2.4.3 mGotoxy Macro352

10.2.4.4 mDumpMem Macro353

10.2.4.5 Macros Containing Code and Data354

10.2.5 Nested Macros355

10.2.6 Example Program:Wrappers356

10.2.7 Section Review357

10.3 Conditional-Assembly Directives358

10.3.1 Checking for Missing Arguments359

10.3.2 Default Argument Initializers360

10.3.3 Boolean Expressions360

10.3.4 IF,ELSE,and ENDIF Directives361

10.3.5 The IFIDN and IFIDNI Directives362

10.3.6 SpecialOperators363

10.3.6.1 Substitution Operator( )363

10.3.6.2 Expansion Operator(%)364

10.3.6.3 Literal-Text Operator(<>)366

10.3.6.4 Literal-Character Operator (!)366

10.3.7 Macro Functions367

10.3.8 Section Review369

10.4 Defining Repeat Blocks370

10.4.1 WHILE Directive370

10.4.2 REPEAT Directive371

10.4.3 FOR Directive371

10.4.4 FORC Directive372

10.4.5 Example:Linked List373

10.5 Chapter Summary375

10.4.6 Section Review375

10.6 Programming Exercises376

11 32-Bit Windows Programming379

11.1 Win32 Console Programming379

11.1.1 Background Information381

11.1.1.1 Windows DataTypes382

11.1.1.2 Console Handles383

11.1.2 Win32 Console Functions384

11.1.3 Console Input386

11.1.3.1 ReadConsole Function387

11.1.3.2 Single-Character Input388

11.1.4 Console Output389

11.1.4.3 Example Program:Console1390

11.1.4.1 Data Structures390

11.1.4.2 WriteConsole Function390

11.1.4.4 WriteConsoleOutputCharacter Function391

11.1.5.1 CreateFile Function392

11.1.5 Reading and Writing Files392

11.1.5.4 WriteFile Function395

11.1.5.3 ReadFile Function395

11.1.5.2 CloseHandle Function395

11.1.5.5 Example WriteFile Program396

11.1.5.6 Moving the File Pointer397

11.1.5.7 Example ReadFile Program397

11.1.6 Console Window Manipulation398

11.1.6.2 GetConsoleScreenBufferlnfo399

11.1.6.1 SetConsoleTitle399

11.1.6.3 SetConsoleWindowlnfo Function400

11.1.6.4 SetConsoleScreenBufferSize Function402

11.1.7 Controlling the Cursor402

11.1.7.1 GetConsoleCursorlnfo Function402

11.1.7.2 SetConsoleCursorlnfo Function402

11.1.7.3 SetConsoleCursorPosition403

11.1.8.1 SetConsoleTextAttribute Function403

11.1.8 Controlling the Text Color403

11.1.8.2 WriteConsoleOutputAttribute Function403

11.1.8.3 Example WriteColors Program403

11.1.9 Time and Date Functions405

11.1.9.1 GetLocalTime and SetLocalTime406

11.1.9.3 Sleep Function407

11.1.9.2 GetTickCount Function407

11.1.9.4 GetDateTime Procedure408

11.1.9.5 Creating a Stopwatch Timer409

11.1.10 Section Review410

11.2 Writing a Graphical Windows Application411

11.2.1 Necessary Structures412

11.2.2 The MessageBox Function413

11.2.3 The WinMain Procedure414

11.2.4 The WinProc Procedure414

11.2.5 The ErrorHandler Procedure415

11.2.6 Program Listing416

11.2.6.1 Running the Program419

11.2.7 Section Review420

11.3.1 Linear Addresses421

11.3.1.1 Translating Logical Addresses to Linear Addresses421

11.3 IA-32 Memory Management421

11.3.1.2 Paging423

11.3.1.3 Descriptor Tables424

11.3.2 Page Translation425

11.3.1.4 Segment Descriptor Details425

11.3.2.1 MS-Windows Virtual Machine Manager426

11.3.3 Section Review427

11.4 Chapter Summary428

11.5 Programming Exercises429

12.1 Introduction431

12.1.1 General Conventions431

12 High-Level Language Interface431

12.2.1 _asm Directive in Microsoft Visual C++433

12.1.2 Section Review433

12.2 Inline Assembly Code433

12.2.1.1 Using the LENGTH,TYPE,and SIZE Operators435

12.2.2 File Encryption Example436

12.2.2.1 Procedure Call Overhead437

12.2.3 Section Review439

12.3 Linking to C++ Programs439

12.3.1 Linking to Borland C++440

12.3.2 ReadSector Example441

12.3.2.1 Main C++ Program That Calls ReadSector442

12.3.2.2 Assembly Language Module444

12.3.3 Example:Large Random Integers446

12.3.4 Using Assembly Language to Optimize C++ Code448

12.3.4.1 FindArray Code Generated by Visual C++449

12.3.4.2 Linking MASM to Visual C++450

12.3.5 Section Review454

12.4 Chapter Summary455

12.5 Programming Exercises456

13 16-Bit MS-DOS Programming457

13.1 MS-DOS and the IBM-PC457

13.1.1 Memory Organization458

13.1.2 Redirecting Input-Output460

13.1.3 Software Interrupts461

13.1.4 INT Instruction461

13.1.4.1 Interrupt Vectoring461

13.1.4.2 Common Interrupts462

13.1.5 Section Review462

13.2 MS-DOS Function Calls(INT 21h)463

13.2.1 Selected Output Functions464

13.2.2 Hello World Program Example467

13.2.3 Selected Input Functions467

13.2.3.1 Example:String Encryption Program469

13.2.3.2 Int 21h Function 3Fh470

13.2.4 Date/Time Functions472

13.2.4.1 Example:Displaying the Time and Date474

13.3 Standsrd MS-DOS File I/O Services476

13.2.5 Section Review476

13.3.0.1 Create or Open File(716Ch)478

13.3.1 Close File Handle(3Eh)479

13.3.2 Move File Pointer(42h)480

13.3.2.1 Get File Creation Date and Time481

13.3.3 Selected Library Procedures481

13.3.3.2 WriteString482

13.3.3.1 ReadString482

13.3.4 Example:Read and Copy a Text File483

13.3.5 Reading the MS-DOS Command Tail485

13.3.6 Example:Creating a Binary File487

13.3.7 Section Review490

13.4 Chapter Summary491

13.5 Chapter Exercises492

14.1 Disk Storage Systems495

14 Disk Fundamentals495

14.1.1 Tracks,Cylinders,and Sectors496

14.1.2 Disk Partitions(Volumes)498

14.1.3 Section Review499

14.2 File Systems500

14.2.1 FAT12501

14.2.2 FAT16501

14.2.3 FAT32501

14.2.4 NTFS502

14.2.5 Primary Disk Areas503

14.2.6 Section Review504

14.3 Disk Directory505

14.3.1 MS-DOS Directory Structure505

14.3.2 Long Filenames in MS-Windows508

14.3.3 File Allocation Table(FAT)510

14.3.4 Section Review511

14.4 Reading and Writing Disk Sectors(7305h)511

14.4.1 Sector Display Program513

14.4.2 Section Review517

14.5 System-Level File Functions517

14.5.1 Get Disk Free Space(7303h)518

14.5.1.1 Disk Free Space Program519

14.5.3 Remove Subdirectory(3Ah)521

14.5.2 Create Subdirectory (39h)521

14.5.6 Section Review522

14.5.5 Get Current Directory(47h)522

14.5.4 Set Current Directory(3Bh)522

14.6 Chapter Summary523

14.7 Programming Exercises524

15.1 Introduction527

15 BIOS-Level Programming527

15.1.1 BIOS Data Area528

15.2 Keyboard Input with INT 16h529

15.2.1 How the Keyboard Works530

15.2.2.1 Set Typematic Rate(03h)531

15.2.2 INT 16h Functions531

15.2.2.2 Push Key into Keyboard Buffer(05h)531

15.2.2.3 Wait for Key(10h)532

15.2.2 4 Check Keyboard Buffer(11h)533

15.2.2.5 Get Keyboard Flags534

15.2.2.6 Clearing the Keyboard Buffer535

15.2.3 Section Review537

15.3.1 Basic Background537

15.3.1.1 Three Levels of Access537

15.3 VIDEO Programming with INT 10h537

15.3.1.2 Running Programs in Full-Screen Mode538

15.3.1.3 Understanding Video Text538

15.3.2 Controlling the Color539

15.3.2.1 Mixing Primary Colors539

15.3.2.2 Attribute Byte540

15.3.3 INT 10h Video Functions541

15.3.3.1 Set Video Mode(00h)542

15.3.3.2 15.3.3.Set Cursor Lines(01h)543

15.3.3.3 Set Cursor Position(02h)544

15.3.3.4 Get Cursor Position and Size(03h)544

15.3.3.5 Scroll Window Up (06h)546

15.3.3.6 Example:Writing Text to a Window547

15.3.3.9 Write Character and Attribute(09h)548

15.3.3.8 Read Character and Attribute(08h)548

15.3.3.7 Scroll Window Down(07h)548

15.3.3.10 Write Character(0Ah)549

15.3.3.11 Toggle Blinking and Intensity Modes550

15.3.3.12 Get Video Mode Information(0Fh)550

15.3.3.13 Write String in Teletype Mode(13h)551

15.3.3.14 Example:Displaying a Color String552

15.3.4.2 Clrscr Procedure554

15.3.4 Library Procedure Examples554

15.3.4.1 Gotoxy Procedure554

15.3.5 Section Review555

15.4 Drawing Graphics Using INT 10h555

15.4.1.1 Write Graphics Pixel(0Ch)556

15.4.1 INT 10h Pixel-Related Functions556

15.4.1.2 Read Graphics Pixel(0Dh)557

15.4.2 DrawLine Program557

15.4.3 Cartesian Coordinates Program559

15.4.4 Converting Cartesian Coordinates to Screen Coordinates562

15.5 Memory-Mapped Graphics563

15.5.1 Mode 13h:320X200,256 Colors563

15.4.5 Section Review563

15.5.2 Memory-Mapped Graphics Program565

15.6.1.1 Reset Mouse and Get Status568

15.6.1 Mouse INT 33h Functions568

15.6 Mouse Programming568

15.5.3 Section Review568

15.6.1.2 Showing and Hiding the Mouse Pointer569

15.6.1.3 Get Mouse Position and Status570

15.6.1.5 Get Button Presses and Releases571

15.6.1.4 Set Mouse Position571

15.6.1.7 Miscellaneous Mouse Functions573

15.6.1.6 Setting Horizontal and Vertical Limits573

15.6.2 Mouse Tracking Program574

15.6.3 Section Review579

15.8 Chapter Exercises580

15.7 Chapter Summary580

16 Expert MS-DOS Programming583

16.1 Introduction583

16.2 Defining Segments584

16.2.1 Simplified Segment Directives584

16.2.2 Explicit Segment Definitions586

16.2.2.1 Align Type587

16.2.2.2 Combine Type587

16.2.2.3 Class Type588

16.2.2.5 Example:Multiple Data Segments588

16.2.2.4 ASSUME Directive588

16.2.3 Segment Overrides589

16.2.4 Combining Segments590

16.3 Runtime Program Structure592

16.2.5 Section Review592

16.3.1 COM Programs593

16.3.2.1 Memory Usage595

16.3.2 EXE Programs595

16.3.2.2 EXE Header596

16.3.3 Section Review597

16.4 Interrupt Handling597

16.4.1 Hardware Interrupts599

16.4.2 Interrupt Control Instructions600

16.4.3 Writing a Custom Interrupt Handler601

16.4.3.1 Ctrl-Break Handler Example602

16.4.4.1 Keyboard Example604

16.4.4 Terminate and Stay Resident Programs604

16.4.5 Application:The No_Reset Program605

Chapter 17 is an additional chapter provided as a PDF file on the CD-ROM accompanying this book.609

16.5 Chapter Summary609

16.4.6 Section Review609

Appendix A:Installing and Using the Assembler611

Appendix B:The IntelInstruction Set617

Appendix C:BIOS and MS-DOS Interrupts649

Appendix D:MASM Reference661

热门推荐