Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Interrupt 20H (decimal 32) is used to exit from a program and pass control
  back to DOS. It is similar to interrupt 21H, function 00H. (See page
  325.) These services can be used interchangeably with any version of DOS
  to end a program.

  Interrupt 20H does not automatically close files opened with interrupt
  21H, functions 0FH or 16H when it terminates a program, so you should
  always use interrupt 21H, function 10H to close such files before
  exiting. If a modified file is not formally closed, its new length will
  not be recorded in the file directory.

  A program can set three operational addresses through DOS interrupts 22H,
  23H, and 24H, as we will see shortly. As part of the clean-up operations
  performed by DOS for interrupt 20H, these addresses are restored to the
  values they had before the program was executed. Resetting these addresses
  is essential if the program that invoked interrupt 20H was executed as the
  "child" of another program. It serves to protect the "parent" program from
  using routines intended for the "child." (See DOS function 4BH [decimal
  75] in Chapter 17.)

  --------------------------------------------------------------------------
  NOTE:
    When DOS executes a program, it constructs a program segment prefix
    (PSP), a 256-byte block of memory that contains control information
    that, among other things, is referenced by DOS when a program is
    terminated. (We discuss the PSP in detail at the end of this chapter.)
    DOS depends on the CS register to point to the PSP when the interrupt
    20H terminate service is invoked. If the CS register points elsewhere,
    DOS may crash.

    In practice, we recommend that you terminate your programs with
    interrupt 21H, function 4CH, which is more flexible and less
    restrictive than interrupt 20H. The only reason to use interrupt 20H is
    to maintain compatibility with DOS version 1.0.
  --------------------------------------------------------------------------

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson