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]

  Service C2H (decimal 194) is the ROM BIOS interface to the built-in PS/2
  pointing-device controller. This interface makes it easy to use an IBM
  PS/2 mouse.

  To use the interface, you must write a short subroutine to which the ROM
  BIOS can pass packets of status information about the pointing device.
  Your subroutine should examine the data in each packet and respond
  appropriately, for example by moving a cursor on the screen. The
  subroutine must exit with a far return without changing the contents of
  the stack.

  To use the ROM BIOS pointing-device interface, carry out the following
  sequence of steps:

  1.  Pass the address of your subroutine to the BIOS (subservice 07H).

  2.  Initialize the interface (subservice 05H).

  3.  Enable the pointing device (subservice 00H).

  At this point, the BIOS begins sending packets of status information to
  your subroutine. The BIOS places each packet on the stack and calls your
  subroutine with a far CALL so that the stack is formatted when the
  subroutine gets control as in Figure 12-9. The low-order byte of the X
  and Y data words contains the number of units the pointing device has
  moved since the previous packet of data was sent. (The Z data byte is
  always 0.) The status byte contains sign, overflow, and button
  information. (See Figure 12-10.)

  +----------------+
  |    Status      |
  |----------------|.---- SP + 10
  |    X data      |
  |----------------|.---- SP + 8
  |    Y data      |
  |----------------|.---- SP + 6
  |    Z data      |
  |----------------|.---- SP + 4
  |                |
  | Return address |
  |                |
  +----------------+.---- SP

  Figure 12-9.  Pointing-device data packet.

  Bit                      Meaning
  --------------------------------------------------------------------------
  0                        Set if left button pressed
  1                        Set if right button pressed
  2-3                      (Reserved)
  4                        Set if X data is negative
  5                        Set if Y data is negative
  6                        Set if X data overflows
  7                        Set if Y data overflows
  --------------------------------------------------------------------------

  Figure 12-10.  Status byte in pointing-device data packet.

  When you use service C2H, the value you pass in register AL selects one of
  eight available subservices. (See Figure 12-11.) The actual register
  contents for each subservice are in Chapter 13, page 284.

  Subservice               Description
  --------------------------------------------------------------------------
  00H                      Enable/disable pointing device.
  01H                      Reset pointing device.
  02H                      Set sample rate.
  03H                      Set resolution.
  04H                      Get pointing-device type.
  05H                      Initialize pointing device.
  06H                      Extended commands.
  07H                      Pass device-driver address to ROM BIOS.
  --------------------------------------------------------------------------

  Figure 12-11.  Subservices available in the BIOS pointing-device interface
  (interrupt 15H, service C2H).

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