home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / msdos / programmer-faq.faq < prev    next >
Encoding:
Text File  |  1995-07-25  |  135.4 KB  |  3,001 lines

  1. Subject: comp.os.msdos.programmer FAQ
  2. Newsgroups: comp.os.msdos.programmer,comp.answers,news.answers
  3. From: jeffrey.carlyle@bgamug.com (Jeffrey Carlyle)
  4. Date: 15 Nov 1994 10:08:24 GMT
  5.  
  6. Archive-name: msdos-programmer-faq/faq
  7. Comp-os-msdos-programmer-archive-name: dos-faq
  8. Posting-frequency: monthly
  9. Last-modified: 05 Sep 1994
  10.  
  11. comp.os.msdos.programmer FAQ Version 2.01
  12. -----------------------------------------
  13. Copyright (C) 1994 by Jeffrey Carlyle, Perplexic Software.  All rights
  14. reserved.  This article is not  in the public  domain,  but it  may be 
  15. redistributed  so long as  this notice,  the acknowledgments,  and the 
  16. information on obtaining the latest copy of this list are retained and
  17. no fee is charged. The code fragments may be used freely; credit would 
  18. be polite.
  19.  
  20. For October's FAQ:
  21. I'll be chacking out all the FTP sites listed in the FAQ and see that
  22. they are still working.
  23.  
  24. TABLE OF CONTENTS
  25. -----------------
  26.  
  27. Section 1.  General FAQ and Newsgroup Information
  28. -------------------------------------------------
  29.   1.01 - What is this article for? (Revised: 05/09/1994)
  30.   1.02 - Who has contributed to this article?    
  31.   1.03 - How can I search this article for a particular topic?
  32.   1.05 - Are the answers guaranteed to be correct and complete?
  33.          (Revised: 05/09/1994)
  34.   1.06 - What is comp.os.msdos.programmer about? (Revised: 05/09/1994)
  35.   1.07 - Is comp.os.msdos.programmer just for C programmers?
  36.   1.08 - What is comp.sys.ibm.pc.programmer?
  37.   1.09 - Is comp.os.msdos.programmer available as a mailing list?
  38.   1.10 - What's this "netiquette"?
  39.   1.11 - How can I learn more about Usenet?
  40.   1.12 - What other technical newsgroups should I know about?
  41.   1.13 - Where are FAQ lists archived?
  42.   1.14 - Where can I get the latest copy of this FAQ list? 
  43.   1.15 - Are there any good on-line references for PC hardware components?
  44.   1.16 - Are there any good on-line references for PC interrupts?
  45.   1.17 - What and where is "Ralf Brown's interrupt list"?
  46.          (Revised: 05/09/1994)
  47.   1.18 - Where can I find lex, yacc, and language grammars?
  48.   1.19 - What's the best book to learn programming?
  49.   1.20 - How do I use ftp?
  50.   1.21 - Why won't my code work?
  51.     
  52. Section 2.  Compile and Link
  53. ----------------------------
  54.   2.01 - What the heck is "DGROUP > 64K"? 
  55.   2.02 - How do I fix "automatic data segment exceeds 64K" or "stack
  56.          plus data exceed 64K"?
  57.   2.03 - Will Borland C code and Microsoft C code link together? 
  58.   2.04 - Why did my program bomb at run time with "floating point
  59.          formats not linked" or "floating point not loaded"?
  60.   2.05 - How can I change the stack size in Borland's C compilers? 
  61.   2.06 - What's the format of an .OBJ file? 
  62.   2.07 - What's the format of an .EXE header?
  63.   2.08 - What's the difference between .COM and .EXE formats?
  64.  
  65. Section 3.  Keyboard
  66. --------------------
  67.   3.01 - How can I read a character without echoing it to the screen,
  68.          and without waiting for the user to press the Enter key?
  69.   3.02 - How can I find out whether a character has been typed, without
  70.          waiting for one?
  71.   3.03 - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
  72.   3.04 - How can I disable the print screen function?
  73.   3.05 - How can my program turn NumLock (CapsLock, ScrollLock) on or
  74.          off?
  75.   3.06 - How can I speed up the keyboard's auto-repeat?
  76.   3.07 - What is the SysRq key for?
  77.   3.08 - How can my program tell what kind of keyboard is on the system?
  78.   3.09 - How can I tell if input, output, or stderr has been redirected?
  79.   3.10 - How can I increase the size of the keyboard buffer?
  80.   3.11 - How can I stuff characters into the keyboard buffer?
  81.  
  82. Section 4.  Disks and files
  83. ---------------------------    
  84.   4.01 - What drive was the PC booted from?
  85.   4.02 - How can I boot from drive b:?
  86.   4.03 - Which real and virtual disk drives are valid?
  87.   4.04 - How can I make my single floppy drive both a: and b:?
  88.   4.05 - How can I disable access to a drive?
  89.   4.06 - How can a batch file test existence of a directory?
  90.   4.07 - Why won't my C program open a file with a path?
  91.   4.08 - How can I redirect printer output to a file? 
  92.   4.09 - How can I redirect the output of a batch file? 
  93.   4.10 - How can I redirect stderr? 
  94.   4.11 - How can my program open more files than DOS's limit of 20?
  95.   4.12 - How can I read, create, change, or delete the volume label?
  96.   4.13 - How can I get the disk serial number? 
  97.   4.14 - What's the format of .OBJ, .EXE., .COM files?
  98.   4.15 - How can I flush the software disk cache?
  99.  
  100. Section 5.  Serial ports (COM ports)
  101. ------------------------------------    
  102.   5.01 - How do I set my machine up to use COM3 and COM4?
  103.   5.02 - How do I find the I/O address of a COM port? 
  104.   5.03 - But aren't the COM ports always at I/O addresses 3F8, 2F8, 3E8,
  105.          and 2E8?
  106.   5.04 - How do I configure a COM port and use it to transmit data?
  107.          (Revised: 05/09/1994)
  108.  
  109. Section 6.  Other hardware questions and problems
  110. -------------------------------------------------    
  111.   6.01 - Which 80x86 CPU is running my program?
  112.   6.02 - How can a C program send control codes to my printer?
  113.   6.03 - How can I redirect printer output to a file?
  114.   6.04 - Which video adapter is installed?
  115.   6.05 - How do I switch to 43- or 50-line mode?
  116.   6.06 - How can I find the Microsoft mouse position and button status?
  117.   6.07 - How can I access a specific address in the PC's memory?
  118.   6.08 - How can I read or write my PC's CMOS memory?
  119.   6.09 - How can I access memory beyond 640K?
  120.   6.10 - How can I use the protected mode? (New: 05/09/1994)
  121.  
  122. Section 7.  Other software questions and problems
  123. -------------------------------------------------    
  124.   7.01 - How can a program reboot my PC?
  125.   7.02 - How can I time events with finer resolution than the system
  126.          clock's 55 ms (about 18 ticks a second)?
  127.   7.03 - How can I find the error level of the previous program?
  128.   7.04 - How can a program set DOS environment variables?
  129.   7.05 - How can I change the switch character to - from /?
  130.   7.06 - How can I write a TSR (terminate-stay-resident utility)?
  131.   7.07 - Why does my interrupt function behave strangely?
  132.   7.08 - How can I write a device driver?
  133.   7.09 - What can I use to manage versions of software?
  134.   7.10 - What's this "null pointer assignment" after my C program
  135.          executes?
  136.   7.11 - How can a batch file tell whether it's being run in a DOS box
  137.          under Windows?
  138.   7.12 - How can my program tell if it's running under Windows?
  139.   7.13 - How can a program tell whether ANSI.SYS is installed?
  140.   7.14 - How do I copyright software that I write?
  141.  
  142. Section 8.  Downloading
  143. -----------------------    
  144.   8.01 - What are SimTel, Garbo, and Wustl?
  145.   8.02 - I have no ftp access.  How can I get files from the archives?
  146.   8.03 - Can I get archives on CD-ROM?
  147.   8.04 - Where do I find program <mumble>?
  148.   8.05 - How can I check SimTel or Garbo before I post a request for a
  149.          program?
  150.   8.06 - How do I download and decode a program I found?
  151.   8.07 - Where is UUDECODE?
  152.   8.08 - Why do I get errors when extracting from a ZIP file I downloaded?
  153.  
  154. Section 9.  Vendors and products
  155. ---------------------------------
  156.   9.01 - How can I contact Borland?
  157.   9.02 - How can I contact Microsoft?
  158.   9.03 - What's the current version of UNZIP? (Revised: 05/09/1994)
  159.   9.04 - What is the phone number for a vendor's BBS?
  160.  
  161. THE ANSWERS
  162. -----------
  163.  
  164. Section 1.  General FAQ and Newsgroup Information
  165. -------------------------------------------------
  166.  
  167.     1.01 - What is this article for?
  168.     --------------------------------
  169.     (Revised: 05/09/1994)
  170.  
  171.     This is the FAQ (Frequently Asked Questions) list for the newsgroup
  172.     comp.os.msdos.programmer. This list is posted monthly; new questions
  173.     and questions with revised answers are marked with "New:" or
  174.     "Revised:" and the date. When any changes occur a seperate post
  175.     with the subject line "comp.os.msdos.programmer FAQ diffs".
  176.  
  177.     FAQ lists are intended to reduce the noise level in their newsgroups
  178.     that results from the repetition of the same questions, correct
  179.     answers, wrong answers, corrections to the wrong answers,
  180.     corrections to the corrections, debate, etc.
  181.     
  182.     This list should serve as a repository of the canonical "best"
  183.     answers to the questions in it.  The names of folks who have helped
  184.     to improve this FAQ list are listed in "1.02 - Who has contributed to
  185.     this article?"
  186.     
  187.     1.02 - Who has contributed to this article?
  188.     -------------------------------------------
  189.  
  190.     This list is maintained and edited by Jeffrey Carlyle, Perplexic
  191.     Software, Bowling Green, Kentucky, USA. (jeffrey.carlyle@bgamug.com)
  192.  
  193.     The major contributor to this list is Stan Brown, the former list 
  194.     maintainer. Most of this list was written by Stan. He can be contacted
  195.     at brown@NCoast.ORG.
  196.  
  197.     Many articles posted in comp.os.msdos.programmer sparked ideas or
  198.     provided information for the first version of this list.  Though
  199.     they are not responsible for any errors, thanks are due to the
  200.     following persons for posted articles or private email that led to
  201.     improvements in this FAQ list:
  202.  
  203.     Jamshid Afshar, Mark Aitchison, Sanjay Aiyagari, George Almasi,
  204.     Aaron Auseth, Robert Baker, Preston Bannister, Scott Barman, Denis
  205.     Beauregard, Per Bergland, Mike Black, Chris Blum, Ron Bodkin, Mark
  206.     Brader, Jon Brinkmann, Andrew James Bromage, Glynn Brooks, Paul
  207.     Brooks, Ralf Brown, Shaun Burnett, D'Arcy J.M. Cain, Raymond Chen,
  208.     Denny de Jonge, Eric DeVolder, Alan Drew, Paul Ducklin, Gary Dueck,
  209.     Roland Eriksson, Mark Evans, Markus Fischer, George Forsman, Roger
  210.     Fulton, Vincent Giovannone, Robert Grunloh, B.Haible, Janos Haide,
  211.     Klaus Hartnegg, Kris Heidenstrom, Tom Haapanen, Joel Hoffman, Ari
  212.     Hovila, Chin Huang, Joe Huffman, Michael Holin, Mike Iarrobino,
  213.     Byrial Jensen, Rune Jorgensen, Ajay Kamdar, Everett Kaser, Jeff
  214.     Kellam, Jen Kilmer, Reinhard Kirchner, Dave Kirsch, Chad Knudsen,
  215.     Samuel Ko, Janne Kukonlehto, Benjamin Lee, Stephen Lee, Jim Lynch,
  216.     Greg Malknecht, Sidney Markowitz, Jim Marks, Dimitri Matzarakis,
  217.     Fred McCall, Ken McKee, Doug Merrett, Tom Milner, Bill Moore, Duncan
  218.     Murdoch, Steve Murphy, Daniel Neri, Mert Nickerson, David Nugent,
  219.     John Oldenburg, David Pape, Keith Petersen, Karl Riedling, Arthur
  220.     Rubin, Gerald Ruderman, Timo Salmi, Tapio Sand, John Schmid, Russell
  221.     Schulz, Huseyin Sevay, Ajay Shah, Bob Smith, Sean Sullivan, Steve
  222.     Summit, Tom Swingle, Anders Thulin, Curt Tilmes, Rick Watkins,
  223.     Ya-Gui Wei, Joe Wells, Scott Winder, Gregory Youngblood,
  224.     khill@vax1.umkc.edu
  225.  
  226.     1.03 - How can I search this article for a particular topic?
  227.     ------------------------------------------------------------
  228.  
  229.     To search for a particular topic, save this article to a text file
  230.     and use your favorite editor's find function to search for a word.
  231.  
  232.     You can use the MS-DOS Editor to search for a topic. Run the editor
  233.     and load the FAQ. Press ALT+S to activate the search menu then press
  234.     F. In the box that says find what enter the word you want to look for.
  235.     When you are completed, press enter. If a match is found EDIT will 
  236.     highlight it. If that is not what you were looking for press F3 and
  237.     EDIT will show you the next match.
  238.  
  239.     1.05 - Are the answerers guaranteed to be correct and complete?
  240.     --------------------------------------------------------------
  241.     (Revised: 05/09/1994)
  242.  
  243.     I have tried to test all of the facts, but THERE IS NO WARRANTY ON
  244.     THE CODE OR ON THE TECHNIQUES DESCRIBED HEREIN. Please send corrections
  245.     to jeffrey.carlyle@bgamug.com. All the code has been tested; but the
  246.     testing may not have been perfect, and machines and configurations vary.
  247.     (Except where otherwise noted, C code was tested with MSC 5, BC++ 2.0,
  248.     or BC++ 4.0.)
  249.  
  250.     The mention of particular books or programs must not be construed to
  251.     reflect unfavorably on any that are not mentioned.
  252.  
  253.     1.06 - What is comp.os.msdos.programmer about?
  254.     ----------------------------------------------
  255.     (Revised: 05/09/1994)
  256.  
  257.     comp.os.msdos.programmer (comp.sys.ibm.pc.programmer until September
  258.     1990) concerns programming for MS-DOS systems.  The article "USENET
  259.     Readership report for Jul 94" in news.lists shows 120,000 readers of
  260.     this newsgroup worldwide.  Traffic (exclusive of crossposts) was 1981
  261.     articles aggregating 3.1 Megabytes. It ranked as the 79th most popular
  262.     newsgroup.
  263.  
  264.     Much of our traffic is about language products (chiefly from Borland
  265.     and Microsoft).  More programming topics focus on C than on any one
  266.     other language, but we are not just for C programmers (see "1.07 - Is
  267.     comp.os.msdos.programmer just for C programmers?").
  268.  
  269.     Since most MS-DOS systems run on hardware that is roughly compatible
  270.     with the IBM PC, on Intel 8088, 80188, or 80x86 chips, we tend to
  271.     get a lot of questions and answers about programming other parts of
  272.     the hardware.
  273.  
  274.     1.07 - Is comp.os.msdos.programmer just for C programmers?
  275.     ----------------------------------------------------------
  276.     
  277.     No, it is for all programmers who want to share information about
  278.     programming in MS-DOS and DOS replacements like 4DOS.  Programs and
  279.     questions are also posted in Pascal, assembly, and other languages
  280.     (including MS-DOS batch programming.)
  281.  
  282.     Why does the newsgroup seem to be so C-oriented sometimes?  There
  283.     are two reasons.  First, comp.lang.c and comp.lang.pascal have
  284.     evolved in different directions.  comp.lang.pascal welcomes vendor-
  285.     specific discussion, such as Turbo Pascal.  Since so many of TP's
  286.     features are tailored to programming on PCs and in MS-DOS, Turbo
  287.     Pascal programmers tend to find DOS questions welcomed there, so
  288.     that comp.os.msdos.programmer gets less of the "DOS in Turbo Pascal"
  289.     traffic.  On the other hand, comp.lang.c has stayed closer to
  290.     talking only about the C language, and vendor-specific or operating-
  291.     system-specific questions are not welcome.  This tends to push
  292.     questions about disks, DOS file structure, video, the keyboard,
  293.     TSRs, etc. to comp.os.msdos.programmer even when those programs are
  294.     written in C.
  295.  
  296.     This FAQ is definitely C-oriented, not because that's necessarily
  297.     best but because I tried to stick to what I could verify personally.
  298.     As a C programmer (with some assembler), I could most carefully
  299.     verify solutions in C or assembler.  I felt that short, clear
  300.     programs could be published in just one language and programmers
  301.     could translate them into their languages of choice.  But the FAQ
  302.     list also contains several long programs written only in C; this is
  303.     a defect with no obvious remedy.  Most answers that point to source
  304.     code at archive sites include both C- and Pascal-language source
  305.     when available.
  306.   
  307.     1.08 - What is comp.sys.ibm.pc.programmer?
  308.     ------------------------------------------  
  309.  
  310.     comp.sys.ibm.pc.programmer is the old name of comp.os.msdos.programmer, 
  311.     and has been obsolete since September 1990.  However, many systems have
  312.     not removed the old group, or have removed it but aliased it to the
  313.     new name.  This means that some people still think they're posting
  314.     to comp.sys.ibm.pc.programmer even though they're actually posting to
  315.     comp.os.msdos.programmer.
  316.  
  317.     You can easily verify the non-existence of comp.sys.ibm.pc.programmer by
  318.     reference to the "List of Active Newsgroups" posted to news.groups.
  319.     It's available as /pub/usenet/news.answers/active-newsgroups/part1
  320.     from the archives (see "1.13 - Where are FAQ lists archived?").
  321.   
  322.     1.09 - Is comp.os.msdos.programmer available as a mailing list?
  323.     ---------------------------------------------------------------
  324.  
  325.     Sorry, no.
  326.  
  327.     1.10 - What's this "netiquette"?
  328.     --------------------------------
  329.  
  330.     Netiquette is good Usenet etiquette.  It includes basic rules like
  331.     the ones below.  (See also "1.11 - How can I learn more about
  332.     Usenet?")
  333.  
  334.     - Always read a newsgroup for a reasonable time before you post an
  335.       article to it.
  336.  
  337.     - Pick the one right group for your article; don't crosspost unless
  338.       absolutely necessary.  If you absolutely must post an article to
  339.       more than one group, do crosspost it and don't post the same
  340.       article separately to each group.  See "1.12 - What other technical
  341.       newsgroups should I know about?" when considering where to post an
  342.       article.
  343.  
  344.     - Before you post a question, make sure you're posting to the right
  345.       newsgroup; the best way to do that is to observe the preceding
  346.       rule.  Check the group's FAQ list (if it has one) to make sure
  347.       that your question isn't already answered there; see "1.13 - Where
  348.       are FAQ lists archived?".
  349.  
  350.     - When you post a question, if you ask for email responses then
  351.       promise to post a summary.  Keep your promise.  And make it a real
  352.       summary: don't just append all the email you got.  Instead, write
  353.       your own (brief) description of the solution:  this is the best
  354.       way to make sure you really understand it.
  355.  
  356.     - Before you post a follow-up, read the other follow-ups.  Very
  357.       often you'll find that someone else has already made the point you
  358.       had in mind.
  359.  
  360.     - When someone posts a question, if you want to know the answer
  361.       don't post a "me, too".  Instead send email to the poster asking
  362.       him or her to share responses with you.
  363.  
  364.     - When posting a follow-up to another posted article, remove all
  365.       headers and signature lines from the old article; just keep the
  366.       line "In <article>, so-and-so writes:".  Also cut the original
  367.       article down as much as possible; just keep enough of it to remind
  368.       readers of the context.
  369.  
  370.     - Keep lines in posted articles to 72-75 characters.  Many
  371.       newsreaders chop off column 81 or arbitrarily insert a newline
  372.       there, which makes longer lines difficult or impossible to read.
  373.       But you need to keep well below 80 characters per line to allow
  374.       for the > characters that get inserted when other people post
  375.       follow-ups to your article.
  376.  
  377.     - Keep your signature to 4 lines or less (including any graphics),
  378.       and for heaven's sake make sure it doesn't get posted twice in
  379.       your article.
  380.  
  381.     - Don't post email without first obtaining the permission of the
  382.       sender.
  383.     
  384.     1.11 - How can I learn more about Usenet?
  385.     -----------------------------------------
  386.     
  387.     There are two important newsgroups for learning about how Usenet and
  388.     newsreader software works:
  389.  
  390.     - news.announce.newusers contains periodic postings that everybody
  391.       is asked to read before posting anything to Usenet.  (In theory,
  392.       all new users are subscribed to news.announce.newusers
  393.       automatically.  But in practice not all newsreader software does
  394.       that, so that many people violate the guidelines given there
  395.       simply because they don't know about them.)
  396.  
  397.     - news.newusers.questions is described as "Q & A for users new to
  398.       the Usenet".  But new and long-time users can ask or answer
  399.       questions about Usenet and newsreader software there.  There's an
  400.       important article, "Welcome to news.newusers.questions! (weekly
  401.       posting)", that everyone is asked to read before posting to
  402.       news.newusers.questions.  (See below for ways to get a copy of
  403.       that article.)
  404.  
  405.     The following postings in news.announce.newusers might be considered
  406.     the "mandatory course" for new users:
  407.  
  408.         Introduction to news.announce.newusers
  409.         What is Usenet?
  410.         Answers to Frequently Asked Questions
  411.         Rules for posting to Usenet
  412.         A Primer on How to Work With the Usenet Community
  413.         Hints on writing style for Usenet
  414.         Emily Postnews Answers Your Questions on Netiquette
  415.  
  416.     The articles mentioned above are downloadable via ftp from
  417.     rtfm.mit.edu in the following files:
  418.  
  419.         /pub/usenet/news.answers/news-newusers-intro
  420.             Welcome to news.newusers.questions! (weekly posting)
  421.         /pub/usenet/news.answers/news-announce-intro/part1
  422.             Introduction to news.announce.newusers
  423.         /pub/usenet/news.answers/what-is-usenet/part1
  424.             What is Usenet?
  425.         /pub/usenet/news.answers/usenet-faq/part1
  426.             Answers to Frequently Asked Questions
  427.         /pub/usenet/news.answers/posting-rules/part1
  428.             Rules for posting to Usenet
  429.         /pub/usenet/news.answers/usenet-primer/part1
  430.             A Primer on How to Work With the Usenet Community
  431.         /pub/usenet/news.answers/usenet-writing-style/part1
  432.             Hints on writing style for Usenet
  433.         /pub/usenet/news.answers/emily-postnews/part1
  434.             Emily Postnews Answers Your Questions on Netiquette
  435.  
  436.     For rtfm.mit.edu instructions, see "1.13 - Where are FAQ lists
  437.     archived?"
  438.     
  439.     1.12 - What other technical newsgroups should I know about?
  440.     -----------------------------------------------------------
  441.     
  442.     Caution:  Some of these newsgroups have specialized charters; you'll
  443.     probably get flamed (and deserve it) if you post to an inappropriate
  444.     group.  Most groups have FAQ lists that will tell you what's
  445.     appropriate.  Don't post a request for the FAQ list; instead,
  446.     retrieve it yourself: see "1.13 - Where are FAQ lists archived?"
  447.  
  448.     - misc.forsale.computers.d and misc.forsale.computers.pc-clone are
  449.       where you post notices of equipment, software, or computer books
  450.       that you want to sell.  Please don't post or crosspost those
  451.       notices to comp.os.msdos.programmer.
  452.  
  453.     - comp.os.ms-windows.programmer.* groups (formerly part of
  454.       comp.windows.ms.programmer):  Similar to comp.os.msdos.programmer,
  455.       but focus on programming for the MS-Windows platform.
  456.  
  457.     - comp.sys.ibm.pc.hardware is for more hardware-oriented discussions
  458.       of the machines that run DOS.
  459.  
  460.     - the various comp.lang.* groups for articles and questions on the
  461.       programming languages.  Caution:  some groups welcome discussions
  462.       that are operating-system dependent or vendor specific; others do
  463.       not.  For example, comp.lang.c is definitely _not_ for questions
  464.       about programming DOS or PC system features, even if the programs
  465.       are written in C.  On the other hand, comp.lang.pascal contains
  466.       much discussion that is specific to Turbo Pascal.
  467.  
  468.     - comp.binaries.ibm.pc.wanted: AFTER you have looked in the other
  469.       groups, this is the place to post a request for a particular
  470.       binary program.
  471.  
  472.     - comp.archives.msdos.announce (moderated) explains how to use the
  473.       archive sites, especially Garbo and SimTel, and lists files
  474.       uploaded to them.  Discussions belong in comp.archives.msdos.d,
  475.       which replaced comp.binaries.ibm.pc.archives in December 1992.
  476.  
  477.     - MSDOS-Ann mailing list, for those who cannot subscribe to the
  478.       comp.archives.msdos.announce newsgroup, lists SimTel and Garbo
  479.       uploads in digest format.  Instructions are downloadable as
  480.  
  481.         /pc/MSDOSANN.ZIP from Garbo
  482.         /pub/msdos/info/msdosann.zip from SimTel.
  483.  
  484.     - comp.binaries.ibm.pc.d is for discussions about programs posted in
  485.       comp.binaries.ibm.pc, and only those programs.  This is a good
  486.       place to report bugs in the programs, but not to ask where to find
  487.       them (see cbip.wanted, above).  comp.binaries.ibm.pc.d is NOT supposed
  488.       to be a general PC discussion group.
  489.  
  490.     - comp.sources.misc: a moderated group for source code for many
  491.       computer systems.  It tends to get lots of Unix stuff, but you may
  492.       also pick up some DOS-compatible code here.
  493.  
  494.     - alt.sources: an unmoderated group for source code.  Guidelines are
  495.       posted periodically.
  496.  
  497.     - comp.os.msdos.programmer.turbovision is specifically for
  498.       programming in Turbo Vision.
  499.     
  500.     - rec.games.programmer discusses many graphics programming topics.
  501.     
  502.     1.13 - Where are FAQ lists archived?
  503.     ------------------------------------
  504.     
  505.     Very possibly the FAQ list you want is already at your site.  Check
  506.     the newsgroup news.answers; if your site doesn't carry news.answers,
  507.     check comp.answers, rec.answers, etc., according to the top-level
  508.     name in the FAQ list's "home" newsgroup.  Articles are posted to the
  509.     *.answers groups in a way that should make them last until the next
  510.     versions are posted.  If they expire sooner at your site, you might
  511.     want to lobby your sysadmin to treat the moderated *.answers groups
  512.     as a special case and grant them longer expiration times than other
  513.     groups.
  514.  
  515.     To ftp most FAQ lists, connect to rtfm.mit.edu, and change to
  516.     directory /pub/usenet/news.answers.  The name of the file that you
  517.     want is the Archive-name from the top of the article.  For instance,
  518.     if the Archive-name is software-eng/part1 you would retrieve
  519.     /pub/usenet/news.answers/software-eng/part1.
  520.  
  521.     By email (only if you have no ftp access, please), the server is
  522.     mail-server@rtfm.mit.edu .  It accepts "send" commands that omit the
  523.     leading "/pub/" from file names; for example:
  524.  
  525.         send usenet/news.answers/software-eng/part1
  526.  
  527.     For full instructions about the mail server, send it a message
  528.     consisting of these two lines:
  529.  
  530.         help
  531.         index
  532.  
  533.     Not just FAQ lists, but every article listed in the "List of
  534.     Periodic Informational Postings" (LoPIP) can be obtained by ftp or
  535.     email from rtfm.mit.edu.  If you have an old copy of an
  536.     informational article, look for an "Archive-name" at the beginning;
  537.     rtfm.mit.edu stores it under that name in /pub/usenet/news.answers.
  538.     If the article has no Archive-name, check the first name on the
  539.     Newsgroups line and change to that directory under /pub/usenet.
  540.  
  541.     Or send email >>> with valid reply-to address << to brown@ncoast.org
  542.     and you'll receive my canned instructions (about 8K) for retrieving
  543.     FAQ lists for most newsgroups, including a few that aren't archived
  544.     at rtfm.mit.edu.  (This offer may be withdrawn without notice
  545.     depending on system constraints.)
  546.     
  547.     1.14 - Where can I get the latest copy of this FAQ list? 
  548.     --------------------------------------------------------
  549.  
  550.     You can retrieve the latest version of this list as
  551.  
  552.         /pub/msdos/info/faqp*.zip from SimTel
  553.         /pc/doc-net/faqp*.zip from Garbo.
  554.  
  555.     Check the date before downloading, to make sure that the archived
  556.     version is actually newer than what you have.
  557.  
  558.     Like most FAQ lists, this one is archived at rtfm.mit.edu and a
  559.     number of mirror sites.  If you have ftp access, retrieve either of
  560.     these identical files:
  561.  
  562.         /pub/usenet/news.answers/msdos-programmer-faq/faq
  563.         /pub/usenet/comp.os.msdos.programmer/dos-faq
  564.  
  565.     If you have no ftp access, see "1.13 - Where are FAQ lists archived?"
  566.     for instructions on retrieving it by email.
  567.  
  568.     1.15 - Are there any good on-line references for PC hardware components?
  569.     ------------------------------------------------------------------------
  570.     
  571.     Good reports of HELPPC21 have been posted.  It is downloadable as
  572.  
  573.         /pub/msdos/info/helppc21.zip at SimTel
  574.         /pc/programming/helppc21.zip at Garbo.
  575.  
  576.     This hypertext system contains much information on ports and other
  577.     hardware, as well as some overlap with Ralf Brown's interrupt list
  578.     (1.17).  It is shareware ($25).
  579.     
  580.     1.16 - Are there any good on-line references for PC interrupts?
  581.     ---------------------------------------------------------------
  582.     
  583.     The definitive work is Ralf Brown's interrupt list; see 1.17.
  584.     
  585.     1.17 - What and where is "Ralf Brown's interrupt list"?
  586.     -------------------------------------------------------
  587.     (Revised: 05/09/1994)
  588.  
  589.     This is megabytes of information on documented and (officially)
  590.     undocumented BIOS and DOS interrupts, DOS tables, and interrupts
  591.     hooked by many software packages.
  592.  
  593.     inter42a.zip, inter42b.zip, and inter42c.zip is the actual
  594.     list. inter42d.zip is a collection of utilities and conversion
  595.     programs for the list. The list is downloadable from:
  596.  
  597.         /pub/msdos/info/ from SimTel
  598.         /pc/programming/ from Garbo.
  599.  
  600.     These versions were uploaded in early August 1994; updates are
  601.     announced every few months in comp.archives.msdos.announce.
  602.     
  603.     1.18 - Where can I find lex, yacc, and language grammars?
  604.     ---------------------------------------------------------
  605.     
  606.     The FAQ list of the comp.compilers newsgroup answers this for Basic,
  607.     C, Pascal, and other languages.  See "1.13 - Where are FAQ lists
  608.     archived?"
  609.     
  610.     1.19 - What's the best book to learn programming?
  611.     -------------------------------------------------
  612.     
  613.     Sorry, this FAQ list cannot settle religious arguments.
  614.  
  615.     Much of the heat over this topic arises because each person believes
  616.     that the book that he or she learned from is the best book.  But
  617.     different people have very different experiences of the same book.
  618.     The only person who can tell you which is the best book for learning
  619.     a given topic is you.
  620.  
  621.     Your best bet is to go to a fairly well-stocked bookstore when you
  622.     have a couple of hours to spare.  Start at one end of the shelf and
  623.     work your way methodically through every book that looks like it
  624.     might cover what you want to learn.  Look at the tables of contents;
  625.     read a page or two from each book.  Then make your decision.  If
  626.     money is a problem, or if you're not sure of your choice, check out
  627.     your top two or three from your library.
  628.  
  629.     1.20 - How do I use ftp?
  630.     ------------------------
  631.     I was much impressed with {The Whole Internet User's Guide and
  632.     Catalog} by Ed Krol (O'Reilly & Associates, second edition ISBN
  633.     1-56592-063-5).  It gives lots of information on using ftp, email,
  634.     Telnet, Archie, etc.  As a new user of ftp (January 1993), I found
  635.     the information made me productive quickly.  (Disclosure:  Though I
  636.     don't believe it has biased my judgment, you should know that
  637.     O'Reilly sent me a free evaluation copy.)
  638.  
  639.     You may also want to look for the "Beginner's Guide to FTP", posted
  640.     periodically in comp.binaries.ibm.pc.  You can retrieve it from
  641.     rtfm.mit.edu (see "1.13 - Where are FAQ lists archived?"), in
  642.     /pub/usenet/comp.binaries.ibm.pc, as *ftp.man*.
  643.  
  644.     When downloading a file by ftp, make sure you have write access to
  645.     your working directory on your local machine, and that your disk has
  646.     enough space to hold the files.  Also make sure that if it's a ZIP
  647.     file or other binary file type, you set the protocol to binary
  648.     before downloading the file.
  649.  
  650.     1.21 - Why won't my code work?
  651.     ------------------------------
  652.     
  653.     First you need to try to determine whether the problem is in your
  654.     use of the programming language or in your use of MS-DOS and your PC
  655.     hardware.  (Your manual should tell you which features are standard
  656.     and which are vendor- or MS-DOS- or PC-specific.  You _have_ read
  657.     your manual carefully, haven't you?)
  658.  
  659.     If the feature that seems to be working wrong is something related
  660.     to your PC hardware or to the internals of MS-DOS, this group is the
  661.     right place to ask.  (Please check this FAQ list first, to make sure
  662.     your question isn't already answered here.)
  663.  
  664.     On the other hand, if your problem is with the programming language,
  665.     the comp.lang hierarchy (including comp.lang.pascal and comp.lang.c)
  666.     is probably a better resource.  Please read the other group's FAQ
  667.     list thoroughly before posting.  (These exist in comp.lang.c,
  668.     comp.lang.c++, comp.lang.modula3, comp.lang.lisp, comp.lang.perl;
  669.     they may exist in other groups as well.)  It's almost never a good
  670.     idea to crosspost between comp.os.msdos.programmer and a language
  671.     group.
  672.  
  673.     Before posting in either place, try to make your program as small as
  674.     possible while still exhibiting the bad behavior.  Sometimes this
  675.     alone is enough to show you where the trouble is.  Also edit your
  676.     description of the problem to be as short as possible.  This makes
  677.     it look more like you tried to solve the problem on your own, and
  678.     makes people more inclined to try to help you.  See also "1.10 -
  679.     What's this "netiquette"?"
  680.  
  681. Section 2.  Compile and link
  682. ----------------------------
  683.  
  684.     2.01 - What the heck is "DGROUP > 64K"?
  685.     ---------------------------------------
  686.  
  687.     This Q explains the problem; the next Q gives some remedies.
  688.  
  689.     DGROUP is a link-time group of data segments, and the compiler
  690.     typically generates code that expects DS to be pointing to DGROUP.
  691.     (Exception:  Borland's huge model has no DGROUP.)
  692.  
  693.     Here's what goes into DGROUP:
  694.  
  695.     - tiny model (all pointers near):  DGROUP holds the entire program.
  696.  
  697.     - small and medium models (data pointers near):  DGROUP holds all
  698.       globals and static variables including string literals, plus the
  699.       stack and the heap.
  700.  
  701.     - large, compact, and huge models in Microsoft (data pointers far):
  702.       DGROUP holds only initialized globals and static variables
  703.       including string literals, plus the stack and the near heap.
  704.  
  705.     - large and compact models in Borland (data pointers far): DGROUP
  706.       holds initialized and uninitialized globals and static variables
  707.       including string literals, but not the stack or heap.
  708.  
  709.     - huge model in Borland (data pointers far): there is no DGROUP, so
  710.       the 64K limit doesn't apply.
  711.  
  712.     In all of the above, which is to say all six models in Microsoft C
  713.     and all but huge in Borland C, DGROUP is limited to 64K including
  714.     string literals (which are treated as static data).  This limitation
  715.     is due to the Intel CPU's segmented architecture.
  716.  
  717.     For more information, see topics like "memory models" and "memory
  718.     management" in the index of your compiler manual.  Also see
  719.     TI738.asc, downloadable as part of
  720.  
  721.         /pub/msdos/turbo-c/bchelp10.zip at SimTel
  722.         /pc/turbopas/bchelp10.zip at Garbo,
  723.  
  724.     for an extended general discussion of memory usage in Borland C
  725.     programs, of which much applies to any C compiler in DOS.
  726.  
  727.     2.02 - How do I fix "automatic data segment exceeds 64K" or
  728.                "stack plus data exceed 64K"?
  729.     -----------------------------------------------------------
  730.  
  731.     These messages are a variation of "DGROUP > 64K".  For causes,
  732.     please see the preceding Q.
  733.  
  734.     If you get this error in tiny model, your program is simply too big
  735.     and you must use a different memory model.  If you get this link
  736.     error in models S, C, M, L, or Microsoft's H, there are some things
  737.     you can do.  (This error can't occur in Borland's huge model.)
  738.  
  739.     If you have one or two big global arrays, simply declare them far.
  740.     The compiler takes this to mean that any references to them will use
  741.     32-bit pointers, so they'll be in separate segments and no longer
  742.     part of DGROUP.
  743.  
  744.     Or you can use the /Gt[number] option with Microsoft or -Ff[=size]
  745.     with Borland C++ 2.0 and up.  This will automatically put variables
  746.     above a certain size into their own segments outside of DGROUP.
  747.  
  748.     Yet another option is to change global arrays to far pointers.  Then
  749.     at the beginning of your program, allocate them from the far heap
  750.     (_fmalloc() in Microsoft, farmalloc() in Borland).
  751.  
  752.     Finally, you can change to huge model (with Borland compilers, not
  753.     Microsoft).  Borland's H model still uses far pointers by default,
  754.     but "sets aside the [64K] limit" and has no DGROUP group, according
  755.     to the BC++ 2.0 Programmer's Guide.  Microsoft's H model does use
  756.     huge data pointers by default but retains DGROUP and its 64K limit,
  757.     so switching to the H model doesn't buy you anything if you have
  758.     DGROUP problems.
  759.  
  760.     2.03 - Will Borland C code and Microsoft C code link together?
  761.     ------------------------------------------------------------
  762.  
  763.     Typically this question is asked by someone who owns compiler A and
  764.     is trying to write code to link with a third-party library that was
  765.     compiled under compiler B.
  766.  
  767.     The answer to the question is, Not in general.  Here are some of the
  768.     reasons:
  769.  
  770.     - "Helper" functions (undocumented functions for stack checking,
  771.       floating-point arithmetic, and operations on longs) differ between
  772.       the two compilers.
  773.  
  774.     - The compilers may embed instructions in the object code that tell
  775.       the linker to look for their own run-time libraries.  You can use
  776.       the linker option that says to ignore such instructions: /n in
  777.       TLINK, /NOD in the Microsoft linker (the one that comes with the C
  778.       compiler, not the one that used to come with DOS).  But getting
  779.       around this problem will very likely just reveal other problems,
  780.       like different helper functions, that have no easy solution.
  781.  
  782.     Those problems will generate link-time errors.  Others may not show
  783.     up until run time:
  784.  
  785.     - Borland's compact, large, and huge models don't assume DS=SS, but
  786.       Microsoft's do.  The -Fs option on the Borland compiler, or one of
  787.       the /A options on Microsoft, should take care of this problem--
  788.       once you know that's what's going on.
  789.  
  790.     - Check conventions for ordering and packing structure members, and
  791.       for alignment of various types on byte, word, paragraph, or other
  792.       boundaries.  Again, you can generally adjust your code to match if
  793.       you know what conventions were used in compiling the "foreign"
  794.       libraries.
  795.  
  796.     - Check the obvious and make sure that your code was compiled under
  797.       the same memory model as the code you're trying to link with.
  798.       (That's necessary, but no guarantee.  Microsoft and Borland don't
  799.       use exactly the same conventions for segments and groups,
  800.       particularly in the larger memory models.)
  801.  
  802.     That said, there are some circumstances where you can link hybrids.
  803.     Your best chance of success comes if you compile in large model with
  804.     the compiler switch that says to reload DS on entry to each
  805.     function, avoid longs and floating point, use only 16-bit pointers,
  806.     suppress stack checking, and specify all libraries used in the link.
  807.  
  808.     2.04 - Why did my program bomb at run time with "floating point
  809.                formats not linked" or "floating point not loaded"?
  810.     ---------------------------------------------------------------
  811.  
  812.     These messages look similar but have very different causes.
  813.  
  814.     "floating point not loaded" is Microsoft C's run-time message when
  815.     the code requires a numeric coprocessor but your computer doesn't
  816.     have one installed.  If the program is yours, relink it using the
  817.     xLIBCE or xLIBCA library (where x is the memory model).
  818.  
  819.     "floating point formats not linked" is a Borland run-time error
  820.     (Borland C or C++, Turbo C or C++).  Borland's compilers try to be
  821.     smart and not link in the floating-point (f-p) library unless you
  822.     need it.  Alas, they all get the decision wrong.  One common case is
  823.     where you don't call any f-p functions, but you have %f or other f-p
  824.     formats in scanf() or printf() calls.  The cure is to call an f-p
  825.     function, or at least force one to be present in the link.
  826.  
  827.     To do that, define this function somewhere in a source file but
  828.     don't call it:
  829.  
  830.         static void forcefloat(float *p) {
  831.             float f = *p;
  832.             forcefloat(&f);
  833.         }
  834.  
  835.     It doesn't have to be in the module with the main program, as long
  836.     as it's in a module that will be included in the link.
  837.  
  838.     If you have Borland C++ 3.0, the README file documents a slightly
  839.     less ugly work-around.  Insert these statements in your program:
  840.  
  841.         extern unsigned _floatconvert;
  842.         #pragma extref _floatconvert
  843.  
  844.     2.05 - How can I change the stack size in Borland's C compilers?
  845.     ----------------------------------------------------------------
  846.  
  847.     In Turbo C, Turbo C++, and Borland C++, you may not find "stack
  848.     size" in the index but the global variable _stklen should be there.
  849.     The manual will instruct you to put a statement like
  850.  
  851.         extern unsigned _stklen = 54321U;
  852.  
  853.     in your code, outside of any function.  You must assign the value
  854.     right in the extern statement; it won't work to assign a value at
  855.     run time.  The linker may give you a duplicate symbol warning, which
  856.     you can ignore.
  857.  
  858.     2.06 - What's the format of an .OBJ file?
  859.     -----------------------------------------
  860.  
  861.     - base .OBJ format:  Intel's document number #121748-001, {8086
  862.       Relocatable Object Module Formats}.  (not verified)
  863.  
  864.     Both Microsoft and Borland have extended the .OBJ format, as has IBM
  865.     for OS/2; and according to the MS-DOS encyclopedia, Microsoft
  866.     doesn't actually use all the listed formats.
  867.  
  868.     - Microsoft-specific .OBJ formats:
  869.  
  870.       * The .OBJ format document dated 14 Dec 1992, a WinHelp file from
  871.         the Microsoft developer's CD-ROM (266K after unzipping), is
  872.         downloadable as
  873.  
  874.         /vendor/microsoft/developer-network/ctech/11-9.zip from
  875.             ftp.uu.net.
  876.  
  877.       * A 45-page article can be found in the {MS-DOS Encyclopedia},
  878.         ISBN 1-55615-049-0, now out of print.
  879.  
  880.       * "Microsoft Object Module Format (OMF)" Specification, 22 Nov
  881.         1991, was published by the Microsoft Languages Group.  (not
  882.         verified)
  883.  
  884.     - Borland-specific .OBJ formats:  Open Architecture Handbook.  The
  885.       Borland Developer's Technical Guide, 1991, no ISBN.  Chapter 2,
  886.       "Object file contents", (pages 27-50) covers the comment records
  887.       sent to the object file by Borland C++ version 3.0 and other
  888.       Borland compilers.  The comment records mostly contain information
  889.       for the Borland debugger. (not verified)
  890.  
  891.     - A "tutorial on the .OBJ format" comes with the VAL experimental
  892.       linker, downloadable as
  893.  
  894.         /pub/msdos/pgmutil/val-link.zip at SimTel
  895.         /pc/assembler/linker.zoo at Garbo.
  896.  
  897.       Despite such different names, those files have the same contents,
  898.       but their contents are dated 18 Feb 1989.  You'd be better off
  899.       with one of the more recent references listed above.
  900.  
  901.     2.07 - What's the format of an .EXE header?
  902.     -------------------------------------------
  903.  
  904.     See PC Magazine 30 June 1992 (xi:12) pages 349-350 for the old and
  905.     new formats.  For a more detailed layout, look under INT 21 AH=4B in
  906.     Ralf Brown's interrupt list (Q 1.17).  That list includes extensions
  907.     for Borland's TLINK and Borland debugger info.
  908.  
  909.     Among the books that detail formats of executable files are {DOS
  910.     Programmer's Reference: 2d Edition} by Terry Dettman and Jim Kyle,
  911.     ISBN 0-88022-458-4; and {Microsoft MS-DOS Programmer's Reference},
  912.     ISBN 1-55615-329-5.
  913.  
  914.     2.08 - What's the difference between .COM and .EXE formats?
  915.     -----------------------------------------------------------
  916.  
  917.     To oversimplify:  a .COM file is a direct image of core, and an .EXE
  918.     file will undergo some further relocation when it is run (and so it
  919.     begins with a relocation header).  A .COM file is limited to 64K for
  920.     all segments combined, but an .EXE file can have as many segments as
  921.     your linker will handle and be as large as RAM can take.
  922.  
  923.     The actual file extension doesn't matter.  DOS knows that a file
  924.     being loaded is in .EXE format if its first two bytes are MZ or ZM;
  925.     otherwise it is assumed to be in .COM format.  For instance, DR-DOS
  926.     6.0's COMMAND.COM is in .EXE format.
  927.  
  928. Section 3.  Keyboard
  929. --------------------
  930.  
  931.     3.01 - How can I read a character without echoing it to the
  932.            screen, and without waiting for the user to press the
  933.            Enter key?
  934.     ------------------------------------------------------------       
  935.  
  936.     The C compilers from Microsoft and Borland offer getch() (or
  937.     getche() to echo the character); Turbo Pascal has ReadKey.
  938.  
  939.     In other programming languages, execute INT 21 AH=8; AL is returned
  940.     with the character from standard input (possibly redirected).  If
  941.     you don't want to allow redirection, or you want to capture Ctrl-C
  942.     and other special keys, use INT 16 AH=10; this will return the scan
  943.     code in AH and ASCII code (if possible) in AL, but  AL=E0 with AH
  944.     nonzero indicates that one of the grey "extended" keys was pressed.
  945.     (If your BIOS doesn't support the extended keyboard, use INT 16 AH=0
  946.     not 10.)
  947.  
  948.     3.02 - How can I find out whether a character has been typed,
  949.            without waiting for one?
  950.     -------------------------------------------------------------
  951.  
  952.     In Turbo Pascal, use KeyPressed.  Both Microsoft C and Turbo C offer
  953.     the kbhit() function.  All of these tell you whether a key has been
  954.     pressed.  If no key has been pressed, they return that information
  955.     to your program.  If a keystroke is waiting, they tell your program
  956.     that but leave the key in the input buffer.
  957.  
  958.     You can use the BIOS call, INT 16 AH=01 or 11, to check whether an
  959.     actual keystroke is waiting; or the DOS call, INT 21 AH=0B, to check
  960.     for a keystroke from stdin (subject to redirection).  See Ralf
  961.     Brown's interrupt list (Q 1.17).
  962.  
  963.     3.03 - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
  964.     ---------------------------------------------------------------
  965.  
  966.     Several utilities are downloadable from /pub/msdos/keyboard at
  967.     SimTel.  In that directory, cadel.zip contains a TSR (with source
  968.     code) to disable those keys.  Also, keykill.arc contains two
  969.     utilities:  keykill.com lets you disable up to three keys of your
  970.     choice, and deboot.com changes the boot key to leftShift-Alt-Del.
  971.  
  972.     C programmers who simply want to make sure that the user can't Ctrl-
  973.     Break out of their program can use the ANSI-standard signal()
  974.     function; the Borland compilers also offer ctrlbrk() for handling
  975.     Ctrl-Break.  However, if your program uses normal DOS input such as
  976.     getch(), ^C will appear on the screen when the user presses Ctrl-C
  977.     or Ctrl-Break.  You can avoid the ^C echo for Ctrl-C by using
  978.     _bios_keybrd() in MSC or bioskey() in BC++; however, Ctrl-Break will
  979.     still terminate the program.
  980.  
  981.     An alternative approach involves programming input at a lower level.
  982.     You can use INT 21 AH=7, which allows redirection but doesn't echo
  983.     the ^C (or any other character, for that matter); or use INT 16 AH=0
  984.     or 10; or hook INT 9 to discard Ctrl-C and Ctrl-Break before the
  985.     regular BIOS keyboard handler sees them; etc., etc.
  986.  
  987.     You should be aware that Ctrl-C and Ctrl-Break are processed quite
  988.     differently internally.  Ctrl-Break, like all keystrokes, is
  989.     processed by the BIOS code at INT 9 as soon as the user presses the
  990.     keys, even if earlier keys are still in the keyboard buffer:  by
  991.     default the handler at INT 1B is called.  Ctrl-C is not special to
  992.     the BIOS, nor is it special to DOS functions 6 and 7; it _is_
  993.     special to DOS functions 1 and 8 when at the head of the keyboard
  994.     buffer.  You will need to make sure BREAK is OFF to prevent DOS
  995.     polling the keyboard for Ctrl-C during non-keyboard operations.
  996.  
  997.     Some good general references are {Advanced MS-DOS} by Ray Duncan,
  998.     ISBN 1-55615-157-8; {8088 Assembler Language Programming:  The IBM
  999.     PC}, ISBN 0-672-22024-5, by Willen & Krantz; and {COMPUTE!'s Mapping
  1000.     the IBM PC}, ISBN 0-942386-92-2.
  1001.  
  1002.     3.04 - How can I disable the print screen function?
  1003.     ---------------------------------------------------
  1004.  
  1005.     There are really two print screen functions:  1) print current
  1006.     screen snapshot, triggered by PrintScreen or Shift-PrtSc or Shift-
  1007.     grey*, and 2) turn on continuous screen echo, started and stopped by
  1008.     Ctrl-P or Ctrl-PrtSc.
  1009.  
  1010.     1) Screen snapshot to printer
  1011.  
  1012.     The BIOS uses INT 5 for this.  Fortunately, you don't need to mess
  1013.     with that interrupt handler.  The standard handler, in BIOS versions
  1014.     dated December 1982 or later, uses a byte at 0040:0100 (= 0000:0500)
  1015.     to determine whether a print screen is currently in progress.  If it
  1016.     is, pressing PrintScreen again is ignored.  So to disable the screen
  1017.     snapshot, all you have to do is write a 1 to that byte.  When the
  1018.     user presses PrintScreen, the BIOS will think that a print screen is
  1019.     already in progress and will ignore the user's keypress.  You can re-
  1020.     enable PrintScreen by zeroing the same byte.
  1021.  
  1022.     Here's some simple code:
  1023.  
  1024.         void prtsc_allow(int allow) /* 0=disable, nonzero=enable */ {
  1025.             unsigned char far* flag = (unsigned char far*)0x00400100UL;
  1026.             *flag = (unsigned char)!allow;
  1027.         }
  1028.  
  1029.     2) Continuous echo of screen to printer
  1030.  
  1031.     If ANSI.SYS is loaded, you can easily disable the continuous echo of
  1032.     screen to printer (Ctrl-P or Ctrl-PrtSc).  Just redefine the keys by
  1033.     "printing" strings like these to the screen (BASIC print, C
  1034.     printf(), Pascal Write statements, or ECHO command in batch files),
  1035.     where <27> stands for the Escape character, ASCII 27:
  1036.  
  1037.         <27>[0;114;"Ctrl-PrtSc disabled"p
  1038.         <27>[16;"^P"p
  1039.  
  1040.     If you haven't installed ANSI.SYS, I can't offer an easy way to
  1041.     disable the echo-screen-to-printer function.
  1042.  
  1043.     Actually, you might not need to disable Ctrl-P and Ctrl-PrtSc.  If
  1044.     your only concern is not locking up your machine, when you see the
  1045.     "Abort, Retry, Ignore, Fail" prompt just press Ctrl-P again and then
  1046.     press I.  As an alternative, install one of the many print spoolers
  1047.     that intercept printer-status queries and always return "Printer
  1048.     ready".
  1049.  
  1050.     3.05 - How can my program turn NumLock (CapsLock, ScrollLock) on
  1051.            or off?
  1052.     ----------------------------------------------------------------
  1053.  
  1054.     First, if you just don't want NumLock turned on when you reboot,
  1055.     check your system's setups.  (Use Ctrl-Alt-Enter any time, or press
  1056.     a special key like Del at boot time, or run the setup program
  1057.     supplied with your system.)  Many systems now have an option in
  1058.     setup to turn NumLock off at boot time.
  1059.  
  1060.     You need to twiddle bit 5, 6, or 4 of location 0040:0017.  Here's
  1061.     some code:  lck() turns on a lock state, and unlck() turns it off.
  1062.     (The status lights on some keyboards may not reflect the change.  If
  1063.     yours is one, call INT 16 AH=2, "get shift status", and that may
  1064.     update them.  It will certainly do no harm.)
  1065.  
  1066.         #define NUM_LOCK  (1 << 5)
  1067.         #define CAPS_LOCK (1 << 6)
  1068.         #define SCRL_LOCK (1 << 4)
  1069.         void lck(int shiftype) {
  1070.             char far* kbdstatus = (char far*)0x00400017UL;
  1071.             *kbdstatus |= (char)shiftype;
  1072.         }
  1073.         void unlck(int shiftype) {
  1074.             char far* kbdstatus = (char far*)0x00400017UL;
  1075.             *kbdstatus &= ~(char)shiftype;
  1076.         }
  1077.  
  1078.     3.06 - How can I speed up the keyboard's auto-repeat?
  1079.     -----------------------------------------------------
  1080.  
  1081.     The keyboard speed has two components: delay (before a key that you
  1082.     hold down starts repeating) and typematic rate (the speed once the
  1083.     key starts repeating).  Most BIOS versions since 1986 let software
  1084.     change the delay and typematic rate by calling INT 16 AH=3, "set
  1085.     typematic rate and delay"; see Ralf Brown's interrupt list (Q 1.17).
  1086.     If you have DOS 4.0 or later, you can use the MODE CON command that
  1087.     you'll find in your DOS manual.
  1088.  
  1089.     On 83-key keyboards (mostly XTs), the delay and typematic rate can't
  1090.     easily be changed.  According to PC Magazine 15 Jan 1991 (x:1) page
  1091.     409, to adjust the typematic rate you need "a memory-resident
  1092.     program which simply '[watches]' the keyboard to see if you're
  1093.     holding down a key ... and after a certain time [starts] stuffing
  1094.     extra copies of the held-down key into the buffer."  No source code
  1095.     is given in that issue; but the QUICKEYS utility that PC Magazine
  1096.     published in 1986 does this sort of watching (not verified); source
  1097.     and object code are downloadable in
  1098.  
  1099.         /pub/msdos/pcmag/vol5n05.zip from SimTel.
  1100.  
  1101.     3.07 - What is the SysRq key for?
  1102.     ---------------------------------
  1103.  
  1104.     There is no standard use for the key.  The BIOS keyboard routines in
  1105.     INT 16 simply ignore it; therefore so do the DOS input routines in
  1106.     INT 21 as well as the keyboard routines in libraries supplied with
  1107.     high-level languages.
  1108.  
  1109.     When you press or release a key, the keyboard triggers hardware line
  1110.     IRQ1, and the CPU calls INT 9.  INT 9 reads the scan code from the
  1111.     keyboard and the shift states from the BIOS data area.
  1112.  
  1113.     What happens next depends on whether your PC's BIOS supports an
  1114.     enhanced keyboard (101 or 102 keys).  If so, INT 9 calls INT 15
  1115.     AH=4F to translate the scan code.  If the translated scan code is 54
  1116.     hex (for the SysRq key) then INT 9 calls INT 15 AH=85 and doesn't
  1117.     put the keystroke into the keyboard buffer.  The default handler of
  1118.     that function does nothing and simply returns.  (If your PC has an
  1119.     older BIOS that doesn't support the extended keyboards, INT 15 AH=4F
  1120.     is not called.  Early ATs have 84-key keyboards, so their BIOS calls
  1121.     INT 15 AH=85 but not 4F.)
  1122.  
  1123.     Thus your program is free to use SysRq for its own purposes, but at
  1124.     the cost of some programming.  You could hook INT 9, but it's
  1125.     probably easier to hook INT 15 AH=85, which is called when SysRq is
  1126.     pressed or released.
  1127.  
  1128.     3.08. How can my program tell what kind of keyboard is on the
  1129.                system?
  1130.     -------------------------------------------------------------
  1131.  
  1132.     Ralf Brown's Interrupt List (Q 1.17) includes MEMORY.LST, a detailed
  1133.     breakdown by Robin Walker of the contents of the BIOS system block
  1134.     that starts at 0040:0000.  Bit 4 of byte 0040:0096 is "1=enhanced
  1135.     keyboard installed".  C code to test the keyboard type:
  1136.  
  1137.         char far *kbd_stat_byte3 = (char far *)0x00400096UL;
  1138.         if (0x10 & *kbd_stat_byte3)
  1139.             /* 101- or 102-key keyboard is installed */
  1140.  
  1141.     PC Magazine 15 Jan 1991 (x:1) suggests on page 412 that "for some
  1142.     clones [the above test] is not foolproof".  If you use this method
  1143.     in your program you should provide the user some way to override
  1144.     this test, or at least some way to tell your program to assume a non-
  1145.     enhanced keyboard.  The article suggests a different approach to
  1146.     determining the type of keyboard.
  1147.  
  1148.     3.09 - How can I tell if input, output, or stderr has been redirected? 
  1149.     ----------------------------------------------------------------------
  1150.  
  1151.     Normally, input and output are associated with the console (i.e.,
  1152.     with the keyboard and the screen, respectively).  If either is not,
  1153.     you know that it has been redirected.  Some source code to check
  1154.     this is available at the usual archive sites.
  1155.  
  1156.     If you program in Turbo Pascal, you'll want this downloadable
  1157.     collection of Turbo Pascal units:
  1158.  
  1159.         /pc/ts/tspa33*.zip at Garbo
  1160.         /pub/msdos/turbopas/tspa33*.zip at SimTel.
  1161.  
  1162.     (where the * is 70, 60, 55, 50, or 40 for Turbo Pascal 7.0, 6.0,
  1163.     5.5, 5.0, or 4.0 respectively.)  Source code is not included.  Also
  1164.     see the downloadable Frequently Asked Questions files by Timo Salmi:
  1165.  
  1166.         /pc/ts/tsfaqp18.zip at Garbo
  1167.         /pub/msdos/info/tsfaqp18.zip at SimTel.
  1168.  
  1169.     If you program in C, use isatty() if your implementation has it.
  1170.     Otherwise, /pub/msdos/sysutil/is_con10.zip is downloadable from
  1171.     SimTel; it includes source code.
  1172.  
  1173.     Good references for the principles are PC Magazine 16 Apr 1991 (x:7)
  1174.     page 374; Ray Duncan's {Advanced MS-DOS}, ISBN 1-55615-157-8, or
  1175.     Ralf Brown's interrupt list (Q 1.17) for INT 21 AX=4400; and Terry
  1176.     Dettman and Jim Kyle's {DOS Programmer's Reference: 2d edition},
  1177.     ISBN 0-88022-458-4, pages 602-603.
  1178.  
  1179.     3.10 - How can I increase the size of the keyboard buffer?
  1180.     ----------------------------------------------------------
  1181.  
  1182.     I tested only one of the many available device drivers that do this,
  1183.     namely BUF160, which extends the keyboard buffer to 160 characters.
  1184.     It performed flawlessly for two years with MS-DOS 5 and Windows 3.1.
  1185.     It's downloadable as
  1186.  
  1187.         /pub/msdos/keyboard/buf160_6.zip at SimTel
  1188.         /pc/keyboard/buf160_6.zip at Garbo.
  1189.  
  1190.     3.11 - How can I stuff characters into the keyboard buffer?
  1191.     -----------------------------------------------------------
  1192.  
  1193.     If your computer has an enhanced keyboard (see "3.08 - How can my
  1194.     program tell what kind of keyboard is on the system?"), put the scan
  1195.     code in CH and the ASCII character in CL, then execute INT 16 AH=5.
  1196.     The return in AL is 0 for success or 1 for buffer full.
  1197.  
  1198.  
  1199. Section 4.  Disks and files
  1200. ---------------------------
  1201.  
  1202.     4.01 - What drive was the PC booted from?
  1203.     -----------------------------------------
  1204.     
  1205.     Under DOS 4.0 or later, use INT 21 AX=3305.  DL is returned with an
  1206.     integer indicating the boot drive (1=A:, etc.).
  1207.  
  1208.     4.02 - How can I boot from drive b:?
  1209.  
  1210.     Downloadable shareware:
  1211.  
  1212.         /pub/msdos/diskutil/boot_b.zip from SimTel
  1213.         /pc/bootutil/boot_b.zip from Garbo.
  1214.  
  1215.     The included documentation says it works by writing a new boot
  1216.     sector on a disk in your a: drive that redirects the boot to your b:
  1217.     drive.  (A similar utility is bboot.zip in the same directory at
  1218.     Garbo only.)
  1219.  
  1220.     If that doesn't work, you can always interchange your a: and b:
  1221.     drives by switching ribbon cables and changing the setup in your
  1222.     BIOS.  From an article posted 27 Jan 1993 on another newsgroup:
  1223.  
  1224.     Take the "ribbon" connector, as you call it, and switch them.  To
  1225.     double check, start at the end of the cable that connects to the
  1226.     motherboard or floppy controller.  Follow the cable until you get to
  1227.     the first connector.  Connect this to the drive you want to be b:.
  1228.     After this, there should be a few lines on the cable that get
  1229.     flipped left to right.  (On most cables, they just cut the lines and
  1230.     physically reverse them.  It should be quite obvious from looking at
  1231.     the cable.)  Anyway, the connector after the pins get flipped right
  1232.     to left is the connector for your a: drive.
  1233.  
  1234.     4.03 - Which real and virtual disk drives are valid? 
  1235.     ----------------------------------------------------
  1236.  
  1237.     Use INT 21 AH=29 (parse filename).  Point DS:SI at a null-terminated
  1238.     ASCII string that contains the drive letter and a colon, point ES:DI
  1239.     at a 37-byte dummy FCB buffer, and call INT 21 AX=2900.  On return,
  1240.     AL is FF if the drive is invalid, something else if the drive is
  1241.     valid.  RAM disks and SUBSTed drives are considered valid.
  1242.  
  1243.     You can detect whether the drive is ASSIGNed by using INT 2F
  1244.     AX=0601.  To check whether the drive is SUBSTed, use INT 21 AX=4409;
  1245.     or use INT 21 AH=52 to test for both JOIN and SUBST.  See Ralf
  1246.     Brown's interrupt list (Q 1.17).
  1247.  
  1248.     Unfortunately, the b: drive is considered valid even on a single-
  1249.     diskette system.  You can check that special case by interrogating
  1250.     the BIOS equipment byte at 0040:0010.  Bits 7-6 contain the one less
  1251.     than the number of diskette drives, so if those bits are zero you
  1252.     know that b: is an invalid drive even though function 29 says it's
  1253.     valid.
  1254.  
  1255.     Following is some code originally posted by Doug Dougherty to test
  1256.     valid drives (treating SUBSTed and JOINed drives as valid), with my
  1257.     fix for the b: special case, tested in Borland C++ 2.0 (in the small
  1258.     model):
  1259.  
  1260.         #include <dos.h>
  1261.         #include <stdio.h>
  1262.         void drvlist(void) {
  1263.             char *s = "A:", fcb_buff[37];
  1264.             int valid;
  1265.             for (   ;  *s<='Z';  (*s)++) {
  1266.                 _SI = (unsigned) s;
  1267.                 _DI = (unsigned) fcb_buff;
  1268.                 _ES = _DS;
  1269.                 _AX = 0x2900;
  1270.                 geninterrupt(0x21);
  1271.                 valid = _AL != 0xFF;
  1272.                 if (*s == 'B'  &&  valid) {
  1273.                     char far *equipbyte = (char far *)0x00400010UL;
  1274.                     valid = (*equipbyte & (3 << 6)) != 0;
  1275.                 }
  1276.                 printf("Drive '%s' is %sa valid drive.\n",
  1277.                         s, valid ? "" : "not ");
  1278.             }
  1279.         }
  1280.  
  1281.     This code was translated to MSC 7.0 and tested it in small model:
  1282.  
  1283.         #include <dos.h>
  1284.         #include <stdio.h>
  1285.         void drvlist(void) {
  1286.             char *s = "A:", fcb_buff[37], *buff=fcb_buff;
  1287.             int valid;
  1288.             for (   ;  *s<='Z';  (*s)++) {
  1289.                 __asm mov si,s      __asm mov di,buff
  1290.                 __asm mov ax,ds     __asm mov es,ax
  1291.                 __asm mov ax,0x2900 __asm int 21h
  1292.                 __asm xor ah,ah     __asm mov valid,ax
  1293.                 valid = (valid != 0xFF);
  1294.                 if (*s == 'B'  &&  valid) {
  1295.                     char far *equipbyte = (char far *)0x00400010UL;
  1296.                     valid = (*equipbyte & (3 << 6)) != 0;
  1297.                 }
  1298.                 printf("Drive '%s' is %sa valid drive.\n",
  1299.                         s, valid ? "" : "not ");
  1300.             }
  1301.         }
  1302.  
  1303.    4.04 - How can I make my single floppy drive both a: and b:?
  1304.    ------------------------------------------------------------
  1305.  
  1306.     Under any DOS since DOS 2.0, you can put the command
  1307.  
  1308.         assign b=a
  1309.  
  1310.     into your AUTOEXEC.BAT file.  Then, when you type "dir b:" you'll no
  1311.     longer get the annoying prompt to insert diskette B (and the even
  1312.     more annoying prompt to insert A the next time you type "dir a:").
  1313.  
  1314.     You may be wondering why anybody would want to do this.  Suppose you
  1315.     use two different machines, maybe one at home and one at work.  One
  1316.     of them has only a 3.5" diskette drive; the other machine has two
  1317.     drives, and b: is the 3.5" one.  You're bound to type "dir b:" on
  1318.     the first one, and get the nuisance message
  1319.  
  1320.         Insert diskette for drive B: and press any key when ready.
  1321.  
  1322.     But if you assign drive b: to point to a:, you avoid this problem.
  1323.  
  1324.     Caution:  there are a few commands, such as DISKCOPY, that will not
  1325.     work right on ASSIGNed or SUBSTed drives.  See the DOS manual for
  1326.     the full list.  Before typing one of those commands, be sure to turn
  1327.     off the mapping by typing "assign" without arguments.
  1328.  
  1329.     The DOS 5.0 manual says that ASSIGN is obsolete, and recommends the
  1330.     equivalent form of SUBST: "subst b: a:\".  Unfortunately, if this
  1331.     command is executed when a: doesn't hold a diskette, the command
  1332.     fails.  ASSIGN doesn't have this problem, so under DOS 5.0 you
  1333.     should disregard that particular bit of advice in the manual.
  1334.  
  1335.     4.05 - How can I disable access to a drive?
  1336.     -------------------------------------------
  1337.  
  1338.     Reader Eric DeVolder writes that he has made available a program to
  1339.     do this.  I haven't tried it, but it's downloadable as
  1340.  
  1341.         /pub/msdos/diskutil/rmdriv20.zip from SimTel
  1342.         /pc/sysutil/rmdriv20.zip at Garbo.
  1343.  
  1344.     4.06 - How can a batch file test existence of a directory?
  1345.     ----------------------------------------------------------
  1346.  
  1347.     The standard way, which in fact is documented in the DOS manual, is
  1348.  
  1349.         if exist d:\path\nul goto found
  1350.  
  1351.     Unfortunately, this is not entirely reliable.  I found it failed in
  1352.     Pathworks (a/k/a PCSA, DEC's network that connects PCs and VAXes),
  1353.     or on a MARS box that uses an OEM version of MS-DOS 5.0.  Readers
  1354.     have reported that it gave the wrong answer on Novell networks, on
  1355.     DR-DOS, and in a DOS window under OS/2.  By "failed" I mean that it
  1356.     "found" a directory that didn't exist, or failed to find one that
  1357.     did exist, or both.  (I'm told that IBM fixed the OS/2 bug in
  1358.     version 2.11 of OS/2.)
  1359.  
  1360.     There appears to be no foolproof way to use pure batch commands to
  1361.     test for existence of a directory.  The real solution is to write a
  1362.     program, which returns a value that your batch program can then test
  1363.     with an "if errorlevel".  Reader Duncan Murdoch kindly posted the
  1364.     following Turbo Pascal version:
  1365.  
  1366.         program existdir;
  1367.             { Confirms the existence of a directory given on the command
  1368.             line.  Returns errorlevel 2 on error, 1 if not found, 0 if
  1369.             found. }
  1370.  
  1371.         uses
  1372.             dos;
  1373.  
  1374.         var
  1375.             s : searchrec;
  1376.  
  1377.         begin
  1378.             if paramcount <> 1 then
  1379.             begin
  1380.                 writeln('Syntax:  EXISTDIR directory');
  1381.                 halt(2);
  1382.             end
  1383.             else
  1384.             begin
  1385.                 findfirst(paramstr(1),Directory,S);
  1386.                 while (Doserror = 0) and ((Directory and S.Attr) = 0) do
  1387.                     findnext(S);
  1388.                 if Doserror <> 0 then
  1389.                 begin
  1390.                     Writeln('Directory not found.');
  1391.                     halt(1);
  1392.                 end
  1393.                 else
  1394.                 begin
  1395.                     Writeln('Directory found.');
  1396.                     halt(0);
  1397.                 end;
  1398.             end;
  1399.         end.
  1400.  
  1401.     Timo Salmi also has a Turbo Pascal version in his Turbo Pascal FAQ,
  1402.     which is downloadable as
  1403.  
  1404.         /pc/ts/tsfaqp18.zip at Garbo
  1405.         /pub/msdos/info/tsfaqp18.zip at SimTel.
  1406.  
  1407.     4.07 - Why won't my C program open a file with a path?
  1408.     ------------------------------------------------------
  1409.  
  1410.     You've probably got something like the following code:
  1411.  
  1412.         char *filename = "c:\foo\bar\mumble.dat";
  1413.         FILE *fptr;
  1414.         . . .
  1415.         fptr = fopen(filename, "r");
  1416.  
  1417.     The problem is that \f is a form feed, \b is a backspace, and \m is
  1418.     m.  Whenever you want a backslash in a string constant in C, you
  1419.     must use two backslashes:
  1420.  
  1421.         char *filename = "c:\\foo\\bar\\mumble.dat";
  1422.  
  1423.     This is a feature of every C compiler, because Dennis Ritchie
  1424.     designed C this way.  It's a problem only on MS-DOS systems, because
  1425.     only DOS (and Atari ST/TT running TOS) uses the backslash in
  1426.     directory paths.  But even in DOS this backslash convention applies
  1427.     _only_ to string constants in your source code.  For file and
  1428.     keyboard input at run time, \ is just a normal character, so users
  1429.     running your program would type in file specs the same way as in DOS
  1430.     commands, with single \ characters.
  1431.  
  1432.     Another possibility is to code all paths in source programs with /
  1433.     rather than \ characters:
  1434.  
  1435.         char *filename = "c:/foo/bar/mumble.dat";
  1436.  
  1437.     Ralf Brown writes, "All versions of the DOS kernel accept either
  1438.     forward or backslashes as directory separators.  I tend to use this
  1439.     form more frequently than backslashes since it is easier to type and
  1440.     read."  This applies to DOS function calls (and therefore to calls
  1441.     to the file library of every programming language), but not to DOS
  1442.     commands.
  1443.  
  1444.     4.08 - How can I redirect printer output to a file?
  1445.     ---------------------------------------------------
  1446.  
  1447.     Recommended: PRN2FILE from PC Magazine, downloadable as:
  1448.  
  1449.         /pub/msdos/printer/prn2file.zip at SimTel
  1450.         /pc/printer/prn2file.zip at Garbo.
  1451.  
  1452.     PC Magazine has given copies away as part of its utilities disks, so
  1453.     you may already have a copy.
  1454.  
  1455.     The directories mentioned above have lots of other utilities to
  1456.     redirect printer output.
  1457.  
  1458.     4.09 - How can I redirect the output of a batch file?
  1459.     -----------------------------------------------------
  1460.  
  1461.     Assuming the batch file is called batch.bat, to send its output
  1462.     (stdout) to another file, just invoke COMMAND.COM as a secondary
  1463.     command processor:
  1464.  
  1465.         command /c batch parameters_if_any >outfile
  1466.  
  1467.     Timo Salmi's notes on this and other batch tricks are downloadable:
  1468.  
  1469.         /pub/msdos/batutil/tsbat44.zip at SimTel
  1470.         /pc/ts/tsbat44.zip at Garbo.
  1471.  
  1472.     4.10 - How can I redirect stderr?
  1473.     ---------------------------------
  1474.  
  1475.     Use freopen(..., stderr) and then execute the desired command via
  1476.     system().  There are downloadable versions of programs to do this.
  1477.     I recommend this file, which includes TP4 source and executable:
  1478.  
  1479.         /pub/msdos/sysutil/rdstderr.zip from SimTel.
  1480.  
  1481.     A C example is downloadable as
  1482.  
  1483.         /pub/msdos/c/redirect.c from SimTel.
  1484.  
  1485.     I compiled it with MSC 7.0, and it works fine with one exception:
  1486.     Contrary to the included comments, redirected output starts writing
  1487.     at the beginning of the output file rather than appending.  That is
  1488.     easily solved by adding "fseek(stderr, 0L, SEEK_END);" after the
  1489.     freopen() call for stderr.
  1490.  
  1491.     4.11 - How can my program open more files than DOS's limit of 20?
  1492.     -----------------------------------------------------------------
  1493.  
  1494.     This is a summary of an article Ralf Brown posted on 8 August 1992,
  1495.     with some additions from a Microsoft tech note and information from
  1496.     Chin Huang.)
  1497.  
  1498.     DOS imposes some limits.  Once you overcome those, which is pretty
  1499.     easy, you may have to take additional measures to overcome the
  1500.     limitations built into your compiler's run-time library.
  1501.  
  1502.     1) Limitations imposed by DOS
  1503.  
  1504.     There are separate limits on files and file handles.  For example,
  1505.     DOS opens three files but five file handles:  CON (stdin, stdout,
  1506.     and stderr), AUX (stdaux), and PRN (stdprn).
  1507.  
  1508.     The limit in FILES= in CONFIG.SYS is a system-wide limit on files
  1509.     opened by all programs (including the three that DOS opens and any
  1510.     opened by TSRs); each process has a limit of 20 handles (including
  1511.     the five that DOS opens).  Example:  CONFIG.SYS has FILES=40.  Then
  1512.     program #1 will be able to open 15 file handles.  Assuming that the
  1513.     program actually does open 15 handles pointing to 15 different
  1514.     files, other programs could still open a total of 22 files (40-3-15
  1515.     = 22), though no one program could open more than 15 file handles.
  1516.  
  1517.     If you're running DOS 3.3 or later, you can increase the per-process
  1518.     limit of 20 file handles by a call to INT 21 AH=67, Set Handle
  1519.     Count.  Your program is still limited by the system-wide limit on
  1520.     open files, so you may also need to increase the FILES= value in
  1521.     your CONFIG.SYS file (and reboot).  The run-time library that you're
  1522.     using may have a fixed-size table of file handles, so you may also
  1523.     need to get source code for the module that contains the table,
  1524.     increase the table size, and recompile it.
  1525.  
  1526.     2) Limitations in Microsoft C run-time library
  1527.  
  1528.     In Microsoft C the run-time library limits you to 20 file handles.
  1529.     To change this, you must be aware of two limits:
  1530.  
  1531.     - file handles used with _open(), _read(), etc.: Edit _NFILE_ in
  1532.       CRT0DAT.ASM.
  1533.  
  1534.     - stream files used with fopen(), fread(), etc.: Edit _NFILE_ in
  1535.       _FILE.C for DOS or FILE.ASM for Windows/QuickWin.  This must not
  1536.       exceed the value of _NFILE_ in CRT0DAT.ASM.
  1537.  
  1538.     (QuickWin uses the constant _WFILE_ in CRT0DAT.ASM and WFILE.ASM for
  1539.     the maximum number of child text windows.)
  1540.  
  1541.     After changing the limits, recompile using CSTARTUP.BAT.  Microsoft
  1542.     recommends that you first read README.TXT in the same directory.
  1543.  
  1544.     3) Limitations in Borland C++ run-time library
  1545.  
  1546.     (Reader Chin Huang provided this information on 12 Sep 1993.)
  1547.  
  1548.     To increase the open file limit for a program you compile with
  1549.     Borland C++ 3.1, edit the file _NFILE.H in the include directory and
  1550.     change the _NFILE_ value.  Compile and link the modules FILES.C and
  1551.     FILES2.C from the lib directory into your program.
  1552.  
  1553.     4.12 - How can I read, create, change, or delete the volume label?
  1554.     ------------------------------------------------------------------
  1555.  
  1556.     In DOS 5.0 (and possibly in 4.0 as well), there are actually two
  1557.     volume labels: the LABEL command reports only the first but changes
  1558.     both of them.
  1559.  
  1560.     - The traditional volume label is an entry with "volume label"
  1561.       attribute in the root directory of the disk.  The DIR, VOL, and
  1562.       LABEL commands report this volume label, and LABEL sets it.
  1563.  
  1564.     - There is a second volume label, which may be different, in the
  1565.       boot record along with the serial number. In DOS 4.0 and later,
  1566.       INT 21 AH=69 gets or sets the boot record's serial number and
  1567.       volume label together; see "4.13 - How can I get the disk serial
  1568.       number?"  DIR and VOL ignore this volume label; the LABEL command
  1569.       doesn't report it but does set it.
  1570.  
  1571.     The rest of this answer assumes that by "volume label" you mean the
  1572.     traditional one, the one that DIR and VOL display.  Though it's a
  1573.     directory entry in the root directory, you can't change it using the
  1574.     newer DOS file-access functions (INT 21 AH=3C, 41, 43); instead, use
  1575.     the old FCB-oriented directory functions.  Specifically, you need to
  1576.     allocate a 64-byte buffer and a 41- byte extended FCB (file control
  1577.     block).  Call INT 21 AH=1A to find out whether there is a volume
  1578.     label.  If there is, AL returns 0 and you can change the label using
  1579.     DOS function 17 or delete it using DOS function 13.  If there's no
  1580.     volume label, function 1A will return FF and you can create a label
  1581.     via function 16.  Important points to notice are that ? wildcards
  1582.     are allowed but * are not; the volume label must be space filled not
  1583.     null terminated.
  1584.  
  1585.     The following MSC 7.0 code worked for me in DOS 5.0; the functions
  1586.     it uses have been around since DOS 2.0.  The function parameter is 0
  1587.     for the current disk, 1 for a:, 2 for b:, etc.  It doesn't matter
  1588.     what your current directory is; these functions always search the
  1589.     root directory for volume labels.  (I didn't try to change the
  1590.     volume label of any networked drives.)
  1591.  
  1592.         // Requires DOS.H, STDIO.H, STRING.H
  1593.         void vollabel(unsigned char drivenum) {
  1594.             static unsigned char extfcb[41], dta[64], status, *newlabel;
  1595.             int chars_got = 0;
  1596.             #define DOS(buff,func) __asm { __asm mov dx,offset buff   \
  1597.                 __asm mov ax,seg buff  __asm push ds  __asm mov ds,ax \
  1598.                 __asm mov ah,func  __asm int 21h  __asm pop ds        \
  1599.                 __asm mov status,al }
  1600.             #define getlabel(buff,prompt) newlabel = buff;  \
  1601.                 memset(newlabel,' ',11);  printf(prompt);   \
  1602.                 scanf("%11[^\n]%n", newlabel, &chars_got);  \
  1603.                 if (chars_got < 11) newlabel[chars_got] = ' ';
  1604.  
  1605.             // Set up the 64-byte transfer area used by function 1A.
  1606.             DOS(dta, 1Ah)
  1607.             // Set up an extended FCB and search for the volume label.
  1608.             memset(extfcb, 0, sizeof extfcb);
  1609.             extfcb[0] = 0xFF;           // denotes extended FCB
  1610.             extfcb[6] = 8;              // volume-label attribute bit
  1611.             extfcb[7] = drivenum;       // 1=A,2=B,...; 0=current drive
  1612.             memset(&extfcb[8], '?', 11);// wildcard *.*
  1613.             DOS(extfcb,11h)
  1614.             if (status == 0) {          // DTA has volume label's FCB
  1615.                 printf("volume label is %11.11s\n", &dta[8]);
  1616.                 getlabel(&dta[0x18],
  1617.                     "new label (\"delete\" to delete): ");
  1618.                 if (chars_got == 0)
  1619.                     printf("label not changed\n");
  1620.                 else if (strncmp(newlabel,"delete  ",11) == 0) {
  1621.                     DOS(dta,13h)
  1622.                     printf(status ? "label failed\n" :
  1623.                                     "label deleted\n");
  1624.                 }
  1625.                 else {                  // user wants to change label
  1626.                     DOS(dta,17h)
  1627.                     printf(status ? "label failed\n" :
  1628.                                     "label changed\n");
  1629.                 }
  1630.             }
  1631.             else {                      // no volume label was found
  1632.                 printf("disk has no volume label.\n");
  1633.                 getlabel(&extfcb[8], "new label (<Enter> for none): ");
  1634.                 if (chars_got > 0) {
  1635.                     DOS(extfcb,16h)
  1636.                     printf(status ? "label failed\n" :
  1637.                                     "label created\n");
  1638.                 }
  1639.             }
  1640.         }        // end function vollabel
  1641.  
  1642.     4.13 - How can I get the disk serial number?
  1643.     --------------------------------------------
  1644.  
  1645.     If the disk was formattted by DOS 4.0 or later, use INT 21: AX=6900
  1646.     gets the serial number; AX=6901 sets it.  (The disk serial number
  1647.     doesn't exist if the disk was formatted with an earlier version of
  1648.     DOS, or with some third-party formatters.)  See Ralf Brown's
  1649.     interrupt list (Q 1.17), or PC Magazine July 1992 (xi:13) page 496,
  1650.     for details.
  1651.  
  1652.     INT 21 AH=69 also gets and sets the volume label in the boot record,
  1653.     which is not necessarily the same as "the" volume label displayed by
  1654.     the DIR, VOL, and LABEL commands.  For that volume label, see "4.12 -
  1655.     How can I read, create, change, or delete the volume label?"
  1656.  
  1657.     4.14 - What's the format of .OBJ, .EXE., .COM files?
  1658.     ----------------------------------------------------
  1659.  
  1660.     Please see "2.06 - What's the format of an .OBJ file?"; "2.07 - What's
  1661.     the format of an .EXE header?"; and "2.08 - What's the difference
  1662.     between .COM and .EXE formats?"
  1663.  
  1664.     4.15 - How can I flush the software disk cache?
  1665.     -----------------------------------------------
  1666.  
  1667.     Please see "7.01 - How can a program reboot my PC?"
  1668.  
  1669.  
  1670. Section 5.  Serial ports (COM ports)
  1671. ------------------------------------
  1672.  
  1673.     5.01 - How do I set my machine up to use COM3 and COM4?
  1674.     -------------------------------------------------------
  1675.  
  1676.     Unless your machine is fairly old, it's probably already set up.
  1677.     After installing the board that contains the extra COM port(s),
  1678.     check the I/O addresses in word 0040:0004 or 0040:0006.  (In DEBUG,
  1679.     type "D 40:4 L4" and remember that every word is displayed low byte
  1680.     first, so if you see "03 56" the word is 5603.)  If those addresses
  1681.     are nonzero, your PC is ready to use the ports and you don't need
  1682.     the rest of this answer.
  1683.  
  1684.     If the I/O address words in the 0040 segment are zero after you've
  1685.     installed the I/O board, you need some code to store these values
  1686.     into the BIOS data segment:
  1687.  
  1688.         0040:0004  word  I/O address of COM3
  1689.         0040:0006  word  I/O address of COM4
  1690.         0040:0011  byte (bits 3-1): number of serial ports installed
  1691.  
  1692.     The documentation with your I/O board should tell you the port
  1693.     addresses.  When you know the proper port addresses, you can add
  1694.     code to your program to store them and the number of serial ports
  1695.     into the BIOS data area before you open communications.  Or you can
  1696.     use DEBUG to create a little program to include in your AUTOEXEC.BAT
  1697.     file, using this script:
  1698.  
  1699.         n SET_ADDR.COM      <--- or a different name ending in .COM
  1700.         a 100
  1701.         mov  AX,0040
  1702.         mov  DS,AX
  1703.         mov  wo [0004],aaaa <--- replace aaaa with COM3 address or 0
  1704.         mov  wo [0006],ffff <--- replace ffff with COM4 address or 0
  1705.         and  by [0011],f1
  1706.         or   by [0011],8    <--- use number of serial ports times 2
  1707.         mov  AH,0
  1708.         int  21
  1709.                             <--- this line must be blank
  1710.         rCX
  1711.         1f
  1712.         rBX
  1713.         0
  1714.         w
  1715.         q
  1716.  
  1717.     5.02 - How do I find the I/O address of a COM port?
  1718.     ---------------------------------------------------
  1719.  
  1720.     Look in the four words beginning at 0040:0000 for COM1 through COM4.
  1721.     (The DEBUG command "D 40:0 L8" will do this.  Remember that words
  1722.     are stored and displayed low byte first, so a word value of 03F8
  1723.     will be displayed as F8 03.)  If the value is zero, that COM port is
  1724.     not installed (or you've got an old BIOS; see "5.01 - How do I set my
  1725.     machine up to use COM3 and COM4?").  If the value is nonzero, it is
  1726.     the I/O address of the transmit/receive register for the COM port.
  1727.     Each COM port occupies eight consecutive I/O addresses (though many
  1728.     chips use only the first seven).
  1729.  
  1730.     Here's some C code to find the I/O address:
  1731.  
  1732.         unsigned ptSel(unsigned comport) {
  1733.             unsigned io_addr;
  1734.             if (comport >= 1  &&  comport <= 4) {
  1735.                 unsigned far *com_addr = (unsigned far *)0x00400000UL;
  1736.                 io_addr = com_addr[comport-1];
  1737.             }
  1738.             else
  1739.                 io_addr = 0;
  1740.             return io_addr;
  1741.         }
  1742.  
  1743.     You might also want to explore Port Finder, downloadable as
  1744.  
  1745.         /pub/msdos/io_util/pf271.zip at SimTel
  1746.         /pub/msdos/utilities/sysutl/pf271.zip at nic.funet.fi
  1747.  
  1748.     I haven't tried it myself, but a posted article reviewed it very
  1749.     favorably and said it also lets you swap ports around.
  1750.  
  1751.     5.03 - But aren't the COM ports always at I/O addresses 3F8,
  1752.                2F8, 3E8, and 2E8?
  1753.     ------------------------------------------------------------
  1754.  
  1755.     The first two are usually right (though not always); the last two
  1756.     are different on many machines.
  1757.  
  1758.     5.04. How do I configure a COM port and use it to transmit data?
  1759.     ------------------------------------------------------------
  1760.     (Revised: 05/09/1994)
  1761.  
  1762.     Do you want actual code, or do you want books that explain what's
  1763.     going on?
  1764.  
  1765.     1) Source code
  1766.  
  1767.     First, check your compiler's run-time library.  Many compilers offer
  1768.     functions similar to Microsoft C's _bios_serialcom() or Borland's
  1769.     bioscom(), which may meet your needs.
  1770.  
  1771.     Second, check for downloadable resources at SimTel and Garbo.  At
  1772.     SimTel, /pub/msdos/c/pcl4c34.zip (March 1993) is described as
  1773.     "Asynchronous communications library for C"; Garbo has a whole
  1774.     /pc/comm directory.  Also, an extended example is in Borland's
  1775.     TechFax TI445, downloadable as part of
  1776.  
  1777.         /pub/msdos/turbo-c/bchelp10.zip at SimTel
  1778.         /pc/turbopas/bchelp10.zip at Garbo.
  1779.  
  1780.     Though written by Borland, much of it is applicable to other forms
  1781.     of C, and it should give you ideas for other programming languages.
  1782.  
  1783.     2) Reference books
  1784.  
  1785.     Highly recommended: Joe Campbell's {C Programmer's Guide to Serial
  1786.     Communications}, ISBN 0-672-22584-0.  He gives complete details on
  1787.     how serial ports work, along with complete programs for doing polled
  1788.     or interrupt-driver I/O.  The book is quite thick, and none of it
  1789.     looks like filler.
  1790.  
  1791.     If Campbell's book is overkill for you, you'll find a good short
  1792.     description of serial I/O in {DOS 5: A Developer's Guide}, ISBN
  1793.     1-55851-177-6, by Al Williams.
  1794.  
  1795.     Finally, a reader has recommended {Serial Communications Programming
  1796.     in C/C++} by Mark Goodwin (ISBN 1558281983), with source code in the
  1797.     book and on disk.  Topics include the basics, various methods of
  1798.     serial communications on the PC (with consideration of high-speed
  1799.     modems), ANSI screen interface, file transfer protocols (Xmodem and
  1800.     Ymodem), etc.  There is code in C, and that code is extended into a
  1801.     C++ class for those who use C++.  There are also subroutines in
  1802.     Assembly.
  1803.  
  1804.     3) Downloadable information files
  1805.  
  1806.     A "Serial Port FAQ" is occasionally posted to this newsgroup, and is
  1807.     downloadable as multiple files:
  1808.  
  1809.         /pub/E-Technik/afd/*Serial* from pfsparc02.phil15.uni-sb.de.
  1810.  
  1811.     For rtfm.mit.edu instructions, see "1.13 - Where are FAQ lists
  1812.     archived?"
  1813.  
  1814.     (The uni-sb.de archive administrator warns that the ftp address may
  1815.     change, sometime in the future, to etcip1.ee.uni-sb.de.)
  1816.  
  1817.  
  1818. Section 6. Other hardware questions and problems
  1819. ------------------------------------------------
  1820.  
  1821.     6.01 - Which 80x86 CPU is running my program?
  1822.     ---------------------------------------------
  1823.  
  1824.     According to an article posted by Michael Davidson, Intel's approved
  1825.     code for distinguishing among 8086, 80286, 80386, and 80486 and for
  1826.     detecting the presence of an 80287 or 80387 is published in Intel's
  1827.     486SX processor manual (order number 240950-001).  David
  1828.     Kirschbaum's improved version of this is downloadable as
  1829.  
  1830.         /pub/msdos/sysinfo/cpuid593.zip from SimTel
  1831.         /pc/sysinfo/cpuid593.zip from Garbo.
  1832.  
  1833.     According to an article posted by its author, WCPU knows the
  1834.     differences between DX and SX varieties of 386 and 486 chips, and
  1835.     can detect a math coprocessor and a Pentium.  It's downloadable as
  1836.  
  1837.         /pub/msdos/sysinfo/wcpu050.zip at SimTel
  1838.         /pc/sysinfo/wcpu050.zip at Garbo.
  1839.  
  1840.     6.02 - How can a C program send control codes to my printer?
  1841.     ------------------------------------------------------------
  1842.  
  1843.     If you just fprintf(stdprn, ...), C will translate some of your
  1844.     control codes.  The way around this is to reopen the printer in
  1845.     binary mode:
  1846.  
  1847.         prn = fopen("PRN", "wb");
  1848.  
  1849.     You must use a different file handle because stdprn isn't an lvalue.
  1850.     By the way, PRN or LPT1 must not be followed by a colon in DOS 5.0.
  1851.  
  1852.     There's one special case, Ctrl-Z (ASCII 26), the DOS end-of-file
  1853.     character.  If you try to send an ASCII 26 to your printer, DOS
  1854.     simply ignores it.  To get around this, you need to reset the
  1855.     printer from "cooked" to "raw" mode.  Microsoft C users must use INT
  1856.     21 AH=44, "get/set device information".  Turbo C and Borland C++
  1857.     users can use ioctl to accomplish the same thing:
  1858.  
  1859.         ioctl(fileno(prn), 1, ioctl(fileno(prn),0) & 0xFF | 0x20, 0);
  1860.  
  1861.     An alternative approach is simply to write the printer output into a
  1862.     disk file, then copy the file to the printer with the /B switch.
  1863.  
  1864.     A third approach is to bypass DOS functions entirely and use the
  1865.     BIOS printer functions at INT 17.  If you also fprintf(stdprn,...)
  1866.     in the same program, you'll need to use fflush() to synchronize
  1867.     fprintf()'s buffered output with the BIOS's unbuffered.
  1868.  
  1869.     By the way, if you've opened the printer in binary mode from a C
  1870.     program, remember that outgoing \n won't be translated to carriage
  1871.     return/line feed.  Depending on your printer, you may need to send
  1872.     explicit \n\r sequences.
  1873.  
  1874.     6.03 - How can I redirect printer output to a file?
  1875.     ---------------------------------------------------
  1876.  
  1877.     Please see "4.08 - How can I redirect printer output to a file?"
  1878.  
  1879.     6.04 - Which video adapter is installed?
  1880.     ----------------------------------------
  1881.  
  1882.     The technique below should work if your BIOS is not too old.  It
  1883.     uses three functions from INT 10, the BIOS video interrupt.  (If
  1884.     you're using a Borland language, you may not have to do this the
  1885.     hard way.  Look for a function called DetectGraph or something
  1886.     similar.)
  1887.  
  1888.     Set AX=1200, BL=32 and call INT 10.  If AL returns 12, you have a
  1889.     VGA.  If not, set AH=12, BL=10 and call INT 10 again.  If BL returns
  1890.     0,1,2,3, you have an EGA with 64,128,192,256K memory.  If not, set
  1891.     AH=0F and call INT 10 a third time.  If AL is 7, you have an MDA
  1892.     (original monochrome adapter) or Hercules; if not, you have a CGA.
  1893.  
  1894.     This worked when tested with a VGA, but I had no other adapter types
  1895.     to test it with.
  1896.  
  1897.     6.05 - How do I switch to 43- or 50-line mode?
  1898.     ---------------------------------------------- 
  1899.  
  1900.     /pub/msdos/screen/vidmode.zip, downloadable from SimTel, contains
  1901.     .COM utilities and .ASM source code.
  1902.  
  1903.     6.06 - How can I find the Microsoft mouse position and button status?
  1904.     ---------------------------------------------------------------------
  1905.  
  1906.     Use INT 33 AH=3, described in Ralf Brown's interrupt list (Q 1.17).
  1907.  
  1908.     The Windows manual says that the Logitech mouse is compatible with
  1909.     the Microsoft one, so the interrupt will probably work the same.
  1910.  
  1911.     Also, many files are downloadable from
  1912.  
  1913.         /pub/msdos/mouse/*.* at SimTel.
  1914.  
  1915.     6.07 - How can I access a specific address in the PC's memory?
  1916.     --------------------------------------------------------------
  1917.  
  1918.     First check the library that came with your compiler.  Many vendors
  1919.     have some variant of peek and poke functions. For example:
  1920.  
  1921.     - In Turbo Pascal, use the pseudo-arrays Mem, MemW, and MemL.  Be
  1922.       sure you use the correct array for the size of data you want to
  1923.       access: byte, word, or double word.
  1924.  
  1925.     - In Turbo C/Borland C, and in recent versions of Microsoft C, use
  1926.       MK_FP; in older versions of Microsoft C, use FP_OFF and FP_SEG.
  1927.       (Caution:  Turbo C and Turbo C++ also have FP_OFF and FP_SEG
  1928.       macros, but they can't be used to construct a pointer.)  Be sure
  1929.       to pick the right data type: probably "unsigned char far *" if
  1930.       you're planning to access bytes and "unsigned short far *" for
  1931.       words.  (The "far" isn't needed if your memory model uses 32-bit
  1932.       data pointers, but including it does no harm.)
  1933.  
  1934.     By the way, it's not useful to talk about "portable" ways to do
  1935.     this.  Any operation that is tied to a specific memory address is
  1936.     not likely to work on another kind of machine.
  1937.  
  1938.     6.08 - How can I read or write my PC's CMOS memory? 
  1939.     ---------------------------------------------------
  1940.  
  1941.     There are a great many public-domain utilities that do this.  These
  1942.     are downloadable from SimTel in directory /pub/msdos/at:
  1943.  
  1944.         cmos14.zip     5965  920817  Saves/restores CMOS to/from file
  1945.         cmoser11.zip  28323  910721  386/286 enhanced CMOS setup program
  1946.         cmosram.zip   76096  920214  Save AT/386/486 CMOS data to file
  1947.             and restore
  1948.         rom2.zip      15692  900131  Save AT and 386 CMOS data to file
  1949.             and restore
  1950.         setup21.zip   18172  880613  Setup program which modifies CMOS
  1951.             RAM
  1952.         viewcmos.zip  11068  900225  Display contents of AT CMOS RAM,
  1953.             w/C source
  1954.  
  1955.     A program to check and display CMOS memory (but not write to it) is
  1956.     downloadable as part of
  1957.  
  1958.         /pc/ts/tsutle22.zip at Garbo
  1959.         /pub/msdos/sysutil/tsutle22.zip at SimTel.
  1960.  
  1961.     Good reports of CMOS299.ZIP, available in the pc.dir directory of
  1962.     cantva.canterbury.ac.nz [132.181.30.3], have been posted.
  1963.  
  1964.     Of the above, my only experience is with CMOSRAM, which seems to
  1965.     work fine.  It contains an excellent (and witty) .DOC file that
  1966.     explains the hardware involved and gives specific recommendations
  1967.     for preventing disaster or recovering from it.  It's $5 shareware.
  1968.  
  1969.     Robert Jourdain's {Programmer's Problem Solver for the IBM PC, XT,
  1970.     and AT} has code for accessing the CMOS RAM, according to an article
  1971.     posted in this newsgroup.
  1972.  
  1973.     6.09 - How can I access memory beyond 640K?
  1974.     -------------------------------------------
  1975.  
  1976.     PC Magazine 29 June 1993 (xii:12) pages 302-304 carry an article,
  1977.     "How DOS Programs Can Use Over 1MB of RAM".
  1978.  
  1979.     6.10 - How can I use the protected mode?
  1980.     ----------------------------------------
  1981.     (New: 05/09/1994)
  1982.  
  1983.     If you are using Borland C++ Version 4.0, you can purchase the
  1984.     Borland PowerPack for DOS Version 1.00. This package includes:
  1985.     Borland C++ 4.02 Service Update, 16-bit DPMI libraries and
  1986.     extenders, 32-bit DPMI libraries and extenders, TurboVision 2.0
  1987.     (16-bit DOS, 16-bit DPMI, 32-bit DPMI), SuperVGA BGI Drivers
  1988.     (16-bit DOS, 16-bit DPMI, 32-bit DPMI).
  1989.  
  1990.     Thomas Pytel has written his own DOS extender for Borland C++
  1991.     4.0.
  1992.  
  1993.     Here is a exert from Pytel's documentation about PMC Version 1.01:
  1994.  
  1995.        "PMC contains a small library of the most commonly used and needed
  1996.     system functions. Some ANSI C compliant functions are provided, but
  1997.     overall, PMC is not ANSI compatible. Malloc functions are available.
  1998.     As are many low level string and memory block functions. PMC also
  1999.     provides some DPMI functions, some non-ANSI file functions, and low
  2000.     level IRQ functions. There are low level functions for fast mode
  2001.     switching using the raw mode switching services of whatever DPMI host
  2002.     it is running under.
  2003.  
  2004.        "I designed the PMC interface and library to serve as a small,
  2005.     tight, kernel for other C code to be built around. My primary use
  2006.     for it will be games, demos, and many other things which do not really
  2007.     use standard C functions. But the low level functions provided in
  2008.     PMC.LIB will find much use in almost any type of program that is done.
  2009.  
  2010.        "PMC allows flat access to low and extended memory. You need not
  2011.     deal with segments or near and far pointers. In fact, BCC32 does
  2012.     not recognize the near or far keywords. Memory is split into two pools,
  2013.     a low memory pool and an extended memory pool. This is transparent to
  2014.     your code though, as the malloc routines check both pools for any
  2015.     memory requests. You can deal explicitly with the low or high memory
  2016.     heaps if you wish. You may need a low memory DMA buffer for example.
  2017.  
  2018.        "The extender used is PMODE 3.0. It is about 9k of code and it
  2019.     is internal to the EXE file which is created. For more information
  2020.     on it, you should read the PMODE documentation. The programs created
  2021.     with PMC will run on any 386+ system which is running as a clean system,
  2022.     under XMS, VCPI, or DPMI. This covers all memory managers and Windows
  2023.     and OS/2. In addition, the PMODE extender is very fast. I should know,
  2024.     I wrote for that purpose."
  2025.  
  2026.     PMC is freeware and includes the source code which is in C
  2027.     and assembly language. PMC Version 1.01 can be found in
  2028.  
  2029.         /pub/msdos/demos/programming/source/pmc101.zip at ftp.eng.ufl.edu
  2030.  
  2031.     Adam Seychell has written a DOS extender for ASM programmers. His
  2032.     shareware library DOS32 Version 2.4 can be found in
  2033.  
  2034.         /pub/msdos/demos/programming/source/dos32v24.zip at ftp.eng.ufl.edu
  2035.  
  2036. Section 7. Other software questions and problems
  2037. ------------------------------------------------
  2038.  
  2039.     7.01 - How can a program reboot my PC?
  2040.     --------------------------------------
  2041.  
  2042.     You can generate a "cold" boot or a "warm" boot.  A cold boot is the
  2043.     same as turning the power off and on; a warm boot is the same as
  2044.     Ctrl-Alt-Del and skips the power-on self 'test.
  2045.  
  2046.     For a warm boot, store the hex value 1234 in the word at 0040:0072.
  2047.     For a cold boot, store 0 in that word.  Then, if you want to live
  2048.     dangerously, jump to address FFFF:0000.  Here's C code to do it:
  2049.  
  2050.         /* WARNING:  data loss possible */
  2051.         void bootme(int want_warm)  /* arg 0 = cold boot, 1 = warm */ {
  2052.             void (far* boot)(void) = (void (far*)(void))0xFFFF0000UL;
  2053.             unsigned far* type = (unsigned far*)0x00400072UL;
  2054.             *type = (want_warm ? 0x1234 : 0);
  2055.             (*boot)( );
  2056.         }
  2057.  
  2058.     What's wrong with that method?  It will boot right away, without
  2059.     closing files, flushing disk caches, etc.  If you boot without
  2060.     flushing a write-behind disk cache (if one is running), you could
  2061.     lose data or trash the file allocation table in your hard drive.
  2062.  
  2063.     There are two methods of signaling the cache to flush its buffers:
  2064.     (1) simulate a keyboard Ctrl-Alt-Del in the keystroke translation
  2065.     function of the BIOS (INT 15 AH=4F; but see notes below), and (2)
  2066.     issue a disk reset (DOS function 0D).  Most disk-cache programs hook
  2067.     one or both of those interrupts, so if you use both methods you'll
  2068.     probably be safe.
  2069.  
  2070.     When user code simulates a Ctrl-Alt-Del, one or more of the programs
  2071.     that have hooked INT 15 AH=4F can ask that the key be ignored by
  2072.     clearing the carry flag.  For example, HyperDisk does this when it
  2073.     has started but not finished a cache flush.  So if the carry flag
  2074.     comes back cleared, the boot code has to wait a couple of clock
  2075.     ticks and then try again.  (None of this matters on older machines
  2076.     whose BIOS can't support 101- or 102-key keyboards; see the
  2077.     discussion of INT 21 AH=4F in "307. What is the SysRq key for?")
  2078.  
  2079.     C code that tries to signal the disk cache (if any) to flush is
  2080.     given below.  Turbo Pascal code by Timo Salmi that does more or less
  2081.     the same job may be found at question 49 (as of this writing) in the
  2082.     Turbo Pascal FAQ in comp.lang.pascal, and is downloadable as file
  2083.     FAQPAS2.TXT, which is part of
  2084.  
  2085.         /pc/ts/tsfaqp18.zip at Garbo
  2086.         /pub/msdos/info/tsfaqp18.zip at SimTel.
  2087.  
  2088.     Here's C code that reboots after trying to signal the disk cache:
  2089.  
  2090.         #include <dos.h>
  2091.         void bootme(int want_warm)  /* arg 0 = cold boot, 1 = warm */ {
  2092.             union REGS reg;
  2093.             void    (far* boot)(void) = (void (far*)(void))0xFFFF0000UL;
  2094.             unsigned far* boottype    =     (unsigned far*)0x00400072UL;
  2095.             char     far* shiftstate  =         (char far*)0x00400017UL;
  2096.             unsigned      ticks;
  2097.             int           time_to_waste;
  2098.             /* Simulate reception of Ctrl-Alt-Del: */
  2099.             for (;;) {
  2100.                 *shiftstate |= 0x0C;    /* turn on Ctrl & Alt */
  2101.                 reg.h.ah = 0x4F;        /* see notes below */
  2102.                 reg.h.al = 0x53;        /* 0x53 = Del's scan code */
  2103.                 reg.x.cflag = 1;        /* sentinel for ignoring key */
  2104.                 int86(0x15, ®, ®);
  2105.                 /* If carry flag is still set, we've finished. */
  2106.                 if (reg.x.cflag)
  2107.                     break;
  2108.                 /* Else waste some time before trying again: */
  2109.                 reg.h.ah = 0;
  2110.                 int86(0x1A, ®, ®);/* system time into CX:DX */
  2111.                 ticks = reg.x.dx;
  2112.                 for (time_to_waste = 3;  time_to_waste > 0;  ) {
  2113.                     reg.h.ah = 0;
  2114.                     int86(0x1A, ®, ®);
  2115.                     if (ticks != reg.x.dx)
  2116.                         ticks = reg.x.dx , --time_to_waste;
  2117.                 }
  2118.             }
  2119.             /* Issue a DOS disk reset request: */
  2120.             reg.h.ah = 0x0D;
  2121.             int86(0x21, ®, ®);
  2122.             /* Set boot type and boot: */
  2123.             *boottype = (want_warm ? 0x1234 : 0);
  2124.             (*boot)( );
  2125.         }
  2126.  
  2127.     Reader Timo Salmi reported (26 July 1993) that the INT 15 AH=4F call
  2128.     may not work on older PCs (below AT, XT2, XT286), according to Ralf
  2129.     Brown's interrupt list (Q 1.17).
  2130.  
  2131.     Reader Roger Fulton reported (1 July 1993) that INT 15 AH=4F hangs
  2132.     even a modern PC "ONLY when ANSI.SYS [is] loaded high using
  2133.     EMM386.EXE.  (Other things loaded high with EMM386.EXE were OK;
  2134.     ANSI.SYS loaded high with QEMM386.SYS was OK; ANSI.SYS loaded low
  2135.     with EMM386.EXE installed was OK.)"  His solution was to use only
  2136.     the disk reset, INT 21 AH=0D, which does flush SMARTDRV, then wait
  2137.     five seconds in hopes that any other disk-caching software would
  2138.     have time to flush its queue.
  2139.  
  2140.     Reader Per Bergland reported (10 Sep 1993) that the jump to
  2141.     FFFF:0000 will not work in Windows or other protected-mode programs.
  2142.     (For example, when the above reboot code ran in a DOS session under
  2143.     Windows, a box with "waiting for system shutdown" appeared.  The PC
  2144.     hung and had to be reset by cycling power.)  His solution, which
  2145.     does a cold boot not a warm boot, is to pulse pin 0 of the 8042
  2146.     keyboard controller, which is connected to the CPU's "reset" line.
  2147.     He has tested the following code on various Compaqs, and expects it
  2148.     will work for any AT-class machine; he cautions that you must first
  2149.     flush the disk cache as indicated above.
  2150.  
  2151.             cli
  2152.         @@WaitOutReady:   ; Busy-wait until 8042 ready for new command
  2153.             in al,64h         ; read 8042 status byte
  2154.             test al,00000010b ; this bit indicates input buffer full
  2155.             jnz @@WaitOutReady
  2156.             mov al,0FEh       ; Pulse "reset" = 8042 pin 0
  2157.             out 64h,al
  2158.             ; The PC will reboot now
  2159.  
  2160.     7.02 - How can I time events with finer resolution than the
  2161.            system clock's 55 ms (about 18 ticks a second)? 
  2162.     -----------------------------------------------------------           
  2163.  
  2164.     The following files, among others, are downloadable from SimTel:
  2165.  
  2166.         /pub/msdos/at :
  2167.         atim.zip       4783  881126  Precision program timing for AT
  2168.  
  2169.         /pub/msdos/c :
  2170.         millisec.zip  37734  911205  MSC/asm src for millisecond timing
  2171.         mschrt3.zip   53708  910605  High-res timer toolbox for MSC 5.1
  2172.         msec_12.zip    8484  920320  High-def timer v1.2 (C,ASM)
  2173.         ztimer11.zip  77625  920428  Microsecond timer for C, C++, ASM
  2174.             (also at Garbo as /pc/c/ztimer11.zip)
  2175.  
  2176.         /pub/msdos/turbo_c :
  2177.         tchrt3.zip    53436  910606  High-res timer for Turbo C 2.0
  2178.         tctimer.zip   15609  891030  High-res timing for Turbo C
  2179.             (same as /pc/c/tctimer.zoo at Garbo; both are version 1.0)
  2180.  
  2181.     For Turbo Pascal users, source and object code are downloadable in
  2182.  
  2183.         /pub/msdos/turbopas/bonus507.zip at SimTel
  2184.         /pc/turbopas/bonus507.zip at Garbo.
  2185.  
  2186.     Also see "Q: How is millisecond timing done?" in FAQPAS.TXT,
  2187.     downloadable as part of
  2188.  
  2189.         /pc/ts/tsfaqp18.zip at Garbo
  2190.         /pub/msdos/info/tsfaqp18.zip at SimTel.
  2191.  
  2192.     7.03 - How can I find the error level of the previous program?
  2193.     --------------------------------------------------------------
  2194.  
  2195.     First, which previous program are you talking about?  If your
  2196.     current program ran another one, when the child program ends its
  2197.     error level is available to the program that spawned it.  Most high-
  2198.     level languages provide a way to do this; for instance, in Turbo
  2199.     Pascal it's Lo(DosExitCode) and the high byte gives the way in which
  2200.     the child terminated.  In Microsoft C, the exit code of a
  2201.     synchronous child process is the return value of the spawn-type
  2202.     function that creates the process.
  2203.  
  2204.     If your language doesn't have a function to return the error code of
  2205.     a child process, you can use INT 21 AH=4D (get return code).  By the
  2206.     way, this will tell you the child's exit code and the manner of its
  2207.     ending (normal, Ctrl-C, critical error, or TSR).
  2208.  
  2209.     It's much trickier if the current program wants to get the error
  2210.     level of the program that ran and finished before this one started.
  2211.     G.A.Theall has published source and compiled code to do this; the
  2212.     code is downloadable as
  2213.  
  2214.         /pub/msdos/batutil/errlvl13.zip at SimTel
  2215.         /pc/batchutil/errlvl12.zip (an older version) at Garbo.
  2216.  
  2217.     (The code uses undocumented features in DOS 3.3 through 5.0.  Theall
  2218.     says in the .DOC file that the values returned under 4DOS or other
  2219.     replacements won't be right.)
  2220.  
  2221.     7.04 - How can a program set DOS environment variables?
  2222.     -------------------------------------------------------
  2223.  
  2224.     Program functions that read or write "the environment" typically
  2225.     access only the program's copy of it.  What this Q really wants to
  2226.     do is to modify the active environment, the one that is affected by
  2227.     SET commands in batch files or at the DOS prompt.  You need to do
  2228.     some programming to find the active environment, and that depends on
  2229.     the version of DOS.
  2230.  
  2231.     A fairly well-written article in PC Magazine 28 Nov 1989 (viii:20),
  2232.     pages 309-314, explains how to find the active environment, and
  2233.     includes Pascal source code.  The article hints at how to change the
  2234.     environment, and suggests creating paths longer than 128 characters
  2235.     as one application.
  2236.  
  2237.     Now as for downloadable source code, there are many possibilities.
  2238.     I looked at some of these, and liked
  2239.  
  2240.         /pub/msdos/envutil/rbsetnv1.zip at SimTel
  2241.         /pc/envutil/rbsetnv1.zip at Garbo
  2242.  
  2243.     the best.  It includes some utilities to manipulate the environment,
  2244.     with source code in C.  A newer program is
  2245.  
  2246.         /pub/msdos/batutil/strings2.zip at SimTel
  2247.         part of /pc/pcmag/vol11n22.zip at Garbo,
  2248.  
  2249.     which is the code from PC Magazine 22 Dec 1992 (xi:22).
  2250.  
  2251.     You can also use a call to INT 2E, Pass Command to Interpreter for
  2252.     Execution; see Ralf Brown's interrupt list (Q 1.17) for details and
  2253.     cautions.
  2254.  
  2255.     7.05 - How can I change the switch character to - from /?
  2256.     ---------------------------------------------------------
  2257.  
  2258.     Under DOS 5.0 and above, you can't--not completely, anyway.  INT 21
  2259.     AX=3700, get switch character, always returns a '/' (hex 2F).  But
  2260.     the DOS commands don't even call that function: they simply hard
  2261.     code '/' as the switch character.
  2262.  
  2263.     Some history:  DOS used to let you change the switch character by
  2264.     using SWITCHAR= in CONFIG.SYS or by calling DOS function 3701.  DOS
  2265.     commands and other programs called DOS function 3700 to find out the
  2266.     switch character.  If you changed the switch character to '-' (the
  2267.     usual choice), you could then type "dir c:/c700 -p" rather than "dir
  2268.     c:\c700 /p".  Under DOS 4.0, the DOS commands ignored the switch
  2269.     character but functions 3700 and 3701 still worked and could be used
  2270.     by other programs.  Under DOS 5.0, even those functions no longer
  2271.     work, though all DOS functions still accept '/' or '\' in file
  2272.     specs.
  2273.  
  2274.     You can reactivate the functions to get and set switchar by using
  2275.     programs like SLASH.ZIP or the sample TSR called SWITCHAR in
  2276.     amisl091.zip (see "7.06 - How can I write a TSR (terminate-stay-
  2277.     resident utility)?").  DOS commands will still use the slash, but
  2278.     non-DOS programs that call DOS function 3700 will use your desired
  2279.     switch character.  (DOS replacements like 4DOS may honor the switch
  2280.     character for internal commands.)
  2281.  
  2282.     Some readers may wonder why this is even an issue.  Making '-' the
  2283.     switch character frees up the front slash to separate names in the
  2284.     path part of a file spec.  This is easier for the ten-fingered to
  2285.     type, and it's one less difference to remember for commuters between
  2286.     DOS and Unix.  The switch character is the only issue, since all the
  2287.     INT 21 functions accept '/' or '\' to separate directory names.
  2288.  
  2289.     7.06 - How can I write a TSR (terminate-stay-resident utility)?
  2290.     ---------------------------------------------------------------
  2291.  
  2292.     There are books, and there's code to download.
  2293.  
  2294.     First, the books:
  2295.  
  2296.     - Ray Duncan's {Advanced MS-DOS}, ISBN 1-55615-157-8, gives a brief
  2297.       checklist intended for experienced programmers.  The ISBN is for
  2298.       the second edition, through DOS 4; but check to see whether the
  2299.       DOS 6 version is available yet.
  2300.  
  2301.     - {DOS 5:  A Developer's Guide} by Al Williams, ISBN 1-55851-177-6,
  2302.       goes into a little more detail, 90 pages worth!
  2303.  
  2304.     - Pascal programmers might look at {The Ultimate DOS Programmer's
  2305.       Manual} by John Mueller and Wallace Wang, ISBN 0-8306-3534-3, for
  2306.       an extended example in mixed Pascal and assembler.
  2307.  
  2308.     - For a pure assembler treatment, check Steven Holzner's {Advanced
  2309.       Assembly Language}, ISBN 0-13-663014-6.  He has a book with the
  2310.       same title out from Brady Press, but it's about half as long as
  2311.       this one.
  2312.  
  2313.     Next, the code.  Some of it is companion code to published articles,
  2314.     which are also listed below:
  2315.  
  2316.     - The Alternate Multiplex Interrupt Specification, downloadable as
  2317.  
  2318.         /pub/msdos/info/altmpx35.zip at SimTel
  2319.         /pc/programming/altmpx35.zip at Garbo
  2320.         /afs/cs/user/ralf/pub/altmpx35.zip at cs.cmu.edu
  2321.  
  2322.     - Ralf Brown's assembly-language implementation of the spec, with
  2323.       utilities in C, is downloadable as
  2324.  
  2325.         /pub/msdos/asmutil/amisl091.zip at SimTel
  2326.         /pc/c/amisl091.zip at Garbo
  2327.         /afs/cs/user/ralf/pub/amisl091.zip at cs.cmu.edu
  2328.  
  2329.     - Douglas Boling's MASM template for a TSR is downloadable as
  2330.  
  2331.         /pub/msdos/asmutl/template.zip at SimTel.
  2332.  
  2333.     - A posted article mentions Boling's "Strategies and Techniques for
  2334.       Writing State-of-the-Art TSRs that Exploit MS-DOS 5", Microsoft
  2335.       Systems Journal, Jan-Feb 1992, Volume 7, Number 1, pages 41-59,
  2336.       with examples downloadable in
  2337.  
  2338.         /pub/msdos/msjournal/msjv7-1.zip at SimTel
  2339.  
  2340.     - code for Al Stevens's "Writing Terminate-and-Stay-Resident
  2341.       Programs", Computer Language, February 1988, pages 37-48 and March
  2342.       1988, pages 67-76 is downloadable as
  2343.  
  2344.         /pub/msdos/c/tsrc.zip at SimTel
  2345.  
  2346.     - software examples to accompany Kaare Christian's "Using Microsoft
  2347.       C Version 5.1 to Write Terminate-and-Stay-Resident Programs",
  2348.       Microsoft Systems Journal, September 1988, Volume 3, Number 5,
  2349.       pages 47-57 are downloadable as
  2350.  
  2351.         /pub/msdos/msjournal/msjv3-5.arc at SimTel
  2352.  
  2353.     Finally, there are commercial products, of which TesSeRact (for C-
  2354.     language TSRs) is one of the best known.
  2355.  
  2356.     7.07 - Why does my interrupt function behave strangely? 
  2357.     -------------------------------------------------------
  2358.  
  2359.     Interrupt service routines can be tricky, because you have to do
  2360.     some things differently from "normal" programs.  If you make a
  2361.     mistake, debugging is a pain because the symptoms may not point at
  2362.     what's wrong.  Your machine may lock up or behave erratically, or
  2363.     just about anything else can happen.  Here are some things to look
  2364.     for.  (See "7.06 - How can I write a TSR (terminate-stay-resident
  2365.     utility)?" for general techniques that may prevent a problem.)
  2366.  
  2367.     First, did you fail to set up the registers at the start of your
  2368.     routine?  When your routine begins executing, you can count on
  2369.     having CS point to your code segment and SS:SP point to some valid
  2370.     stack (of unknown length), and that's it.  In particular, an
  2371.     interrupt service routine must set DS to DGROUP before accessing any
  2372.     data in its data segments.  (If you're writing in a high-level
  2373.     language, the compiler may generate this code for you automatically;
  2374.     check your compiler manual.  For instance, in Borland and Microsoft
  2375.     C, give your function the "interrupt" attribute.)
  2376.  
  2377.     Did you remember to turn off stack checking when compiling your
  2378.     interrupt server and any functions it calls?  The stack during the
  2379.     interrupt is not where the stack-checking code expects it to be.
  2380.     (Caution:  Some third-party libraries have stack checking compiled
  2381.     in, so you can't call them from your interrupt service routine.)
  2382.  
  2383.     Next, are you calling any DOS functions (INT 21, 25, or 26) in your
  2384.     routine?  DOS is not re-entrant.  This means that if your interrupt
  2385.     happens to be triggered while the CPU is executing a DOS function,
  2386.     calling another DOS function will wreak havoc.  (Some DOS functions
  2387.     are fully re-entrant, as noted in Ralf Brown's interrupt list (Q
  2388.     1.17).  Also, your program can test, in a way too complicated to
  2389.     present here, when it's safe to call non-re-entrant DOS functions.
  2390.     See INT 28, INT 21 AH=34, and INT 21 AX=5D06 or 5D0B; and consult
  2391.     {Undocumented DOS} by Andrew Schulman.  Your program must read both
  2392.     the "InDOS flag" and the "critical error flag".)
  2393.  
  2394.     Is a function in your language library causing trouble?  Does it
  2395.     depend on some initializations done at program startup that is no
  2396.     longer available when the interrupt executes?  Does it call DOS (see
  2397.     preceding paragraph)?  For example, in both Borland and Microsoft C
  2398.     the memory-allocation functions (malloc(), etc..) call DOS functions
  2399.     and also depend on setups that they can't get at from inside an
  2400.     interrupt; so do the standard I/O functions like scanf() and
  2401.     printf().  Many other library functions have the same problem, so
  2402.     you can't use them inside an interrupt function without special
  2403.     precautions.
  2404.  
  2405.     Is your routine simply taking too long?  This can be a problem if
  2406.     you're hooking on to the timer interrupt, INT 1C or INT 8.  That
  2407.     interrupt expects to be called about every 55 ms, which is 18.2
  2408.     times a second.  Therefore your routine, plus any others hooked to
  2409.     the same interrupts, must execute in less than 55 ms.  If they use
  2410.     even a substantial fraction of that time, you'll see significant
  2411.     slowdowns of your foreground program.  A good discussion is
  2412.     downloadable as
  2413.  
  2414.         pub/msdos/SIMTEL20-mirror/info/intshare.zip at ni.funet.fi
  2415.         /pub/msdos/info/intshare.zip at SimTel.
  2416.  
  2417.     Did you forget to restore all registers at the end of your routine?
  2418.  
  2419.     Did you chain improperly to the original interrupt?  You need to
  2420.     restore the stack to the way it was upon entry to your routine, then
  2421.     do a far jump (not call) to the original interrupt service routine.
  2422.     (The process is a little different in high-level languages.)
  2423.  
  2424.     7.08 - How can I write a device driver?
  2425.     ---------------------------------------
  2426.  
  2427.     Many books answer this in detail.  Among them are {Advanced MS-DOS}
  2428.     and {DOS 5: A Developer's Guide}, cited in the preceding Q.  Michael
  2429.     Tischer's {PC System Programming}, ISBN 1-55755-036-0, has an
  2430.     extensive treatment, as does Dettman and Kyle's {DOS Programmer's
  2431.     Reference: 2d Edition}, ISBN 0-88022-458-4.  For a really in-depth
  2432.     treatment, look for a specialized book like Robert Lai's {Writing MS-
  2433.     DOS Device Drivers}, ISBN 0-201-13185-4.
  2434.  
  2435.     7.09 - What can I use to manage versions of software? 
  2436.     -----------------------------------------------------
  2437.  
  2438.     A port of the Unix RCS utility is downloadable as
  2439.  
  2440.         /pub/msdos/gnuish/rcs55ax.zip (EXE and docs) from SimTel
  2441.         /pub/msdos/gnuish/rcs55as.zip (source) from SimTel
  2442.         /pc/unix/alrcs5ex.zip (EXE and docs ?) from Garbo.
  2443.  
  2444.     This version of RCS is no longer limited to one-character extensions
  2445.     on filenames (for example, .CPP and .BAS are now OK).
  2446.  
  2447.     An RCS56 is available at a number of archive sites, but it appears
  2448.     to be unauthorized.  In response to a query, Keith Petersen, SimTel
  2449.     administrator, said that RCS56 was removed from SimTel at the
  2450.     author's request because it did not contain source code and thus was
  2451.     in violation of the GNU copyleft.
  2452.  
  2453.     As for commercial software, I posted a question asking for readers'
  2454.     experiences in July 1993 and seven readers responded.  PVCS from
  2455.     Intersolv (formerly Polymake) got five positive reviews, though
  2456.     several readers commented that it's expensive; RCS from MKS got one
  2457.     positive and one negative review; Burton TLIB got one negative
  2458.     review; DRTS from ILSI got one positive review.
  2459.  
  2460.     7.10 - What's this "null pointer assignment" after my C program
  2461.                executes? 
  2462.     ---------------------------------------------------------------
  2463.  
  2464.     Somewhere in your program, you assigned a value _through_ a pointer
  2465.     without first assigning a value _to_ the pointer.  (This might have
  2466.     been something like a strcpy() or memcpy() with a pointer as its
  2467.     first argument, not necessarily an actual assignment statement.)
  2468.     Your program may look like it ran correctly, but if you get this
  2469.     message you can be certain that there's a bug somewhere.
  2470.  
  2471.     Microsoft and Borland C, as part of their exit code (after a call to
  2472.     exit() or a return from your main function), check whether the
  2473.     location 0000 in your data segment contains a different value from
  2474.     what you started with.  If so, they infer that you must have used an
  2475.     uninitialized pointer.  This implies that the message will appear at
  2476.     the end of execution of your program regardless of where the error
  2477.     actually occurred.
  2478.  
  2479.     To track down the problem, you can put exit() calls at various spots
  2480.     in the program and narrow down where the uninitialized pointer is
  2481.     being used by seeing which added exit() makes the null-pointer
  2482.     message disappear.  Or, if your program was compiled with small or
  2483.     medium models, which use 16-bit data pointers, tell the debugger to
  2484.     set a watch at location 0000 in your data segment.  (If data
  2485.     pointers are 32 bits, as in the compact and large models, a null
  2486.     pointer will overwrite the interrupt vectors at 0000:0000 and
  2487.     probably lock up your machine.)
  2488.  
  2489.     Under MSC/C++ 7.0, you can declare the undocumented library function
  2490.  
  2491.         extern _cdecl _nullcheck(void);
  2492.  
  2493.     and then sprinkle calls to _nullcheck() through your program at
  2494.     regular intervals.
  2495.  
  2496.     Borland's TechFax document TI726 discusses the null pointer
  2497.     assignment from a Borland point of view.  It's one of many documents
  2498.     downloadable as part of
  2499.  
  2500.         /pub/msdos/turbo-c/bchelp10.zip at SimTel
  2501.         /pc/turbopas/bchelp10.zip at Garbo.
  2502.  
  2503.     7.11 - How can a batch file tell whether it's being run in a DOS
  2504.                box under Windows? 
  2505.     ----------------------------------------------------------------
  2506.     
  2507.     When Windows 3.0 or 3.1 is running, the DOS environment will contain
  2508.     a definition of the string windir, in lower case.  That's not really
  2509.     useful, however, because the batch statement
  2510.  
  2511.         if "%windir%" == "" ...
  2512.  
  2513.     will test for an environment variable WINDIR in upper case.
  2514.  
  2515.     Your only real option is to write a program as suggested by the
  2516.     following Q, and have it return a value which your batch file can
  2517.     test via "if errorlevel".
  2518.  
  2519.     7.12 - How can my program tell if it's running under Windows?
  2520.     -------------------------------------------------------------
  2521.  
  2522.     Execute INT 2F AX=4680.  If AX returns 0, you're in Windows real
  2523.     mode or standard mode (or under the DOS shell).  Otherwise, call INT
  2524.     2F AX=1600.  If AL returns something other than 0 or 80, you're in
  2525.     Windows 386 enhanced mode.  See PC Magazine 24 Nov 1992 (xi:20)
  2526.     pages 492-493.
  2527.  
  2528.     For more information, see PC Magazine 26 May 1992 (xi:10) pages 345-
  2529.     346.  A program, WINMODE, is available as part of
  2530.  
  2531.         /pub/msdos/pcmag/vol11n10.zip at SimTel
  2532.         /pc/pcmag/vol11n10.zip at Garbo.
  2533.  
  2534.     PC Magazine 29 March 1994 (xiii:6) pages 312 and 320 published a new
  2535.     program, WINVER.  This would be in
  2536.  
  2537.         /pub/msdos/pcmag/vol13n06.zip at SimTel
  2538.         /pc/pcmag/vol13n06.zip at Garbo.
  2539.  
  2540.     7.13 - How can a program tell whether ANSI.SYS is installed?
  2541.     ------------------------------------------------------------
  2542.  
  2543.     In DOS 4.0 and above, call INT 2F AX=1A00.  If the value FF is
  2544.     returned in AL, ANSI.SYS is installed.  For more information, see
  2545.     Ralf Brown's interrupt list (question 1.17).
  2546.  
  2547.     7.14. How do I copyright software that I write? 
  2548.     -----------------------------------------------
  2549.  
  2550.     You can download a very comprehensive answer from the Internet.
  2551.     Terry Carroll posts a six-part Copyright FAQ to misc.legal,
  2552.     news.answers and other groups.  A short answer follows, not based on
  2553.     that article.
  2554.  
  2555.     Disclaimer: I am not a lawyer, and this is not legal advice.  Also,
  2556.     there are very likely to be differences in copyright law among
  2557.     nations.  No matter where you live, if significant money may be
  2558.     involved, get legal advice.  The following is adapted (and greatly
  2559.     condensed) from chapter 4 of the Chicago Manual of Style (13th
  2560.     edition, ISBN 0-226-10390-0).
  2561.  
  2562.     In the U.S. (at least), when you write something, you own the
  2563.     copyright.  (The exception that matters most to programmers is
  2564.     "works made for hire", i.e., code you write because your employer or
  2565.     client pays you to.  A contract, agreed in advance, can vest the
  2566.     copyright in the programmer even if an employee; otherwise the
  2567.     employer owns the copyright.)  You don't have to register the work
  2568.     with the Copyright Office unless (until) the copyright is infringed
  2569.     and you intend to bring suit; however, it is easier to recover
  2570.     damages in court if you did register the work within three months of
  2571.     publication.
  2572.  
  2573.     From paragraph 4.16 of the Chicago Manual:  "... the [copyright]
  2574.     notice consists of three parts: (1) the symbol [C-in-a-circle]
  2575.     (preferred because it also suits the requirements of the Universal
  2576.     Copyright Convention), the word 'Copyright', or the abbreviation
  2577.     'Copr.', (2) the year of first publication, and (3) the name of the
  2578.     copyright owner.  Most publishers also add the phrase 'All rights
  2579.     reserved' because it affords some protection in Central and South
  2580.     American countries ...."  Surprise: "(C)" is legally not the same as
  2581.     the C-in-a-circle, so those of us who are ASCII-bound must use the
  2582.     word or the abbreviation.
  2583.  
  2584.  
  2585. Section 8.  Downloading
  2586. -----------------------
  2587.  
  2588.     8.01 - What are SimTel, Garbo, and Wustl?
  2589.     -----------------------------------------
  2590.  
  2591.     These are three of the most popular archive sites, with a few
  2592.     bazillion files available for free downloading by ftp.  (For email
  2593.     access, see "8.02 - I have no ftp access.  How can I get files from
  2594.     the archives?".)  Many of the files are shareware and you're
  2595.     expected to send a payment directly to the authors if you use them
  2596.     regularly.
  2597.  
  2598.     In comp.archives.msdos.d, Samuel Ko posts a two-part "Useful MS-DOS
  2599.     Programs at SIMTEL20 and Garbo"; it's downloadable as
  2600.  
  2601.         /pub/msdos/info/useful34.zip at SimTel
  2602.         /pc/filelist/useful34.zip at Garbo
  2603.         /pub/usenet/news.answers/msdos-archives/part* at rtfm.mit.edu.
  2604.  
  2605.     For rtfm.mit.edu instructions, see "1.13 - Where are FAQ lists
  2606.     archived?"
  2607.  
  2608.     A few words about file names and versions:  Many files at the
  2609.     archive sites are updated from time to time.  I verified every
  2610.     filename in this FAQ as of 24 Mar 1994 by ftp to the named sites, or
  2611.     by consulting their index files.  If you can't find a file given in
  2612.     these articles as mumble12.zip, perhaps there's a newer version; try
  2613.     mumble13.zip or mumble14.zip, or mumble*.zip if your ftp program
  2614.     supports wildcards (most do so).  Please let me know of any out-of-
  2615.     date file names.
  2616.  
  2617.     This FAQ should show both Garbo and SimTel directory and file names,
  2618.     if available, for every file mentioned for downloading.  If you see
  2619.     a listing for only one of them, it means that the file was not found
  2620.     at the other site, or that the other site's catalog shows an old
  2621.     version.
  2622.  
  2623.     Also remember that caps and lower case filenames are not
  2624.     interchangeable at most archive sites.
  2625.  
  2626.     1) SimTel = oak.oakland.edu is located at the University of
  2627.     Rochester in the USA, and there are also many mirror sites including
  2628.     wuarchive.wustl.edu, archive.orst.edu, ftp.uu.net, nic.funet.fi,
  2629.     archie.au, and nctucca.edu.tw.  For instructions, see these monthly
  2630.     articles in comp.archives.msdos.announce:
  2631.  
  2632.         How to find files in the SIMTEL20 msdos collection
  2633.         How to order SIMTEL20 files via e-mail
  2634.         How to upload files to SIMTEL20
  2635.  
  2636.     These are downloadable from SimTel as
  2637.  
  2638.         /pub/msdos/filedocs/aaaread.me
  2639.         /pub/msdos/filedocs/mailserv.inf
  2640.         /pub/msdos/filedocs/upload.inf.
  2641.  
  2642.     2) Garbo = garbo.uwasa.fi [128.214.87.1] is located at the
  2643.     University of Vaasa in Finland and maintained by Timo Salmi
  2644.     (ts@uwasa.fi) and others.  Garbo and SimTel contain many of the same
  2645.     files, but there are many differences too.  Among them: the
  2646.     directory structures differ greatly, and case is significant in
  2647.     directory and file names at Garbo.
  2648.  
  2649.     3) wustl = wuarchive.wustl.edu [128.252.135.4] mirrors, among
  2650.     others, Garbo (in /systems/ibmpc/garbo) and SimTel (in
  2651.     /systems/ibmpc/msdos).  As with any mirror site, it may lag by a day
  2652.     or two, so you may not want to try it on the same day you see an
  2653.     upload notice posted.
  2654.  
  2655.     4) others:
  2656.  
  2657.     A comprehensive list of MS-DOS archive sites is downloadable as
  2658.  
  2659.         /pc/pd2/moder35.zip at Garbo
  2660.         /pub/msdos/info/moder35.zip at SimTel.
  2661.  
  2662.     For archie.au via Telnet (different from the Archie file-finding
  2663.     mail servers):  Oceanian users should try archie.au first.  Paul
  2664.     Brooks has written to say that it "mirrors Garbo and SimTel-20 (in
  2665.     /micros/pc/simtel-20, /micros/pc/garbo) as well as many other
  2666.     archives.  Telnetting to 'archie.au' and logging on as 'archie' (no
  2667.     password) will access the Oceanic ARCHIE server." Email Craig Warren
  2668.     (ccw@archie.au) for instructions if needed.
  2669.  
  2670.     8.02 - I have no ftp access.  How can I get files from the archives?
  2671.     --------------------------------------------------------------------
  2672.  
  2673.     First, be sure that you have no ftp access before trying email
  2674.     methods.  (Ask your sysadmin, or a knowledgeable user at your site.)
  2675.     ftp is better for you because it's faster, and it uses less net
  2676.     resources too.
  2677.  
  2678.     When using an email server, make sure the Reply-to path in your
  2679.     message is valid.  If it's not, you'll get no reply from the server.
  2680.     Do wait a few days before assuming you're not going to get a
  2681.     response; some servers have long pending queues.  After a suitable
  2682.     wait, get your sysadmin's help to correct your reply-to, and send
  2683.     your message again.
  2684.  
  2685.     Occasionally a machine goes down for an extended period, which may
  2686.     prevent a timely reply to your message.  If you're sure your message
  2687.     bears a good reply path and you haven't got a reply in a week or so,
  2688.     you might send your message again, once.  Don't post it as an
  2689.     article in a newsgroup.
  2690.  
  2691.     For files from SimTel, see "How to order SIMTEL20 files via e-mail",
  2692.     posted monthly in comp.archives.msdos.announce; or send email
  2693.     containing only the word "help" to listserv@vm1.nodak.edu.  For
  2694.     instructions on using Garbo's email server, send a request to Timo
  2695.     Salmi at ts@uwasa.fi.
  2696.  
  2697.     The DEC Western Research Labs server will get files from any ftp
  2698.     site by ftp and then email them to you.  Send email containing
  2699.     "help" to ftpmail@decwrl.dec.com.
  2700.  
  2701.     8.03 - Can I get archives on CD-ROM?
  2702.     ------------------------------------
  2703.  
  2704.     Copies of the SimTel MS-DOS, Macintosh and Unix-C collections (also
  2705.     of wuarchive, cica, and others) are available from Walnut Creek
  2706.     CDROM, 1547 Palos Verdes, Suite 260, Walnut Creek, CA 94596-2228,
  2707.     telephone (800) 786-9907 or +1 510 674-0783, or FAX +1 510 674-0821,
  2708.     or email rab@cdrom.com.
  2709.  
  2710.     For a catalog of disks available, send email to info@cdrom.com, or
  2711.     ftp the catalog as /cdrom/catalog from cdrom.com.
  2712.  
  2713.     8.04 Where do I find program <mumble>?
  2714.     --------------------------------------
  2715.  
  2716.     You _are_ asking about shareware, freeware, or public-domain
  2717.     programs, right?  Commercial software is not legally distributed
  2718.     through the net, in general.  (Occasionally vendors will make
  2719.     patches available, but these are useful only to upgrade software you
  2720.     already own.)
  2721.  
  2722.     That said, there are several newsgroups to help you find a program.
  2723.     comp.binaries.ibm.pc.wanted is generally the best place to ask your
  2724.     question.  Please review the guidelines in "108. What other
  2725.     technical newsgroups should I know about?"
  2726.  
  2727.     Download and check the indexes from SimTel and Garbo (see "8.05 - How
  2728.     can I check SimTel or Garbo before I post a request for a
  2729.     program?").  Unless what you're looking for is commercial software,
  2730.     there's a good chance it will be at one or both of those sites.  The
  2731.     Archie servers maintain directories of many (not all) ftp sites
  2732.     worldwide.  You can Telnet to a server or client to search for
  2733.     files, or perform a search by email.
  2734.  
  2735.     8.05 - How can I check SimTel or Garbo before I post a request
  2736.                for a program?
  2737.     --------------------------------------------------------------
  2738.  
  2739.     SimTel and Garbo have indexes of their contents, which you can
  2740.     download and then search off line.
  2741.  
  2742.     Garbo's index file, /pc/INDEX.ZIP, contains an annotated list, often
  2743.     updated, of the MS-DOS files there.  The news file /pc/pd2/news-pd2
  2744.     contains selected news on all MS-DOS directories at Garbo.
  2745.  
  2746.     SimTel's index files, in /pub/msdos/filedocs, are updated several
  2747.     times a month.  simlist.zip contains a list in text format.  But you
  2748.     may prefer the file simindex.zip, which is comma-delimited for easy
  2749.     use with any of these search facilities:
  2750.  
  2751.     - Two downloadable search programs are simtel35.zip and
  2752.       simdir22.zip.
  2753.  
  2754.     - dBASE III or IV users can load the index from simindex.zip using
  2755.       instructions in simibm.inf and simibm.db3.
  2756.  
  2757.     - PC-FILE users should get simibm.hdr, which tells how to use
  2758.       simibm.ibm.
  2759.  
  2760.     8.06 - How do I download and decode a program I found?
  2761.     ------------------------------------------------------
  2762.  
  2763.     See the "Starter kit" and "Beginner's guide to binaries" in
  2764.     comp.binaries.ibm.pc, usually posted on the first and 15th of every
  2765.     month.  Please wait for these articles to come around; don't post a
  2766.     request.  If you can't wait, they are downloadable from
  2767.  
  2768.         Garbo as /pc/doc-net/starter.kit and bin.man
  2769.         rtfm.mit.edu in /pub/usenet/comp.binaries.ibm.pc .  The file
  2770.             names are quite long; try look for names of the form
  2771.             *starter.kit* and *bin.man*
  2772.  
  2773.     For rtfm.mit.edu instructions, see "1.13 - Where are FAQ lists
  2774.     archived?"
  2775.  
  2776.     Most binaries are posted and sent through email in 'uuencode'
  2777.     format.  The starter kit contains a uudecode program to turn this
  2778.     file back into binary.  Since the uuencoded file is bigger than the
  2779.     binary, you'll save connect time if you can uudecode it and then
  2780.     download the binary file.  Remember to set file type to binary.
  2781.  
  2782.     8.07 - Where is UUDECODE?
  2783.     -------------------------
  2784.  
  2785.     You can find it at SimTel and Garbo, but it's easier to take it from
  2786.     the "starter kit" mentioned in the preceding Q.
  2787.  
  2788.     If you're logged in at a Unix site, there's almost certainly a
  2789.     uudecode there:  just type "uudecode" followed by a space and the
  2790.     file name.  The binary file is 25% smaller than the uuencoded file,
  2791.     so you'll save connect time if you can uudecode it on the Unix host
  2792.     and then download the binary file.  Remember: set file type binary.
  2793.  
  2794.     8.08 - Why do I get errors when extracting from a ZIP file I downloaded?
  2795.     ------------------------------------------------------------------------
  2796.  
  2797.     There are many possible causes, but two of them probably account for
  2798.     95% of all problems.
  2799.  
  2800.     1) File transmission:  You must tell the archive site to transfer
  2801.     ZIP files in binary mode.  Depending on your software, you may also
  2802.     need to set your local software to receive files in binary mode.
  2803.  
  2804.     2) Unzipping program:  Make sure you aren't using an obsolete
  2805.     version.  In <9303290853.kp28285@tacom-emh1.army.mil> on 29 Mar
  2806.     1993, Keith Petersen, SimTel administrator, wrote:  "SIMTEL20 has
  2807.     standardized on the Info-ZIP group's ZIP and UNZIP because they are
  2808.     freely distributable and they have no restrictions on exporting.
  2809.     The latest version of Info-ZIP's ZIP and UNZIP can always be found
  2810.     in directory" /pub/msdos/zip "and will always have the name 'Info-
  2811.     ZIP' in the description to make them easy to locate."  PKUNZIP
  2812.     version 1.10 may not unzip newer stuff from archive sites because
  2813.     site administrators have now embraced version 2.04.  Also see "9.03 -
  2814.     What's the current version of UNZIP?"
  2815.  
  2816.  
  2817. Section 9.  Vendors and products
  2818. --------------------------------
  2819.  
  2820.     9.01 - How can I contact Borland?
  2821.     ---------------------------------
  2822.  
  2823.     Patches, examples, and product info can be found at ftp.borland.com in
  2824.     the /pub directory.
  2825.  
  2826.     Borland has set up these email addresses.  However, none of them is
  2827.     for technical support such as help with finding your own programming
  2828.     errors and explaining compiler messages.
  2829.  
  2830.     - bp7-info@borland.com will reply to any message with 17K of info on
  2831.       Borland Pascal with Objects 7.0 and Turbo Pascal 7.0.
  2832.  
  2833.     - customer-support@borland.com is for questions about prices and
  2834.       features of products, replacing bad or missing disks, info on
  2835.       upgrades, etc.  They do not accept emailed credit-card numbers.
  2836.  
  2837.     - bugs@borland.com will take "a well-documented bug report" and send
  2838.       an automated response, but will not give you a work around or a
  2839.       scheduled fix date or even confirm that it is or is not considered
  2840.       a bug.  "The purpose of bugs@borland.com is to improve future
  2841.       products sooner, not as a substitute for tech support channels."
  2842.  
  2843.     Email tech support is available only through Compuserve (GO BOR).
  2844.  
  2845.     Telephone support is provided through separate phone numbers for
  2846.     most products.  If you're calling from the U.S., dial (800) 841-8180
  2847.     for a recorded list of toll numbers to call.  Borland's BBS is at +1
  2848.     408 439 9096.  The surface-mail address is Technical Support
  2849.     Department, Borland International, P.O. Box 660001, Scotts Valley CA
  2850.     95067-0001, USA.
  2851.  
  2852.     You'll need to give your product's name, version, and serial number.
  2853.  
  2854.     Borland's TechFax documents are also available for download:
  2855.  
  2856.         /pub/msdos/turbo-c/bchelp10.zip at SimTel
  2857.         /pc/turbopas/bchelp10.zip at Garbo.
  2858.  
  2859.     These documents are detailed answers to common questions about Turbo
  2860.     C and Borland C products, and aggregate several hundred Kbytes.
  2861.  
  2862.     9.02. How can I contact Microsoft?
  2863.     ----------------------------------
  2864.  
  2865.     Individual employees of Microsoft (not MicroSoft, please!) post here
  2866.     sometimes.  Their addresses all take the form person@microsoft.com.
  2867.     However, Microsoft as a company does not answer individual questions
  2868.     via email through the Internet.
  2869.  
  2870.     1) information available via anonymous ftp
  2871.  
  2872.     The Microsoft gowinnt anonymous ftp server (ftp.microsoft.com) offers
  2873.     a variety of information for developers. Unlike many ftp servers,
  2874.     Microsoft's is run on Windows NT and does not suppurt UNIX-like
  2875.     directory names. Instead of cd /developer/devtools, you would use
  2876.     cd \developer\devtools; the path names are not case sensitive.
  2877.  
  2878.     ftp.microsoft.com directories of interest to programmers:
  2879.  
  2880.     Directory                          Description
  2881.     ----------------------------------------------------------------
  2882.     \developer\devtools                Files relating to Microsoft C
  2883.                                        and other programming tools.
  2884.     \developer\drg                     Microsoft Developer Relations
  2885.                                        Group information. Contains
  2886.                                        Word for Windows documents on
  2887.                                        programming issues.
  2888.     \developer\msdn                    Microsoft Developer's Network
  2889.                                        information.
  2890.     \developer\msj                     Microsoft Systems Journal info.
  2891.     \softlib                           Has index file for
  2892.                                        \softlib\mslfiles.
  2893.     \softlib\mslfiles                  Many file relating to MS-DOS,
  2894.                                        Windows, etc.
  2895.  
  2896.  
  2897.     2) information via U.S. Mail
  2898.  
  2899.     Microsoft Product Support is at 16011 NE 36th Way, Box 97017,
  2900.     Redmond WA 98073-9717, USA.
  2901.  
  2902.     You can subscribe to the {Microsoft Developer News} by mailing a
  2903.     request to Microsoft Developer Network, P.O. Box 51812, Boulder CO
  2904.     80322-1812, U.S.A.  The nearest I can figure, this is free;
  2905.     certainly I've never paid for it or been asked to.
  2906.  
  2907.     3) tech support via modem
  2908.  
  2909.     On Compuserve, GO MICROSOFT; or call Microsoft's BBS at +1 206 936-
  2910.     6735 in the U.S., or +1 416 507-3022 in Canada.
  2911.  
  2912.     4) tech support via voice telephone lines
  2913.  
  2914.     If you want to place an order or get general pre-sales information,
  2915.     call the appropriate sales and service number:
  2916.  
  2917.         U.S. end-user sales                   (800) 426-9400
  2918.         U.S. corporate/gov't/reseller/
  2919.                  educational sales            (800) 227-4679
  2920.         Canadian sales                        (800) 568-3503
  2921.         International sales                  +1 206 936-8661
  2922.  
  2923.     For tech support you must make an ordinary long-distance phone call.
  2924.     Microsoft has separate incoming phone numbers for many products.
  2925.     Since it's your nickel, first check your documentation to see if a
  2926.     phone number is listed.  Here are phone numbers (as of 1 June 1992)
  2927.     for a few products of most interest to the readers of this group:
  2928.  
  2929.         C/C++               (206) 635-7007
  2930.         MASM                (206) 646-5109
  2931.         DOS Upgrade Users   (206) 646-5104 (for 90 days after first
  2932.             call)
  2933.         Windows Users       (206) 637-6098
  2934.  
  2935.     If you can't find the direct number any other way, call the "master"
  2936.     numbers below or the sales numbers a few paragraphs above.  You'll
  2937.     get the "voice mail phone tree from h-ll" but you'll eventually get
  2938.     to the right department.  They don't provide technical assistance,
  2939.     but a voice menu will help you find the current phone number for the
  2940.     department you need.
  2941.  
  2942.         U.S. end-user product support         (206) 454-2030
  2943.         U.S. languages support                (206) 637-7096
  2944.  
  2945.     9.03. What's the current version of UNZIP?
  2946.     ------------------------------------------
  2947.     (Revised: 05/09/1994)
  2948.  
  2949.     The current version of PKWare's PKZip is 2.04g.
  2950.     The current version of InfoZip's ZIP is 2.0.1.
  2951.     The current version of InfoZip's UNZIP is 5.12.
  2952.  
  2953.     Since April 1993, the administrators of Garbo and SimTel have
  2954.     accepted uploads in the ZIP 2.0 format.  You can use the free Info-
  2955.     ZIP versions, or PKZIP 2.04g (not 2.04c or 2.04e).  SimTel has
  2956.     standardized on the Info-ZIP versions for several reasons, as
  2957.     explained in an article posted 29 Mar 1993 in
  2958.     comp.archives.msdos.announce.
  2959.  
  2960.     The primary source of the free Info-ZIP programs is at ftp.uu.net,
  2961.     directory /pub/archiving/zip; or at quest.jpl.nasa.gov, directory
  2962.     /pub.  Files are in those directories or in subdirectories as shown
  2963.     below.  The DOS executable for UNZIP is self extracting; all others
  2964.     require UNZIP 5.0, 5.1, 5.11 or 5.12:
  2965.  
  2966.         MSDOS/unzip512x.exe - DOS executable and doc, UNZIP 5.12
  2967.         unzip512.zip - source code for UNZIP 5.12, all platforms
  2968.         MSDOS/zip20x.zip - DOS exe and doc, ZIP without crypt support
  2969.         zip201.zip - source code for ZIP 2.0, all platforms
  2970.         MSDOS/zcryp20x.zip - DOS exe and doc, ZIP with crypt support
  2971.         zcrypt21.zip - source code for ZIP crypt support
  2972.         WINDOWS/wunz20x.zip - Windows 3.1 WIZUNZIP 2.0 exe and help file
  2973.         WINDOWS/wunz20sr.zip - Windows 3.1 WIZUNZIP 2.0 source
  2974.  
  2975.     The essential files are also available at SimTel in /pub/msdos/zip
  2976.     and at Garbo in /pc/arcers.
  2977.  
  2978.     PKZIP and PKUNZIP are shareware products of PKWARE Inc.  The current
  2979.     version is 2.04g, which is the third official version after 1.10.
  2980.     They are downloadable
  2981.  
  2982.         from PKWARE's bulletin board, +1 414 354 8670, or
  2983.         from Garbo as /pc/arcers/pkz204g.exe
  2984.         from SimTel as /pub/msdos/zip/pkz204g.exe
  2985.  
  2986.     By the way, if you want to develop your own utilities, you will find
  2987.     the ZIP 2.0 data structures described in the downloadable file
  2988.  
  2989.         /pub/msdos/zip/appnote.zip at SimTel.
  2990.  
  2991.     9.04. What is the phone number for a vendor's BBS?
  2992.     --------------------------------------------------
  2993.  
  2994.     Robert Baker (rbakerpc@delphi.com) uploaded a list of 800 bulletin-
  2995.     board support numbers operated by software vendors as of August
  2996.     1993.  It is downloadable as /pub/msdos/bbslist/bbs_9308.zip from
  2997.     SimTel.
  2998.  
  2999. (End of comp.os.msdos.programmer FAQ Version 2.01)
  3000.  
  3001.