home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / docum / advdos.doc / s0 next >
Encoding:
Text File  |  1992-04-21  |  8.8 KB  |  268 lines

  1. Advanced MS-DOS Programming
  2.  
  3.  
  4. ════════════════════════════════════════════════════════════════════════════
  5.  
  6.  
  7. Advanced MS-DOS Programming
  8.  
  9. The Microsoft(R) Guide for Assembly Language and C Programmers
  10.  
  11. By Ray Duncan
  12.  
  13.  
  14. ════════════════════════════════════════════════════════════════════════════
  15.  
  16.  
  17.   PUBLISHED BY
  18.   Microsoft Press
  19.   A Division of Microsoft Corporation
  20.   16011 NE 36th Way, Box 97017, Redmond, Washington 98073-9717
  21.   Copyright (C) 1986, 1988 by Ray Duncan
  22.   Published 1986. Second edition 1988.
  23.   All rights reserved. No part of the contents of this book may be
  24.   reproduced or transmitted in any form or by any means without the written
  25.   permission of the publisher.
  26.   Library of Congress Cataloging in Publication Data
  27.  
  28.   Duncan, Ray, 1952-
  29.   Advanced MS-DOS programming.
  30.   Rev. ed. of: Advanced MS-DOS. (C)1986.
  31.   Includes index.
  32.   1. MS-DOS (Computer operating system)  2. Assembler language
  33.   (Computer program language)  3. C (Computer program language)
  34.   I. Duncan, Ray, 1952-    Advanced MS-DOS.    II. Title.
  35.   QA76.76.063D858      1988      005.4'46      88-1251
  36.   ISBN 1-55615-157-8
  37.   Printed and bound in the United States of America.
  38.  
  39.   1 2 3 4 5 6 7 8 9    FGFG    3 2 1 0 9 8
  40.  
  41.   Distributed to the book trade in the United States by Harper & Row.
  42.  
  43.   Distributed to the book trade in Canada by General Publishing Company,
  44.   Ltd.
  45.  
  46.   Penguin Books Ltd., Harmondworth, Middlesex, England
  47.   Penguin Books Australia Ltd., Ringwood, Victoria, Australia
  48.   Penguin Books N.Z. Ltd., 182-190 Wairu Road, Auckland 10, New Zealand
  49.  
  50.   British Cataloging in Publication Data available
  51.  
  52.   IBM(R), PC/AT(R), and PS/2(R) are registered trademarks of International
  53.   Business Machines Corporation. CodeView(R), Microsoft(R), MS-DOS(R), and
  54.   XENIX(R) are registered trademarks and InPort TM is a trademark of
  55.   Microsoft Corporation.
  56.  
  57.   ──────────────────────────────────────────────────────────────────────────
  58.       Technical Editor: Mike Halvorson  Production Editor: Mary Ann Jones
  59.   ──────────────────────────────────────────────────────────────────────────
  60.  
  61.  
  62.  
  63.                                   Dedication
  64.  
  65.                                   For Carolyn
  66.  
  67.  
  68.  
  69. ────────────────────────────────────────────────────────────────────────────
  70. Contents
  71.  
  72.   Road Map to Figures and Tables
  73.  
  74.   Acknowledgments
  75.  
  76.   Introduction
  77.  
  78.   SECTION 1   PROGRAMMING FOR MS-DOS
  79.  
  80.   Chapter 1   Genealogy of MS-DOS
  81.  
  82.   Chapter 2   MS-DOS in Operation
  83.  
  84.   Chapter 3   Structure of MS-DOS Application Programs
  85.  
  86.   Chapter 4   MS-DOS Programming Tools
  87.  
  88.   Chapter 5   Keyboard and Mouse Input
  89.  
  90.   Chapter 6   Video Display
  91.  
  92.   Chapter 7   Printer and Serial Port
  93.  
  94.   Chapter 8   File Management
  95.  
  96.   Chapter 9   Volumes and Directories
  97.  
  98.   Chapter 10  Disk Internals
  99.  
  100.   Chapter 11  Memory Management
  101.  
  102.   Chapter 12  The EXEC Function
  103.  
  104.   Chapter 13  Interrupt Handlers
  105.  
  106.   Chapter 14  Installable Device Drivers
  107.  
  108.   Chapter 15  Filters
  109.  
  110.   Chapter 16  Compatibility and Portability
  111.  
  112.   SECTION 2   MS-DOS FUNCTIONS REFERENCE
  113.  
  114.   SECTION 3   IBM ROM BIOS AND MOUSE FUNCTIONS REFERENCE
  115.  
  116.   SECTION 4   LOTUS/INTEL/MICROSOFT EMS FUNCTIONS REFERENCE
  117.  
  118.   Index
  119.  
  120.  
  121.  
  122.  
  123. ────────────────────────────────────────────────────────────────────────────
  124. Road Map to Figures and Tables
  125.  
  126.   MS-DOS versions and release dates
  127.  
  128.   MS-DOS memory map
  129.  
  130.   Structure of program segment prefix (PSP)
  131.  
  132.   Structure of .EXE load module
  133.  
  134.   Register conditions at program entry
  135.  
  136.   Segments, groups, and classes
  137.  
  138.   Macro Assembler switches
  139.  
  140.   C Compiler switches
  141.  
  142.   Linker switches
  143.  
  144.   MAKE switches
  145.  
  146.   ANSI escape sequences
  147.  
  148.   Video attributes
  149.  
  150.   Structure of normal file control block (FCB)
  151.  
  152.   Structure of extended file control block
  153.  
  154.   MS-DOS error codes
  155.  
  156.   Structure of boot sector
  157.  
  158.   Structure of directory entry
  159.  
  160.   Structure of fixed-disk master block
  161.  
  162.   LIM EMS error codes
  163.  
  164.   Intel 80x86 internal interrupts (faults)
  165.  
  166.   Intel 80x86, MS-DOS, and ROM BIOS interrupts
  167.  
  168.   Device-driver attribute word
  169.  
  170.   Device-driver command codes
  171.  
  172.   Structure of BIOS parameter block (BPB)
  173.  
  174.   Media descriptor byte
  175.  
  176.  
  177.  
  178. ────────────────────────────────────────────────────────────────────────────
  179. Acknowledgments
  180.  
  181.   My renewed thanks to the outstanding editors and production staff at
  182.   Microsoft Press, who make beautiful books happen, and to the talented
  183.   Microsoft developers, who create great programs to write books about.
  184.   Special thanks to Mike Halvorson, Jeff Hinsch, Mary Ann Jones, Claudette
  185.   Moore, Dori Shattuck, and Mark Zbikowski; if this book has anything unique
  186.   to offer, these people deserve most of the credit.
  187.  
  188.  
  189.  
  190. ────────────────────────────────────────────────────────────────────────────
  191. Introduction
  192.  
  193.   Advanced MS-DOS Programming is written for the experienced C or
  194.   assembly-language programmer. It provides all the information you need to
  195.   write robust, high-performance applications under the MS-DOS operating
  196.   system. Because I believe that working, well-documented programs are
  197.   unbeatable learning tools, I have included detailed programming examples
  198.   throughout──including complete utility programs that you can adapt to your
  199.   own needs.
  200.  
  201.   This book is both a tutorial and a reference and is divided into four
  202.   sections, so that you can find information more easily. Section 1
  203.   discusses MS-DOS capabilities and services by functional group in the
  204.   context of common programming issues, such as user input, control of the
  205.   display, memory management, and file handling. Special classes of
  206.   programs, such as interrupt handlers, device drivers, and filters, have
  207.   their own chapters.
  208.  
  209.   Section 2 provides a complete reference guide to MS-DOS function calls,
  210.   organized so that you can see the calling sequence, results, and version
  211.   dependencies of each function at a glance. I have also included notes,
  212.   where relevant, about quirks and special uses of functions as well as
  213.   cross-references to related functions. An assembly-language example is
  214.   included for each entry in Section 2.
  215.  
  216.   Sections 3 and 4 are references to IBM ROM BIOS, Microsoft Mouse driver,
  217.   and Lotus/Intel/Microsoft Expanded Memory Specification functions. The
  218.   entries in these two sections have the same form as in Section 2, except
  219.   that individual programming examples have been omitted.
  220.  
  221.   The programs in this book were written with the marvelous Brief editor
  222.   from Solution Systems and assembled or compiled with Microsoft Macro
  223.   Assembler version 5.1 and Microsoft C Compiler version 5.1. They have been
  224.   tested under MS-DOS versions 2.1, 3.1, 3.3, and 4.0 on an 8088-based IBM
  225.   PC, an 80286-based IBM PC/AT, and an 80386-based IBM PS/2 Model 80. As far
  226.   as I am aware, they do not contain any software or hardware dependencies
  227.   that will prevent them from running properly on any IBM PC─compatible
  228.   machine running MS-DOS version 2.0 or later.
  229.  
  230. Changes from the First Edition
  231.  
  232.   Readers who are familiar with the first edition will find many changes in
  233.   the second edition, but the general structure of the book remains the
  234.   same. Most of the material comparing MS-DOS to CP/M and UNIX/XENIX has
  235.   been removed; although these comparisons were helpful a few years ago,
  236.   MS-DOS has become its own universe and deserves to be considered on its
  237.   own terms.
  238.  
  239.   The previously monolithic chapter on character devices has been broken
  240.   into three more manageable chapters focusing on the keyboard and mouse,
  241.   the display, and the serial port and printer. Hardware-dependent video
  242.   techniques have been de-emphasized; although this topic is more important
  243.   than ever, it has grown so complex that it requires a book of its own. A
  244.   new chapter discusses compatibility and portability of MS-DOS applications
  245.   and also contains a brief introduction to Microsoft OS/2, the new
  246.   multitasking, protected-mode operating system.
  247.  
  248.   A road map to vital figures and tables has been added, following the Table
  249.   of Contents, to help you quickly locate the layouts of the program segment
  250.   prefix, file control block, and the like.
  251.  
  252.   The reference sections at the back of the book have been extensively
  253.   updated and enlarged and are now complete through MS-DOS version 4.0, the
  254.   IBM PS/2 Model 80 ROM BIOS and the VGA video adapter, the Microsoft Mouse
  255.   driver version 6.0, and the Lotus/Intel/Microsoft Expanded Memory
  256.   Specification version 4.0.
  257.  
  258.   In the two years since Advanced MS-DOS Programming was first published,
  259.   hundreds of readers have been kind enough to send me their comments, and I
  260.   have tried to incorporate many of their suggestions in this new edition.
  261.   As before, please feel free to contact me via MCI Mail (user name LMI),
  262.   CompuServe (user ID 72406,1577), or BIX (user name rduncan).
  263.  
  264.   Ray Duncan  Los Angeles, California  September 1988
  265.  
  266.  
  267.  
  268.