Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- DOS 5.0 Ref. - <b>int 28h dos idle handler</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Int 28h                 DOS Idle Handler

    The DOS Idle Handler carries out background operations, such as
    printing from a queue, while the system waits for user input. DOS
    issues this interrupt while waiting for completion of character
    I/O functions (Int 21 functions 01h through 0Ch).

    Programs that are idle (for example, programs that are polling for
    user input) can issue Int 28h. Programs should also issue DOS Idle
    Call (Int 2Fh, multiplex function 1680h).

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

    DOS provides a minimal Int 28h handler that returns immediately.
    System commands, such as PRINT, install their own handlers to
    carry out background processing. Although other programs can
    install Int 28h handlers, these programs must take great care to
    prevent corrupting internal stacks and registers.

    DOS issues Int 28h only if a character I/O function has not yet
    completed, but does not issue the interrupt if a critical-error
    handler is currently running (that is, the ErrorMode internal
    variable is not zero). DOS issues the interrupt each time it loops
    through a low-level read or write operation, and continues to
    issue the interrupt until a character is read or written.

    Programs that install an idle handler should create a chain of
    handlers - that is, save the original address from the Int 28h
    vector-table entry and call the address as part of processing.

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

    DOS makes a few preparations before issuing Int 28h. When control
    transfers to the Int 28h handler, segment registers point to
    internal DOS data segments. The SS:SP registers point to the top
    of the DOS internal I/O stack. To prevent corrupting the system
    data and stack, the Int 28h handler must switch to its own stack,
    preserve all registers, and set segment registers to point to its
    own data segments.

    Although the Int 28h handler can call system functions, it must
    not call character I/O functions (Int 21h functions 01h through
    0Ch) without first setting the ErrorMode variable to 1. If the
    handler calls these functions without setting ErrorMode, the call
    will corrupt the internal I/O stack and DOS operation.

    Before returning to the system, the Int 28h handler must restore
    the SS:SP registers to point to the I/O stack, restore all
    registers, and set the ErrorMode variable to zero.

See Also: 1680h 34h

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