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]

  In order to make direct use of the ROM BIOS services from your programs,
  you generally need to create an assembly-language interface routine to
  link the programming language to the ROM BIOS. When we say "interface
  routine," we are referring to the conventional program-development
  subroutines--subroutines that are assembled into object modules (.OBJ
  files) and then linked into working programs (.EXE or .COM files in DOS).
  For more on this subject, see Chapter 19.

  Working with assembly language can seem a fearsome task if you are not
  already comfortable with it. While there are plenty of good reasons to be
  intimidated by assembly language--after all, it is the most difficult and
  demanding kind of programming--it's really not that difficult to create an
  assembly-language interface routine.

  --------------------------------------------------------------------------
  ROM BIOS Interrupt Conflicts
    In the hardware specification for the 8086 family of microprocessors,
    Intel reserved interrupt numbers 00H through 1FH for use by the
    microprocessor itself. (See Figure 8-2.) Unfortunately, IBM had
    appropriated several of these reserved interrupt numbers for its own use
    in the design of the IBM PC. This wasn't a problem with the PC and
    PC/XT, which used the Intel 8088, because the 8088 predefined only
    interrupts 00H through 04H.

    When the PC/AT appeared, however, IBM's use of Intel's reserved
    interrupt numbers led to a conflict. The reason: The AT's 80286 chip
    predefines some of the same interrupt numbers that IBM's ROM BIOS uses.
    The conflict appears when you use the 80286 BOUND instruction to
    validate an array index, because the 80286 signals an out-of-bounds
    array index by executing interrupt 05H--which IBM had previously
    assigned to the ROM BIOS print-screen function. If you aren't careful, a
    program that executes the BOUND instruction can unexpectedly print the
    screen.

    To resolve the conflict, you must install an interrupt 05H handler that
    inspects the code that caused the interrupt: This handler can determine
    whether the interrupt was executed in software or by the CPU. You can
    also avoid this problem by using a protected-mode operating system like
    OS/2, which bypasses the ROM BIOS. If you use DOS, however, be aware
    that a programming error can occasionally lead to unexpected execution
    of a ROM BIOS routine.
  --------------------------------------------------------------------------

    Interrupt     CPU                          Function
    ------------------------------------------------------------------------
    00H           8088,8086,80286,80386        Divide error
    01H           8088,8086,80286,80386        Single-step
    02H           8088,8086,80286,80386        NMI (nonmaskable interrupt)
    03H           8088,8086,80286,80386        Breakpoint (INT 3)
    04H           8088,8086,80286,80386        Overflow (INTO)
    05H           80286,80386                  BOUND out of range
    06H           80286,80386                  Invalid opcode
    07H           80286,80386                  Coprocessor not available
    08H           80286,80386                  Double exception (double
                                               fault)
    09H           80286,80386                  Coprocessor segment overrun
    0AH           80386                        Invalid task-state segment
    0BH           80386                        Segment not present
    0CH           80386                        Stack fault
    0DH           80286,80386                  General protection exception
    0EH           80386                        Page fault
    10H           80286,80386                  Coprocessor error
    ------------------------------------------------------------------------

    Figure 8-2.  Predefined hardware interrupts in Intel microprocessors.

  To create your own interfaces, you will need to have an assembler that is
  compatible with the DOS standards for object files. All the examples we
  give here are for the Microsoft Macro Assembler.

  --------------------------------------------------------------------------
  NOTE:
    Interpreted BASIC can work with machine-language subroutines put
    directly into memory. Preparing the sort of assembler subroutine that
    will work with BASIC can be done as easily with DEBUG's A (assemble)
    command as it can with an ordinary assembler. See Chapter 20 for more
    on this subject.
  --------------------------------------------------------------------------

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