EXTENDING DOS a Programmers's Guide to Protected-Mode DOS Second Edition
Total Page:16
File Type:pdf, Size:1020Kb
EXTENDING DOS A Programmers's Guide to Protected-Mode DOS Second Edition Edited by Ray Duncan Ray Duncan Charles Petzold Andrew Schulman M. Steven Baker Ross P. Nelson Stephen R. Davis Robert Moote Addison-Wesley Publishing Company, Inc. Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan Paris Seoul Milan Mexico City Taipei Chapter 1—Programming the IBM PC j By Ross P. Nelson DOS Lives -i The Quest for RAM 2 The IBM PC Architecture 5 A New Family Member 7 Solving Real Problems IQ Using Protected Mode 25 DOS Extenders 23 Intel's 32-bit Microprocessors 24 Operating Environments 3Q What About OS/2? 31 Choosing Your Market 32 Chapter 2—Expanded Memory and the EMS 35 By Ray Duncan Components of Expanded Memory 37 Obtaining Access to Expanded Memory 40 Using Expanded Memory 44 EMS Pitfalls for Drivers and TSRs 49 EMS Emulators 52 EMS Example Program 54 Chapter 3—Extended Memory and the XMS 75 By Ray Duncan Reaching Extended Memory in Real Mode 78 The ROM BIOS Extended Memory Functions 79 Primitive Extended Memory Management 85 The eXtended Memory Specification (XMS) EXTENDING DOS, Second Edition Programming Example: The XMSDISK.SYS Driver 96 XMS Example Program 97 LOADALL: The Back Door to Extended Memory 116 Chapter 4—16-bit Protected-Mode DOS Extenders 121 By Andrew Schulman 123 Isn't the 286 Outdated? 124 DOS: The Outer Limits Protected-Mode MS-DOS ^7 No More Overlays BigMalloc Protected-Mode C++ Creating the Illusion 143 INT 21h Isn't Enough 146 The RUN286 Loader 150 Compatibility 153 Debugging with CVP and TDW under DOS 159 Isn't There Any Work Involved? 162 Bugs! 164 Real-Mode Practices 173 Limits to Transparency 188 New Features 191 Benefits and Limitations 295 Chapter 5—32-bit Protected-Mode DOS Extenders By M. Steven Baker 196 Looking Back in Time 202 Onward to 32 Bits 206 Benefits of Using 386 Protected-Mode DOS Extenders 20216 The 386 Dos Extenders—How They Work 220 Software Interrupt Processing 223 Hardware Choices 228 Moving to 32-bit Programming—It's Easy 229 A Simple C Example n Similarities and Differences Between 386 DOS Extenders IM Contents How Windows 3.0 Bugs Affect DOS Extenders 252 Special DOS Extender Features 263 A Simple 386 DOS Extender Application 277 Summary 2«9 Chapter 6—The Windows Operating Environment 291 By Charles Petzold Windows: A GUI for MS-DOS 292 The Future of Windows 296 Commitments and Trade-offs 298 Architecture and Features 299 A Sample Program 319 The 32-Bit Future 343 Chapter 7—DESQview ^45 By Stephen R. Davis Quarterdeck Expanded Memory Manager 345 DESQview 348 The DESQview API 350 The Clock Example 353 Windowing 3g4 Panels 368 DESQview Tasks 372 DESQview Processes 376 Memory Under DESQview 379 Intertask Communication 3g4 Intertask Messages 3og How DESQview Uses Messages 393 Why Use DESQview? 401 Chapter 8—VCPI for EMS/DOS Extender Compatibility 403 By Robert Moote End-User Encounters with VCPI 404 Why VCPI: Incompatibilities Between EMS Emulators and DOS Extenders 407 The VCPI Interface 412 vi EXTENDING DOS, Second Edition ScenarioofVCPIUse 418 InsideVCPI 423 Summary 4^2 Chapter 9—The DOS Protected-Mode Interface (DPMI) 433 By Ray Duncan The Politics of Protected Mode 434 The DPMI Programming Interface 438 Using DPMI Functions 443 Programming Example: TheTINYDOSX.ASM DOS Extender 448 Chapter 10—Multitasking and DOS Extenders 463 By Robert Moote Windows Standard Mode 464 Windows Enhanced Mode and DPMI 465 DESQview and VCPI 476 Windows/DPMI vs. DESQview/VCPI 481 482 Summary 483 Appendix A 491 Appendix B 495 Appendix C 499 Appendix D 511 Appendix E Exploring Protected Mode with Instant-C 511 Using Protection 515 Appendix F ^ Documents and Specifications 5zy Index 531 .