comp.os.msdos.programmer FAQ part 1/5

comp.os.msdos.programmer FAQ part 1/5

Post by Jeffrey Carly » Sat, 19 Jul 2003 18:07:55



Archive-name: msdos-programmer-faq/part1
Comp-os-msdos-programmer-archive-name: dos-faq-pt1.txt
Posting-frequency: 28 days
Last-modified: 8 Feb 2002

comp.os.msdos.programmer FAQ Version 2002.02.08

This is the Frequently Asked Questions list for the newsgroup
comp.os.msdos.programmer.

COPYRIGHT

Copyright 2002 by Jeffrey Carlyle. All rights reserved. This article is
not in the public domain, but it may be redistributed so long as this
notice, the acknowledgments, and the information on obtaining the latest
copy of this list are retained and no fee is charged. The code fragments
may be used freely; credit to the FAQ would be polite. This FAQ is not to
be included in any static: archive (e.g. CD-ROM or book); however, a
pointer to the FAQ may be included. See <Q:01.14> [Where can I get the
latest copy of this FAQ list?] for a link to the latest version of the
FAQ.)

This is part 1 of 5 parts.

TABLE OF CONTENTS

PART 1: (this part)
Section 1.  General FAQ and Newsgroup Information
  <Q:01.01> - Is MS-DOS Dead?
  <Q:01.02> - What is this article for?
  <Q:01.03> - Who has contributed to this article?
  <Q:01.04> - How can I search this article for a particular topic?
  <Q:01.05> - Are the answers guaranteed to be correct and complete?
  <Q:01.06> - What is comp.os.msdos.programmer about?
  <Q:01.07> - Is comp.os.msdos.programmer just for C programmers?
  <Q:01.08> - What is comp.sys.ibm.pc.programmer?
  <Q:01.09> - Is comp.os.msdos.programmer available as a mailing list?
  <Q:01.10> - What's this netiquette?
  <Q:01.11> - How can I learn more about Usenet?
  <Q:01.12> - What other technical newsgroups should I know about?
  <Q:01.13> - Where are FAQ lists archived?
  <Q:01.14> - Where can I get the latest copy of this FAQ list?

Section 2.  General Reference
  <Q:02.01> - Are there any good on-line references for PC hardware
              components?
  <Q:02.02> - Are there any good on-line references for PC interrupts?
  <Q:02.03> - What and where is Ralf Brown's interrupt list?
  <Q:02.04> - Where can I find lex, yacc, and language grammars?
  <Q:02.05> - What's the best book to learn programming?
  <Q:02.06> - Why won't my code work?
  <Q:02.07> - Are there any good sources of example code?
  <Q:02.08> - What and where is SNIPPETS?
  <Q:02.09> - Is the source code MS-DOS available?
  <Q:02.10> - What are my alternatives for MS-DOS compatible OSes?
  <Q:02.11> - What and where is FreeDOS?
  <Q:02.12> - Where can I find out about batch files?

PART 2:
Section 3.  Compile and link
  <Q:03.01> - What the heck is DGROUP > 64K?
  <Q:03.02> - How do I fix 'automatic data segment exceeds 64K' or 'stack
              plus data exceed 64K'?
  <Q:03.03> - Will Borland C code and Microsoft C code link together?
  <Q:03.04> - Why did my program bomb at run time with 'floating point
              formats not linked' or 'floating point not loaded'?
  <Q:03.05> - How can I change the stack size in Borland's C compilers?
  <Q:03.06> - What's the format of an .OBJ file?
  <Q:03.07> - What's the format of an .EXE header?
  <Q:03.08> - What's the difference between .COM and .EXE formats?
  <Q:03.09> - How do I create a .COM file?
  <Q:03.10> - Where is EXE2BIN located?
  <Q:03.11> - What does this message mean: 'A20 already enabled so test
              is meaning less?'

Section 4.  Keyboard
  <Q:04.01> - How can I read a character without echoing it to the
              screen, and without waiting for the user to press the Enter
              key?
  <Q:04.02> - How can I find out whether a character has been typed,
              without waiting for one?
  <Q:04.03> - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
  <Q:04.04> - How can I disable the print screen function?
  <Q:04.05> - How can my program turn NumLock (CapsLock, ScrollLock) on
              or off?
  <Q:04.06> - How can I speed up the keyboard's auto-repeat?
  <Q:04.07> - What is the SysRq key for?
  <Q:04.08> - How can my program tell what kind of keyboard is on the
              system?
  <Q:04.09> - How can I tell if input, output, or stderr has been
              redirected?
  <Q:04.10> - How can I increase the size of the keyboard buffer?
  <Q:04.11> - How can I stuff characters into the keyboard buffer?

PART 3:
Section 5.  Disks and files
  <Q:05.01> - What drive was the PC booted from?
  <Q:05.02> - How can I boot from drive B:?
  <Q:05.03> - Which real and virtual disk drives are valid?
  <Q:05.04> - How can I make my single floppy drive both a: and b:?
  <Q:05.05> - How can I disable access to a drive?
  <Q:05.06> - How can a batch file test existence of a directory?
  <Q:05.07> - Why won't my C program open a file with a path?
  <Q:05.08> - How can I redirect printer output to a file?
  <Q:05.09> - How can I redirect the output of a batch file?
  <Q:05.10> - How can I redirect stderr?
  <Q:05.11> - How can my program open more files than DOS's limit of 20?
  <Q:05.12> - How can I read, create, change, or delete the volume label?
  <Q:05.13> - How can I get the disk serial number?
  <Q:05.14> - What's the format of .OBJ, .EXE., .COM files?
  <Q:05.15> - How can I flush the software disk cache?
  <Q:05.16> - How can I see if a drive is a RAM drive?
  <Q:05.17> - How can I determine a hard drive's manufacturer?
  <Q:05.18> - Where can I find information about the ATA/ATAPI
              specification?
  <Q:05.19> - How can I copy files to or from filenames containing date
              information?

Section 6.  Serial ports (COM ports)
  <Q:06.01> - How do I set my machine up to use COM3 and COM4?
  <Q:06.02> - How do I find the I/O address of a COM port?
  <Q:06.03> - But aren't the COM ports always at I/O addresses 3F8, 2F8,
              3E8, and 2E8?
  <Q:06.04> - How do I configure a COM port and use it to transmit data?

PART 4:
Section 7.  Other hardware questions and problems
  <Q:07.01> - Which 80x86 CPU is running my program?
  <Q:07.02> - How can a C program send control codes to my printer?
  <Q:07.03> - How can I redirect printer output?
  <Q:07.04> - Which video adapter is installed?
  <Q:07.05> - How do I switch to 43- or 50-line mode?
  <Q:07.06> - How can I find the Microsoft mouse position and button
              status?
  <Q:07.07> - How can I access a specific address in the PC's memory?
  <Q:07.08> - How can I read or write my PC's CMOS memory?
  <Q:07.09> - How can I access memory beyond 640K?
  <Q:07.10> - How can I use the protected mode?
  <Q:07.11> - How can I tell if my program is running on a PS/2-style
              machine.
  <Q:07.12> - Is there a 80x87 math unit installed?
  <Q:07.13> - How can I power off the computer from a batch file?

Section 8.  Other software questions and problems
  <Q:08.01> - How can a program reboot my PC?
  <Q:08.02> - How can I time events with finer resolution than the system
              clock's 55 ms (about 18 ticks a second)?
  <Q:08.03> - How can I find the error level of the previous program?
  <Q:08.04> - How can a program set DOS environment variables?
  <Q:08.05> - How can I change the switch character to - from /?
  <Q:08.06> - How can I write a TSR (terminate-stay-resident utility)?
  <Q:08.07> - Why does my interrupt function behave strangely?
  <Q:08.08> - How can I write a device driver?
  <Q:08.09> - What can I use to manage versions of software?
  <Q:08.10> - What's this 'null pointer assignment' after my C program
              executes?
  <Q:08.11> - How can a batch file tell whether it's being run in a DOS
              box under Windows?
  <Q:08.12> - How can my program tell if it's running under Windows?
  <Q:08.13> - How can a program tell whether ANSI.SYS is installed?
  <Q:08.14> - How do I copyright software that I write?
  <Q:08.15> - How can I place date and time information into environment
              variables?

PART 5:
Section 9.  Downloading
  <Q:09.01> - What are SimTel, Garbo, and Wustl?
  <Q:09.02> - Can I get archives on CD-ROM?
  <Q:09.03> - Where do I find program <mumble>?

Section 10.  Vendors and products
  <Q:10.01> - How can I contact Borland?
  <Q:10.02> - How can I contact Microsoft?
  <Q:10.03> - What is the current version of DJGPP?
  <Q:10.04> - What and where is DJGPP?
  <Q:10.05> - Are there any good shareware/freeware compilers?
  <Q:10.06> - Where is QBASIC?
  <Q:10.07> - What is a vendor's web site address?

------------------------------

Subject: Section 1. General FAQ and Newsgroup Information
Date: 5 Feb 2002 22:03:03 -0500

 The General FAQ and Newsgroup Information section contains information
 about how to use the FAQ and the newsgroup.

------------------------------

Subject: <Q:01.01> - Is MS-DOS Dead?
Date: 7 Feb 2002 14:31:56 -0500

 No. Though Microsoft may not be actively developing MS-DOS there are
 still many computers that are not capable of running Microsoft Windows.
 The current versions of Microsoft Windows will also run most MS-DOS
 programs; therefore, MS-DOS is not dead, and will most- likely never die
 just as Commodore-64s and Amigas have not completely died.

 Indeed, DOS has found a new life in embedded systems. Other parties
 continue to develop MS-DOS compatible operating systems for more
 information see <Q:02.10> [What are my alternatives for MS-DOS
 compatible OSes?]

 Windows NT, 2000, and XP all have a "Command Prompt" which is similar to
 the orignal MS-DOS command prompt. The new Windows command prompt has
 some differences from the original MS-DOS command prompty; see <Q:01.12>
 [What other technical newsgroups should I know about?] for pointers on
 where to learn about these diffences.

------------------------------

Subject: <Q:01.02> - What is this article for?
Date: 5 Feb 2002 22:03:03 -0500

 This is the FAQ (Frequently Asked Questions) list for the newsgroup
 comp.os.msdos.programmer.

 FAQ lists are intended to reduce the noise level in their newsgroups
 that results from the repetition of the same questions, correct answers,
 wrong answers, corrections to the wrong answers,
...

read more »

 
 
 

comp.os.msdos.programmer FAQ part 1/5

Post by Jeffrey Carly » Sat, 19 Jul 2003 18:08:16


Archive-name: msdos-programmer-faq/part2
Comp-os-msdos-programmer-archive-name: dos-faq-pt2.txt
Posting-frequency: 28 days
Last-modified: 8 Feb 2002

comp.os.msdos.programmer FAQ Version 2002.02.08

This is the Frequently Asked Questions list for the newsgroup
comp.os.msdos.programmer.

COPYRIGHT

Copyright 2002 by Jeffrey Carlyle. All rights reserved. This article is
not in the public domain, but it may be redistributed so long as this
notice, the acknowledgments, and the information on obtaining the latest
copy of this list are retained and no fee is charged. The code fragments
may be used freely; credit to the FAQ would be polite. This FAQ is not to
be included in any static: archive (e.g. CD-ROM or book); however, a
pointer to the FAQ may be included. See <Q:01.14> [Where can I get the
latest copy of this FAQ list?] for a link to the latest version of the
FAQ.)

This is part 2 of 5 parts.

TABLE OF CONTENTS

PART 1:
Section 1.  General FAQ and Newsgroup Information
  <Q:01.01> - Is MS-DOS Dead?
  <Q:01.02> - What is this article for?
  <Q:01.03> - Who has contributed to this article?
  <Q:01.04> - How can I search this article for a particular topic?
  <Q:01.05> - Are the answers guaranteed to be correct and complete?
  <Q:01.06> - What is comp.os.msdos.programmer about?
  <Q:01.07> - Is comp.os.msdos.programmer just for C programmers?
  <Q:01.08> - What is comp.sys.ibm.pc.programmer?
  <Q:01.09> - Is comp.os.msdos.programmer available as a mailing list?
  <Q:01.10> - What's this netiquette?
  <Q:01.11> - How can I learn more about Usenet?
  <Q:01.12> - What other technical newsgroups should I know about?
  <Q:01.13> - Where are FAQ lists archived?
  <Q:01.14> - Where can I get the latest copy of this FAQ list?

Section 2.  General Reference
  <Q:02.01> - Are there any good on-line references for PC hardware
              components?
  <Q:02.02> - Are there any good on-line references for PC interrupts?
  <Q:02.03> - What and where is Ralf Brown's interrupt list?
  <Q:02.04> - Where can I find lex, yacc, and language grammars?
  <Q:02.05> - What's the best book to learn programming?
  <Q:02.06> - Why won't my code work?
  <Q:02.07> - Are there any good sources of example code?
  <Q:02.08> - What and where is SNIPPETS?
  <Q:02.09> - Is the source code MS-DOS available?
  <Q:02.10> - What are my alternatives for MS-DOS compatible OSes?
  <Q:02.11> - What and where is FreeDOS?
  <Q:02.12> - Where can I find out about batch files?

PART 2: (this part)
Section 3.  Compile and link
  <Q:03.01> - What the heck is DGROUP > 64K?
  <Q:03.02> - How do I fix 'automatic data segment exceeds 64K' or 'stack
              plus data exceed 64K'?
  <Q:03.03> - Will Borland C code and Microsoft C code link together?
  <Q:03.04> - Why did my program bomb at run time with 'floating point
              formats not linked' or 'floating point not loaded'?
  <Q:03.05> - How can I change the stack size in Borland's C compilers?
  <Q:03.06> - What's the format of an .OBJ file?
  <Q:03.07> - What's the format of an .EXE header?
  <Q:03.08> - What's the difference between .COM and .EXE formats?
  <Q:03.09> - How do I create a .COM file?
  <Q:03.10> - Where is EXE2BIN located?
  <Q:03.11> - What does this message mean: 'A20 already enabled so test
              is meaning less?'

Section 4.  Keyboard
  <Q:04.01> - How can I read a character without echoing it to the
              screen, and without waiting for the user to press the Enter
              key?
  <Q:04.02> - How can I find out whether a character has been typed,
              without waiting for one?
  <Q:04.03> - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
  <Q:04.04> - How can I disable the print screen function?
  <Q:04.05> - How can my program turn NumLock (CapsLock, ScrollLock) on
              or off?
  <Q:04.06> - How can I speed up the keyboard's auto-repeat?
  <Q:04.07> - What is the SysRq key for?
  <Q:04.08> - How can my program tell what kind of keyboard is on the
              system?
  <Q:04.09> - How can I tell if input, output, or stderr has been
              redirected?
  <Q:04.10> - How can I increase the size of the keyboard buffer?
  <Q:04.11> - How can I stuff characters into the keyboard buffer?

PART 3:
Section 5.  Disks and files
  <Q:05.01> - What drive was the PC booted from?
  <Q:05.02> - How can I boot from drive B:?
  <Q:05.03> - Which real and virtual disk drives are valid?
  <Q:05.04> - How can I make my single floppy drive both a: and b:?
  <Q:05.05> - How can I disable access to a drive?
  <Q:05.06> - How can a batch file test existence of a directory?
  <Q:05.07> - Why won't my C program open a file with a path?
  <Q:05.08> - How can I redirect printer output to a file?
  <Q:05.09> - How can I redirect the output of a batch file?
  <Q:05.10> - How can I redirect stderr?
  <Q:05.11> - How can my program open more files than DOS's limit of 20?
  <Q:05.12> - How can I read, create, change, or delete the volume label?
  <Q:05.13> - How can I get the disk serial number?
  <Q:05.14> - What's the format of .OBJ, .EXE., .COM files?
  <Q:05.15> - How can I flush the software disk cache?
  <Q:05.16> - How can I see if a drive is a RAM drive?
  <Q:05.17> - How can I determine a hard drive's manufacturer?
  <Q:05.18> - Where can I find information about the ATA/ATAPI
              specification?
  <Q:05.19> - How can I copy files to or from filenames containing date
              information?

Section 6.  Serial ports (COM ports)
  <Q:06.01> - How do I set my machine up to use COM3 and COM4?
  <Q:06.02> - How do I find the I/O address of a COM port?
  <Q:06.03> - But aren't the COM ports always at I/O addresses 3F8, 2F8,
              3E8, and 2E8?
  <Q:06.04> - How do I configure a COM port and use it to transmit data?

PART 4:
Section 7.  Other hardware questions and problems
  <Q:07.01> - Which 80x86 CPU is running my program?
  <Q:07.02> - How can a C program send control codes to my printer?
  <Q:07.03> - How can I redirect printer output?
  <Q:07.04> - Which video adapter is installed?
  <Q:07.05> - How do I switch to 43- or 50-line mode?
  <Q:07.06> - How can I find the Microsoft mouse position and button
              status?
  <Q:07.07> - How can I access a specific address in the PC's memory?
  <Q:07.08> - How can I read or write my PC's CMOS memory?
  <Q:07.09> - How can I access memory beyond 640K?
  <Q:07.10> - How can I use the protected mode?
  <Q:07.11> - How can I tell if my program is running on a PS/2-style
              machine.
  <Q:07.12> - Is there a 80x87 math unit installed?
  <Q:07.13> - How can I power off the computer from a batch file?

Section 8.  Other software questions and problems
  <Q:08.01> - How can a program reboot my PC?
  <Q:08.02> - How can I time events with finer resolution than the system
              clock's 55 ms (about 18 ticks a second)?
  <Q:08.03> - How can I find the error level of the previous program?
  <Q:08.04> - How can a program set DOS environment variables?
  <Q:08.05> - How can I change the switch character to - from /?
  <Q:08.06> - How can I write a TSR (terminate-stay-resident utility)?
  <Q:08.07> - Why does my interrupt function behave strangely?
  <Q:08.08> - How can I write a device driver?
  <Q:08.09> - What can I use to manage versions of software?
  <Q:08.10> - What's this 'null pointer assignment' after my C program
              executes?
  <Q:08.11> - How can a batch file tell whether it's being run in a DOS
              box under Windows?
  <Q:08.12> - How can my program tell if it's running under Windows?
  <Q:08.13> - How can a program tell whether ANSI.SYS is installed?
  <Q:08.14> - How do I copyright software that I write?
  <Q:08.15> - How can I place date and time information into environment
              variables?

PART 5:
Section 9.  Downloading
  <Q:09.01> - What are SimTel, Garbo, and Wustl?
  <Q:09.02> - Can I get archives on CD-ROM?
  <Q:09.03> - Where do I find program <mumble>?

Section 10.  Vendors and products
  <Q:10.01> - How can I contact Borland?
  <Q:10.02> - How can I contact Microsoft?
  <Q:10.03> - What is the current version of DJGPP?
  <Q:10.04> - What and where is DJGPP?
  <Q:10.05> - Are there any good shareware/freeware compilers?
  <Q:10.06> - Where is QBASIC?
  <Q:10.07> - What is a vendor's web site address?

------------------------------

Subject: Section 3. Compile and link
Date: 5 Feb 2002 22:03:03 -0500

 The Compile and Link section contains information issues involving
 compiling and linking of MS-DOS code.

------------------------------

Subject: <Q:03.01> - What the heck is DGROUP > 64K?
Date: 5 Feb 2002 22:03:03 -0500

 This question explains the problem; the next question gives some
 remedies.

 DGROUP is a link-time group of data segments, and the compiler typically
 generates code that expects DS to be pointing to DGROUP. (Exception:
 Borland's huge model has no DGROUP.)

 Here's what goes into DGROUP:

 * Tiny models (all pointers near): DGROUP holds the entire program.

 * Small and medium models (data pointers near): DGROUP holds all globals
   and static variables including string literal data, plus the stack and
   the heap.

 * Large, compact, and huge models in Microsoft (data pointers far):
   DGROUP holds only initialized globals and static variables including
   string literal data, plus the stack and the near heap.

 * Large and compact models in Borland (data pointers far): DGROUP holds
   initialized and uninitialized globals and static variables including
   string literal data, but not the stack or heap.

 * Huge model in Borland (data pointers far): there is no DGROUP, so the
   64K limit doesn't apply.

 In all of the above, which is to say all six models in Microsoft C and
 all but huge in Borland C, DGROUP is limited to 64K including string
 literal data (which are treated as static data). This limitation is due
 to the Intel CPU's segmented architecture.

 For more information, see topics
...

read more »

 
 
 

comp.os.msdos.programmer FAQ part 1/5

Post by Jeffrey Carly » Sat, 19 Jul 2003 18:08:17


Archive-name: msdos-programmer-faq/part4
Comp-os-msdos-programmer-archive-name: dos-faq-pt4.txt
Posting-frequency: 28 days
Last-modified: 8 Feb 2002

comp.os.msdos.programmer FAQ Version 2002.02.08

This is the Frequently Asked Questions list for the newsgroup
comp.os.msdos.programmer.

COPYRIGHT

Copyright 2002 by Jeffrey Carlyle. All rights reserved. This article is
not in the public domain, but it may be redistributed so long as this
notice, the acknowledgments, and the information on obtaining the latest
copy of this list are retained and no fee is charged. The code fragments
may be used freely; credit to the FAQ would be polite. This FAQ is not to
be included in any static: archive (e.g. CD-ROM or book); however, a
pointer to the FAQ may be included. See <Q:01.14> [Where can I get the
latest copy of this FAQ list?] for a link to the latest version of the
FAQ.)

This is part 4 of 5 parts.

TABLE OF CONTENTS

PART 1:
Section 1.  General FAQ and Newsgroup Information
  <Q:01.01> - Is MS-DOS Dead?
  <Q:01.02> - What is this article for?
  <Q:01.03> - Who has contributed to this article?
  <Q:01.04> - How can I search this article for a particular topic?
  <Q:01.05> - Are the answers guaranteed to be correct and complete?
  <Q:01.06> - What is comp.os.msdos.programmer about?
  <Q:01.07> - Is comp.os.msdos.programmer just for C programmers?
  <Q:01.08> - What is comp.sys.ibm.pc.programmer?
  <Q:01.09> - Is comp.os.msdos.programmer available as a mailing list?
  <Q:01.10> - What's this netiquette?
  <Q:01.11> - How can I learn more about Usenet?
  <Q:01.12> - What other technical newsgroups should I know about?
  <Q:01.13> - Where are FAQ lists archived?
  <Q:01.14> - Where can I get the latest copy of this FAQ list?

Section 2.  General Reference
  <Q:02.01> - Are there any good on-line references for PC hardware
              components?
  <Q:02.02> - Are there any good on-line references for PC interrupts?
  <Q:02.03> - What and where is Ralf Brown's interrupt list?
  <Q:02.04> - Where can I find lex, yacc, and language grammars?
  <Q:02.05> - What's the best book to learn programming?
  <Q:02.06> - Why won't my code work?
  <Q:02.07> - Are there any good sources of example code?
  <Q:02.08> - What and where is SNIPPETS?
  <Q:02.09> - Is the source code MS-DOS available?
  <Q:02.10> - What are my alternatives for MS-DOS compatible OSes?
  <Q:02.11> - What and where is FreeDOS?
  <Q:02.12> - Where can I find out about batch files?

PART 2:
Section 3.  Compile and link
  <Q:03.01> - What the heck is DGROUP > 64K?
  <Q:03.02> - How do I fix 'automatic data segment exceeds 64K' or 'stack
              plus data exceed 64K'?
  <Q:03.03> - Will Borland C code and Microsoft C code link together?
  <Q:03.04> - Why did my program bomb at run time with 'floating point
              formats not linked' or 'floating point not loaded'?
  <Q:03.05> - How can I change the stack size in Borland's C compilers?
  <Q:03.06> - What's the format of an .OBJ file?
  <Q:03.07> - What's the format of an .EXE header?
  <Q:03.08> - What's the difference between .COM and .EXE formats?
  <Q:03.09> - How do I create a .COM file?
  <Q:03.10> - Where is EXE2BIN located?
  <Q:03.11> - What does this message mean: 'A20 already enabled so test
              is meaning less?'

Section 4.  Keyboard
  <Q:04.01> - How can I read a character without echoing it to the
              screen, and without waiting for the user to press the Enter
              key?
  <Q:04.02> - How can I find out whether a character has been typed,
              without waiting for one?
  <Q:04.03> - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
  <Q:04.04> - How can I disable the print screen function?
  <Q:04.05> - How can my program turn NumLock (CapsLock, ScrollLock) on
              or off?
  <Q:04.06> - How can I speed up the keyboard's auto-repeat?
  <Q:04.07> - What is the SysRq key for?
  <Q:04.08> - How can my program tell what kind of keyboard is on the
              system?
  <Q:04.09> - How can I tell if input, output, or stderr has been
              redirected?
  <Q:04.10> - How can I increase the size of the keyboard buffer?
  <Q:04.11> - How can I stuff characters into the keyboard buffer?

PART 3:
Section 5.  Disks and files
  <Q:05.01> - What drive was the PC booted from?
  <Q:05.02> - How can I boot from drive B:?
  <Q:05.03> - Which real and virtual disk drives are valid?
  <Q:05.04> - How can I make my single floppy drive both a: and b:?
  <Q:05.05> - How can I disable access to a drive?
  <Q:05.06> - How can a batch file test existence of a directory?
  <Q:05.07> - Why won't my C program open a file with a path?
  <Q:05.08> - How can I redirect printer output to a file?
  <Q:05.09> - How can I redirect the output of a batch file?
  <Q:05.10> - How can I redirect stderr?
  <Q:05.11> - How can my program open more files than DOS's limit of 20?
  <Q:05.12> - How can I read, create, change, or delete the volume label?
  <Q:05.13> - How can I get the disk serial number?
  <Q:05.14> - What's the format of .OBJ, .EXE., .COM files?
  <Q:05.15> - How can I flush the software disk cache?
  <Q:05.16> - How can I see if a drive is a RAM drive?
  <Q:05.17> - How can I determine a hard drive's manufacturer?
  <Q:05.18> - Where can I find information about the ATA/ATAPI
              specification?
  <Q:05.19> - How can I copy files to or from filenames containing date
              information?

Section 6.  Serial ports (COM ports)
  <Q:06.01> - How do I set my machine up to use COM3 and COM4?
  <Q:06.02> - How do I find the I/O address of a COM port?
  <Q:06.03> - But aren't the COM ports always at I/O addresses 3F8, 2F8,
              3E8, and 2E8?
  <Q:06.04> - How do I configure a COM port and use it to transmit data?

PART 4: (this part)
Section 7.  Other hardware questions and problems
  <Q:07.01> - Which 80x86 CPU is running my program?
  <Q:07.02> - How can a C program send control codes to my printer?
  <Q:07.03> - How can I redirect printer output?
  <Q:07.04> - Which video adapter is installed?
  <Q:07.05> - How do I switch to 43- or 50-line mode?
  <Q:07.06> - How can I find the Microsoft mouse position and button
              status?
  <Q:07.07> - How can I access a specific address in the PC's memory?
  <Q:07.08> - How can I read or write my PC's CMOS memory?
  <Q:07.09> - How can I access memory beyond 640K?
  <Q:07.10> - How can I use the protected mode?
  <Q:07.11> - How can I tell if my program is running on a PS/2-style
              machine.
  <Q:07.12> - Is there a 80x87 math unit installed?
  <Q:07.13> - How can I power off the computer from a batch file?

Section 8.  Other software questions and problems
  <Q:08.01> - How can a program reboot my PC?
  <Q:08.02> - How can I time events with finer resolution than the system
              clock's 55 ms (about 18 ticks a second)?
  <Q:08.03> - How can I find the error level of the previous program?
  <Q:08.04> - How can a program set DOS environment variables?
  <Q:08.05> - How can I change the switch character to - from /?
  <Q:08.06> - How can I write a TSR (terminate-stay-resident utility)?
  <Q:08.07> - Why does my interrupt function behave strangely?
  <Q:08.08> - How can I write a device driver?
  <Q:08.09> - What can I use to manage versions of software?
  <Q:08.10> - What's this 'null pointer assignment' after my C program
              executes?
  <Q:08.11> - How can a batch file tell whether it's being run in a DOS
              box under Windows?
  <Q:08.12> - How can my program tell if it's running under Windows?
  <Q:08.13> - How can a program tell whether ANSI.SYS is installed?
  <Q:08.14> - How do I copyright software that I write?
  <Q:08.15> - How can I place date and time information into environment
              variables?

PART 5:
Section 9.  Downloading
  <Q:09.01> - What are SimTel, Garbo, and Wustl?
  <Q:09.02> - Can I get archives on CD-ROM?
  <Q:09.03> - Where do I find program <mumble>?

Section 10.  Vendors and products
  <Q:10.01> - How can I contact Borland?
  <Q:10.02> - How can I contact Microsoft?
  <Q:10.03> - What is the current version of DJGPP?
  <Q:10.04> - What and where is DJGPP?
  <Q:10.05> - Are there any good shareware/freeware compilers?
  <Q:10.06> - Where is QBASIC?
  <Q:10.07> - What is a vendor's web site address?

------------------------------

Subject: Section 7. Other hardware questions and problems
Date: 5 Feb 2002 22:03:03 -0500

 The subject says it all. Bv)

------------------------------

Subject: <Q:07.01> - Which 80x86 CPU is running my program?
Date: 5 Feb 2002 22:03:03 -0500

 SNIPPETS (see <Q:02.08> [What and where is SNIPPETS?]) contains
 C-callable x86 assembly language code for determining the type of CPU in
 CPUCHECK.ASM.

------------------------------

Subject: <Q:07.02> - How can a C program send control codes to my
        printer?
Date: 5 Feb 2002 22:03:03 -0500

 If you just fprintf(stdprn, ...), C will translate some of your control
 codes. The way around this is to reopen the printer in binary mode: prn
 = fopen("PRN", "wb");

 You must use a different file handle because stdprn isn't an lvalue. By
 the way, in DOS 5.0 a colon must not follow PRN or LPT1.

 There's one special case, Ctrl-Z (ASCII 26), the DOS end-of- file
 character. If you try to send an ASCII 26 to your printer, DOS simply
 ignores it. To get around this, you need to reset the printer from
 "cooked" to "raw" mode. Microsoft C users must use INT 21 AH=44,
 "get/set device information". Turbo C and Borland C++ users can use
 ioctl to accomplish the same thing: ioctl(fileno(prn), 1,
 ioctl(fileno(prn),0) & 0xFF | 0x20, 0);

 An alternative approach is simply to write the printer output into a
 disk file, then copy the file to the printer with the /B switch.

 A third approach is to bypass DOS functions entirely and use the BIOS
 printer functions at INT 17. If you also fprintf(stdprn,...) in the same
 program, you'll need to use fflush()
...

read more »

 
 
 

comp.os.msdos.programmer FAQ part 1/5

Post by Jeffrey Carly » Sat, 19 Jul 2003 18:08:17


Archive-name: msdos-programmer-faq/part3
Comp-os-msdos-programmer-archive-name: dos-faq-pt3.txt
Posting-frequency: 28 days
Last-modified: 8 Feb 2002

comp.os.msdos.programmer FAQ Version 2002.02.08

This is the Frequently Asked Questions list for the newsgroup
comp.os.msdos.programmer.

COPYRIGHT

Copyright 2002 by Jeffrey Carlyle. All rights reserved. This article is
not in the public domain, but it may be redistributed so long as this
notice, the acknowledgments, and the information on obtaining the latest
copy of this list are retained and no fee is charged. The code fragments
may be used freely; credit to the FAQ would be polite. This FAQ is not to
be included in any static: archive (e.g. CD-ROM or book); however, a
pointer to the FAQ may be included. See <Q:01.14> [Where can I get the
latest copy of this FAQ list?] for a link to the latest version of the
FAQ.)

This is part 3 of 5 parts.

TABLE OF CONTENTS

PART 1:
Section 1.  General FAQ and Newsgroup Information
  <Q:01.01> - Is MS-DOS Dead?
  <Q:01.02> - What is this article for?
  <Q:01.03> - Who has contributed to this article?
  <Q:01.04> - How can I search this article for a particular topic?
  <Q:01.05> - Are the answers guaranteed to be correct and complete?
  <Q:01.06> - What is comp.os.msdos.programmer about?
  <Q:01.07> - Is comp.os.msdos.programmer just for C programmers?
  <Q:01.08> - What is comp.sys.ibm.pc.programmer?
  <Q:01.09> - Is comp.os.msdos.programmer available as a mailing list?
  <Q:01.10> - What's this netiquette?
  <Q:01.11> - How can I learn more about Usenet?
  <Q:01.12> - What other technical newsgroups should I know about?
  <Q:01.13> - Where are FAQ lists archived?
  <Q:01.14> - Where can I get the latest copy of this FAQ list?

Section 2.  General Reference
  <Q:02.01> - Are there any good on-line references for PC hardware
              components?
  <Q:02.02> - Are there any good on-line references for PC interrupts?
  <Q:02.03> - What and where is Ralf Brown's interrupt list?
  <Q:02.04> - Where can I find lex, yacc, and language grammars?
  <Q:02.05> - What's the best book to learn programming?
  <Q:02.06> - Why won't my code work?
  <Q:02.07> - Are there any good sources of example code?
  <Q:02.08> - What and where is SNIPPETS?
  <Q:02.09> - Is the source code MS-DOS available?
  <Q:02.10> - What are my alternatives for MS-DOS compatible OSes?
  <Q:02.11> - What and where is FreeDOS?
  <Q:02.12> - Where can I find out about batch files?

PART 2:
Section 3.  Compile and link
  <Q:03.01> - What the heck is DGROUP > 64K?
  <Q:03.02> - How do I fix 'automatic data segment exceeds 64K' or 'stack
              plus data exceed 64K'?
  <Q:03.03> - Will Borland C code and Microsoft C code link together?
  <Q:03.04> - Why did my program bomb at run time with 'floating point
              formats not linked' or 'floating point not loaded'?
  <Q:03.05> - How can I change the stack size in Borland's C compilers?
  <Q:03.06> - What's the format of an .OBJ file?
  <Q:03.07> - What's the format of an .EXE header?
  <Q:03.08> - What's the difference between .COM and .EXE formats?
  <Q:03.09> - How do I create a .COM file?
  <Q:03.10> - Where is EXE2BIN located?
  <Q:03.11> - What does this message mean: 'A20 already enabled so test
              is meaning less?'

Section 4.  Keyboard
  <Q:04.01> - How can I read a character without echoing it to the
              screen, and without waiting for the user to press the Enter
              key?
  <Q:04.02> - How can I find out whether a character has been typed,
              without waiting for one?
  <Q:04.03> - How can I disable Ctrl-C/Ctrl-Break and/or Ctrl-Alt-Del?
  <Q:04.04> - How can I disable the print screen function?
  <Q:04.05> - How can my program turn NumLock (CapsLock, ScrollLock) on
              or off?
  <Q:04.06> - How can I speed up the keyboard's auto-repeat?
  <Q:04.07> - What is the SysRq key for?
  <Q:04.08> - How can my program tell what kind of keyboard is on the
              system?
  <Q:04.09> - How can I tell if input, output, or stderr has been
              redirected?
  <Q:04.10> - How can I increase the size of the keyboard buffer?
  <Q:04.11> - How can I stuff characters into the keyboard buffer?

PART 3: (this part)
Section 5.  Disks and files
  <Q:05.01> - What drive was the PC booted from?
  <Q:05.02> - How can I boot from drive B:?
  <Q:05.03> - Which real and virtual disk drives are valid?
  <Q:05.04> - How can I make my single floppy drive both a: and b:?
  <Q:05.05> - How can I disable access to a drive?
  <Q:05.06> - How can a batch file test existence of a directory?
  <Q:05.07> - Why won't my C program open a file with a path?
  <Q:05.08> - How can I redirect printer output to a file?
  <Q:05.09> - How can I redirect the output of a batch file?
  <Q:05.10> - How can I redirect stderr?
  <Q:05.11> - How can my program open more files than DOS's limit of 20?
  <Q:05.12> - How can I read, create, change, or delete the volume label?
  <Q:05.13> - How can I get the disk serial number?
  <Q:05.14> - What's the format of .OBJ, .EXE., .COM files?
  <Q:05.15> - How can I flush the software disk cache?
  <Q:05.16> - How can I see if a drive is a RAM drive?
  <Q:05.17> - How can I determine a hard drive's manufacturer?
  <Q:05.18> - Where can I find information about the ATA/ATAPI
              specification?
  <Q:05.19> - How can I copy files to or from filenames containing date
              information?

Section 6.  Serial ports (COM ports)
  <Q:06.01> - How do I set my machine up to use COM3 and COM4?
  <Q:06.02> - How do I find the I/O address of a COM port?
  <Q:06.03> - But aren't the COM ports always at I/O addresses 3F8, 2F8,
              3E8, and 2E8?
  <Q:06.04> - How do I configure a COM port and use it to transmit data?

PART 4:
Section 7.  Other hardware questions and problems
  <Q:07.01> - Which 80x86 CPU is running my program?
  <Q:07.02> - How can a C program send control codes to my printer?
  <Q:07.03> - How can I redirect printer output?
  <Q:07.04> - Which video adapter is installed?
  <Q:07.05> - How do I switch to 43- or 50-line mode?
  <Q:07.06> - How can I find the Microsoft mouse position and button
              status?
  <Q:07.07> - How can I access a specific address in the PC's memory?
  <Q:07.08> - How can I read or write my PC's CMOS memory?
  <Q:07.09> - How can I access memory beyond 640K?
  <Q:07.10> - How can I use the protected mode?
  <Q:07.11> - How can I tell if my program is running on a PS/2-style
              machine.
  <Q:07.12> - Is there a 80x87 math unit installed?
  <Q:07.13> - How can I power off the computer from a batch file?

Section 8.  Other software questions and problems
  <Q:08.01> - How can a program reboot my PC?
  <Q:08.02> - How can I time events with finer resolution than the system
              clock's 55 ms (about 18 ticks a second)?
  <Q:08.03> - How can I find the error level of the previous program?
  <Q:08.04> - How can a program set DOS environment variables?
  <Q:08.05> - How can I change the switch character to - from /?
  <Q:08.06> - How can I write a TSR (terminate-stay-resident utility)?
  <Q:08.07> - Why does my interrupt function behave strangely?
  <Q:08.08> - How can I write a device driver?
  <Q:08.09> - What can I use to manage versions of software?
  <Q:08.10> - What's this 'null pointer assignment' after my C program
              executes?
  <Q:08.11> - How can a batch file tell whether it's being run in a DOS
              box under Windows?
  <Q:08.12> - How can my program tell if it's running under Windows?
  <Q:08.13> - How can a program tell whether ANSI.SYS is installed?
  <Q:08.14> - How do I copyright software that I write?
  <Q:08.15> - How can I place date and time information into environment
              variables?

PART 5:
Section 9.  Downloading
  <Q:09.01> - What are SimTel, Garbo, and Wustl?
  <Q:09.02> - Can I get archives on CD-ROM?
  <Q:09.03> - Where do I find program <mumble>?

Section 10.  Vendors and products
  <Q:10.01> - How can I contact Borland?
  <Q:10.02> - How can I contact Microsoft?
  <Q:10.03> - What is the current version of DJGPP?
  <Q:10.04> - What and where is DJGPP?
  <Q:10.05> - Are there any good shareware/freeware compilers?
  <Q:10.06> - Where is QBASIC?
  <Q:10.07> - What is a vendor's web site address?

------------------------------

Subject: Section 5. Disks and files
Date: 5 Feb 2002 22:03:03 -0500

 Information about accessing disks and files from MS-DOS.

------------------------------

Subject: <Q:05.01> - What drive was the PC booted from?
Date: 5 Feb 2002 22:03:03 -0500

 Under DOS 4.0 or later, use INT 21 AX=3305. DL is returned with an
 integer indicating the boot drive (1=A:, etc.).

------------------------------

Subject: <Q:05.02> - How can I boot from drive B:?
Date: 5 Feb 2002 22:03:03 -0500

 Downloadable shareware:
 <ftp://ftp.simtel.net/pub/simtelnet/msdos/diskutil/boot_b.zip>
 <ftp://garbo.uwasa.fi/pc/bootutil/boot_b.zip>

 The included documentation says it works by writing a new boot sector on
 a disk in your a: drive that redirects the boot to your B: drive. (A
 similar utility is bboot.zip in the same directory at Garbo only.)

 If that doesn't work, you can always interchange your A: and B: drives
 by switching ribbon cables and changing the setup in your BIOS. From an
 article posted 27 Jan 1993 on another newsgroup:

 [begin quotation]
   Take  the  "ribbon" connector, as you call it, and  switch
   them.  To double-check, start at the end of the cable that
   connects to the motherboard or floppy controller.   Follow
   the  cable until you get to the first connector.   Connect
   this to the drive you want to be B:.

   After this, there should be a few lines on the cable  that
   get flipped left to right.  (On most cables, they just cut
   the lines and physically reverse them.  It should be quite
   obvious from looking at the cable.)  Anyway, the connector
   after  the pins get
...

read more »