home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft_Programmers_Library.7z / MPL / intel / mouse.txt < prev    next >
Encoding:
Text File  |  2013-11-08  |  276.2 KB  |  7,592 lines

  1.  Microsoft(R) Mouse Programmer's Reference Guide
  2.  
  3.  
  4.  
  5.  ───────────────────────────────────────────────────────────────────────────
  6.  
  7.  Microsoft(R) Mouse Programmer's Reference Guide
  8.  
  9.  for IBM(R) Personal Computers and Compatibles
  10.  
  11.  ───────────────────────────────────────────────────────────────────────────
  12.  
  13.  Information in this document is subject to change without notice and does
  14.  not represent a commitment on the part of Microsoft Corporation. The
  15.  software described in this document is furnished under a license agreement.
  16.  The software may be used or copied only in accordance with the terms of the
  17.  agreement.
  18.  
  19.  (C)Copyright Microsoft Corporation, 1986
  20.  
  21.  If you have comments about this documentation or the software it describes,
  22.  complete the Problem Report at the back of this manual and return it to
  23.  Microsoft.
  24.  
  25.  Microsoft(R) and the Microsoft logo are registered trademarks, and
  26.  InPort(TM) is a trademark, of Microsoft Corporation.
  27.  
  28.  IBM(R) is a registered trademark of International Business Machines
  29.  Corporation.
  30.  
  31.  Turbo Pascal(R) is a registered trademark of Borland International, Inc.
  32.  
  33.  Hercules(TM) is a trademark of Hercules Computer Technology.
  34.  
  35.  WordStar(R) is a registered trademark of MicroPro International
  36.  Corporation.
  37.  
  38.  
  39.  
  40.  ═══════════════════════════════════════════════════════════════════════════
  41.  Contents
  42.  
  43.  
  44.  About this Guide
  45.  
  46.     PREADME.DOC
  47.     Product Support
  48.     Microsoft Software License Agreement Addendum
  49.     Disclaimer of Warranty
  50.  
  51.  Creating Mouse Menus
  52.  
  53.  1  Creating Your Own Mouse Menu
  54.  
  55.     Mouse Menu Language
  56.     Statement Format
  57.           Labels
  58.           Parameters
  59.           Comments
  60.     Mouse Menu Program Structure
  61.           Mouse Event Statements (BEGIN, ASSIGN)
  62.           Menu Subroutine Statements (MENU, OPTION, MEND)
  63.           Popup Subroutine Statements (POPUP, TEXT, SELECT, PEND)
  64.           Action Statements (EXECUTE, TYPE, NOTHING)
  65.           String Match Statement (MATCH)
  66.     Creating a Mouse Menu
  67.     Running a Mouse Menu Program
  68.  
  69.  2  Mouse Menu Language Statements
  70.  
  71.     ASSIGN
  72.           Description
  73.           Parameters
  74.     BEGIN
  75.           Description
  76.           Parameters
  77.     EXECUTE
  78.           Description
  79.           Parameters
  80.     MATCH
  81.           Description
  82.           Parameters
  83.     MENU...MEND
  84.           Description
  85.           Parameters
  86.     NOTHING
  87.           Description
  88.     OPTION
  89.           Description
  90.           Parameters
  91.     POPUP...PEND
  92.           Description
  93.           Parameters
  94.     SELECT
  95.           Description
  96.           Parameters
  97.     TEXT
  98.           Description
  99.           Parameters
  100.     TYPE
  101.           Description
  102.           Parameters
  103.  
  104.  3  Sample Mouse Menu Programs
  105.  
  106.     SIMPLE Mouse Menu Program
  107.           SIMPLE Mouse Menu Source Program
  108.     DOSOVRLY Mouse Menu Program
  109.           DOSOVRLY Mouse Menu Source Program
  110.  
  111.  4  Mouse Menu Messages
  112.  
  113.  Designing Mouse Interfaces
  114.  
  115.  5  The Mouse Interface
  116.  
  117.     Screen Modes
  118.     The Virtual Screen
  119.     Graphics and Text Cursors
  120.           Graphics Cursor
  121.           Software Text Cursor
  122.           Hardware Text Cursor
  123.     Mouse Buttons
  124.     Mouse Unit of Distance: The Mickey
  125.     The Internal Cursor Flag
  126.  
  127.  6 Mouse Function Descriptions
  128.  
  129.     Mouse Functions
  130.     Function 0: Mouse Reset and Status
  131.     Function 1: Show Cursor
  132.     Function 2: Hide Cursor
  133.     Function 3: Get Button Status and Mouse Position
  134.     Function 4: Set Mouse Cursor Position
  135.     Function 5: Get Button Press Information
  136.     Function 6: Get Button Release Information
  137.     Function 7: Set Minimum and Maximum Horizontal Cursor Position
  138.     Function 8: Set Minimum and Maximum Vertical Cursor Position
  139.     Function 9: Set Graphics Cursor Block
  140.     Function 10: Set Text Cursor
  141.     Function 11: Read Mouse Motion Counters
  142.     Function 12: Set Interrupt Subroutine Call Mask and Address
  143.     Function 13: Light Pen Emulation Mode On
  144.     Function 14: Light Pen Emulation Mode Off
  145.     Function 15: Set Mickey/Pixel Ratio
  146.     Function 16: Conditional Off
  147.     Function 19: Set Double-Speed Threshhold
  148.     Function 20: Swap Interrupt Subroutines
  149.     Function 21: Get Mouse Driver State Storage Requirements
  150.     Function 22: Save Mouse Driver State
  151.     Function 23: Restore Mouse Driver State
  152.     Function 24: Set Alternate Subroutine Call Mask and Address
  153.     Function 25: Get User Alternate Interrupt Address
  154.     Function 26: Set Mouse Sensitivity
  155.     Function 27: Get Mouse Sensitivity
  156.     Function 28: Set Mouse Interrupt Rate
  157.     Function 29: Set CRT Page Number
  158.     Function 30: Get CRT Page Number
  159.     Function 31: Disable Mouse Driver
  160.     Function 32: Enable Mouse Driver
  161.     Function 33: Software Reset
  162.     Function 34: Set Language For Messages
  163.     Function 35: Get Language Number
  164.     Function 36: Get Driver Version, Mouse Type, and IRG #
  165.  
  166.  7  Making Mouse Function Calls
  167.  
  168.     Making Calls from the BASIC Interpreter
  169.     Making Calls from Assembly-Language Programs
  170.     Making Calls from High-Level-Language Programs
  171.           Making Calls from Microsoft QuickBASIC
  172.           Making Calls from Microsoft Pascal
  173.           Making Calls from Microsoft FORTRAN
  174.           Making Calls from Microsoft C
  175.     Piano Program Listing
  176.     Sample Cursors
  177.           Standard Cursor Shape
  178.           Up Arrow
  179.           Left Arrow
  180.           Check Mark
  181.           Pointing Hand
  182.           Diagonal Cross
  183.           Rectangular Cross
  184.           Hourglass
  185.  
  186.  8  Writing Mouse Programs for IBM EGA Modes
  187.  
  188.     The EGA Register Interface Library
  189.           How the Interface Library Works
  190.     How to Call the EGA Register Interface Library
  191.           Making Calls from Assembly-Language Programs
  192.           Making Calls from High-Level-Language Programs
  193.     Restrictions on Use of the EGA Register Interface Library
  194.           Calls to BIOS ROM Video Routines
  195.     EGA Register Interface Functions
  196.     Function F0: Read One Register
  197.     Function F1: Write One Register
  198.     Function F2: Read Register Range
  199.     Function F3: Write Register Range
  200.     Function F4: Read Register Set
  201.     Function F5: Write Register Set
  202.     Function F6: Revert to Default Registers
  203.     Function F7: Define Default Register Table
  204.     Function FA: Interrogate Driver
  205.  
  206.  Appendix A  Mouse Command Line Switches
  207.  
  208.     Control Panel Switches
  209.     Mouse Driver Switches
  210.           Specifying Mouse Sensitivity
  211.           Setting the Interrupt Rate for the InPort Mouse
  212.           Specifying the Type and Location of the Mouse
  213.           Disabling or Removing the Mouse Driver
  214.  
  215.  Appendix B  Linking Existing Mouse Programs with MOUSE.LIB
  216.  
  217.  Appendix C  Making Calls from Borland Turbo Pascal Programs
  218.  
  219.  Appendix D  Using the Hercules Graphics Card with Mouse Programs
  220.  
  221.  
  222.  
  223.  ═══════════════════════════════════════════════════════════════════════════
  224.  About This Guide
  225.  
  226.  
  227.  
  228.  By now you're probably enjoying the convenience of the Microsoft(R) Mouse
  229.  with the applications and the Microsoft Expert Mouse Menus that were
  230.  included in your mouse package. This guide explains how you can create your
  231.  own Mouse Menu programs for applications, as well as design a mouse
  232.  interface for applications that you write yourself. It assumes that you
  233.  have done some programming, understand basic program design concepts, and
  234.  are familiar with the operation of the Microsoft Mouse.
  235.  
  236.  This guide has two main parts:
  237.  
  238.   ■  Creating Mouse Menus explains how to create a Mouse Menu program that
  239.      allows you to use the Microsoft Mouse with an application that doesn't
  240.      have built-in mouse support.
  241.  
  242.   ■  Designing Mouse Interfaces explains how to build mouse support directly
  243.      into one of your own applications.
  244.  
  245.  In addition, four appendices give you technical information about the
  246.  mouse command line switches, linking existing mouse programs with version
  247.  6.0 of the Microsoft Mouse Library, using the mouse with Borland Turbo
  248.  Pascal programs, and using the Hercules Graphics Card with mouse programs.
  249.  
  250.  
  251.  ───────────────────────────────────────────────────────────────────────────
  252.  PREADME.DOC
  253.  
  254.  The Microsoft Mouse Tools disk that came with this guide may include a file
  255.  named PREADME.DOC. Read this file for information that became available
  256.  after this guide was printed.
  257.  
  258.  
  259.  ───────────────────────────────────────────────────────────────────────────
  260.  Product Support
  261.  
  262.  If you have a question about designing a mouse menu or mouse interface and
  263.  can't find the answer in this guide, call our Product Support staff by
  264.  dialing the telephone number on the registration card that came with the
  265.  Microsoft Mouse Programmer's Reference Guide. They will be ready to give
  266.  you the help you need in order to use the Microsoft Mouse with many
  267.  applications.
  268.  
  269.  When you call, please have the following information at hand:
  270.  
  271.   ■  The product number on the Microsoft Mouse Tools disk
  272.  
  273.   ■  The Microsoft Mouse Programmer's Reference Guide
  274.  
  275.   ■  Your Microsoft Mouse type
  276.  
  277.   ■  Your system configuration
  278.  
  279.  
  280.  ───────────────────────────────────────────────────────────────────────────
  281.  Microsoft Software License Agreement Addendum
  282.  
  283.                    DISTRIBUTION OF MICROSOFT MOUSE LIBRARY
  284.  
  285.  Microsoft grants you the royalty-free right to reproduce and distribute the
  286.  Mouse Library provided that you (a) distribute the Mouse Library only in
  287.  conjunction with and as part of your own software product; (b) do not use
  288.  Microsoft's name, logo, or trademarks to market your software product;
  289.  (c) include Microsoft's copyright notice for the Library on your product
  290.  label and as part of the sign-on message for your software product; and
  291.  (d) otherwise comply with the Microsoft License Agreement and this
  292.  Addendum. The "Mouse Library" consists of the files described as
  293.  "MOUSE.LIB", "OLDMOUSE.LIB", and "EGA.LIB".
  294.  
  295.  If you distribute any portion of the Mouse Library, you agree to
  296.  indemnify, hold harmless, and defend Microsoft from and against any claims
  297.  or lawsuits, including attorney's fees, that arise or result from such
  298.  distribution.
  299.  
  300.  
  301.  ───────────────────────────────────────────────────────────────────────────
  302.  Disclaimer of Warranty
  303.  
  304.                  USE OF MICROSOFT MOUSE EXAMPLE SOURCE CODE
  305.  
  306.  Your compilation of the source code included on the Microsoft Mouse Tools
  307.  disk and/or described in this guide, and your subsequent use of the
  308.  resultant programs, constitutes your acceptance of all results, intended or
  309.  otherwise, of such use. The source code is meant solely as an example, and
  310.  Microsoft does not warrant, guarantee, or otherwise make any claim
  311.  concerning the usability or functionality of the programs defined by the
  312.  source code.
  313.  
  314.  
  315.  
  316.  ═══════════════════════════════════════════════════════════════════════════
  317.  Creating Mouse Menus
  318.  
  319.  
  320.  
  321.  This section explains how to use the Mouse Menu programming language to
  322.  create your own mouse menus for applications.
  323.  
  324.  Chapter 1, "Creating Your Own Mouse Menu," gives an overview of the
  325.  Mouse Menu programming language and explains how to create and run a Mouse
  326.  Menu program.
  327.  
  328.  Chapter 2, "Mouse Menu Language Statements," explains in detail how to
  329.  use each of the Mouse Menu language statements.
  330.  
  331.  Chapter 3, "Sample Mouse Menu Programs," provides the listings for two
  332.  Mouse Menu programs that are both good examples for designing mouse menus
  333.  and useful programs you may want to use yourself.
  334.  
  335.  Chapter 4, "Mouse Menu Messages," lists the messages that the Mouse
  336.  Menu programs can display, along with descriptions of possible causes and
  337.  actions you should take.
  338.  
  339.  
  340.  
  341.  ═══════════════════════════════════════════════════════════════════════════
  342.  1  Creating Your Own Mouse Menu
  343.  
  344.  
  345.  
  346.  This chapter provides background information that you'll need before you
  347.  create a Mouse Menu program. It includes:
  348.  
  349.   ■  An overview of the Mouse Menu programming language
  350.  
  351.   ■  A description of program statements and their components
  352.  
  353.   ■  Descriptions of the various types of subroutines
  354.  
  355.   ■  A discussion of how statements and subroutines are combined to form a
  356.      Mouse Menu program
  357.  
  358.  Once you're familiar with how a Mouse Menu program is put together,
  359.  follow the procedure in "Creating a Mouse Menu" at the end of this chapter
  360.  to create a working mouse menu.
  361.  
  362.  Note  Mouse menus cannot be used with programs that use graphics display
  363.  modes or that have built-in mouse support.
  364.  
  365.  
  366.  ───────────────────────────────────────────────────────────────────────────
  367.  Mouse Menu Language
  368.  
  369.  The Mouse Menu programming language consists of 13 commands. These commands
  370.  are used in statements, which assign different functions to the mouse,
  371.  simulate pressing keys, and create menus.
  372.  
  373.  The following table lists the commands in the Mouse Menu programming
  374.  language:
  375.  
  376. ╓┌─────────────────────┌─────────────────────────────────────────────────────╖
  377.  Command               Purpose
  378.  ───────────────────────────────────────────────────────────────────────────
  379.  ASSIGN                Assigns new values for the mouse.
  380.  Command               Purpose
  381. ASSIGN                Assigns new values for the mouse.
  382.  
  383.  BEGIN                 Assigns initial values for the mouse.
  384.  
  385.  EXECUTE               Specifies a sequence of statements executed when the
  386.                        mouse is moved, a mouse button is clicked, or a menu
  387.                        item is chosen.
  388.  
  389.  MATCH                 Specifies the action taken when a unique string of
  390.                        characters is displayed at a specific location on the
  391.                        screen.
  392.  
  393.  MENU                  Begins a Menu subroutine.
  394.  
  395.  MEND                  Ends a Menu subroutine.
  396.  
  397.  NOTHING               Indicates that no action is taken. An alternative to
  398.                        the EXECUTE, TYPE, and MATCH statements.
  399.  
  400.  OPTION                Defines an item in a Menu subroutine and the action
  401.  Command               Purpose
  402. OPTION                Defines an item in a Menu subroutine and the action
  403.                        taken when the item is selected.
  404.  
  405.  POPUP                 Begins a Popup subroutine.
  406.  
  407.  PEND                  Ends a Popup subroutine.
  408.  
  409.  SELECT                Defines the action taken when an item is selected in
  410.                        a popup menu.
  411.  
  412.  TEXT                  Defines the text for a popup menu title or menu
  413.                        items.
  414.  
  415.  TYPE                  Specifies a key or keys typed when the mouse is
  416.                        moved, a mouse button is clicked, or a menu item is
  417.                        chosen
  418.  
  419.  
  420.  ───────────────────────────────────────────────────────────────────────────
  421.  Statement Format
  422.  
  423.  You can enter statements in the Mouse Menu programming language in
  424.  uppercase or lowercase letters. Most statements have the following format:
  425.  
  426.  [label:] command [parameters ;comments]
  427.  
  428.  The BEGIN statement and statements within Menu and Popup subroutines don't
  429.  use this format because they don't require labels--BEGIN doesn't need a
  430.  label because it's always the first statement in a program; statements
  431.  within subroutines don't need labels because the program executes them
  432.  sequentially.
  433.  
  434.  The components of a statement are described next.
  435.  
  436.  
  437.  Labels
  438.  
  439.  A label is the name you give a statement. For example, in the following
  440.  statement "mat1" is the label of the MATCH statement:
  441.  
  442.  mat1: MATCH 23,,INVERSE,"FORMAT",exec1,exec2
  443.  
  444.  A label allows the program to execute statements in a different order than
  445.  the order in which they appear.
  446.  
  447.  When using labels, follow these rules:
  448.  
  449.   ■  A statement's label must begin with a letter and be followed by a
  450.      colon (:).
  451.  
  452.   ■  Put at least one space between the colon and the command.
  453.  
  454.   ■  Do not use command names or the words BACKSPACE, ENTER, ESCAPE, or TAB
  455.      for labels.
  456.  
  457.   ■  Use any printable standard ASCII characters except for a colon.
  458.  
  459.   ■  Use labels that suggest what the statement does in the program. For
  460.      example, use "menu1" as the label for the first Menu subroutine.
  461.  
  462.  
  463.  Parameters
  464.  
  465.  A parameter is a variable that affects the action of the statement.
  466.  Generally, when you use the statement, you must substitute an appropriate
  467.  value for each parameter. All statements except NOTHING, MEND, and PEND
  468.  have parameters.
  469.  
  470.  Parameters come after the command word in a statement. Put a space
  471.  between the command word and the first parameter. Commas must separate any
  472.  parameters after the first one.
  473.  
  474.  The EXECUTE and TYPE statements allow a variable number of parameters.
  475.  These statements can have from 1 to 31 parameters. Other statements have a
  476.  set number of parameters. If you don't want to use a parameter but want to
  477.  use the parameters that follow, include an additional comma to hold the
  478.  place of the unused parameter.
  479.  
  480.  For example, in the following statement, "23", "INVERSE", "FORMAT",
  481.  "exec1", and "exec2" are the values of MATCH statement parameters. The two
  482.  commas (,,) indicate that the second parameter is not used:
  483.  
  484.  mat1: MATCH 23,,INVERSE,"FORMAT",exec1,exec2
  485.  
  486.  The program automatically uses a specific value (the default value) for any
  487.  parameter that is left out of a statement that has a set number of
  488.  parameters.
  489.  
  490.  The Mouse Menu programming language uses three types of parameters:
  491.  numeric parameters, string parameters, and attribute parameters.
  492.  
  493.  ────────────────────────────────────────
  494.  Numeric parameters
  495.  ────────────────────────────────────────
  496.  
  497.  Numeric parameters are used for numeric data, such as screen coordinates or
  498.  movement-sensitivity values for the mouse. As the name suggests, you must
  499.  use a number for a numeric parameter.
  500.  
  501.  In the preceding example, "23", the row coordinate for the MATCH
  502.  statement, is the value of a numeric parameter.
  503.  
  504.  ────────────────────────────────────────
  505.  String parameters
  506.  ────────────────────────────────────────
  507.  
  508.  Most string parameters specify text for menus or messages. Use a string of
  509.  digits, letters, special characters, or spaces for a string parameter.
  510.  
  511.  In the example above, "FORMAT", the string that the MATCH statement
  512.  looks for, is the string parameter.
  513.  
  514.  ─────────────────────────────────────────
  515.  Display attribute parameters
  516.  ─────────────────────────────────────────
  517.  
  518.  A display attribute parameter specifies how a menu or message box appears
  519.  on the screen. This parameter can have one of four values: "normal",
  520.  "bold", "inverse", or, if your system uses a color display adapter and
  521.  monitor, a number that designates specific foreground and background
  522.  colors. Figure 1.1 shows how the values "normal", "bold", and "inverse"
  523.  affect the text displayed by a popup menu.
  524.  
  525.  
  526.               ╔══════════════════════════════════════════╗
  527.               ║                                          ║
  528.               ║    Figure 1.1 is found on page 1-4       ║
  529.               ║    in the printed version of the book.   ║
  530.               ║                                          ║
  531.               ╚══════════════════════════════════════════╝
  532.  
  533.  ───────────────────────────────────────────────────────────────────────────
  534.  1.1  Effects of Attribute Parameters
  535.  
  536.  
  537.  If you do not specify an attribute parameter, the default attribute is
  538.  used. The default attributes are included in the description of each
  539.  statement in Chapter 2, "Mouse Menu Language Statements."
  540.  
  541.  ────────────────────────────────────────
  542.  Color menus
  543.  ────────────────────────────────────────
  544.  
  545.  If your system uses a color display adapter and color monitor, you can use
  546.  the attribute parameter in a statement to specify particular colors for the
  547.  background and foreground of a menu or message box. Text is displayed in
  548.  the foreground color; the rest of the box is displayed in the background
  549.  color.
  550.  
  551.  The table on the next page lists the background and foreground colors
  552.  available, and gives a corresponding value for each. (The exact shades of
  553.  colors may vary somewhat on different equipment.) The value for a
  554.  particular color differs depending on whether the color is being used for
  555.  the foreground or background. The display attribute that specifies a
  556.  particular color combination is the sum of the values for the desired
  557.  foreground and background colors.
  558.  
  559.  Note  If you specify a display attribute value greater than 127, the
  560.  foreground color will blink when the menu or message box is displayed.
  561.  
  562.  ────────────────────────────────────────
  563.  Foreground and background color values
  564.  ────────────────────────────────────────
  565.  
  566.  Color                          Foreground                Background
  567.  ──────────────────────────────────────────────────────────────────────────
  568.  Black                               0                          0
  569.  Blue                                1                         16
  570.  Green                               2                         32
  571.  Cyan (blue-green)                   3                         48
  572.  Red                                 4                         64
  573.  Magenta                             5                         80
  574.  Brown                               6                         96
  575.  White                               7                        112
  576.  Gray                                8                        128
  577.  Light Blue                          9                        144
  578.  Light Green                        10                        160
  579.  Light Cyan                         11                        176
  580.  Light Red                          12                        192
  581.  Light Magenta                      13                        208
  582.  Yellow                             14                        224
  583.  White (high intensity)             15                        240
  584.  
  585.  If you want green text on a blue background, the value of the attribute
  586.  parameter would be 18. The value for a green foreground is 2, and the value
  587.  for a blue background is 16; add these two values together to get the final
  588.  value of 18.
  589.  
  590.  Specifying a value of 7 is equivalent to specifying the attribute
  591.  parameter "normal". The value 7 is the sum of 0, the value for a black
  592.  background, and 7, the value for a white foreground. Similarly, you can
  593.  specify a "bold" menu by specifying the attribute value 15, and
  594.  an "inverse" menu by specifying the value 112. "Bold" uses high-intensity
  595.  white for the foreground (15) and black for the background (0); "inverse"
  596.  uses black for the foreground (0) and white for the background (112).
  597.  
  598.  Note  A gray background (128) looks the same as a black background (0).
  599.  
  600.  
  601.  Comments
  602.  
  603.  Comments describe what a statement does. Comments have no effect on how the
  604.  statement is executed. They are used only to help you read and understand
  605.  the program.
  606.  
  607.  You can insert comments at the end of a statement or on a separate
  608.  line. Precede a comment with a semicolon (;). If you include comments on
  609.  the same line as the statement, separate the last parameter of the
  610.  statement and the semicolon preceding the comments with a space.
  611.  
  612.  
  613.  ───────────────────────────────────────────────────────────────────────────
  614.  Mouse Menu Program Structure
  615.  
  616.  There are five types of statements in a Mouse Menu source program:
  617.  
  618.   ■  Mouse Event Statements: BEGIN, ASSIGN
  619.  
  620.      Define what action is taken when a mouse event occurs (such as
  621.      clicking a mouse button)
  622.  
  623.   ■  Menu Subroutine Statements: MENU, OPTION, MEND
  624.  
  625.      Create single-column popup menus
  626.  
  627.   ■  Popup Subroutine Statements: POPUP, TEXT, SELECT, PEND
  628.  
  629.      Create multiple-column menus and message boxes
  630.  
  631.   ■  Action Statements: EXECUTE, TYPE, NOTHING
  632.  
  633.      Perform an action as a result of a Mouse Event, Menu Subroutine, or
  634.      String Match Statement
  635.  
  636.   ■  String Match Statement: MATCH
  637.  
  638.      Executes other statements depending on what is displayed on the
  639.      screen
  640.  
  641.  The following sections describe how each statement type is used in a
  642.  Mouse Menu source program. (For specific information about statements and
  643.  their parameters, see Chapter 2, "Mouse Menu Language Statements.")
  644.  
  645.  
  646.  Mouse Event Statements (BEGIN, ASSIGN)
  647.  
  648.  Mouse Event statements specify which statements the program executes when
  649.  the user clicks a mouse button or moves the mouse.
  650.  
  651.  ────────────────────────────────────────
  652.  BEGIN statement
  653.  ────────────────────────────────────────
  654.  
  655.  Use the BEGIN statement to specify the initial statements executed when
  656.  particular mouse events occur and to set the initial mouse sensitivity.
  657.  Always use BEGIN as the first statement in your program.
  658.  
  659.  There are three types of parameters in the BEGIN statement:
  660.  
  661.   ■  Button Parameters:
  662.  
  663.        lfbtn   Left button
  664.        rtbtn   Right button
  665.        btbtn   Both buttons
  666.  
  667.      Define the action taken when one or both mouse buttons are pressed
  668.  
  669.   ■  Movement Parameters:
  670.  
  671.        lfmov   Mouse left
  672.        rtmov   Mouse right
  673.        upmov   Mouse up
  674.        dnmov   Mouse down
  675.  
  676.      Define the action taken when the mouse is moved. The cursor keys are
  677.      often assigned to the mouse movement parameters in a TYPE statement.
  678.  
  679.   ■  Movement Sensitivity Parameters:
  680.  
  681.        hsen    Horizontal movement sensitivity
  682.        vsen    Vertical movement sensitivity
  683.  
  684.   Define how much the mouse must move (in mickeys, the unit of mouse
  685.   movement) before the cursor moves. This is helpful in tailoring cursor
  686.   movement to the different column and row widths found in spreadsheet
  687.   programs. (For more information on mickeys, see Chapter 5, "The Mouse
  688.   Interface.")
  689.  
  690.  ────────────────────────────────────────
  691.  ASSIGN statement
  692.  ────────────────────────────────────────
  693.  
  694.  Use the ASSIGN statement to assign new values to mouse events or mouse
  695.  sensitivity. ASSIGN is useful if you want to execute different statements
  696.  or subroutines depending on the mode of an application program or on other
  697.  conditions that require the mouse to be used differently.
  698.  
  699.  
  700.  Menu Subroutine Statements (MENU, OPTION, MEND)
  701.  
  702.  Menu subroutines create single-column popup menus. Single-column menus are
  703.  bordered menus with a single column of menu items. (Figure 1.1, earlier in
  704.  this chapter, shows examples of single-column menus.) The user chooses
  705.  items in the menu by moving the mouse pointer to the desired item, then
  706.  clicking either mouse button. If the user clicks both mouse buttons at
  707.  once, the equivalent of a NOTHING statement is executed and the menu
  708.  disappears.
  709.  
  710.  Menu subroutines use this format:
  711.  
  712.  label:  MENU ["title",row,column,attribute]
  713.  
  714.          OPTION ["text",pointer]
  715.          .
  716.          .
  717.          .
  718.          MEND
  719.  
  720.  ────────────────────────────────────────
  721.  MENU statement
  722.  ────────────────────────────────────────
  723.  
  724.  A Menu subroutine begins with a MENU statement that specifies:
  725.  
  726.   ■  The menu's title, enclosed in double quotation marks
  727.  
  728.   ■  The row and column of the screen where the upper-left corner of the
  729.      menu will appear
  730.  
  731.   ■  The menu's display attribute (for more information, see "Parameters"
  732.      earlier in this chapter)
  733.  
  734.  ────────────────────────────────────────
  735.  OPTION statement
  736.  ────────────────────────────────────────
  737.  
  738.  OPTION statements specify the menu items and action when an item is chosen.
  739.  At least one OPTION statement should be included in each Menu subroutine as
  740.  an exit point from the menu.
  741.  
  742.  The pointer parameter is the label of the statement that is executed
  743.  when the user chooses that menu item. If no pointer parameter is specified,
  744.  the equivalent of a NOTHING statement is executed when that item is chosen
  745.  and the menu disappears.
  746.  
  747.  ────────────────────────────────────────
  748.  MEND statement
  749.  ────────────────────────────────────────
  750.  
  751.  A MEND (or "menu end") statement always follows the last OPTION statement
  752.  to end the Menu subroutine.
  753.  
  754.  ────────────────────────────────────────
  755.  Sample Menu subroutine
  756.  ────────────────────────────────────────
  757.  
  758.  This sample Menu subroutine produces the "Inverse Attribute" menu shown in
  759.  Figure 1.1:
  760.  
  761.  menu1: MENU    "BASIC Commands",5,20
  762.         OPTION  "Cancel Menu"
  763.         OPTION  "List",F1
  764.         OPTION  "Run",F2
  765.         OPTION  "Load",F3
  766.         MEND
  767.  
  768.  F1: TYPE 0,59   ;simulate pressing the F1 key
  769.  F2: TYPE 0,60   ;simulate pressing the F2 key
  770.  F3: TYPE 0,61   ;simulate pressing the F3 key
  771.  
  772.  The menu produced by this subroutine appears at row 5, column 20. Because
  773.  no attribute was specified, inverse screen characteristics (the default
  774.  attribute) are used. When the menu appears on the screen, the cursor bar is
  775.  always on the first menu item (in this case, "Cancel Menu").
  776.  
  777.  If the user chooses "Cancel Menu", the menu disappears because no
  778.  pointer parameter is specified for that OPTION statement. If the user
  779.  chooses any other item, the statement identified in the pointer parameter
  780.  for that OPTION statement is executed.
  781.  
  782.  
  783.  Popup Subroutine Statements (POPUP, TEXT, SELECT, PEND)
  784.  
  785.  Popup subroutines are used to create more complex menus or message boxes.
  786.  
  787.  Multiple-column menus are used in the same way as single-column menus:
  788.  the user chooses items by moving the mouse pointer to the item, then
  789.  clicking either mouse button. Clicking both mouse buttons at once removes
  790.  the menu from the screen. When the menu first appears on the screen, the
  791.  highlight is always over the first menu item.
  792.  
  793.  Figure 1.2 shows a sample multiple-column menu:
  794.  
  795.  
  796.               ╔══════════════════════════════════════════╗
  797.               ║                                          ║
  798.               ║    Figure 1.2 is found on page 1-11      ║
  799.               ║    in the printed version of the book.   ║
  800.               ║                                          ║
  801.               ╚══════════════════════════════════════════╝
  802.  
  803.  ───────────────────────────────────────────────────────────────────────────
  804.  1.2  Multiple-Column Menu
  805.  
  806.  
  807.  Message boxes are simply popup menus that display messages instead of menu
  808.  items. You can combine Popup subroutines with MATCH statements so that
  809.  message boxes appear when the program mode changes, or when other
  810.  conditions cause the screen display to change.
  811.  
  812.  Figure 1.3 shows a sample message box:
  813.  
  814.  
  815.               ╔══════════════════════════════════════════╗
  816.               ║                                          ║
  817.               ║    Figure 1.3 is found on page 1-11      ║
  818.               ║    in the printed version of the book.   ║
  819.               ║                                          ║
  820.               ╚══════════════════════════════════════════╝
  821.  
  822.  ───────────────────────────────────────────────────────────────────────────
  823.  1.3  Message Box
  824.  
  825.  ────────────────────────────────────────
  826.  Popup subroutine format
  827.  ────────────────────────────────────────
  828.  
  829.  Popup subroutines for multiple-column menus and message boxes use the
  830.  following format:
  831.  
  832.  label:  POPUP [row,column,attribute]
  833.          [TEXT ["text string"]]
  834.          .
  835.          .
  836.          .
  837.          SELECT [row,col,width,pointer]
  838.          .
  839.          .
  840.          .
  841.          PEND
  842.  
  843.  ────────────────────────────────────────
  844.  POPUP statement
  845.  ────────────────────────────────────────
  846.  
  847.  Each Popup subroutine begins with a POPUP statement that specifies:
  848.  
  849.   ■  The row and column of the menu's top-left corner
  850.  
  851.   ■  The menu's display attribute. For more information on display
  852.      attributes, see "Parameters" earlier in this chapter.
  853.  
  854.  ────────────────────────────────────────
  855.  TEXT statements
  856.  ────────────────────────────────────────
  857.  
  858.  Use TEXT statements to specify the menu title and menu items. Type in the
  859.  title text, item text, and menu borders exactly as they'll appear on each
  860.  line of the menu, and enclose them in double quotation marks. You can
  861.  include ASCII graphics characters, such as "=" or "|", in the borders or
  862.  item text.
  863.  
  864.  The text will be located on the screen relative to the coordinates you
  865.  specify in the POPUP statement.
  866.  
  867.  ────────────────────────────────────────
  868.  SELECT statements
  869.  ────────────────────────────────────────
  870.  
  871.  Use SELECT statements to define:
  872.  
  873.   ■  The areas in which the user can choose each menu item. Specify the row,
  874.      column, and width of the selection area, relative to the menu's top-
  875.      left corner. The relative coordinates of the top-left corner of the
  876.      popup menu are "1,1".
  877.  
  878.   ■  The statement that is executed when the user chooses an item. As with
  879.      the OPTION statement for a single-column menu, you specify the label of
  880.      the statement that is executed.
  881.  
  882.  You must include at least one SELECT statement in each Popup subroutine
  883.  as an exit point.
  884.  
  885.  ────────────────────────────────────────
  886.  PEND statement
  887.  ────────────────────────────────────────
  888.  
  889.  A PEND (or "popup end") statement always follows the last SELECT statement
  890.  to end the Popup subroutine.
  891.  
  892.  ────────────────────────────────────────
  893.  Sample Popup subroutines
  894.  ────────────────────────────────────────
  895.  
  896.  This sample Popup subroutine creates the multiple-column menu shown
  897.  earlier, in Figure 1.2:
  898.  
  899.  movmen: popup 2,1
  900.          text " ======= CURSOR MOVEMENT ======= "
  901.          text "| Cancel menu    Top of screen  |"
  902.          text "| Screen up      Bottom of scrn |"
  903.          text "| Screen down    Start of file  |"
  904.          text "| Previous place End of file    |"
  905.          text " =============================== "
  906.          select 2,3,15
  907.          select 3,3,15,keyctrlr
  908.          select 4,3,15,keyctrlc
  909.          select 5,3,15,keyctrlqp
  910.          select 2,16,15,keyctrlqe
  911.          select 3,16,15,keyctrlqx
  912.          select 4,16,15,keyctrlqr
  913.          select 5,16,15,keyctrlqc
  914.          pend
  915.  
  916.  In this example, the top-left corner of the menu will be at row 2, column
  917.  1. Because no attribute parameter is specified, the menu will be displayed
  918.  using the inverse display attribute.
  919.  
  920.  The TEXT statements specify the menu items and their locations relative
  921.  to the top-left corner. The first item starts at "relative" row 2, column 3
  922.  in the menu, but its actual coordinates are row 3, column 3. ASCII graphics
  923.  characters are used to create solid menu borders.
  924.  
  925.  When the menu appears on the screen, the first item (in this case,
  926.  "Cancel menu") is highlighted.
  927.  
  928.  The SELECT statements define the item selection areas. In the first
  929.  item ("Cancel menu"), "2, 13, 15" define the row, column, and width of the
  930.  selection area, respectively. Because the SELECT statement for "Cancel
  931.  menu" does not specify a label for the pointer parameter, the menu will be
  932.  cleared from the screen if the user chooses "Cancel menu." The other SELECT
  933.  statements execute the statements named in their pointer parameters.
  934.  
  935.  The following sample Popup subroutine creates the message box shown in
  936.  Figure 1.3:
  937.  
  938.  
  939.  mousehlp: popup 2,1
  940.    text " =============== MOUSE HELP =================== "
  941.    text "|                                              |"
  942.    text "| Left button  - Displays Edit/Block menu      |"
  943.    text "| Right button - Displays Cursor movement menu |"
  944.    text "| Both buttons - Displays Edit/File menu       |"
  945.    text "|                                              |"
  946.    text "| Moving the mouse up,down,left, or right will |"
  947.    text "| cause the cursor to move in that direction.  |"
  948.    text "|                                              |"
  949.    text " ============================================== "
  950.    select 1,18,10
  951.    pend
  952.  
  953.  
  954.  The POPUP statement defines row 2, column 1 as the top-left-corner
  955.  coordinates. Because no attribute parameter is specified, "inverse" will be
  956.  used.
  957.  
  958.  The TEXT statements define the message box border and the message text.
  959.  The single SELECT statement defines an exit point for the menu. Because the
  960.  message box has only one SELECT statement, the user cannot move the cursor
  961.  within the message box.
  962.  
  963.  
  964.  Action Statements (EXECUTE, TYPE, NOTHING)
  965.  
  966.  Action statements specify what action is taken when the user chooses a menu
  967.  item, clicks one or both buttons, or moves the mouse.
  968.  
  969.  ────────────────────────────────────────
  970.  EXECUTE statement
  971.  ────────────────────────────────────────
  972.  
  973.  Use the EXECUTE statement to define a series of statements that will be
  974.  executed when:
  975.  
  976.   ■  The user clicks one or both mouse buttons
  977.  
  978.   ■  The user chooses a menu item
  979.  
  980.   ■  The user moves the mouse
  981.  
  982.   ■  A MATCH statement is executed (see the next section, "String Match
  983.      Statement")
  984.  
  985.  Use statement labels to specify the statements that the EXECUTE
  986.  statement will carry out. You can specify up to 31 labels for each
  987.  EXECUTE statement. An EXECUTE statement can carry out another EXECUTE
  988.  statement to increase the number of statements that are carried out. You
  989.  can link up to 31 EXECUTE statements in this manner.
  990.  
  991.  Here is a sample EXECUTE statement with five labels:
  992.  
  993.  exec1: EXECUTE dsk,s,a,s,exec4
  994.  
  995.  This statement executes the statements labeled "dsk", "s", "a", "s", and
  996.  "exec4".
  997.  
  998.  ────────────────────────────────────────
  999.  TYPE statement
  1000.  ────────────────────────────────────────
  1001.  
  1002.  Use the TYPE statement to simulate pressing keys on the keyboard. For
  1003.  example, the following TYPE statement simulates pressing the a key:
  1004.  
  1005.  key1: TYPE "a"
  1006.  
  1007.  The following TYPE statement simulates typing the diskcopy a: b: command
  1008.  and pressing the ENTER key:
  1009.  
  1010.  key15: TYPE "diskcopy a: b:",enter
  1011.  
  1012.  You can indicate which key or sequence of keys is simulated in one of three
  1013.  ways:
  1014.  
  1015.   ■  Use its key name, or a sequence of key names, enclosed in double
  1016.      quotation marks (for example, "A").
  1017.  
  1018.   ■  Use the ASCII code for the character on the key (for example, 65 for
  1019.      "A"). You can use extended ASCII codes, ASCII control characters, and
  1020.      extended keyboard scan codes to simulate special keys or key sequences,
  1021.      such as ALT, CONTROL-Q, spacebar, and arrow keys. (See the IBM BASIC
  1022.      manual for a list of ASCII codes. For a list of ASCII control
  1023.      characters and extended keyboard scan codes, see "TYPE" in Chapter 2,
  1024.      "Mouse Menu Language Statements.")
  1025.  
  1026.   ■  Use its symbolic name. The predefined symbolic keys are "enter", "tab",
  1027.      "backsp", and "esc".
  1028.  
  1029.  Here are sample TYPE statements. The comments indicate which key(s) each
  1030.  statement simulates.
  1031.  
  1032.  Label                 Code                    Comments
  1033.  ───────────────────────────────────────────────────────────────────────────
  1034.  dir:                  TYPE "dir"              ;type the command "dir"
  1035.  a:                    TYPE "a:"               ;type "a:"
  1036.  lf:                   TYPE 0,75               ;simulate the left arrow key
  1037.  rt:                   TYPE 0,77               ;simulate the right arrow key
  1038.  up:                   TYPE 0,72               ;simulate the up arrow key
  1039.  dn:                   TYPE 0,80               ;simulate the down arrow key
  1040.  s:                    TYPE 32                 ;type a space
  1041.  ent:                  TYPE enter              ;simulate the ENTER key
  1042.  
  1043.  The statements labeled "dir"  and "a" simulate typing a character string by
  1044.  enclosing the characters in double quotation marks.
  1045.  
  1046.  The next four statements define the arrow keys using extended keyboard
  1047.  scan codes. The statement labeled "s" simulates the spacebar by using the
  1048.  standard ASCII code.
  1049.  
  1050.  The statement labeled "ent" simulates pressing ENTER by using the
  1051.  symbolic name for the key.
  1052.  
  1053.  ────────────────────────────────────────
  1054.  NOTHING statement
  1055.  ────────────────────────────────────────
  1056.  
  1057.  Use the NOTHING statement to specify that no action is taken. Most often,
  1058.  this statement is used with other statements when you want to disable a
  1059.  parameter.
  1060.  
  1061.  
  1062.  String Match Statement (MATCH)
  1063.  
  1064.  MATCH statements permit a Mouse Menu program to take different actions
  1065.  depending on what is displayed on the screen.
  1066.  
  1067.  A MATCH statement specifies a string of characters, a row and column on
  1068.  the screen, and a display attribute. If a line on the screen matches the
  1069.  specified string, begins at the specified row and column, and appears in
  1070.  the specified display attribute, then the program executes a particular
  1071.  statement. This feature enables a Mouse Menu source program to respond to
  1072.  different operating modes of the application program or screen display.
  1073.  
  1074.  For example, if an application program always displays "COMMAND" on
  1075.  line 22 of the screen when it is in command mode, and displays "ALPHA" in
  1076.  the same place when it is in alphanumeric mode, you can use a MATCH
  1077.  statement to take a different action depending on which mode the
  1078.  application program is in.
  1079.  
  1080.  A MATCH statement uses the following format:
  1081.  
  1082.  MATCH row,column,attribute,string,match,nomatch
  1083.  
  1084.   ■  The "row" and "column" parameters describe where the "string" parameter
  1085.      must be located on the screen for a match.
  1086.  
  1087.   ■  The "attribute" parameter indicates how the string must appear on
  1088.      the screen for a match. This parameter can have one of the symbolic
  1089.      values "normal", "bold", or "inverse", or a decimal value that denotes
  1090.      specific foreground and background colors. (For information on the
  1091.      attribute parameter, see "Parameters" earlier in this chapter.) If the
  1092.      attribute parameter is left blank or given the value of 0, all display
  1093.      attributes are matched.
  1094.  
  1095.   ■  The "match" and "nomatch" parameters are the labels of the statements
  1096.      to be executed if the match is made or not made.
  1097.  
  1098.  ────────────────────────────────────────
  1099.  Sample program using MATCH statements
  1100.  ────────────────────────────────────────
  1101.  
  1102.  The following sample Mouse Menu source program shows how a MATCH statement
  1103.  is used:
  1104.  
  1105.  BEGIN   menu1,chna,ent,lf,rt,up,dn
  1106.  .
  1107.  .
  1108.  .
  1109.  chna: MATCH 4,1,normal, "A",ex20,ex19
  1110.  chnb: MATCH 4,1,normal, "B",ex21,chna
  1111.  chnc: MATCH 4,1,normal, "C",ex19,chna
  1112.  ana:  ASSIGN ,chna
  1113.  anb:  ASSIGN ,chnb
  1114.  anc:  ASSIGN ,chnc
  1115.  ex19: EXECUTE cls,a,ent,ana    ;change to A:
  1116.  ex20: EXECUTE cls,b,ent,anb    ;change to B:
  1117.  ex21: EXECUTE cls,c,ent,anc    ;change to C:
  1118.  ent:  TYPE enter
  1119.  cls:  TYPE "cls",enter
  1120.  a:    TYPE "a:"
  1121.  b:    TYPE "b:"
  1122.  c:    TYPE "c:"
  1123.  
  1124.  This program changes the active disk when the user clicks the right mouse
  1125.  button. The program follows this procedure:
  1126.  
  1127.   ■  When the user clicks the right mouse button, the MATCH statement
  1128.      labeled "chna" checks row 4, column 1 on the screen. If it finds an "A"
  1129.      in "normal" display, it executes the statement labeled "ex20".
  1130.  
  1131.   ■  The "ex20" statement clears the screen, changes the active drive to
  1132.      "B:" and executes the statement labeled "anb", which reassigns the
  1133.      right button parameter to "chnb".
  1134.  
  1135.   ■  Now if the user clicks the right mouse button, the MATCH statement
  1136.      labeled "chnb" checks row 4, column 1 on the screen. If it finds a "B"
  1137.      in "normal" display, it executes the statement labeled "ex21".
  1138.  
  1139.   ■  The "ex21" statement clears the screen, changes the active drive to
  1140.      "C:" and executes the statement labeled "anc", which reassigns the
  1141.      right button parameter to "chnc".
  1142.  
  1143.   ■  Now if the user clicks the right mouse button, the MATCH statement
  1144.      labeled "chnc" checks row 4, column 1 on the screen. If it finds a "C"
  1145.      in "normal" display, it executes the statement labeled "ex19".
  1146.  
  1147.   ■  The "ex19" statement clears the screen, changes the active drive to
  1148.      "A:" and executes the statement labeled "ana", which reassigns the
  1149.      right button parameter to "chna". The program is now back to step 1.
  1150.  
  1151.  
  1152.  ───────────────────────────────────────────────────────────────────────────
  1153.  Creating a Mouse Menu
  1154.  
  1155.  You should now be able to start writing Mouse Menu programs. Follow the
  1156.  procedure below to create a source file and then an executable Mouse Menu
  1157.  program file from the source file.
  1158.  
  1159.  Note  The Microsoft Mouse Tools disk that came with this guide includes
  1160.  Mouse Menu source files for some commonly used applications that don't have
  1161.  built-in mouse support (such as WordStar). Use the following procedure to
  1162.  create mouse menus from these source files.
  1163.  
  1164.  To create a mouse menu:
  1165.  
  1166.   1  Write the Mouse Menu program into a source file using a text editor or
  1167.      word processing program. Save the source file with the filename
  1168.      extension ".DEF". This file is used by the MAKEMENU utility program to
  1169.      generate an executable Mouse Menu program (a .MNU file).
  1170.  
  1171.      Be sure to save the source file as a standard ASCII text file. Most
  1172.      simple editors save files in ASCII by default, but when using a word
  1173.      processing program, such as Microsoft Word, you usually need to select
  1174.      a special "unformatted" option to get ASCII text.
  1175.  
  1176.      If you want to create a mouse menu from one of the source files
  1177.      included on the Microsoft Mouse Tools disk, you can copy the source
  1178.      file and edit the copy to meet your specific needs.
  1179.  
  1180.      Note  When a source file is converted to a .MNU file, it must not
  1181.      exceed 57K.
  1182.  
  1183.   2  Use the MAKEMENU utility to create an executable menu file from the
  1184.      source file.
  1185.  
  1186.      To use MAKEMENU, type makemenu and press ENTER.
  1187.  
  1188.      At the prompt, type the name of the source file (without the ".DEF"
  1189.      extension), then press ENTER.
  1190.  
  1191.      If your file has no errors, MAKEMENU displays this message:
  1192.  
  1193.      Conversion completed
  1194.  
  1195.      and returns you to DOS. The mouse menu is ready to be tested following
  1196.      the procedure given below.
  1197.  
  1198.      If your file has errors, MAKEMENU displays the types of errors and
  1199.      statements containing the errors. (For more information on error
  1200.      messages, see Chapter 4, "Mouse Menu Messages.") Correct the source
  1201.      program and repeat this procedure.
  1202.  
  1203.  ────────────────────────────────────────
  1204.  Testing the mouse menu
  1205.  ────────────────────────────────────────
  1206.  
  1207.  When the Mouse Menu source file has been translated into an executable menu
  1208.  file, it is ready to be tested.
  1209.  
  1210.  Note  If, when you ran the Mouse Setup program, you did not specify that
  1211.  the mouse driver should be loaded automatically every time you start DOS,
  1212.  make sure you type mouse to install the mouse driver before you start
  1213.  your menu file.
  1214.  
  1215.  To test the mouse menu:
  1216.  
  1217.   1  Type menu <filename> at the DOS prompt and press ENTER to start the
  1218.      Mouse Menu program. In this command, <filename> is the name of the
  1219.      Mouse Menu program file without the .MNU extension.
  1220.  
  1221.      When the Mouse Menu file has been loaded, this message appears:
  1222.  
  1223.      Menu installed
  1224.  
  1225.   2  Start your application program and try out the menu to ensure that it
  1226.      works under all conditions in your program.
  1227.  
  1228.      If it doesn't work as desired, end the Mouse Menu program by typing
  1229.      menu off at the DOS prompt and pressing ENTER.
  1230.  
  1231.      This message is displayed:
  1232.  
  1233.      Keyboard emulation off
  1234.  
  1235.      Correct the source file, then run the MAKEMENU utility program again.
  1236.  
  1237.  
  1238.  ───────────────────────────────────────────────────────────────────────────
  1239.  Running a Mouse Menu Program
  1240.  
  1241.  Follow these steps to run a Mouse Menu program:
  1242.  
  1243.   1  Use the DOS COPY command to copy the executable Mouse Menu (.MNU) file
  1244.      and the MENU.COM file onto the disk that contains the application
  1245.      program with which you want to use the menu.
  1246.  
  1247.   2  Type menu <filename> to run the Mouse Menu program for the application.
  1248.      In this command, <filename> is the name of the Mouse Menu program.
  1249.  
  1250.      Note  To start a Mouse Menu program that is not in the current
  1251.      directory, include the path name of the directory that contains the
  1252.      Mouse Menu file. For more information, see the PATH command in your DOS
  1253.      manual.
  1254.  
  1255.      When the Mouse Menu file has been loaded, the following message
  1256.      appears:
  1257.  
  1258.      Menu installed
  1259.  
  1260.   3  Run the application program according to the instructions in the
  1261.      program's documentation.
  1262.  
  1263.  A Mouse Menu program runs independently of the corresponding application
  1264.  program. You should end the Mouse Menu program you're running and begin
  1265.  another whenever you end one application and begin another.
  1266.  
  1267.  ────────────────────────────────────────
  1268.  Ending a Mouse Menu program
  1269.  ────────────────────────────────────────
  1270.  
  1271.  To end the Mouse Menu program:
  1272.  
  1273.   ■  Type menu off and press ENTER.
  1274.  
  1275.      This message is displayed:
  1276.  
  1277.      Keyboard emulation off
  1278.  
  1279.  You can then load and run another Mouse Menu program.
  1280.  
  1281.  ────────────────────────────────────────
  1282.  Memory allocation for mouse menus
  1283.  ────────────────────────────────────────
  1284.  
  1285.  MENU.COM can allocate up to 57K of memory for a Mouse Menu program. (The
  1286.  size of MENU.COM (7K) plus the size of the .MNU file cannot exceed 64K.) If
  1287.  the menu file is less than 6K, MENU.COM allocates 6K of memory. If the menu
  1288.  file is greater than 6K, MENU.COM allocates the exact size of the file.
  1289.  
  1290.  Every time you start DOS, the first menu file you load determines the
  1291.  amount of memory reserved for a menu file. If you plan to use more than one
  1292.  mouse menu before restarting your system, first load the .MNU file
  1293.  that requires the greatest amount of memory so that MENU.COM will have
  1294.  allocated enough memory to hold each menu file.
  1295.  
  1296.  
  1297.  
  1298.  ═══════════════════════════════════════════════════════════════════════════
  1299.  2  Mouse Menu Language Statements
  1300.  
  1301.  
  1302.  
  1303.  This chapter describes in alphabetical order each of the statements used by
  1304.  the Mouse Menu programming language. Each statement description includes:
  1305.  
  1306.  
  1307.   ■  The statement syntax
  1308.  
  1309.   ■  A description of each parameter
  1310.  
  1311.   ■  An example of how to use the statement
  1312.  
  1313.  ────────────────────────────────────────
  1314.  Statement syntax conventions
  1315.  ────────────────────────────────────────
  1316.  
  1317.  In the syntax diagram for each statement:
  1318.  
  1319.   ■  The command word appears in capital letters.
  1320.  
  1321.   ■  Labels appear in small letters. Each label must be separated from the
  1322.      command word by a colon (:) and a space.
  1323.  
  1324.   ■  Parameters appear in small letters. Each parameter must be separated
  1325.      from other parameters by a comma (,). If a parameter is not used, the
  1326.      statement must include an additional comma where the parameter would
  1327.      have appeared. (For example, if the second parameter in a statement is
  1328.      not used, the statement would include two commas in a row (,,) after
  1329.      the first parameter.)
  1330.  
  1331.   ■  If a parameter appears in brackets ([]), it is optional. If a parameter
  1332.      does not appear in brackets, it is required. If a parameter appears in
  1333.      double quotation marks (" "), the double quotation marks are required.
  1334.  
  1335.   ■  If a parameter can appear more than once in a statement, the second
  1336.      occurrence of the parameter is enclosed in brackets and followed by an
  1337.      ellipsis (...).
  1338.  
  1339.  
  1340.  ───────────────────────────────────────────────────────────────────────────
  1341.  ASSIGN
  1342.  
  1343.  label: ASSIGN [lfbtn],[rtbtn],[btbtn],[lfmot],[rtmot],
  1344.         [upmot],[dnmot],[hsen],[vsen]
  1345.  
  1346.  
  1347.  Description
  1348.  
  1349.  ASSIGN redefines one or more of the mouse parameters given in the BEGIN
  1350.  statement or most recent ASSIGN statement. If a parameter value isn't
  1351.  specified in an ASSIGN statement, the last parameter value given (in either
  1352.  the BEGIN statement or another ASSIGN statement) is used. Statement labels
  1353.  are used for all parameters except "hsen" and "vsen".
  1354.  
  1355.  All ASSIGN statements must be labeled.
  1356.  
  1357.  
  1358.  Parameters
  1359.  
  1360.  lfbtn            New label of the first statement executed when the user
  1361.                   clicks the left mouse button.
  1362.  
  1363.  rtbtn            New label of the first statement executed when the user
  1364.                   clicks the right mouse button.
  1365.  
  1366.  btbtn
  1367.                   New label of the first statement executed when the user
  1368.                   clicks both mouse buttons at once.
  1369.  
  1370.  lfmot            New label of the first statement executed when the user
  1371.                   moves the mouse to the left.
  1372.  
  1373.  rtmot            New label of the first statement executed when the user
  1374.                   moves the mouse to the right.
  1375.  
  1376.  upmot            New label of the first statement executed when the user
  1377.                   moves the mouse forward.
  1378.  
  1379.  dnmot            New label of the first statement executed when the user
  1380.                   moves the mouse backward.
  1381.  
  1382.  hsen             New value of the horizontal movement sensitivity
  1383.                   parameter.
  1384.  
  1385.  vsen             New value of the vertical movement sensitivity parameter.
  1386.  
  1387.  
  1388.  Example
  1389.  
  1390.  BEGIN esc,ent,mm1,lf,rt,up,dn
  1391.  .
  1392.  .
  1393.  .
  1394.  reassign: ASSIGN y,not,,,,not,not,16,18
  1395.  
  1396.  In this example, the BEGIN statement assigns the initial values of all
  1397.  button and movement parameters. Because no values are specified for the
  1398.  sensitivity parameters ("vsen" and "hsen"), the default values are used.
  1399.  
  1400.  The ASSIGN statement changes the values of the left button, right
  1401.  button, and up and down movement parameters. (If "Not" were the label of a
  1402.  NOTHING statement, the ASSIGN statement would disable any response to
  1403.  clicking the right mouse button or moving the mouse forward or backward.)
  1404.  It also changes the value of "hsen" to 16 and the value of "vsen" to 18.
  1405.  Commas are used for the parameters whose values aren't changed.
  1406.  
  1407.  
  1408.  ───────────────────────────────────────────────────────────────────────────
  1409.  BEGIN
  1410.  
  1411.  BEGIN [lfbtn],[rtbtn],[btbtn],[lfmot],[rtmot],[upmot],
  1412.         [dnmot],[hsen],[vsen]
  1413.  
  1414.  
  1415.  Description
  1416.  
  1417.  BEGIN defines what actions are taken when the mouse is used. Because BEGIN
  1418.  is always the first statement in a menu source file, it doesn't require a
  1419.  statement label.
  1420.  
  1421.  The parameters for BEGIN define the statements to be executed when the
  1422.  mouse buttons are clicked or the mouse is moved. It also defines the
  1423.  movement sensitivity for the mouse. All parameters are optional. If no
  1424.  value is given for a button or mouse movement parameter, the corresponding
  1425.  function is not used.
  1426.  
  1427.  Note  When a Menu subroutine is executed, the parameters for BEGIN do not
  1428.  affect the mouse functions. Either mouse button can be used to choose an
  1429.  item in a menu, and all mouse movement functions are active.
  1430.  
  1431.  Statement labels are required for all parameters except the mouse movement
  1432.  parameters. These are the labels of the statements that are executed when
  1433.  the event governed by each parameter occurs.
  1434.  
  1435.  The movement sensitivity parameters control the horizontal and
  1436.  vertical movement sensitivity of the mouse. Movement sensitivity is the
  1437.  distance the mouse must move (measured in mickeys, the unit of mouse
  1438.  movement) before the on-screen pointer moves. (For more information about
  1439.  mickeys, see Chapter 5, "The Mouse Interface.")
  1440.  
  1441.  
  1442.  Parameters
  1443.  
  1444.  lfbtn            Label of the first statement executed when the user clicks
  1445.                   the left mouse button. If you don't specify a label,
  1446.                   nothing happens when the user clicks the left mouse
  1447.                   button.
  1448.  
  1449.  rtbtn            Label of the first statement executed when the user clicks
  1450.                   the right mouse button. If you don't specify a label,
  1451.                   nothing happens when the user clicks the right mouse
  1452.                   button.
  1453.  
  1454.  btbtn            Label of the first statement executed when the user clicks
  1455.                   both mouse buttons. If you don't specify a label, nothing
  1456.                   happens when the user clicks both mouse buttons.
  1457.  
  1458.  lfmot            Label of the first statement executed when the user moves
  1459.                   the mouse to the left. If you don't specify a label,
  1460.                   nothing happens when the user moves the mouse to the left.
  1461.  
  1462.  rtmot            Label of the first statement executed when the user moves
  1463.                   the mouse to the right. If you don't specify a label,
  1464.                   nothing happens when the user moves the mouse to the
  1465.                   right.
  1466.  
  1467.  upmot            Label of the first statement executed when the user moves
  1468.                   the mouse forward. If you don't specify a label, nothing
  1469.                   happens when the user moves the mouse forward.
  1470.  
  1471.  dnmot            Label of the first statement executed when the user moves
  1472.                   the mouse backward. If you don't specify a label, nothing
  1473.                   happens when the user moves the mouse backward.
  1474.  
  1475.  hsen             Number between 0 and 32767 that defines how many mickeys
  1476.                   the mouse must move vertically before the on-screen
  1477.                   pointer moves. If 0 is specified, the mouse is disabled
  1478.                   horizontally. If no value is specified, the default value
  1479.                   of 4 mickeys is used. (One mickey is approximately 1/200
  1480.                   inch.)
  1481.  
  1482.  vsen             Number between 0 and 32767 that defines how many mickeys
  1483.                   the mouse must move vertically before the on-screen
  1484.                   pointer moves. If 0 is specified, the mouse is disabled
  1485.                   vertically. If no value is specified, the default value of
  1486.                   8 mickeys is used.
  1487.  
  1488.  
  1489.  Example
  1490.  
  1491.  BEGIN ent,esc,,lf,rt,up,dn
  1492.  
  1493.  lf:  TYPE 0,75   ;simulate the left cursor key
  1494.  rt:  TYPE 0,77   ;simulate the right cursor key
  1495.  up:  TYPE 0,72   ;simulate the up cursor key
  1496.  dn:  TYPE 0,80   ;simulate the down cursor key
  1497.  esc: TYPE ESC    ;simulate the Esc key
  1498.  ent: TYPE ENTER  ;simulate the enter key
  1499.  
  1500.  The BEGIN statement in this example gives initial values for all parameters
  1501.  except "btbtn", "hsen", and "vsen". Because "btbtn" isn't specified,
  1502.  nothing happens when the user clicks both mouse buttons. Because no values
  1503.  are given for "hsen" and "vsen", the default values are used (4 and 8
  1504.  mickeys, respectively).
  1505.  
  1506.  
  1507.  ───────────────────────────────────────────────────────────────────────────
  1508.  EXECUTE
  1509.  
  1510.  label: EXECUTE statement[,statement...]
  1511.  
  1512.  
  1513.  Description
  1514.  
  1515.  EXECUTE can carry out other statements when one of the following events
  1516.  occurs:
  1517.  
  1518.   ■  A menu item is selected
  1519.  
  1520.   ■  The mouse is moved
  1521.  
  1522.   ■  One or both mouse buttons are clicked
  1523.  
  1524.   ■  A MATCH statement is executed
  1525.  
  1526.  Each EXECUTE statement may specify up to 31 other statements to be
  1527.  executed. EXECUTE can call other EXECUTE statements to increase the number
  1528.  even further; up to 31 EXECUTE statements can be linked in this manner.
  1529.  Statements within an EXECUTE statement are executed sequentially, starting
  1530.  with the first statement.
  1531.  
  1532.  
  1533.  Parameters
  1534.  
  1535.  label            Name of the EXECUTE statement. All EXECUTE statements must
  1536.                   be labeled.
  1537.  
  1538.  statement        Name(s) of the statement(s) to be executed. Any labeled
  1539.                   statement can be used. (Using the calling statement may
  1540.                   cause an endless loop.)
  1541.  
  1542.  
  1543.  Example
  1544.  
  1545.  dir:   TYPE "dir"  ;type dir
  1546.  s:     TYPE 32     ;simulate the spacebar
  1547.                     ;" " may also be used
  1548.  a:     TYPE "A:"   ;type  A:
  1549.  ent:   TYPE ENTER  ;simulate the ENTER key
  1550.  exec4: EXECUTE dir,s,a,ent
  1551.  
  1552.  The EXECUTE statement labeled "exec4" executes the statements labeled
  1553.  "dir", "s", "a", and "ent". These statements simulate typing dir A: and
  1554.  pressing ENTER.
  1555.  
  1556.  
  1557.  ───────────────────────────────────────────────────────────────────────────
  1558.  MATCH
  1559.  
  1560.  label: MATCH row,column,attribute,string,match, nomatch
  1561.  
  1562.  
  1563.  Description
  1564.  
  1565.  MATCH executes other statements or subroutines depending on whether or not
  1566.  it finds a specified string in a given screen location.
  1567.  
  1568.  Values for the row and column parameters are given in absolute screen
  1569.  coordinates. The starting coordinates for the screen are in the upper-left
  1570.  corner of the screen (row 1, column 1).
  1571.  
  1572.  
  1573.  Parameters
  1574.  
  1575.  label            Name of the MATCH statement. All MATCH statements must be
  1576.                   labeled.
  1577.  
  1578.  row              A number that specifies the row of the first character of
  1579.                   the match string. If no value is specified, row 1 is
  1580.                   assigned.
  1581.  
  1582.  column           A number that specifies the column of the first character
  1583.                   of the match string. If no value is specified, column 1 is
  1584.                   assigned.
  1585.  
  1586.  attribute        A value that specifies how the match string must appear on
  1587.                   the screen for a match to occur. This can be one of the
  1588.                   symbolic values "normal", "bold", or "inverse", or a
  1589.                   decimal value that denotes specific foreground and
  1590.                   background colors. (For more information, see "Parameters"
  1591.                   in Chapter 1, "Creating Your Own Mouse Menu.") If the
  1592.                   attribute parameter is left blank or given the value of 0,
  1593.                   the MATCH statement matches any attribute value.
  1594.  
  1595.  string           The string to match. This can be any string of up to 255
  1596.                   ASCII characters, enclosed in double quotation marks
  1597.                   (""). You must specify the string parameter.
  1598.  
  1599.  match            Label of a statement or subroutine executed if the string
  1600.                   is matched. This label must be present in the program.
  1601.  
  1602.  nomatch          Label of a statement or subroutine executed if the string
  1603.                   is not matched. This label must be present in the program.
  1604.  
  1605.  
  1606.  Example
  1607.  
  1608.  BEGIN  leftb,rightb,bothb,mousel,mouser,mouseu,moused,16,40
  1609.  
  1610.  leftb: MATCH 1,12,normal,"e",imen,chk33
  1611.  chk33: MATCH 1,12,,"n",imen,chkl
  1612.  chkl:  MATCH 1,11,,":",emen,not
  1613.  
  1614.  imen:  POPUP 2,1
  1615.        .
  1616.        .
  1617.        .
  1618.  
  1619.        PEND
  1620.  
  1621.  emen:  POPUP 2,1
  1622.        .
  1623.        .
  1624.        .
  1625.  
  1626.        PEND
  1627.  not:  NOTHING
  1628.  
  1629.  This sample from the WS.DEF menu source file checks whether WordStar is
  1630.  displaying the BEGINNING MENU or the MAIN MENU.
  1631.  
  1632.  When the user clicks the left mouse button:
  1633.  
  1634.   ■  The MATCH statement labeled "leftb" looks for an "e" at row 1, column
  1635.      12. This is the first character in the string "editing no file", which
  1636.      is on the screen in that position if WordStar version 3.2 is displaying
  1637.      the BEGINNING MENU.
  1638.  
  1639.      If "leftb" finds the "e" in that position, it executes the statement
  1640.      labeled "imen". (In WS.DEF, "imen" displays the NO-FILE popup menu
  1641.      for WordStar.)
  1642.  
  1643.      If "leftb" doesn't find the "e" in that position, it executes the
  1644.      statement labeled "chk33".
  1645.  
  1646.   ■  The "chk33" statement looks for the letter "n" at row 1, column 12.
  1647.      This is the first character in the string "not editing", which is on
  1648.      the screen in that position if WordStar version 3.3 is displaying the
  1649.      BEGINNING MENU.
  1650.  
  1651.      If "chk33" finds the "n" in that position, it executes the
  1652.      statement labeled "imen". (In WS.DEF, "imen" displays the NO-FILE popup
  1653.      menu for WordStar.)
  1654.  
  1655.      If "chk33" doesn't find the "n" in that position, it executes the
  1656.      statement labeled "chkl".
  1657.  
  1658.   ■  The "chkl" statement looks for a colon (:) after the disk drive
  1659.      identifier in the first line of the WordStar MAIN MENU display.
  1660.  
  1661.      If "chkl" finds a colon, it executes the statement labeled "emen".
  1662.      (In WS.DEF, "emen" displays the EDIT/BLOCK popup menu.)
  1663.  
  1664.      If "chkl" doesn't find a colon, the menu program does nothing.
  1665.  
  1666.  
  1667.  ───────────────────────────────────────────────────────────────────────────
  1668.  MENU...MEND
  1669.  
  1670.  label:    MENU  ["title"],[row],[column],[attribute]
  1671.            .
  1672.            .
  1673.            .
  1674.            MEND
  1675.  
  1676.  
  1677.  Description
  1678.  
  1679.  The MENU statement is the first statement in a Menu subroutine. A Menu
  1680.  subroutine creates a single-column popup menu. (For an example of the
  1681.  format of a Menu subroutine, see "Menu Sub-routine Statements" in Chapter
  1682.  1, "Creating Your Own Mouse Menu.")
  1683.  
  1684.  Menus created with a Menu subroutine are bordered, single-column menus.
  1685.  The specific dimensions of a menu are determined by the number of items
  1686.  in a menu and the largest number of characters in either the longest
  1687.  menu item or the menu title.
  1688.  
  1689.  When the menu is displayed, the first menu item (if any) is highlighted.
  1690.  The user chooses any menu item by moving the mouse until that item is
  1691.  highlighted, then clicking either mouse button. If the user clicks both
  1692.  mouse buttons, the equivalent of a NOTHING statement is executed and
  1693.  the menu disappears.
  1694.  
  1695.  The MEND ("menu end") statement indicates the end of a Menu
  1696.  subroutine. Each Menu subroutine must have a MEND statement. MEND
  1697.  statements are not labeled.
  1698.  
  1699.  
  1700.  Parameters
  1701.  
  1702.  label            Name of the Menu subroutine. All Menu subroutines must be
  1703.                   labeled.
  1704.  
  1705.  title            Text of the menu title, enclosed in double quotation marks
  1706.                   (" "). The menu title is limited to one line above the
  1707.                   rest of the menu. If you don't specify a title, a blank
  1708.                   line is used.
  1709.  
  1710.  row              A number that specifies the row where the top-left corner
  1711.                   of the menu appears. Be sure to specify a value that
  1712.                   allows the entire menu to be displayed. (For example, if
  1713.                   the menu contains 20 items and you choose a row value
  1714.                   greater than 5, then some of the screen items will not be
  1715.                   displayed on the 25-row screen.) If you don't specify a
  1716.                   row, the top-left corner is in row 1.
  1717.  
  1718.  column           A number that specifies the column where the top-left
  1719.                   corner of the menu appears. If you don't specify a column,
  1720.                   the top-left corner is in column 1.
  1721.  
  1722.  attribute        A value that specifies how the menu is displayed on the
  1723.                   screen. This can be "normal", "bold", or "inverse", or a
  1724.                   decimal value that specifies particular foreground and
  1725.                   background colors. (For more information, see "Parameters"
  1726.                   in Chapter 1, "Creating Your Own Mouse Menu.") If you
  1727.                   don't specify a value, inverse is used. The colors of the
  1728.                   mouse pointer depend on the display attribute value for
  1729.                   the menu. (For detailed information on how the interaction
  1730.                   between the mouse pointer and menu display determine the
  1731.                   colors of the pointer, see "Graphics Cursor" in Chapter 5,
  1732.                   "The Mouse Interface.")
  1733.  
  1734.  
  1735.  Example
  1736.  
  1737.  menu1: MENU    "Display Directory",5,5,normal
  1738.         OPTION  "Cancel"
  1739.         OPTION  "A:",ex1
  1740.         OPTION  "B:",ex2
  1741.         OPTION  "C:",ex3
  1742.         MEND
  1743.  
  1744.  ex1:   EXECUTE dir,s,a,ent   ;dir A:
  1745.  ex2:   EXECUTE dir,s,b,ent   ;dir B:
  1746.  ex3:   EXECUTE dir,s,c,ent   ;dir C:
  1747.  ent:   TYPE 13               ;simulate the enter key
  1748.  dir:   TYPE "dir"            ;type dir
  1749.  a:     TYPE "A:"             ;type A:
  1750.  b:     TYPE "B:"             ;type B:
  1751.  c:     TYPE "C:"             ;type C:
  1752.  s:     TYPE 32               ;type a space
  1753.  
  1754.  In this example, the MENU statement uses all four parameters. The menu
  1755.  title is "Display Directory". The top-left column of the menu is in row 5,
  1756.  column 5. The menu is displayed with a normal screen attribute.
  1757.  
  1758.  The OPTION statements specify which statements are executed when the
  1759.  user chooses items from the menu. (For more information about the OPTION
  1760.  statement, see "OPTION" later in this chapter.)
  1761.  
  1762.  
  1763.  ───────────────────────────────────────────────────────────────────────────
  1764.  NOTHING
  1765.  
  1766.  label: NOTHING
  1767.  
  1768.  
  1769.  Description
  1770.  
  1771.  Use the NOTHING statement to specify that no action is taken when the user
  1772.  clicks a mouse button, moves the mouse, or chooses a menu option, or when a
  1773.  MATCH statement is executed. A NOTHING statement must be labeled.
  1774.  
  1775.  
  1776.  Example
  1777.  
  1778.  rightb:  MATCH 1,11,NORMAL, ":",movmen,nul
  1779.  .
  1780.  .
  1781.  .
  1782.  movmen:  POPUP 2,1
  1783.  TEXT "======= CURSOR MOVEMENT ======"
  1784.  .
  1785.  .
  1786.  .
  1787.  nul:     NOTHING
  1788.  
  1789.  
  1790.  This example from the WS.DEF Mouse Menu program determines which popup menu
  1791.  is displayed when the user clicks the right mouse button.
  1792.  
  1793.   ■  If the MATCH statement finds the specified character, it executes
  1794.      the statement labeled "movmen" to display the CURSOR MOVEMENT popup
  1795.      menu.
  1796.  
  1797.   ■  If the MATCH statement doesn't find the specified character, it
  1798.      executes the NOTHING statement labeled "nul", and the Mouse Menu
  1799.      program does nothing.
  1800.  
  1801.  
  1802.  ───────────────────────────────────────────────────────────────────────────
  1803.  OPTION
  1804.  
  1805.  [label:] OPTION [text],[pointer]
  1806.  
  1807.  
  1808.  Description
  1809.  
  1810.  OPTION statements define each menu item in a Menu subroutine. OPTION
  1811.  parameters define the text of the menu item and what happens when the user
  1812.  chooses the menu item.
  1813.  
  1814.  OPTION statements are usually not labeled, although they can be. If
  1815.  they are labeled, the MAKEMENU program ignores the labels when assembling
  1816.  the source program.
  1817.  
  1818.  
  1819.  Parameters
  1820.  
  1821.  text             Legend text for the menu item. The legend text must be
  1822.                   enclosed in double quotation marks (" "). If you don't
  1823.                   specify legend text for a menu item, the menu displays a
  1824.                   blank line for that item.
  1825.  
  1826.  pointer          Label of the statement that is executed when the user
  1827.                   chooses the menu item. If you don't include a pointer
  1828.                   parameter, the menu is cleared from the screen when the
  1829.                   user chooses the menu item. (For example, you'd leave out
  1830.                   the pointer parameter for a "cancel menu" item.)
  1831.  
  1832.  
  1833.  Example
  1834.  
  1835.  menu5:   MENU    "Format",5,5,normal
  1836.           OPTION  "Cancel"
  1837.           OPTION  "A:",ex16
  1838.           OPTION  "B:",ex17
  1839.           OPTION  "C:",ex18
  1840.           MEND
  1841.  
  1842.  This example shows OPTION statements that define four menu items. If the
  1843.  user chooses the first menu item, the menu is cleared from the screen
  1844.  because the OPTION statement has no pointer parameter. If the user chooses
  1845.  any other menu item, the specified statement is executed.
  1846.  
  1847.  
  1848.  ───────────────────────────────────────────────────────────────────────────
  1849.  POPUP...PEND
  1850.  
  1851.  label:    POPUP  [row],[column],[attribute]
  1852.            .
  1853.            .
  1854.            .
  1855.            PEND
  1856.  
  1857.  
  1858.  Description
  1859.  
  1860.  The POPUP statement is the first statement in a Popup subroutine. A Popup
  1861.  subroutine creates a multiple-column menu or a message box. (For an example
  1862.  of the format of a Popup subroutine, see "Popup Subroutine Statements" in
  1863.  Chapter 1, "Creating Your Own Mouse Menu.")Dp
  1864.  
  1865.  The PEND ("popup end") statement indicates the end of a Popup subroutine.
  1866.  Each Popup subroutine must have a PEND statement. PEND statements are
  1867.  not labeled.
  1868.  
  1869.  
  1870.  Parameters
  1871.  
  1872.  label            Name of the Popup subroutine. All POPUP statements must be
  1873.                   labeled.
  1874.  
  1875.  row              A number that specifies the row where the top-left corner
  1876.                   of the menu or message box appears. Be sure to specify a
  1877.                   value that allows the entire menu or message box to be
  1878.                   displayed. (For example, if the menu or message box takes
  1879.                   up 20 lines and you choose a row value greater than 5,
  1880.                   then some of the screen items will not be displayed on the
  1881.                   25-row screen.) If you don't specify a row, the top-left
  1882.                   corner is in row 1.
  1883.  
  1884.  column           A number that specifies the column where the top-left
  1885.                   corner of the menu or message box appears. If you don't
  1886.                   specify a column, the top-left corner is in column 1.
  1887.  
  1888.  attribute        A value that specifies how the menu is displayed on the
  1889.                   screen. This can be "normal", "bold", or "inverse", or a
  1890.                   decimal value that specifies particular foreground and
  1891.                   background colors. (For more information, see "Parameters"
  1892.                   in Chapter 1, "Creating Your Own Mouse Menu.") If you
  1893.                   don't specify a value, inverse is used. The colors of the
  1894.                   mouse pointer depend on the display attribute value for
  1895.                   the menu. (For detailed information on how the interaction
  1896.                   between the mouse pointer and menu display determine the
  1897.                   colors of the pointer, see "Graphics Cursor" in Chapter 5,
  1898.                   "The Mouse Interface.")
  1899.  
  1900.  
  1901.  Examples
  1902.  
  1903.  This example from the VC.DEF Mouse Menu program is a Popup subroutine for a
  1904.  multiple-column menu:
  1905.  
  1906.  DELETE:  POPUP 2,1,inverse
  1907.           TEXT "Delete: Row Column "
  1908.           SELECT 1,9,3,DR
  1909.           SELECT 1,13,6,DC
  1910.           PEND
  1911.  
  1912.  DR:      TYPE "/dr"
  1913.  DC:      TYPE "/dc"
  1914.  
  1915.  The POPUP statement defines the top-left corner of the menu as row 2,
  1916.  column 1. The menu contains the menu title and the menu items on the same
  1917.  line, as shown by the single TEXT statement. The two SELECT statements
  1918.  define the item selection areas. (For more information about SELECT and
  1919.  TEXT, see "SELECT" and "TEXT" later in this chapter.)
  1920.  
  1921.  This example from the WS.DEF Mouse Menu program is a Popup subroutine
  1922.  for a message box:
  1923.  
  1924.  
  1925.  mousehlp: popup 2,1
  1926.    text " =============== MOUSE HELP =================== "
  1927.    text "|                                              |"
  1928.    text "| Left button  - Displays Edit/Block menu      |"
  1929.    text "| Right button - Displays Cursor movement menu |"
  1930.    text "| Both buttons - Displays Edit/File menu       |"
  1931.    text "|                                              |"
  1932.    text "| Moving the mouse up,down,left, or right will |"
  1933.    text "| cause the cursor to move in that direction.  |"
  1934.    text "|                                              |"
  1935.    text " ============================================== "
  1936.    select 1,18,10
  1937.    pend
  1938.  
  1939.  
  1940.  In this example, ASCII graphics characters are used to create solid double
  1941.  borders for the menu. The single SELECT statement is used to clear the
  1942.  message box from the screen. (Since the label for an executable statement
  1943.  is not included in the SELECT statement, clicking a mouse button simply
  1944.  clears the message box from the screen.)
  1945.  
  1946.  
  1947.  ───────────────────────────────────────────────────────────────────────────
  1948.  SELECT
  1949.  
  1950.  SELECT row,column,width[,pointer]
  1951.  
  1952.  
  1953.  Description
  1954.  
  1955.  The SELECT statement is used in Popup subroutines to define selection areas
  1956.  for items on the menu. It also specifies which statement is executed if the
  1957.  cursor is in the defined area. The defined area does not have to contain
  1958.  any text. (For more information about the TEXT statement, see "TEXT" later
  1959.  in this chapter.)
  1960.  
  1961.  SELECT statements do not have labels.
  1962.  
  1963.  Note  The highlight in a menu or message box jumps from one defined
  1964.  selection area to another when the user moves the mouse. It is a good idea
  1965.  to define each part of a menu with a SELECT statement so that the movement
  1966.  of the highlight and the mouse are visually coordinated. However, make sure
  1967.  you don't define the same screen position with more than one SELECT
  1968.  statement.
  1969.  
  1970.  
  1971.  Parameters
  1972.  
  1973.  row              A number that defines the horizontal starting point (row)
  1974.                   of the item selection area. The defined area is relative
  1975.                   to the "row" and "column" coordinates specified in the
  1976.                   POPUP statement.
  1977.  
  1978.  column           A number that defines the vertical starting point (column)
  1979.                   of the item selection area. The defined area is relative
  1980.                   to the "row" and "column" coordinates specified in the
  1981.                   POPUP statement.
  1982.  
  1983.  width            The number of characters in the item selection area. If
  1984.                   you don't specify a number, one character is assumed.
  1985.  
  1986.  pointer          Label of the statement executed when the user chooses the
  1987.                   menu item. If a pointer parameter isn't included, the menu
  1988.                   is cleared from the screen.
  1989.  
  1990.  
  1991.  Examples
  1992.  
  1993.  For examples of how to use SELECT statements, see "Popup Subroutine
  1994.  Statements" in Chapter 1, "Creating Your Own Mouse Menu" and "POPUP...PEND"
  1995.  earlier in this chapter.
  1996.  
  1997.  
  1998.  ───────────────────────────────────────────────────────────────────────────
  1999.  TEXT
  2000.  
  2001.  TEXT "string"
  2002.  
  2003.  
  2004.  Description
  2005.  
  2006.  TEXT is used in Popup subroutines to define the menu title and the legend
  2007.  text for menu items. It is similar to the "title" and "text" parameters in
  2008.  the MENU and OPTION statements, but allows text to be placed anywhere on
  2009.  the screen below and to the right of the upper-left corner specified for
  2010.  the popup menu.
  2011.  
  2012.  
  2013.  Parameter
  2014.  
  2015.  string           Defines the popup menu title or the legend text of a menu
  2016.                   item. Text may include ASCII graphics characters. All text
  2017.                   must be enclosed in double quotation marks (" "). Text
  2018.                   location on the screen is relative to the top-left corner
  2019.                   of the popup menu. Text display attributes are determined
  2020.                   by the attribute parameter in the POPUP statement.
  2021.  
  2022.  
  2023.  Examples
  2024.  
  2025.  For examples of how to use TEXT statements, see "Popup Subroutine
  2026.  Statements" in Chapter 1, "Creating Your Own Mouse Menu," and
  2027.  "POPUP...PEND" earlier in this chapter.
  2028.  
  2029.  
  2030.  ───────────────────────────────────────────────────────────────────────────
  2031.  TYPE
  2032.  
  2033.  label: TYPE key [,key...]
  2034.  
  2035.  
  2036.  Description
  2037.  
  2038.  A TYPE statement simulates typing one or more key- strokes. Keys are
  2039.  specified by enclosing the keystroke(s) in double quotation marks, using
  2040.  the ASCII code that corresponds to the key(s), using a predefined symbolic
  2041.  key name, or, for certain special-function keys, using the key's extended
  2042.  keyboard scan code.
  2043.  
  2044.  Note  All keys specified in the TYPE statement are inserted into a keyboard
  2045.  buffer when the menu program is running and are not output as keystrokes
  2046.  until the menu program becomes inactive.
  2047.  
  2048.  
  2049.  Parameters
  2050.  
  2051.  label            Name of the TYPE statement. Every TYPE statement must be
  2052.                   labeled.
  2053.  
  2054.  key              Name of the key. It can be:
  2055.  
  2056.                 ■  A single letter or number enclosed in double quotation
  2057.                    marks (" "), or a sequence of keystrokes enclosed in
  2058.                    double quotation marks (such as "dir")
  2059.  
  2060.                 ■  A standard ASCII code (characters 0 through 127), or
  2061.                    an extended ASCII code (characters 128 through 255)
  2062.  
  2063.                 ■  An extended keyboard scan code
  2064.  
  2065.                 ■  Any of the following predefined symbolic keys:
  2066.                    "enter", "tab", "backsp", "esc".
  2067.  
  2068.  Note  If you want to simulate typing a quotation mark ("), use ASCII code
  2069.  34.
  2070.  
  2071.  The ASCII control characters (0 through 31) and extended keyboard scan
  2072.  codes that you can use with the TYPE statement are listed after the
  2073.  examples below. Refer to the IBM BASIC manual for a complete list of ASCII
  2074.  character codes.
  2075.  
  2076.  
  2077.  Examples
  2078.  
  2079.  These TYPE statements use character strings to define the keystrokes:
  2080.  
  2081.  dir:   TYPE "dir"  ;type the command "dir"
  2082.  a:     TYPE "a:"   ;type "a:"
  2083.  
  2084.  This TYPE statement uses an ASCII code to simulate typing a space:
  2085.  
  2086.  s:     TYPE 32     ;type a space
  2087.  
  2088.  These TYPE statements use extended keyboard scan codes to simulate the
  2089.  arrow keys:
  2090.  
  2091.  lf:    TYPE 0,75   ;simulate the left arrow key
  2092.  rt:    TYPE 0,77   ;simulate the right arrow key
  2093.  up:    TYPE 0,72   ;simulate the up arrow key
  2094.  dn:    TYPE 0,80   ;simulate the down arrow key
  2095.  
  2096.  
  2097.  ASCII Control Characters and Extended Keyboard Scan Codes
  2098.  
  2099.  This section lists the functions of the ASCII control characters and the
  2100.  extended keyboard scan codes when used with the TYPE statement. (See the
  2101.  IBM BASIC manual for a complete list of ASCII codes.) It also lists the key
  2102.  sequences that cannot be simulated using the TYPE statement.
  2103.  
  2104.  Note  The output characteristics listed for particular key functions are
  2105.  for a mouse menu running at the DOS level. A standard application may not
  2106.  interpret all keyboard operations in the same way. Applications that
  2107.  reprogram or directly access the keyboard, or bypass the DOS system
  2108.  facilities for keyboard input, may not function correctly with mouse menus.
  2109.  
  2110.  ASCII Control Characters  The following table lists the function of each
  2111.  ASCII control character when used with the TYPE statement:
  2112.  
  2113.  ASCII           Key                          ASCII          Key
  2114.  code            equivalent                   code           equivalent
  2115.  ───────────────────────────────────────────────────────────────────────────
  2116.   0              none                         16             CONTROL-P
  2117.   1              CONTROL-A                    17             CONTROL-Q
  2118.   2              CONTROL-B                    18             CONTROL-R
  2119.   3              CONTROL-C                    19             CONTROL-S
  2120.   4              CONTROL-D                    20             CONTROL-T
  2121.   5              CONTROL-E                    21             CONTROL-U
  2122.   6              CONTROL-F                    22             CONTROL-V
  2123.   7              CONTROL-G                    23             CONTROL-W
  2124.   8              backspace                    24             CONTROL-X
  2125.   9              horizontal tab               25             CONTROL-Y
  2126.  10              line feed                    26             CONTROL-Z
  2127.  11              CONTROL-K                    27             ESCAPE
  2128.  12              CONTROL-L                    28             CONTROL-
  2129.  13              carriage return              29             CONTROL-]
  2130.  14              CONTROL-N                    30             CONTROL-^
  2131.  15              CONTROL-O                    31             Control-_
  2132.  
  2133.  Extended Keyboard Scan Codes  Extended keyboard scan codes have two
  2134.  components: a character code (which is always 0) and a scan code (for
  2135.  example, "0,75"). The tables below list the scan codes you can use with the
  2136.  TYPE statement and the character code 0 to simulate specific keystrokes.
  2137.  (Standard or extended ASCII characters cannot be used as extended keyboard
  2138.  scan codes.)
  2139.  
  2140.  Keystroke(s)                                              Scan code
  2141.  ───────────────────────────────────────────────────────────────────────────
  2142.  HOME                                                         71
  2143.  CONTROL-HOME                                                119
  2144.  up arrow key                                                 72
  2145.  down arrow key                                               80
  2146.  left arrow key                                               75
  2147.  CONTROL-left arrow key                                      115
  2148.  right arrow key                                              77
  2149.  CONTROL-right arrow key                                     116
  2150.  END                                                          79
  2151.  CONTROL-END                                                 117
  2152.  PAGEUP                                                       73
  2153.  CONTROL-PAGEUP                                              132
  2154.  PAGEDOWN                                                     81
  2155.  CONTROL-PAGEDOWN                                            118
  2156.  CONTROL-PRINTSCREEN                                         114
  2157.  INSERT                                                       82
  2158.  DELETE                                                       83
  2159.  SHIFT-TAB                                                    15
  2160.  
  2161. ╓┌──────────────────────────┌──────────────────┌───────────────────────┌─────╖
  2162.                             Scan                                       Scan
  2163.  Keystroke(s)               code               Keystroke(s)            code
  2164.  ───────────────────────────────────────────────────────────────────────────
  2165.                             Scan                                       Scan
  2166.  Keystroke(s)               code               Keystroke(s)            code
  2167.  ───────────────────────────────────────────────────────────────────────────
  2168.  F1                         59                 ALT-0                   129
  2169.  F2                         60                 ALT-1                   120
  2170.  F3                         61                 ALT-2                   121
  2171.  F4                         62                 ALT-3                   122
  2172.  F5                         63                 ALT-4                   123
  2173.  F6                         64                 ALT-5                   124
  2174.  F7                         65                 ALT-6                   125
  2175.  F8                         66                 ALT-7                   126
  2176.  F9                         67                 ALT-8                   127
  2177.  F10                        68                 ALT-9                   128
  2178.  SHIFT-F1 (F11)             84                 ALT--                   130
  2179.  SHIFT-F2 (F12)             85                 ALT-=                   131
  2180.  SHIFT-F3 (F13)             86                 ALT-A                   30
  2181.  SHIFT-F4 (F14)             87                 ALT-B                   48
  2182.  SHIFT-F5 (F15)             88                 ALT-C                   46
  2183.  SHIFT-F6 (F16)             89                 ALT-D                   32
  2184.  SHIFT-F7 (F17)             90                 ALT-E                   18
  2185.  SHIFT-F8 (F18)             91                 ALT-F                   33
  2186.                             Scan                                       Scan
  2187.  Keystroke(s)               code               Keystroke(s)            code
  2188. SHIFT-F8 (F18)             91                 ALT-F                   33
  2189.  SHIFT-F9 (F19)             92                 ALT-G                   34
  2190.  SHIFT-F10 (F20)            93                 ALT-H                   35
  2191.  CONTROL-F1 (F21)           94                 ALT-I                   23
  2192.  CONTROL-F2 (F22)           95                 ALT-J                   36
  2193.  CONTROL-F3 (F23)           96                 ALT-K                   37
  2194.  CONTROL-F4 (F24)           97                 ALT-L                   38
  2195.  CONTROL-F5 (F25)           98                 ALT-M                   50
  2196.  CONTROL-F6 (F26)           99                 ALT-N                   49
  2197.  CONTROL-F7 (F27)          100                 ALT-O                   24
  2198.  CONTROL-F8 (F28)          101                 ALT-P                   25
  2199.  CONTROL-F9 (F29)          102                 ALT-Q                   16
  2200.  CONTROL-F10 (F30)         103                 ALT-R                   19
  2201.  ALT-F1 (F31)              104                 ALT-S                   31
  2202.  ALT-F2 (F32)              105                 ALT-T                   20
  2203.  ALT-F3 (F33)              106                 ALT-U                   22
  2204.  ALT-F4 (F34)              107                 ALT-V                   47
  2205.  ALT-F5 (F35)              108                 ALT-W                   17
  2206.  ALT-F6 (F36)              109                 ALT-X                   45
  2207.                             Scan                                       Scan
  2208.  Keystroke(s)               code               Keystroke(s)            code
  2209. ALT-F6 (F36)              109                 ALT-X                   45
  2210.  ALT-F7 (F37)              110                 ALT-Y                   21
  2211.  ALT-F8 (F38)              111                 ALT-Z                   44
  2212.  ALT-F9 (F39)              112
  2213.  ALT-F10 (F40)             113
  2214.  
  2215.  Key Sequences That Cannot Be Simulated  Some key sequences cannot be
  2216.  simulated using the TYPE statement because they are suppressed in the ROM
  2217.  (Read-Only Memory) BIOS (Basic Input/Output System) keyboard routine. These
  2218.  include the following key combinations:
  2219.  
  2220.  SHIFT-PRINTSCREEN
  2221.  
  2222.  ALT-BACKSPACE
  2223.  
  2224.  ALT-ESCAPE
  2225.  
  2226.  ALT plus one of the following characters: [ ] ; ' ─ , . / *
  2227.  
  2228.  ALT plus one of the following keys: ENTER, CONTROL, SHIFT, CAPS LOCK, NUM
  2229.  LOCK, SCROLL LOCK
  2230.  
  2231.  ALT plus one of the arrow keys
  2232.  
  2233.  CONTROL plus one of the following characters: 1 3 4 5 7 8 9 0 = ; ' ─ , . /
  2234.  
  2235.  CONTROL plus one of the following keys: TAB, SHIFT, CAPS LOCK, NUM LOCK
  2236.  
  2237.  CONTROL-BREAK
  2238.  
  2239.  CONTROL-ALT-DELETE
  2240.  
  2241.  CONTROL plus one of the arrow keys
  2242.  
  2243.  CONTROL-INSERT
  2244.  
  2245.  
  2246.  
  2247.  ═══════════════════════════════════════════════════════════════════════════
  2248.  3  Sample Mouse Menu Programs
  2249.  
  2250.  
  2251.  
  2252.  This chapter includes the source program listings for two basic Mouse Menu
  2253.  programs that simplify some of the tasks commonly performed on an IBM PC or
  2254.  compatible computer:
  2255.  
  2256.   ■  The SIMPLE Mouse Menu program allows you to simulate pressing the
  2257.      ENTER, ESCAPE, INSERT, and arrow keys by either clicking or moving the
  2258.      mouse.
  2259.  
  2260.   ■  The DOSOVRLY Mouse Menu program allows you to execute simple DOS
  2261.      commands by using the mouse to choose the commands from a menu rather
  2262.      than typing them on the keyboard.
  2263.  
  2264.  You can type the source program listing for either mouse menu into a
  2265.  source file, run MAKEMENU to generate an executable Mouse Menu file, then
  2266.  start using the mouse menu immediately. Or you may want to use these
  2267.  listings as a basis for designing similar mouse menus that include
  2268.  additional features specific to your needs.
  2269.  
  2270.  
  2271.  ───────────────────────────────────────────────────────────────────────────
  2272.  SIMPLE Mouse Menu Program
  2273.  
  2274.  The SIMPLE Mouse Menu allows you to use the mouse instead of typing a few
  2275.  commonly used keys. It is most helpful when used with applications that
  2276.  require frequent use of the arrow keys. For example, in many spreadsheet
  2277.  applications you must press the arrow keys on your keyboard to move the
  2278.  cursor on the screen. If the SIMPLE Mouse Menu is installed, you can move
  2279.  the cursor on the screen by simply moving the mouse on your desk top. In
  2280.  addition, clicking the left mouse button is equivalent to pressing the
  2281.  ENTER key, clicking the right mouse button simulates pressing the ESCAPE
  2282.  key, and clicking both mouse buttons at once is the same as pressing the
  2283.  INSERT key. If your application does not use one of these keys, and you
  2284.  click the corresponding mouse button(s) by accident, the application will
  2285.  respond as if you had typed the key on the keyboard. You can correct the
  2286.  mistake as you would any typing error.
  2287.  
  2288.  
  2289.  SIMPLE Mouse Menu Source Program
  2290.  
  2291.  ; A menu to simulate arrow, enter, escape,
  2292.  ; and insert keys
  2293.  ;
  2294.  ;
  2295.  begin ent,es,ins,lf,rt,up,dn,32,16
  2296.  ;
  2297.  ent:  type enter
  2298.  es:   type esc
  2299.  ins:  type 0,82
  2300.  ;
  2301.  lf:   type 0,75
  2302.  rt:   type 0,77
  2303.  up:   type 0,72
  2304.  dn:   type 0,80
  2305.  
  2306.  
  2307.  ───────────────────────────────────────────────────────────────────────────
  2308.  DOSOVRLY Mouse Menu Program
  2309.  
  2310.  The DOSOVRLY Mouse Menu allows you to choose several commonly used DOS
  2311.  commands at the DOS command level by simply pointing to an option on a menu
  2312.  and clicking the mouse. In other words, this mouse menu "overlays" DOS.
  2313.  
  2314.  In addition to a main menu, the DOSOVRLY Mouse Menu program has two
  2315.  submenus, "Directory" and "Change Directory," which each list additional
  2316.  DOS commands. The source program for DOSOVRLY is a good example of how you
  2317.  might create a hierarchy of menus and submenus in one of your own Mouse
  2318.  Menu programs.
  2319.  
  2320.  The DOSOVRLY Mouse Menu provides several features that are useful at
  2321.  the DOS command level:
  2322.  
  2323.   ■  Moving the mouse left and right simulates pressing the left and right
  2324.      arrow keys. This allows you to edit your DOS commands by just moving
  2325.      the mouse.
  2326.  
  2327.   ■  Clicking the right mouse button simulates pressing the ENTER key.
  2328.  
  2329.   ■  Clicking both mouse buttons at once simulates typing cls, the DOS
  2330.      command for clearing the screen.
  2331.  
  2332.   ■  Clicking the left mouse button displays the DOSOVRLY main menu. Options
  2333.      on this menu allow you to clear the screen, execute the DATE or TIME
  2334.      command, or choose "DIRECTORY" or "CHANGE DIRECTORY" to view the
  2335.      corresponding submenus of DOS commands. To select a menu option, move
  2336.      the highlight to the option, then click either mouse button. From
  2337.      within a submenu, you can choose an option to move to the other submenu
  2338.      or click the left mouse button to return to the main menu.
  2339.  
  2340.  Note  In the DOSOVRLY source program, the lb, rb, bb, lm, and rm parameters
  2341.  specified in the BEGIN statement are labels for EXECUTE statements. These
  2342.  EXECUTE statements branch off to the appropriate TYPE statements. This
  2343.  format demonstrates how you can use the EXECUTE statement in your Mouse
  2344.  Menu programs. This program could be simplified by branching directly from
  2345.  the BEGIN statement to the TYPE statements using: BEGIN
  2346.  mnu1,return,cls,left,right
  2347.  
  2348.  
  2349.  DOSOVRLY Mouse Menu Source Program
  2350.  
  2351.  BEGIN lb,rb,bb,lm,rm
  2352.  lb:  execute mnu1    ; main menu if left button
  2353.  rb:  execute return  ; type enter if right button
  2354.  bb:  execute cls     ; type CLS if both buttons
  2355.  lm:  execute left    ; left arrow if left motion
  2356.  rm:  execute right   ; right arrow if right motion
  2357.  ;
  2358.  mnu1: MENU "Main Menu",2,55,NORMAL
  2359.     option "cancel           ",none
  2360.     option "clear the screen ",cls
  2361.     option "date             ",date
  2362.     option "time             ",time
  2363.     option "DIRECTORY        ",mnu3
  2364.     option "CHANGE DIRECTORY ",mnu2
  2365.     MEND
  2366.  ;
  2367.  mnu2: MENU "Change Directory",2,55,NORMAL
  2368.     option "cancel           ",none
  2369.     option "cd ..            ",cd1
  2370.     option "cd               ",cd2
  2371.     option "DIRECTORY        ",mnu3
  2372.     option "MAIN MENU        ",mnu1
  2373.     MEND
  2374.  ;
  2375.  mnu3: MENU "Directory",2,55,NORMAL
  2376.     option "cancel           ",none
  2377.     option "dir              ",dir
  2378.     option "dir *.exe        ",dire
  2379.     option "dir *.bat        ",dirb
  2380.     option "dir *.bak        ",dirx
  2381.     option "dir *.sys        ",dirs
  2382.     option "dir *.doc        ",dird
  2383.     option "dir *.           ",dirz
  2384.     option "CHANGE DIRECTORY ",mnu2
  2385.     option "MAIN MENU        ",mnu1
  2386.     MEND
  2387.  ;
  2388.  none:      nothing           ; do nothing
  2389.  ;
  2390.  return:    type enter
  2391.  cls:       type "cls",enter
  2392.  left:      type 0,75         ; left arrow
  2393.  right:     type 0,77         ; right arrow
  2394.  date:      type "date",enter
  2395.  time:      type "time",enter
  2396.  cd1:       type "cd ..",enter
  2397.  cd2:       type "cd
  2398.  dir:       type "dir",enter
  2399.  dire:      type "dir *.exe",enter
  2400.  dirb:      type "dir *.bat",enter
  2401.  dirx:      type "dir *.bak",enter
  2402.  dirs:      type "dir *.sys",enter
  2403.  dird:      type "dir *.doc",enter
  2404.  dirz:      type "dir *."
  2405.  
  2406.  
  2407.  
  2408.  ═══════════════════════════════════════════════════════════════════════════
  2409.  4  Mouse Menu Messages
  2410.  
  2411.  
  2412.  
  2413.  This chapter lists the messages that the MENU and MAKEMENU programs can
  2414.  display, along with descriptions of possible causes and what actions you
  2415.  may take in response to them.
  2416.  
  2417.  Conversion completed
  2418.   ■  The MAKEMENU program finished creating an executable menu file.
  2419.      No action is required. The DOS system prompt appears after MAKEMENU
  2420.      displays this message.
  2421.  
  2422.  Error--Invalid statement: xxxx
  2423.   ■  Either the statement had no label, the statement's label didn't end
  2424.      with a colon (:), or the statement had an invalid parameter or
  2425.      syntax error.
  2426.      Make sure that all statements (except the BEGIN statement and
  2427.      statements within Menu and Popup subroutines) are labeled. Make sure
  2428.      that all labels are followed by a colon. Check the statement syntax for
  2429.      correct use of commas and spaces.
  2430.  
  2431.  Error--Label already used: label
  2432.   ■  The same label was used to name more than one statement.
  2433.      Make sure that labels are unique for each statement.
  2434.  
  2435.  Error--Label not found: xxxx
  2436.   ■  A label specified for a parameter did not exist.
  2437.      Make sure that the statements have labels and that the labels are
  2438.      correct.
  2439.  
  2440.  Illegal function call at address xxxxxx
  2441.   ■  A TYPE or EXECUTE statement had too many parameters, a SELECT statement
  2442.      defined the item selection area outside of the menu, or a SELECT or an
  2443.      OPTION statement had quotation marks placed incorrectly.
  2444.      Use the correct number of parameters, redefine the item selection area,
  2445.      or ensure that double quotation marks are used correctly to designate
  2446.      text strings.
  2447.  
  2448.  Keyboard emulation off
  2449.   ■  The Mouse Menu program is no longer running.
  2450.      No action is required.
  2451.  
  2452.  Keyboard emulation on
  2453.   ■  The Mouse Menu program is running.
  2454.      No action is required.
  2455.  
  2456.  Menu installed
  2457.   ■  You started up a Mouse Menu program, and it is running.
  2458.      No action is required. Use the mouse menu as usual.
  2459.  
  2460.  Name of file to convert:
  2461.   ■  You typed "makemenu" to create an executable Mouse Menu file.
  2462.      Type in a Mouse Menu filename without the ".DEF" extension.
  2463.  
  2464.  
  2465.  
  2466.  ═══════════════════════════════════════════════════════════════════════════
  2467.  Designing Mouse Interfaces
  2468.  
  2469.  
  2470.  
  2471.  This section provides the technical information you need to design a mouse
  2472.  interface for one of your own application programs. To build mouse support
  2473.  into your program, you'll include calls to a set of mouse functions. You
  2474.  can make mouse function calls from the BASIC interpreter, from assembly-
  2475.  language programs, and from programs in high-level languages such as
  2476.  Microsoft QuickBASIC, Pascal, FORTAN, and C.
  2477.  
  2478.  Chapter 5, "The Mouse Interface," describes the interface between the
  2479.  computer screen and the Microsoft Mouse software.
  2480.  
  2481.  Chapter 6, "Mouse Function Descriptions," describes the input, output,
  2482.  and operation of each function call your program can make to the mouse
  2483.  driver.
  2484.  
  2485.  Chapter 7, "Making Mouse Function Calls," describes how to make mouse
  2486.  function calls from interpreted BASIC, assembly, and high-level-language
  2487.  programs. It also includes the source listing for the Piano demonstration
  2488.  program that came in your Microsoft Mouse package, and explains how to
  2489.  specify eight mouse cursor shapes.
  2490.  
  2491.  Chapter 8, "Writing Mouse Programs for IBM EGA Modes," explains how to
  2492.  use the Microsoft EGA Register Interface when your program includes mouse
  2493.  support for IBM enhanced graphics modes D, E, F, and 10.
  2494.  
  2495.  
  2496.  
  2497.  ═══════════════════════════════════════════════════════════════════════════
  2498.  5  The Mouse Interface
  2499.  
  2500.  
  2501.  
  2502.  This chapter describes the interface between the mouse software and the IBM
  2503.  PC. In particular, it discusses how the mouse software uses certain
  2504.  features of the computer to create a cursor on the screen and control its
  2505.  movement. This chapter talks about:
  2506.  
  2507.   ■  Screen modes
  2508.  
  2509.   ■  The virtual screen
  2510.  
  2511.   ■  Graphics and text cursors
  2512.  
  2513.   ■  Mouse buttons
  2514.  
  2515.   ■  The mouse unit of distance: the mickey
  2516.  
  2517.   ■  The internal cursor flag
  2518.  
  2519.  Since many of the mouse functions use the interface, it is important
  2520.  for you to read the following sections carefully and understand them before
  2521.  you use the functions in application programs.
  2522.  
  2523.  
  2524.  ───────────────────────────────────────────────────────────────────────────
  2525.  Screen Modes
  2526.  
  2527.  The screen mode defines the number of pixels (points of light) on the
  2528.  screen and the types of objects that appear on the screen. The available
  2529.  screen modes depend on the adapter in your computer. These screen modes and
  2530.  the adapters on which they are supported are listed in the table on the
  2531.  next page. (Specific information about each screen mode is given in the
  2532.  documentation for each adapter.)
  2533.  
  2534.                      Virtual              Bits/Pixel
  2535.  Screen   Display    Screen      Cell     (Graphics
  2536.  Mode     Adapter    (X x Y)     Size       Modes)
  2537.  ───────────────────────────────────────────────────
  2538.  0        C,E,3270   640 x 200   16 x 8       -
  2539.  1        C,E,3270   640 x 200   16 x 8       -
  2540.  2        C,E,3270   640 x 200   8 x 8        -
  2541.  3        C,E,3270   640 x 200   8 x 8        -
  2542.  4        C,E,3270   640 x 200   2 x 1        2
  2543.  5        C,E,3270   640 x 200   2 x 1        2
  2544.  6        C,E,3270   640 x 200   1 x 1        1
  2545.  7        M,E,3270   640 x 200   8 x 8        -
  2546.  D        E          640 x 200   16 x 8       2
  2547.  E        E          640 x 200   1 x 1        1
  2548.  F        E          640 x 350   1 x 1        1
  2549.  10       E          640 x 350   1 x 1        1
  2550.  30       3270       720 x 350   1 x 1        1
  2551.  -        H          720 x 348   1 x 1        1
  2552.  
  2553.  Display adapters:
  2554.  
  2555.  M = IBM Monochrome Display/Printer Adapter
  2556.  
  2557.  C = IBM Color/Graphics Monitor Adapter
  2558.  
  2559.  E = IBM Enhanced Graphics Adapter
  2560.  
  2561.  3270 = IBM All Points Addressable Graphics Adapter (3270 PC)
  2562.  
  2563.  H = Hercules Monochrome Graphics Card
  2564.  
  2565.  
  2566.  ───────────────────────────────────────────────────────────────────────────
  2567.  The Virtual Screen
  2568.  
  2569.  The mouse software operates on the computer screen as if it were a virtual
  2570.  screen of individual points arranged in a matrix of horizontal and vertical
  2571.  points. The "Virtual Screen" column in the table above gives the number of
  2572.  horizontal and vertical points in the matrix for each supported screen
  2573.  mode.
  2574.  
  2575.  Whenever interrupt 10h is called to change the screen mode, the mouse
  2576.  software intercepts the call and determines which virtual screen to use.
  2577.  The mouse software also reads the screen mode and chooses the appropriate
  2578.  virtual screen whenever mouse function 0 is called to reset default
  2579.  parameter values in the mouse software.
  2580.  
  2581.  Regardless of the screen mode, the software uses a pair of virtual-
  2582.  screen coordinates to locate an object on the screen. Each pair of
  2583.  coordinates defines a point on the virtual screen. The horizontal
  2584.  coordinate is given first.
  2585.  
  2586.  Many mouse functions take virtual-screen coordinates as input or
  2587.  return them as output. Whenever you refer to a pixel or character in a
  2588.  mouse function, make sure that the horizontal and vertical coordinates are
  2589.  the correct values for the given screen mode. The mouse functions always
  2590.  return correct values for the given screen mode.
  2591.  
  2592.  ────────────────────────────────────────
  2593.  Graphics modes 6, E, F, 10, and 30
  2594.  ────────────────────────────────────────
  2595.  
  2596.  In graphics modes 6, E, F, 10, and 30, and for the Hercules graphics
  2597.  display modes, each point in the virtual screen has a one-to-one
  2598.  correspondence with each pixel on the screen. In these modes, the full
  2599.  range of coordinates in the "Virtual Screen" column is permitted.
  2600.  
  2601.  ────────────────────────────────────────
  2602.  Graphics modes 4 and 5
  2603.  ────────────────────────────────────────
  2604.  
  2605.  In graphics modes 4 and 5, the screen has half the number of pixels that it
  2606.  has in the other graphics modes. To compensate, the mouse software uses
  2607.  only even-numbered horizontal coordinates. This means that every other
  2608.  point in the virtual screen corresponds to a pixel.
  2609.  
  2610.  ────────────────────────────────────────
  2611.  Text modes 2, 3, and 7
  2612.  ────────────────────────────────────────
  2613.  
  2614.  In text modes 2, 3, and 7, only characters are permitted on the screen.
  2615.  Each character is an 8-by-8-pixel group (see the "Cell Size" column in the
  2616.  table).
  2617.  
  2618.  Because the mouse software cannot access the individual pixels in a
  2619.  character, it uses the coordinates of the pixel in the upper-left corner of
  2620.  the cell for the character's location. Since each character is an 8-by-8-
  2621.  pixel group, both the horizontal and vertical coordinates are multiples of
  2622.  eight.
  2623.  
  2624.  For example, the character in the upper-left corner of the screen has
  2625.  the coordinates (0,0), and the character immediately to the right of it has
  2626.  the coordinates (8,0).
  2627.  
  2628.  
  2629.  ────────────────────────────────────────
  2630.  Text modes 0 and 1
  2631.  ────────────────────────────────────────
  2632.  
  2633.  In text modes 0 and 1, as in text modes 2, 3, and 7, only characters are
  2634.  permitted on the screen. Each character is a 16-by-8-pixel group (see
  2635.  "Cell Size" in the table).
  2636.  
  2637.  The mouse software uses the coordinates of just one pixel in a
  2638.  character for the character's location. However, the screen has only half
  2639.  as many pixels as in modes 2, 3, and 7. To compensate, the mouse software
  2640.  uses horizontal coordinates that are multiples of 16.
  2641.  
  2642.  For example, the character in the upper-left corner of the screen has
  2643.  the coordinates (0,0), and the character immediately to the right of it has
  2644.  the coordinates (16,0).
  2645.  
  2646.  
  2647.  ───────────────────────────────────────────────────────────────────────────
  2648.  Graphics and Text Cursors
  2649.  
  2650.  The mouse has three different cursors:
  2651.  
  2652.   ■  The graphics cursor is a shape (for example, an arrow) that moves over
  2653.      the images on the screen.
  2654.  
  2655.   ■  The software text cursor is a character attribute (for example, an
  2656.      underscore) that moves from character to character on the screen.
  2657.  
  2658.   ■  The hardware text cursor is a flashing block, half-block, or underscore
  2659.      that moves from character to character on the screen.
  2660.  
  2661.  The mouse software supports only one of these cursors on the screen at
  2662.  any time. In your application program, you can choose which cursor is on
  2663.  the screen, and even switch back and forth between cursors.
  2664.  
  2665.  Mouse functions 9 and 10 permit you to define the characteristics of
  2666.  these cursors in your application program. You can define the
  2667.  characteristics yourself, or use the characteristics of the sample cursors
  2668.  provided. For more information about the sample cursors, see Chapter 7,
  2669.  "Making Mouse Function Calls."
  2670.  
  2671.  The following paragraphs describe the cursors in detail.
  2672.  
  2673.  
  2674.  Graphics Cursor
  2675.  
  2676.  The graphics cursor, used when the computer is in one of the graphics
  2677.  modes, is a block of pixels.
  2678.  
  2679.   ■  In modes 6, E, F, 10, and 30, and for the Hercules Monochrome Graphics
  2680.      Card, it is 256 pixels in a 16-by-16-pixel square.
  2681.  
  2682.   ■  In modes 4 and 5, it is 128 pixels in an 8-by-16-pixel square.
  2683.  
  2684.  As the mouse moves, the block moves over the screen and interacts with
  2685.  the pixels directly under it. This interaction creates the cursor shape and
  2686.  background.
  2687.  
  2688.  ────────────────────────────────────────
  2689.  Screen mask and cursor mask
  2690.  ────────────────────────────────────────
  2691.  
  2692.  The interaction between the cursor points and screen pixels is defined by
  2693.  two 16-by-16-bit arrays: the screen mask and the cursor mask.
  2694.  
  2695.   ■  The screen mask determines whether the cursor pixel is part of the
  2696.      shape or background.
  2697.  
  2698.   ■  The cursor mask determines how the pixel under the cursor contributes
  2699.      to the color of the cursor.
  2700.  
  2701.  In your application program, you can specify the shapes of the screen
  2702.  mask and cursor mask by defining them as arrays and passing these arrays as
  2703.  parameters in a call to mouse function 9. (For more information, see the
  2704.  description of function 9 in Chapter 6, "Mouse Function Descriptions.")
  2705.  
  2706.  The interactions between the screen mask and the cursor mask differ
  2707.  somewhat between graphics modes 4, 5, 6, F, and 30 and the IBM Enhanced
  2708.  Graphics Adapter graphics modes E and 10.
  2709.  
  2710.  ────────────────────────────────────────
  2711.  Modes 4, 5, 6, F, and 30, and
  2712.  the Hercules Graphics Card
  2713.  ────────────────────────────────────────
  2714.  
  2715.  In modes 6, F, and 30, and for the Hercules Graphics Card, each bit in the
  2716.  masks corresponds to a pixel in the cursor block. In modes 4 and 5, each
  2717.  pair of bits corresponds to a pixel.
  2718.  
  2719.  To create the cursor, the mouse software operates on the data in the
  2720.  computer's screen memory that defines the color of each pixel on the
  2721.  screen. First, the software logically ANDs the screen mask with the 256
  2722.  bits of data that define the pixels under the cursor. Then, it logically
  2723.  XORs the cursor mask with the result of the AND operation. The following
  2724.  table shows how these operations affect the individual screen bits:
  2725.  
  2726.  If the screen                 And the cursor                 The resulting
  2727.  mask bit is                   mask bit is                    screen bit is
  2728.  ───────────────────────────────────────────────────────────────────────────
  2729.        0                             0                            0
  2730.        0                             1                            1
  2731.        1                             0                          unchanged
  2732.        1                             1                           inverted
  2733.  
  2734.  In modes 6, F, and 30, and for the Hercules Graphics Card, each screen bit
  2735.  defines the color of a single pixel. Therefore, one bit in the screen mask
  2736.  and one bit in the cursor mask define the pixel's color when the cursor is
  2737.  over it. For example, if the first bit in the screen mask is 1 and the
  2738.  first bit in the cursor mask is 0, then the upper-left corner of the cursor
  2739.  block is transparent.
  2740.  
  2741.  In modes 4 and 5, each pair of screen bits defines the color of a
  2742.  pixel. Therefore, a pair of bits in the screen mask and a pair in the
  2743.  cursor mask define a pixel's color.
  2744.  
  2745.  ────────────────────────────────────────
  2746.  Modes E and 10
  2747.  ────────────────────────────────────────
  2748.  
  2749.  In EGA four-plane modes E and 10, as in modes 6, F, and 30, each bit in the
  2750.  screen mask and cursor mask corresponds to a pixel in the cursor block.
  2751.  
  2752.  The cursor mask and screen mask are stored in off-screen memory. Each
  2753.  plane has its own cursor mask and screen mask. Therefore, for each plane,
  2754.  the "resulting screen bit" in the table on the previous page is actually
  2755.  the bit used in the color table lookup on the EGA.
  2756.  
  2757.  In modes E and 10, the mouse driver automatically sets the write mask
  2758.  register on the EGA to all 1s. Therefore, when your application program
  2759.  calls mouse function 9 to set the cursor shape, the cursor pixels may be
  2760.  either black, white, transparent, or inverted.
  2761.  
  2762.  The mouse driver does not support color cursors in modes E and 10.
  2763.  
  2764.  ────────────────────────────────────────
  2765.  Graphics cursor "hot spot"
  2766.  ────────────────────────────────────────
  2767.  
  2768.  Whenever a mouse function refers to the graphics cursor location, it gives
  2769.  the point on the virtual screen that lies directly under the cursor's hot
  2770.  spot. The hot spot is the point in the cursor block that the mouse software
  2771.  uses to determine the cursor coordinates.
  2772.  
  2773.  You can define the hot spot in the cursor block by passing the horizontal
  2774.  and vertical coordinates of the point to mouse function 9. The
  2775.  coordinates can be within the range -16 to 16; however, in modes 4 and 5,
  2776.  the horizontal coordinate must be an even number. In all graphics modes,
  2777.  the coordinates are relative to the upper-left corner of the cursor block.
  2778.  
  2779.  
  2780.  Software Text Cursor
  2781.  
  2782.  The software text cursor is used when the computer is in one of the text
  2783.  modes.
  2784.  
  2785.  The text cursor affects how characters appear on the screen. Unlike
  2786.  the graphics cursor, the text cursor usually does not have a shape of its
  2787.  own. Instead, it changes the character attributes (such as foreground and
  2788.  background color, intensity, and underscoring) of the character directly
  2789.  under it. If the cursor does have a shape of its own, it is one of the 256
  2790.  characters in the ASCII character set.
  2791.  
  2792.  ────────────────────────────────────────
  2793.  Screen mask and cursor mask
  2794.  ────────────────────────────────────────
  2795.  
  2796.  The effect of the text cursor on the character under it is defined by two
  2797.  16-bit values called the screen mask and the cursor mask.
  2798.  
  2799.   ■  The screen mask determines which of the character's attributes are
  2800.      preserved.
  2801.  
  2802.   ■  The cursor mask determines how these attributes are changed to yield
  2803.      the cursor.
  2804.  
  2805.  To create the cursor, the mouse software operates on the data that
  2806.  defines each character on the screen. The software first logically ANDs the
  2807.  screen mask and the 16 bits of screen data for the character under the
  2808.  cursor. It then logically XORs the cursor mask and the result of the AND
  2809.  operation.
  2810.  
  2811.  The 16 bits of screen data for each character take the following form:
  2812.  
  2813.  
  2814.           15 │ 14          12 │ 11 │ 10          8 │ 7          0 │
  2815.        ──────┼────────────────┼────┼───────────────┼──────────────┤
  2816.           b  │ bckgd          │ i  │    foregd     │   char       │
  2817.              │                │    │               │              │
  2818.        ──────┴────────────────┴────┴───────────────┴──────────────┘
  2819.                     odd address (M+1)             even address (M)
  2820.  
  2821.  ───────────────────────────────────────────────────────────────────────────
  2822.  5.1  Screen Data for Character
  2823.  
  2824.  
  2825.  In Figure 5.1:
  2826.  
  2827.  Bit(s)                Purpose
  2828.  ───────────────────────────────────────────────────────────────────────────
  2829.  15 (b)                Sets blinking or nonblinking character
  2830.  1214 (bckgd)          Set the background color
  2831.  11 (i)                Sets high intensity or medium intensity
  2832.  810 (foregd)          Set the foreground color
  2833.  07 (char)             ASCII value of the character
  2834.  
  2835.  The range of values for each field depends on the display adapter in the
  2836.  computer. (See the display adapter documentation for details.)
  2837.  
  2838.  The screen mask and cursor mask are divided into the same fields as
  2839.  those shown in Figure 5.1. The values of these fields in the screen mask
  2840.  and cursor mask define the character's new attributes when the cursor is
  2841.  over the character.
  2842.  
  2843.  For example, to invert the foreground and background colors, the
  2844.  screen mask and cursor mask should have the values shown in Figure 5.2:
  2845.  
  2846.  
  2847.                     ┌───┬────────┬───┬────────┬────────┬────────┐
  2848.                     │ b │ bckgd  │ i │ foregd │  char  │   =    │
  2849.      ┌──────────────┼───┼────────┼───┼────────┼────────┼────────┤
  2850.      │ screen mask  │ 0 │  111   │ 0 │  111   │11111111│ &H77FF │
  2851.      │ cursor mask  │ 0 │  111   │ 0 │  111   │00000000│ &H7700 │
  2852.      └──────────────┴───┴────────┴───┴────────┴────────┴────────┘
  2853.  
  2854.  ───────────────────────────────────────────────────────────────────────────
  2855.  5.2  Sample Screen/Cursor Mask Values
  2856.  
  2857.  
  2858.  In your application program, you can define the values of the screen mask
  2859.  and cursor mask by passing their values as parameters to mouse function 10.
  2860.  (For more information, see the description of function 10 in Chapter 6,
  2861.  "Mouse Function Descriptions.")
  2862.  
  2863.  Whenever a mouse function refers to the text cursor location, it gives
  2864.  the coordinates of the character under the cursor. The text cursor does not
  2865.  have a hot spot.
  2866.  
  2867.  
  2868.  Hardware Text Cursor
  2869.  
  2870.  The hardware text cursor is another cursor that can be used when the
  2871.  computer is in one of the text modes.
  2872.  
  2873.  The hardware text cursor is actually the computer's cursor (the one
  2874.  you see on the screen after the DOS system-level prompt). The mouse
  2875.  software allows you to adapt this cursor to your needs.
  2876.  
  2877.  ────────────────────────────────────────
  2878.  Scan lines
  2879.  ────────────────────────────────────────
  2880.  
  2881.  The hardware cursor is 8 pixels wide and 8 to 14 pixels tall. Each
  2882.  horizontal set of pixels forms a line called a scan line. There are 8
  2883.  to 14 scan lines.
  2884.  
  2885.  A scan line can be on or off. If a scan line is on, it appears as a
  2886.  flashing bar on the screen. If a scan line is off, it has no effect on the
  2887.  screen. Your program can define which lines are on and which are off by
  2888.  passing the numbers of the first and last lines in the cursor to mouse
  2889.  function 10.
  2890.  
  2891.  The number of lines in the cursor depends on the display adapter in
  2892.  the computer.
  2893.  
  2894.   ■  If the computer has an IBM Color/Graphics Monitor Adapter, the cursor
  2895.      has 8 lines, numbered 0 to 7.
  2896.  
  2897.   ■  If the computer has an IBM Monochrome Display and Printer Adapter, the
  2898.      cursor has 14 lines, numbered 0 to 13.
  2899.  
  2900.   ■  If the computer has an IBM Enhanced Graphics Adapter and an IBM Color
  2901.      Display, the cursor has 8 lines, numbered 0 to 7. If the computer has
  2902.      an IBM Enhanced Graphics Adapter and an IBM Enhanced Color Display, the
  2903.      cursor has 14 lines, numbered 0 to 13.
  2904.  
  2905.  Note  Only block cursors are supported on the 3270 PC.
  2906.  
  2907.  
  2908.  ───────────────────────────────────────────────────────────────────────────
  2909.  Mouse Buttons
  2910.  
  2911.  Mouse functions 5 and 6 read the state of the mouse buttons and keep a
  2912.  count of the number of times the buttons are pressed and released.
  2913.  
  2914.  A button state is pressed if the button is down, and released if the
  2915.  button is up. When a mouse function returns the state of the buttons, it
  2916.  returns an integer value in which the first 2 bits are set or cleared. Bit
  2917.  0 represents the state of the left button, and bit 1 represents the state
  2918.  of the right button. If a bit is set (equal to 1), the button is down. If a
  2919.  bit is clear (equal to 0), the button is up.
  2920.  
  2921.  The mouse software increments a counter each time the corresponding
  2922.  button is pressed or released. The software sets a counter to 0 after a
  2923.  reset (mouse function 0) or after a counter's contents are read.
  2924.  
  2925.  
  2926.  ───────────────────────────────────────────────────────────────────────────
  2927.  Mouse Unit of Distance: The Mickey
  2928.  
  2929.  The motion of the mouse track ball is translated into values that express
  2930.  the direction and duration of the motion. The values are given in a unit of
  2931.  distance called a mickey, which is approximately 1/200 inch.
  2932.  
  2933.  When the user slides the mouse across a desk top, the mouse hardware
  2934.  passes to the mouse software a horizontal and vertical mickey count; that
  2935.  is, the number of mickeys the mouse ball has rolled in the horizontal and
  2936.  vertical directions. The software uses the mickey count to move the cursor
  2937.  a certain number of pixels on the screen.
  2938.  
  2939.  ────────────────────────────────────────
  2940.  Mouse sensitivity
  2941.  ────────────────────────────────────────
  2942.  
  2943.  The number of pixels that the cursor moves does not have to correspond
  2944.  one-to-one with the number of mickeys the track ball rolls. The mouse
  2945.  software defines a sensitivity for the mouse--the number of mickeys
  2946.  required to move the cursor 8 pixels on the screen. The sensitivity
  2947.  determines the rate at which the cursor moves on the screen.
  2948.  
  2949.  In your application program, you can define the mouse's sensitivity by
  2950.  passing a mickey count to mouse function 15. The mickey count can be any
  2951.  value from 1 to 32767. For example, if you pass a count of 8, the
  2952.  sensitivity is 8 mickeys per 8 pixels. That is, the cursor will move 1
  2953.  pixel for each mickey the ball rolls, or one character for every 8 mickeys
  2954.  the ball rolls.
  2955.  
  2956.  
  2957.  ───────────────────────────────────────────────────────────────────────────
  2958.  The Internal Cursor Flag
  2959.  
  2960.  The mouse software maintains an internal flag that determines when the
  2961.  cursor should be displayed on the screen. The value of this flag is always
  2962.  0 or less.
  2963.  
  2964.   ■  When the flag is 0, the cursor is displayed.
  2965.  
  2966.   ■  When the flag is any other value, the cursor is hidden.
  2967.  
  2968.  Application programs cannot access this flag directly. To change the
  2969.  flag's value, the program must call mouse functions 1 and 2. Function 1
  2970.  increments the flag; function 2 decrements it. Initially, the flag's value
  2971.  is -1, so a call to function 1 displays the cursor.
  2972.  
  2973.  Your program can call either function 1 or function 2 any number of
  2974.  times, but if it calls function 2, it must call function 1 later to restore
  2975.  the flag's previous value. For example, if the cursor is on the screen and
  2976.  your program calls function 2 five times, it must also call function 1 five
  2977.  times to return the cursor to the screen.
  2978.  
  2979.  If the cursor is displayed, any additional calls to function 1 have no
  2980.  effect on the internal cursor flag, so one call to function 2 will always
  2981.  hide the cursor. In addition, your program can call mouse function 0 or
  2982.  change screen modes to reset the flag to -1 and hide the cursor.
  2983.  
  2984.  
  2985.  
  2986.  ═══════════════════════════════════════════════════════════════════════════
  2987.  6   Mouse Function Descriptions
  2988.  
  2989.  
  2990.  
  2991.  This chapter describes the input, output, and operation of each mouse
  2992.  function call. The actual statements required to make the function calls
  2993.  depend on the programming language you're using. For specific instructions
  2994.  on making calls from the BASIC interpreter, assembly-language programs, and
  2995.  high-level-language programs, refer to Chapter 7, "Making Mouse Function
  2996.  Calls."
  2997.  
  2998.  Note  If you are designing an application program with mouse support that
  2999.  uses extended graphics modes D, E, F, and 10 on the IBM Enhanced Graphics
  3000.  Adapter (EGA), the program must interact with the adapter through the
  3001.  Microsoft EGA Register Interface. For instructions on using the EGA Register
  3002.  Interface, see Chapter 8, "Writing Mouse Programs for IBM EGA Modes."
  3003.  
  3004.  
  3005.  ────────────────────────────────────────────────────────────────────────────
  3006.  Mouse Functions
  3007.  
  3008.  The following table lists the mouse functions by function number:
  3009.  
  3010. ╓┌───────────┌───────────────────────────────────────────────────────────────╖
  3011.  Number      Function
  3012.  ────────────────────────────────────────────────────────────────────────────
  3013.   0         Mouse Reset and Status
  3014.   1         Show Cursor
  3015.   2         Hide Cursor
  3016.   3         Get Button Status and Mouse Position
  3017.   4         Set Mouse Cursor Position
  3018.   5         Get Button Press Information
  3019.   6         Get Button Release Information
  3020.   7         Set Minimum and Maximum Horizontal Cursor Position
  3021.   8         Set Minimum and Maximum Vertical Cursor Position
  3022.   9         Set Graphics Cursor Block
  3023.  10         Set Text Cursor
  3024.  11         Read Mouse Motion Counters
  3025.  12         Set Interrupt Subroutine Call Mask and Address
  3026.  Number      Function
  3027. 12         Set Interrupt Subroutine Call Mask and Address
  3028.  13         Light Pen Emulation Mode On
  3029.  14         Light Pen Emulation Mode Off
  3030.  15         Set Mickey/Pixel Ratio
  3031.  16         Conditional Off
  3032.  19         Set Double-Speed Threshold
  3033.  20         Swap Interrupt Subroutines
  3034.  21         Get Mouse Driver State Storage Requirements
  3035.  22         Save Mouse Driver State
  3036.  23         Restore Mouse Driver State
  3037.  24         Set Alternate Subroutine Call Mask and Address
  3038.  25         Get User Alternate Interrupt Address
  3039.  26         Set Mouse Sensitivity
  3040.  27         Get Mouse Sensitivity
  3041.  28         Set Mouse Interrupt Rate
  3042.  29         Set CRT Page Number
  3043.  30         Get CRT Page Number
  3044.  31         Disable Mouse Driver
  3045.  32         Enable Mouse Driver
  3046.  33         Software Reset
  3047.  Number      Function
  3048. 33         Software Reset
  3049.  34         Set Language for Messages
  3050.  35         Get Language Number
  3051.  36         Get Driver Version, Mouse Type, and IRQ#
  3052.  
  3053.  
  3054.  
  3055.  Each function description in this chapter specifies the following:
  3056.  
  3057.   ■  The parameters required to make the call (input) and the expected
  3058.      return values (output)
  3059.  
  3060.   ■  Any special considerations regarding the function
  3061.  
  3062.   ■  A BASIC interpreter program fragment that illustrates how to use the
  3063.      call. (For more information about calling mouse functions from the
  3064.      BASIC interpreter, see Chapter 7, "Making Mouse Function Calls.")
  3065.  
  3066.  In the descriptions of all functions, the parameter names M1%, M2%,
  3067.  M3%, and M4% are dummy variable names. When making a call, use the names of
  3068.  the variables that you want to pass.
  3069.  
  3070.  The dummy variable names include the percent sign (%) to emphasize
  3071.  that only integer variables can be used as parameters. Constants, single-
  3072.  precision variables, and double-precision variables are not allowed.
  3073.  
  3074.  If the function description does not specify an input for a parameter,
  3075.  you don't need to supply a value for that parameter before making the call.
  3076.  If the function description does not specify an output value for a
  3077.  parameter, the parameter's value is the same before and after the call.
  3078.  
  3079.  Caution  All function calls require four parameters. The mouse software
  3080.  does not check input values, so be sure that the values you assign to the
  3081.  parameters are correct for the given function and screen mode. If you pass
  3082.  the wrong number of parameters or assign incorrect values, you will get
  3083.  unpredictable results.
  3084.  
  3085.  
  3086.  ───────────────────────────────────────────────────────────────────────────
  3087.  Function 0: Mouse Reset and Status
  3088.  
  3089.  Input                 Output
  3090.  ───────────────────────────────────────────────────────────────────────────
  3091.  M1%=0                 M1%=mouse status
  3092.                        M2%=number of buttons
  3093.                            (2 if M1%=-1, otherwise 0)
  3094.  
  3095.  Function 0 returns the current status of the mouse hardware and software.
  3096.  The mouse status is 0 if the mouse hardware and software are not installed
  3097.  or -1 if the hardware and software are installed.
  3098.  
  3099.  This function also resets the mouse driver to the following default
  3100.  values:
  3101.  
  3102. ╓┌────────────────────────────────┌──────────────────────────────────────────╖
  3103.  Parameter                        Value
  3104.  ───────────────────────────────────────────────────────────────────────────
  3105.  cursor position                  screen center
  3106.  
  3107.  internal cursor flag             -1 (cursor hidden)
  3108.  
  3109.  graphics cursor                  arrow
  3110.  Parameter                        Value
  3111. graphics cursor                  arrow
  3112.  
  3113.  text cursor                      reverse video
  3114.  
  3115.  interrupt call mask              all 0 (no interrupt subroutine specified)
  3116.  
  3117.  light pen emulation mode         enabled
  3118.  
  3119.  horizontal mickey/pixel ratio    8 to 8
  3120.  
  3121.  vertical mickey/pixel ratio      16 to 8
  3122.  
  3123.  horizontal min/max               0/current display-mode virtual screen
  3124.  cursor position                  x-value minus 1
  3125.  
  3126.  vertical min/max                 0/current display-mode virtual screen
  3127.  cursor position                  y-value minus 1
  3128.  
  3129.  CRT page number                  0
  3130.  
  3131.  
  3132.  
  3133.  Example
  3134.  
  3135.  This program fragment verifies that the mouse is installed, and returns an
  3136.  error message if it is not.
  3137.  
  3138.   100  '
  3139.   200  '  Is mouse present? If not, error.
  3140.   300  '
  3141.   400  DEF SEG=0
  3142.   500  MSEG=256*PEEK(51*4+3)+PEEK(51*4+2)
  3143.   600  MOUSE=256*PEEK(51*4+1)+PEEK(51*4)+2
  3144.   700  IF MSEG OR (MOUSE-2) THEN 60
  3145.   800  PRINT "Mouse not found":END
  3146.   900  DEF SEG=MSEG
  3147.  1000  IF PEEK (MOUSE-2)=207 then 700
  3148.  1100  M1%=0
  3149.  1200  CALL MOUSE(M1%, M2%, M3%, M4%)
  3150.  1300  IF NOT (M1%)THEN 700
  3151.  
  3152.  
  3153.  ───────────────────────────────────────────────────────────────────────────
  3154.  Function 1: Show Cursor
  3155.  
  3156.  Input                 Output
  3157.  ───────────────────────────────────────────────────────────────────────────
  3158.  M1%=1                    -
  3159.  
  3160.  Function 1 increments the internal cursor flag and, if the  flag is 0,
  3161.  displays the cursor on the screen. The cursor tracks the motion of the
  3162.  mouse, changing position as the mouse changes position.
  3163.  
  3164.  The current value of the internal cursor flag depends on the number of
  3165.  calls that have been made to functions 1 and 2. (For more information, see
  3166.  "The Internal Cursor Flag" in Chapter 5, "The Mouse Interface.") The
  3167.  default flag value is -1; therefore, after a reset (function 0), the
  3168.  program must call function 1 to redisplay the cursor.
  3169.  
  3170.  If the internal cursor flag is already 0, this function does nothing.
  3171.  
  3172.  
  3173.  Example
  3174.  
  3175.  100  '
  3176.  200  '  Show the cursor
  3177.  300  '
  3178.  400  M1%=1
  3179.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  3180.  
  3181.  
  3182.  ───────────────────────────────────────────────────────────────────────────
  3183.  Function 2: Hide Cursor
  3184.  
  3185.  Input                 Output
  3186.  ───────────────────────────────────────────────────────────────────────────
  3187.  M1%=2                    -
  3188.  
  3189.  Function 2 removes the cursor from the screen and decrements the internal
  3190.  cursor flag. When the cursor is hidden, it continues to track the motion of
  3191.  the mouse, changing position as the mouse changes position.
  3192.  
  3193.  Use this function before you change any area of the screen that
  3194.  contains the cursor. This will ensure that the cursor won't affect the data
  3195.  written to the screen.
  3196.  
  3197.  Note  If your program changes the screen mode, function 2 is called
  3198.  automatically so that the cursor will be drawn correctly the next time it
  3199.  is displayed.
  3200.  
  3201.  Remember that each time your program calls function 2, it must call
  3202.  function 1 later to restore the internal cursor flag to its previous value.
  3203.  (For more information, see "The Internal Cursor Flag" in Chapter 5, "The
  3204.  Mouse Interface.")
  3205.  
  3206.  Note  At the end of your program, call function 2 to hide the mouse cursor.
  3207.  If the internal cursor flag is 0 when the program ends, the mouse cursor
  3208.  will remain on the screen.
  3209.  
  3210.  
  3211.  Example
  3212.  
  3213.  100  '
  3214.  200  '  Hide the cursor
  3215.  300  '
  3216.  400  M1%=2
  3217.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  3218.  
  3219.  
  3220.  ───────────────────────────────────────────────────────────────────────────
  3221.  Function 3: Get Button Status and Mouse Position
  3222.  
  3223.  Input                 Output
  3224.  ───────────────────────────────────────────────────────────────────────────
  3225.  M1%=3                 M2%=button status
  3226.                        M3%=cursor position (horizontal)
  3227.                        M4%=cursor position (vertical)
  3228.  
  3229.  Function 3 returns the state of the left and right mouse buttons and the
  3230.  horizontal and vertical coordinates of the cursor.
  3231.  
  3232.  The button status is a single integer value. Bit 0 represents the left
  3233.  button; bit 1 represents the right button. These bits are 1 if the
  3234.  corresponding button is down, and 0 if it is up.
  3235.  
  3236.  The cursor coordinates are always within the range of minimum and
  3237.  maximum values for the virtual screen. (For more information, see "The
  3238.  Virtual Screen" in Chapter 5, "The Mouse Interface.")
  3239.  
  3240.  
  3241.  Example
  3242.  
  3243.  100  '
  3244.  200  '  Check button status
  3245.  300  '
  3246.  400  M1%=3
  3247.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  3248.  600  IF M2% AND 1 THEN PRINT "Left button down."
  3249.  700  IF M2% AND 2 THEN PRINT "Right button down."
  3250.  
  3251.  
  3252.  ───────────────────────────────────────────────────────────────────────────
  3253.  Function 4: Set Mouse Cursor Position
  3254.  
  3255.  Input                                             Output
  3256.  ───────────────────────────────────────────────────────────────────────────
  3257.  M1%=4                                                -
  3258.  M3%=new cursor coordinate (horizontal)
  3259.  M4%=new cursor coordinate (vertical)
  3260.  
  3261.  Function 4 sets the cursor to the specified horizontal and vertical screen
  3262.  coordinates. The parameter values must be within the horizontal and
  3263.  vertical coordinate ranges for the virtual screen.
  3264.  
  3265.  If the screen is not in a mode with a cell size of 1 x 1, the
  3266.  parameter values are rounded to the nearest horizontal or vertical
  3267.  coordinate values permitted for the current screen mode. (For more
  3268.  information, see "The Virtual Screen" in Chapter 5, "The Mouse
  3269.  Interface.")
  3270.  
  3271.  
  3272.  Example
  3273.  
  3274.  Assume that HMAX and VMAX are the maximum horizontal and vertical
  3275.  coordinate values for the virtual screen. This call to function 4 sets the
  3276.  cursor to the center of the screen:
  3277.  
  3278.  100  '
  3279.  200  '  Put cursor in center of screen
  3280.  300  '
  3281.  400  M1%=4
  3282.  500  M3%=INT(HMAX/2)
  3283.  600  M4%=INT(VMAX/2)
  3284.  700  CALL MOUSE(M1%, M2%, M3%, M4%)
  3285.  
  3286.  
  3287.  ───────────────────────────────────────────────────────────────────────────
  3288.  Function 5: Get Button Press Information
  3289.  
  3290.  Input                 Output
  3291.  ───────────────────────────────────────────────────────────────────────────
  3292.  M1%=5                 M1%=button status
  3293.  M2%=button            M2%=number of button presses
  3294.                        M3%=cursor (horizontal) at last press
  3295.                        M4%=cursor (vertical) at last press
  3296.  
  3297.  Function 5 returns the following:
  3298.  
  3299.   ■  The current status of the specified button
  3300.  
  3301.   ■  The number of times the specified button was pressed since the last
  3302.      call to this function
  3303.  
  3304.   ■  The horizontal and vertical coordinates of the cursor the last time the
  3305.      specified button was pressed
  3306.  
  3307.  The parameter M2% specifies which button is checked. If this parameter
  3308.  is 0, the left button is checked. If this parameter is 1, the right button
  3309.  is checked.
  3310.  
  3311.  The button status is a single integer value. Bit 0 represents the left
  3312.  button and bit 1 represents the right button. These bits are 1 if the
  3313.  corresponding button is down, and 0 if it is up.
  3314.  
  3315.  The number of button presses is always in the range 0 to 32767.
  3316.  Overflow is not detected. The count is set to 0 after the call.
  3317.  
  3318.  The values for the horizontal and vertical coordinates are in the
  3319.  ranges defined by the virtual screen. These values represent the cursor
  3320.  position when the button was last pressed, not the cursor's current
  3321.  position.
  3322.  
  3323.  
  3324.  Example
  3325.  
  3326.  100  '
  3327.  200  '  Get button press information
  3328.  300  '
  3329.  400  M1%=5
  3330.  500  M2%=0   '  left button
  3331.  600  CALL MOUSE(M1%, M2%, M3%, M4%)
  3332.  700  IF (M1% AND 1) THEN PRINT "Left button down."
  3333.  
  3334.  
  3335.  ───────────────────────────────────────────────────────────────────────────
  3336.  Function 6: Get Button Release Information
  3337.  
  3338.  Input                 Output
  3339.  ───────────────────────────────────────────────────────────────────────────
  3340.  M1%=6                 M1%=button status
  3341.  M2%=button            M2%=number of button releases
  3342.                        M3%=cursor (horizontal) at last release
  3343.                        M4%=cursor (vertical) at last release
  3344.  
  3345.  Function 6 returns the following:
  3346.  
  3347.   ■  The current status of the specified button
  3348.  
  3349.   ■  The number of times the specified button was released since the last
  3350.      call to this function
  3351.  
  3352.   ■  The horizontal and vertical coordinates of the cursor the last time the
  3353.      specified button was released
  3354.  
  3355.  The parameter M2% specifies which button is checked. If this parameter
  3356.  is 0, the left button is checked. If this parameter is 1, the right button
  3357.  is checked.
  3358.  
  3359.  The button status is a single integer value. Bit 0 represents the left
  3360.  button and bit 1 represents the right button. These bits are 1 if the
  3361.  corresponding button is down, and 0 if it is up.
  3362.  
  3363.  The number of button releases is always in the range 0 to 32767.
  3364.  Overflow is not detected. The count is set to 0 after the call.
  3365.  
  3366.  The values for the horizontal and vertical coordinates are in the
  3367.  ranges defined by the virtual screen. These values represent the cursor
  3368.  position when the button was last released, not the cursor's current
  3369.  position.
  3370.  
  3371.  
  3372.  Example
  3373.  
  3374.  100  '
  3375.  200  '  Get button release information
  3376.  300  '
  3377.  400  M1%=6
  3378.  500  M2%=1     '   right button
  3379.  600  CALL MOUSE(M1%, M2%, M3%, M4%)
  3380.  700  IF (M1% AND 2) THEN PRINT "Right button down."
  3381.  
  3382.  
  3383.  ───────────────────────────────────────────────────────────────────────────
  3384.  Function 7: Set Minimum and Maximum Horizontal Cursor Position
  3385.  
  3386.  Input                    Output
  3387.  ───────────────────────────────────────────────────────────────────────────
  3388.  M1%=7                       -
  3389.  M3%=minimum position
  3390.  M4%=maximum position
  3391.  
  3392.  Function 7 sets the minimum and maximum horizontal cursor coordinates on
  3393.  the screen. All cursor movement after the call to function 7 is restricted
  3394.  to the specified area. The minimum and maximum values are defined by the
  3395.  virtual screen. (For more information, see "The Virtual Screen" in Chapter
  3396.  5, "The Mouse Interface.")
  3397.  
  3398.  If the minimum value is greater than the maximum value, the two values
  3399.  are swapped.
  3400.  
  3401.  
  3402.  Example
  3403.  
  3404.  100  '
  3405.  200  ' Limit cursor to horizontal positions below 150
  3406.  300  '
  3407.  400  M1%=7
  3408.  500  M3%=0
  3409.  600  M4%=150
  3410.  700  CALL MOUSE(M1%, M2%, M3%, M4%)
  3411.  
  3412.  
  3413.  ───────────────────────────────────────────────────────────────────────────
  3414.  Function 8: Set Minimum and Maximum Vertical Cursor Position
  3415.  
  3416.  
  3417.  Input                    Output
  3418.  ───────────────────────────────────────────────────────────────────────────
  3419.  M1%=8                       -
  3420.  M3%=minimum position
  3421.  M4%=maximum position
  3422.  
  3423.  Function 8 sets the minimum and maximum vertical cursor coordinates on the
  3424.  screen. After function 8 is called, cursor movement is restricted to the
  3425.  specified area. The minimum and maximum values are defined by the virtual
  3426.  screen. (For more information, see "The Virtual Screen" in Chapter 5, "The
  3427.  Mouse Interface.")
  3428.  
  3429.  If the minimum value is greater than the maximum value, the two values
  3430.  are swapped.
  3431.  
  3432.  
  3433.  Example
  3434.  
  3435.  100  '
  3436.  200  '  Limit cursor to vertical positions between
  3437.  300  '  100 and 150
  3438.  400  '
  3439.  500  M1%=8
  3440.  600  M3%=100
  3441.  700  M4%=150
  3442.  800  CALL MOUSE(M1%, M2%, M3%, M4%)
  3443.  
  3444.  
  3445.  ───────────────────────────────────────────────────────────────────────────
  3446.  Function 9: Set Graphics Cursor Block
  3447.  
  3448.  Input                                      Output
  3449.  ───────────────────────────────────────────────────────────────────────────
  3450.  M1%=9                                         -
  3451.  M2%=cursor hot spot (horizontal)
  3452.  M3%=cursor hot spot (vertical)
  3453.  M4%=pointer to screen and cursor masks
  3454.  
  3455.  Function 9 defines the shape, color, and center of the graphics cursor (the
  3456.  cursor used when the computer is in graphics mode). Your program must call
  3457.  function 1 to display the graphics cursor.
  3458.  
  3459.  Function 9 uses the values found in the screen mask and cursor mask to
  3460.  build the cursor shape and color.
  3461.  
  3462.  To pass the screen mask and cursor mask, assign their values to an
  3463.  integer array (packed 2 bytes per integer) and use the first element of the
  3464.  array as the parameter M4% in the call (see the example on the next page).
  3465.  
  3466.  The cursor hot spot values must define one pixel within the cursor.
  3467.  The values must be within the range -16 to 16.
  3468.  
  3469.  For more information about the screen mask, cursor mask, and the
  3470.  graphics cursor hot spot, see "Graphics and Text Cursors" in Chapter 5,
  3471.  "The Mouse Interface."
  3472.  
  3473.  Note  For more information about calling function 9 from programs in
  3474.  assembly language, see the section "Making Calls from Assembly-Language
  3475.  Programs" in Chapter 7, "Making Mouse Function Calls."
  3476.  
  3477.  
  3478.  Example
  3479.  
  3480.  To define a cursor in high-resolution graphics mode, first assign the
  3481.  values to the cursor array, then make the call:
  3482.  
  3483.   100  '
  3484.   200  ' Define the screen mask
  3485.   300  '
  3486.   400  CURSOR(0,0)=&HFFFF      '1111111111111111
  3487.   500  CURSOR(1,0)=&HFFFF      '1111111111111111
  3488.   600  CURSOR(2,0)=&HFFFF      '1111111111111111
  3489.   700  CURSOR(3,0)=&HFFFF      '1111111111111111
  3490.   800  CURSOR(4,0)=&HFFFF      '1111111111111111
  3491.   900  CURSOR(5,0)=&HFFFF      '1111111111111111
  3492.  1000  CURSOR(6,0)=&HFFFF      '1111111111111111
  3493.  1100  CURSOR(7,0)=&HFFFF      '1111111111111111
  3494.  1200  CURSOR(8,0)=&HFFFF      '1111111111111111
  3495.  1300  CURSOR(9,0)=&HFFFF      '1111111111111111
  3496.  1400  CURSOR(10,0)=&HFFFF     '1111111111111111
  3497.  1500  CURSOR(11,0)=&HFFFF     '1111111111111111
  3498.  1600  CURSOR(12,0)=&HFFFF     '1111111111111111
  3499.  1700  CURSOR(13,0)=&HFFFF     '1111111111111111
  3500.  1800  CURSOR(14,0)=&HFFFF     '1111111111111111
  3501.  1900  CURSOR(15,0)=&HFFFF     '1111111111111111
  3502.  2000  '
  3503.  2100  '  Define the cursor mask
  3504.  2200  '
  3505.  2300  CURSOR(0,1)=&H8000       '1000000000000000
  3506.  2400  CURSOR(1,1)=&HE000       '1110000000000000
  3507.  2500  CURSOR(2,1)=&HF800       '1111100000000000
  3508.  2600  CURSOR(3,1)=&HFE00       '1111111000000000
  3509.  2700  CURSOR(4,1)=&HD800       '1101100000000000
  3510.  2800  CURSOR(5,1)=&H0C00       '0000110000000000
  3511.  2900  CURSOR(6,1)=&H0600       '0000011000000000
  3512.  3000  CURSOR(7,1)=&H0300       '0000001100000000
  3513.  3100  CURSOR(8,1)=&H0000       '0000000000000000
  3514.  3200  CURSOR(9,1)=&H0000       '0000000000000000
  3515.  3300  CURSOR(10,1)=&H0000      '0000000000000000
  3516.  3400  CURSOR(11,1)=&H0000      '0000000000000000
  3517.  3500  CURSOR(12,1)=&H0000      '0000000000000000
  3518.  3600  CURSOR(13,1)=&H0000      '0000000000000000
  3519.  3700  CURSOR(14,1)=&H0000      '0000000000000000
  3520.  3800  CURSOR(15,1)=&H0000      '0000000000000000
  3521.  3900  '
  3522.  4000  '  Set the mouse cursor shape, color, and
  3523.  4050  '  hot spot
  3524.  4100  '
  3525.  4200  M1%=9
  3526.  4300  M2%=0 '  horizontal hot spot
  3527.  4400  M3%=0 '  vertical hot spot
  3528.  4500  CALL MOUSE(M1%, M2%, M3%, CURSOR(0,0))
  3529.  
  3530.  
  3531.  ───────────────────────────────────────────────────────────────────────────
  3532.  Function 10: Set Text Cursor
  3533.  
  3534.  Input                                       Output
  3535.  ───────────────────────────────────────────────────────────────────────────
  3536.  M1%=10                                         -
  3537.  M2%=cursor select
  3538.  M3%=screen mask value/scan line start
  3539.  M4%=cursor mask value/scan line stop
  3540.  
  3541.  Function 10 selects the software or hardware text cursor. Your program must
  3542.  call function 1 to display the text cursor.
  3543.  
  3544.  The value of the parameter M2% specifies which cursor is selected. If
  3545.  M2% is 0, the software text cursor is selected. If M2% is 1, the hardware
  3546.  text cursor is selected.
  3547.  
  3548.  If the software text cursor is selected, parameters M3% and M4% must
  3549.  specify the screen mask and cursor mask. These masks define the attributes
  3550.  of a character when the cursor is over it. The mask values depend on the
  3551.  display adapter in the computer. (For more information, see "Software Text
  3552.  Cursor" in Chapter 5, "The Mouse Interface.")
  3553.  
  3554.  If the hardware text cursor is selected, parameters M3% and M4% must
  3555.  specify the line numbers of the first and last scan lines in the cursor.
  3556.  These line numbers depend on the display adapter in the computer. (For more
  3557.  information, see "Hardware Text Cursor" in Chapter 5, "The Mouse
  3558.  Interface.")
  3559.  
  3560.  100  '
  3561.  200  '  Create text cursor that inverts foreground
  3562.  300  '  and background colors
  3563.  400  '
  3564.  500  M1%=10
  3565.  600  M2%=0          ' select software text cursor
  3566.  700  M3%=&HFFFF     ' screen mask
  3567.  800  M4%=&H7700     ' cursor mask
  3568.  900  CALL MOUSE(M1%, M2%, M3%, M4%)
  3569.  
  3570.  
  3571.  ───────────────────────────────────────────────────────────────────────────
  3572.  Function 11: Read Mouse Motion Counters
  3573.  
  3574.  Input                 Output
  3575.  ───────────────────────────────────────────────────────────────────────────
  3576.  M1%=11                M3%=count (horizontal)
  3577.                        M4%=count (vertical)
  3578.  
  3579.  Function 11 returns the horizontal and vertical mickey count since the last
  3580.  call to this function. The mickey count is the distance that the mouse has
  3581.  moved, in 1/200 inch increments. (For more information, see "Mouse Unit of
  3582.  Distance: The Mickey" in Chapter 5, "The Mouse Interface.")
  3583.  
  3584.  The mickey count is always within the range -32768 to 32767.
  3585.  
  3586.   ■  A positive horizontal count indicates motion to the right. A negative
  3587.      horizontal count indicates motion to the left.
  3588.  
  3589.   ■  A positive vertical count indicates motion to the bottom of the screen.
  3590.      A negative vertical count indicates motion to the top of the screen.
  3591.  
  3592.  Overflow is ignored. The mickey count is set to 0 after the call is
  3593.  completed.
  3594.  
  3595.  
  3596.  Example
  3597.  
  3598.  100  '
  3599.  200  '  Get the mickey count
  3600.  300  '
  3601.  400  M1%=11
  3602.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  3603.  
  3604.  
  3605.  ───────────────────────────────────────────────────────────────────────────
  3606.  Function 12: Set Interrupt Subroutine Call Mask and Address
  3607.  
  3608.  Input                                     Output
  3609.  ───────────────────────────────────────────────────────────────────────────
  3610.  M1%=12                                       -
  3611.  M3%=call mask
  3612.  M4%=subroutine address
  3613.  
  3614.  Function 12 sets the call mask and subroutine address for mouse hardware
  3615.  interrupts.
  3616.  
  3617.  The mouse hardware interrupts automatically stop execution of your
  3618.  program and call the specified subroutine whenever one or more of the
  3619.  conditions defined by the call mask occur. When the subroutine finishes,
  3620.  your program continues execution at the point of interruption.
  3621.  
  3622.  The call mask is a single integer value that defines which conditions
  3623.  cause an interrupt. Each bit in the call mask corresponds to a specific
  3624.  condition, as shown in the following table:
  3625.  
  3626.  Mask bit              Condition
  3627.  ───────────────────────────────────────────────────────────────────────────
  3628.  0                     Cursor position changes
  3629.  1                     Left button pressed
  3630.  2                     Left button released
  3631.  3                     Right button pressed
  3632.  4                     Right button released
  3633.  5-15                  Not used
  3634.  
  3635.  To enable the subroutine for a given condition, set the corresponding call
  3636.  mask bit to 1 and pass the mask as parameter M3%.
  3637.  
  3638.  To disable the subroutine for a given condition, set the corresponding
  3639.  bit to 0 and pass the mask as parameter M3%.
  3640.  
  3641.  A call to function 0 automatically sets the call mask to 0.
  3642.  
  3643.  Note  Before your program ends, be sure to set the interrupt call mask to
  3644.  0. If the call mask and subroutine remain defined when the program is no
  3645.  longer running, the subroutine will still be executed if one of the
  3646.  conditions defined by the call mask occurs.
  3647.  
  3648.  When the mouse software makes a call to the subroutine, it loads the
  3649.  following information into the CPU registers:
  3650.  
  3651.  Register              Information
  3652.  ───────────────────────────────────────────────────────────────────────────
  3653.  AX                    Condition mask (similar to the call mask except a bit
  3654.                        is set only if the condition has occurred)
  3655.  
  3656.  BX                    Button state
  3657.  
  3658.  CX                    Cursor coordinate (horizontal)
  3659.  
  3660.  DX                    Cursor coordinate (vertical)
  3661.  
  3662.  DI                    Horizontal mouse counts (mickeys)
  3663.  
  3664.  SI                    Vertical mouse counts (mickeys)
  3665.  
  3666.  Note The DS register contains the mouse driver data segments. The
  3667.  subroutine is responsible for setting DS as needed.
  3668.  
  3669.  ────────────────────────────────────────
  3670.  Calling from interpreted BASIC programs
  3671.  ────────────────────────────────────────
  3672.  
  3673.  To use function 12 with the BASIC interpreter:
  3674.  
  3675.   1  Load an assembly-language subroutine into the BASIC interpreter's data
  3676.      segment. All exits from the subroutine must use a far return
  3677.      instruction.
  3678.  
  3679.   2  Assign the entry address of the subroutine to an integer variable.
  3680.  
  3681.   3  Pass this variable to function 12 as the fourth parameter.
  3682.  
  3683.  ────────────────────────────────────────
  3684.  Calling from high-level language programs
  3685.  ────────────────────────────────────────
  3686.  
  3687.  To use function 12 in a high-level-language program:
  3688.  
  3689.   1  Link an assembly-language subroutine with the program's object file(s).
  3690.      All exits from the subroutine must use a far return instruction.
  3691.  
  3692.   2  Assign the entry address of the subroutine to an integer variable.
  3693.  
  3694.      In QuickBASIC programs and C small- and compact-model programs,
  3695.      the address is an offset only.
  3696.  
  3697.      In FORTRAN programs, Pascal programs, and C medium-, large-, and
  3698.      huge-model programs, the address consists of both a segment and an
  3699.      offset.
  3700.  
  3701.   3  Pass this variable to function 12 as the fourth parameter.
  3702.  
  3703.  ────────────────────────────────────────
  3704.  Calling from assembly language programs
  3705.  ────────────────────────────────────────
  3706.  
  3707.  For information on using function 12 in assembly-language programs, see
  3708.  "Making Calls from Assembly-Language Programs" in Chapter 7, "Making Mouse
  3709.  Function Calls."
  3710.  
  3711.  
  3712.  Example
  3713.  
  3714.  The following example calls function 12 from the BASIC interpreter. Assume
  3715.  that an assembly-language subroutine has been loaded into the BASIC
  3716.  interpreter's data segment and that the integer variable SKETCH% has been
  3717.  assigned the subroutine's entry address. The following BASIC statements set
  3718.  up calls to SKETCH% any time the user presses the left mouse button.
  3719.  
  3720.  100  '
  3721.  200  '  Call subroutine SKETCH on left button press
  3722.  300  '
  3723.  400  M1%=12
  3724.  500  M3%=&H01
  3725.  600  M4%=SKETCH%
  3726.  700  CALL MOUSE(M1%, M2%, M3%, M4%)
  3727.  
  3728.  
  3729.  ───────────────────────────────────────────────────────────────────────────
  3730.  Function 13: Light Pen Emulation Mode On
  3731.  
  3732.  Input                   Output
  3733.  ───────────────────────────────────────────────────────────────────────────
  3734.  M1%=13                     -
  3735.  
  3736.  Function 13 allows the mouse to emulate a light pen. When the mouse
  3737.  emulates a light pen, calls to the PEN function (described in the IBM BASIC
  3738.  manual) return the cursor position at the last "pen down."
  3739.  
  3740.  The mouse buttons control the "pen down" and "pen off the screen"
  3741.  states. The pen is down when both mouse buttons are down. The pen is off
  3742.  the screen when both mouse buttons are up.
  3743.  
  3744.  The mouse software enables light pen emulation mode after each reset
  3745.  (function 0).
  3746.  
  3747.  
  3748.  Example
  3749.  
  3750.  100  '
  3751.  200  '  Enable light pen
  3752.  300  '
  3753.  400  M1%=13
  3754.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  3755.  
  3756.  
  3757.  ───────────────────────────────────────────────────────────────────────────
  3758.  Function 14: Light Pen Emulation Mode Off
  3759.  
  3760.  Input                    Output
  3761.  ───────────────────────────────────────────────────────────────────────────
  3762.  M1%=14                      -
  3763.  
  3764.  Function 14 disables light pen emulation. When light pen emulation is
  3765.  disabled, calls to the PEN function (described in the IBM BASIC manual)
  3766.  return information about the light pen only.
  3767.  
  3768.  If a program uses both a light pen and the mouse, the program must
  3769.  disable the mouse light pen emulation mode to work correctly.
  3770.  
  3771.  
  3772.  Example
  3773.  
  3774.  100  '
  3775.  200  '  Disable light pen
  3776.  300  '
  3777.  400  M1%=14
  3778.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  3779.  
  3780.  
  3781.  ───────────────────────────────────────────────────────────────────────────
  3782.  Function 15: Set Mickey/Pixel Ratio
  3783.  
  3784.  Input                                     Output
  3785.  ───────────────────────────────────────────────────────────────────────────
  3786.  M1%=15                                       -
  3787.  M3%=mickey/pixel ratio (horizontal)
  3788.  M4%=mickey/pixel ratio (vertical)
  3789.  
  3790.  Function 15 sets the mickey-to-pixel ratio for horizontal and vertical
  3791.  mouse motion. The ratios specify the number of mickeys per 8 pixels. The
  3792.  values must be in the range 1 to 32767. (For more information, see "Mouse
  3793.  Unit of Distance: The Mickey" in Chapter 5, "The Mouse Interface.")
  3794.  
  3795.  The default value for the horizontal ratio is 8 mickeys to 8 pixels.
  3796.  With this ratio, the mouse must travel 6.4 inches to move the cursor
  3797.  horizontally across the screen.
  3798.  
  3799.  The default value for the vertical ratio is 16 mickeys to 8 pixels.
  3800.  With this ratio, the mouse must travel 4 inches to move the cursor
  3801.  vertically across the screen.
  3802.  
  3803.  
  3804.  Example
  3805.  
  3806.  100  '
  3807.  200  '  Set mickey/pixel ratio at 16 to 8 and 32 to 8
  3808.  300  '
  3809.  400  M1%=15
  3810.  500  M3%=16  ' horizontal ratio
  3811.  600  M4%=32  ' vertical ratio
  3812.  700  CALL MOUSE(M1%, M2%, M3%, M4%)
  3813.  
  3814.  
  3815.  ───────────────────────────────────────────────────────────────────────────
  3816.  Function 16: Conditional Off
  3817.  
  3818.  Input                                      Output
  3819.  ───────────────────────────────────────────────────────────────────────────
  3820.  M1%=16                                        -
  3821.  M4%=address of the region array
  3822.  
  3823.  Function 16 defines a region on the screen for updating. If the mouse
  3824.  pointer is in the defined region or moves into it, function 16 hides the
  3825.  mouse cursor while the region is being updated. After your program calls
  3826.  function 16, the program must call function 1 to show the cursor again.
  3827.  
  3828.  The region is defined by placing the screen coordinate values in a
  3829.  four-element array. The elements of the array are defined as follows:
  3830.  
  3831.  Array Offset     Value
  3832.  ───────────────────────────────────────────────────────────────────────────
  3833.  1                Left x screen coordinate
  3834.  2                Upper y screen coordinate
  3835.  3                Right x screen coordinate
  3836.  4                Lower y screen coordinate
  3837.  
  3838.  Function 16 is similar to function 2, but is intended for advanced
  3839.  applications that require quicker screen updates.
  3840.  
  3841.  Note  For information on calling function 16 from assembly-language
  3842.  programs, see "Making Calls from Assembly-Language Programs" in Chapter 7,
  3843.  "Making Mouse Function Calls."
  3844.  
  3845.  
  3846.  Example
  3847.  
  3848.   100  '
  3849.   200  '  Define screen region for conditional off
  3850.   300  '
  3851.   400  OFF%(1)=10  ' left x value of region
  3852.   500  OFF%(2)=30  ' upper y value of region
  3853.   600  OFF%(3)=40  ' right x value of region
  3854.   700  OFF%(4)=80  ' lower y value of region
  3855.   800  M1%=16
  3856.   900  CALL MOUSE(M1%, M2%, M3%, OFF%(0))
  3857.  1000 '
  3858.  1100 '  Screen update routine
  3859.   .
  3860.   .
  3861.   .
  3862.  2200 '
  3863.  2300 M1%=1
  3864.  2400 CALL MOUSE(M1%, M2%, M3%, M4%)
  3865.  
  3866.  
  3867.  ───────────────────────────────────────────────────────────────────────────
  3868.  Function 19: Set Double-Speed Threshold
  3869.  
  3870.  Input                                        Output
  3871.  ───────────────────────────────────────────────────────────────────────────
  3872.  M1%=19                                          -
  3873.  M4%=threshold speed in mickeys/second
  3874.  
  3875.  Function 19 sets the threshold speed for doubling the cursor's motion on
  3876.  the screen. Using function 19 makes it easier to point at images widely
  3877.  separated on the screen.
  3878.  
  3879.  Parameter M4% defines the mouse's threshold speed. If no value is
  3880.  given, or if the mouse is reset by a call to function 0, a default value of
  3881.  64 mickeys per second is assigned. If the mouse moves faster than the value
  3882.  of M4%, cursor motion doubles in speed. The threshold speed remains set
  3883.  until function 19 is called again or until the mouse is reset by function
  3884.  0.
  3885.  
  3886.  Once your program turns on the speed-doubling feature, this feature is
  3887.  always on. However, the program can effectively turn off this feature by
  3888.  setting M4% to a speed faster than the mouse can physically move (for
  3889.  example, 10,000) and then calling function 19.
  3890.  
  3891.  
  3892.  Example
  3893.  
  3894.   100  '
  3895.   110  '   Set threshold to 32 mickeys/sec
  3896.   120  '
  3897.   130  M1%=19
  3898.   140  M4%=32  '  mickeys/second
  3899.   150  CALL MOUSE (M1%, M2%, M3%, M4%)
  3900.    .
  3901.    .
  3902.    .
  3903.  1000  '   Turn off speed doubling
  3904.  1010  M1%=19
  3905.  1020  M4%=10000   '  mickeys/second
  3906.  1030  CALL MOUSE(M1%, M2%, M3%, M4%)
  3907.  
  3908.  
  3909.  ───────────────────────────────────────────────────────────────────────────
  3910.  Function 20: Swap Interrupt Subroutines
  3911.  
  3912.  Input                            Output
  3913.  ───────────────────────────────────────────────────────────────────────────
  3914.  M1%=20                           M2%=segment of old subroutine
  3915.  M2%=segment of new subroutine    M3%=old call mask
  3916.  M3%=new call mask                M4%=offset of old subroutine
  3917.  M4%=offset of new subroutine
  3918.  
  3919.  Function 20 sets new values for the call mask and subroutine address for
  3920.  mouse hardware interrupts and returns the values that were previously
  3921.  specified.
  3922.  
  3923.  The mouse hardware interrupts automatically stop execution of your
  3924.  program and call the specified subroutine whenever one or more of the
  3925.  conditions defined by the call mask occur. When the subroutine finishes,
  3926.  your program continues execution at the point of interruption.
  3927.  
  3928.  The call mask is an integer value that defines which conditions cause
  3929.  an interrupt. Each bit in the call mask corresponds to a specific
  3930.  condition, as shown in the following table:
  3931.  
  3932.  Mask bit              Condition
  3933.  ───────────────────────────────────────────────────────────────────────────
  3934.  0                     Cursor position changes
  3935.  1                     Left button pressed
  3936.  2                     Left button released
  3937.  3                     Right button pressed
  3938.  4                     Right button released
  3939.  5-15                  Not used
  3940.  
  3941.  To enable the subroutine for a given condition, set the corresponding call
  3942.  mask bit to 1 and pass the mask as parameter M3%.
  3943.  
  3944.  To disable the subroutine for a given condition, set the corresponding
  3945.  bit to 0 and pass the mask as parameter M3%. Function 0 automatically
  3946.  disables all interrupts.
  3947.  
  3948.  Note  Before your program ends, be sure to restore the initial values of
  3949.  the call mask and subroutine address.
  3950.  
  3951.  When the mouse software makes a call to the subroutine, it loads the
  3952.  following information into the CPU registers:
  3953.  
  3954.  Register              Information
  3955.  ───────────────────────────────────────────────────────────────────────────
  3956.  AX                    Condition mask (similar to the call mask except a bit
  3957.                        is set only if the condition has occurred)
  3958.  
  3959.  BX                    Button state
  3960.  
  3961.  CX                    Cursor coordinate (horizontal)
  3962.  
  3963.  DX                    Cursor coordinate (vertical)
  3964.  
  3965.  DI                    Horizontal mouse counts (mickeys)
  3966.  
  3967.  SI                    Vertical mouse counts (mickeys)
  3968.  
  3969.  Note  The DS register contains the mouse driver data segments. The
  3970.  subroutine is responsible for setting DS as needed.
  3971.  
  3972.  ────────────────────────────────────────
  3973.  Calling from interpreted BASIC programs
  3974.  ────────────────────────────────────────
  3975.  
  3976.  To use function 20 with the BASIC interpreter:
  3977.  
  3978.   1  Load an assembly-language subroutine into the BASIC interpreter's data
  3979.      segment. All exits from the subroutine must use a far return
  3980.      instruction.
  3981.  
  3982.   2  Assign the entry offset of the subroutine to an integer variable.
  3983.  
  3984.   3  Pass this variable to function 20 as the fourth parameter.
  3985.  
  3986.  If M2% is set to 0 in an interpreted BASIC program, the segment of the
  3987.  new subroutine is assumed to be identical to the BASIC data segment.
  3988.  
  3989.  ────────────────────────────────────────
  3990.  Calling from high-level-language programs
  3991.  ────────────────────────────────────────
  3992.  
  3993.  To use function 20 in a high-level-language program:
  3994.  
  3995.   1  Link an assembly-language subroutine with the program's object file(s).
  3996.      All exits from the subroutine must use a far return instruction.
  3997.  
  3998.   2  In FORTRAN programs, Pascal programs, and C medium-, large-, and huge-
  3999.      model programs, assign the subroutine's segment to an integer variable.
  4000.      In QuickBASIC programs, and C small- and compact-model programs, set
  4001.      this variable to 0.
  4002.  
  4003.   3  Assign the subroutine's offset to an integer variable.
  4004.  
  4005.   4  Pass the variable containing either the subroutine's segment or 0 to
  4006.      function 20 as the second parameter. Pass the variable containing the
  4007.      subroutine's offset as the fourth parameter.
  4008.  
  4009.      If M2% is set to 0 in a high-level-language program, the segment
  4010.      of the new subroutine is assumed to be identical to the program's data
  4011.      segment.
  4012.  
  4013.  ────────────────────────────────────────
  4014.  Calling from assembly-language programs
  4015.  ────────────────────────────────────────
  4016.  
  4017.      For information on using function 20 in assembly-language programs, see
  4018.      "Making Calls from Assembly-Language Programs" in Chapter 7, "Making
  4019.      Mouse Function Calls."
  4020.  
  4021.  
  4022.  Example
  4023.  
  4024.  The following example calls function 20 from the BASIC interpreter. Assume
  4025.  that an assembly-language subroutine has been loaded into the BASIC
  4026.  interpreter's data segment and that the integer variable SKETCH% has been
  4027.  assigned the subroutine's entry offset. The following BASIC statements set
  4028.  up calls to SKETCH% any time the user presses the left mouse button.
  4029.  
  4030.  100  '
  4031.  200  '  Call subroutine SKETCH on left button press
  4032.  300  '
  4033.  400  M1%=20
  4034.  500  M2%=0
  4035.  600  M3%=&H01
  4036.  700  M4%=SKETCH%
  4037.  800  CALL MOUSE(M1%, M2%, M3%, M4%)
  4038.  
  4039.  
  4040.  If your program does not change the return values of M1%, M2%, M3%, and
  4041.  M4%, you can restore the previous interrupt subroutine call mask and
  4042.  address by adding the following statement after the initial call to
  4043.  function 20.
  4044.  
  4045.  CALL MOUSE(M1%, M2%, M3%, M4%)
  4046.  
  4047.  
  4048.  ───────────────────────────────────────────────────────────────────────────
  4049.  Function 21: Get Mouse Driver State Storage Requirements
  4050.  
  4051.  Input                 Output
  4052.  ───────────────────────────────────────────────────────────────────────────
  4053.  M1%=21                M2%=buffer size required for mouse
  4054.                            driver state
  4055.  
  4056.  Function 21 returns the size of the buffer required to store the current
  4057.  state of the mouse driver. It is used with functions 22 and 23 when you
  4058.  want to temporarily interrupt a program that is using the mouse and execute
  4059.  another program that also uses the mouse, such as one of the Microsoft
  4060.  Expert Mouse Menu programs.
  4061.  
  4062.  
  4063.  Example
  4064.  
  4065.  100  '
  4066.  200  '  Get required storage size
  4067.  300  '
  4068.  400  M1%=21
  4069.  500  CALL MOUSE(M1%, M2%, M3%, M4%)
  4070.  600  BufSIZE%=M2%
  4071.  
  4072.  
  4073.  ───────────────────────────────────────────────────────────────────────────
  4074.  Function 22: Save Mouse Driver State
  4075.  
  4076.  Input                             Output
  4077.  ───────────────────────────────────────────────────────────────────────────
  4078.  M1%=22                               -
  4079.  M4%=pointer to the buffer
  4080.  
  4081.  Function 22 saves the current mouse driver state in a buffer allocated by
  4082.  your program. It is used with functions 21 and 23 when you want to
  4083.  temporarily interrupt a program that is using the mouse and execute another
  4084.  program that also uses the mouse.
  4085.  
  4086.  Before your program calls function 22, the program should call
  4087.  function 21 to determine the buffer size required for saving the mouse
  4088.  driver state, then allocate the appropriate amount of memory.
  4089.  
  4090.  Note  For information on calling function 22 from an assembly-language
  4091.  program, see "Making Calls from Assembly-Language Programs" in Chapter 7,
  4092.  "Making Mouse Function Calls."
  4093.  
  4094.  
  4095.  Example
  4096.  
  4097.  Assume that the buffer size was obtained by calling function 21 and has
  4098.  been allocated in the BASIC interpreter's data segment. Assume also that
  4099.  BUFPTR contains the address of the buffer.
  4100.  
  4101.  100  '
  4102.  200  '  Save the mouse driver state
  4103.  300  '
  4104.  400  M1%=22
  4105.  500  M4%=BUFPTR
  4106.  600  CALL MOUSE(M1%, M2%, M3%, M4%)
  4107.  
  4108.  
  4109.  ───────────────────────────────────────────────────────────────────────────
  4110.  Function 23: Restore Mouse Driver State
  4111.  
  4112.  Input                             Output
  4113.  ───────────────────────────────────────────────────────────────────────────
  4114.  M1%=23                               -
  4115.  M4%=pointer to the buffer
  4116.  
  4117.  Function 23 restores the last mouse driver state saved by function 22. It
  4118.  is used with functions 21 and 22 when you want to temporarily interrupt a
  4119.  program that is using the mouse and execute another program that also uses
  4120.  the mouse. To restore the mouse driver state saved by function 22, call
  4121.  function 23 at the end of the interrupt program.
  4122.  
  4123.  Note  For information on calling function 23 from an assembly-language
  4124.  program, see "Making Calls from Assembly-Language Programs" in Chapter 7,
  4125.  "Making Mouse Function Calls."
  4126.  
  4127.  
  4128.  Example
  4129.  
  4130.  Assume that function 22 saved the mouse driver state in a buffer allocated
  4131.  by the program. Assume also that BUFPTR contains the address of the buffer.
  4132.  
  4133.  100  '
  4134.  200  '  Restore the mouse state
  4135.  300  '
  4136.  400  M1%=23
  4137.  500  M4%=BUFPTR
  4138.  600  CALL MOUSE(M1%, M2%, M3%, M4%)
  4139.  
  4140.  
  4141.  ────────────────────────────────────────────────────────────────────────────
  4142.  Function 24: Set Alternate Subroutine Call Mask and Address
  4143.  
  4144.  Input                       Output
  4145.  ────────────────────────────────────────────────────────────────────────────
  4146.  M1%=24                      M1%=error status
  4147.                                   (-1 if error occurred)
  4148.  M3%=user interrupt call
  4149.       mask
  4150.  M4%=user subroutine
  4151.       address
  4152.  
  4153.  Function 24 sets the interrupt call mask and user subroutine address for
  4154.  mouse hardware interrupts. Subroutine calls using function 24 allow the
  4155.  called routine to be reentrant; i.e., the subroutine called can itself make
  4156.  interrupt calls.
  4157.  
  4158.  The mouse hardware interrupts automatically stop execution of your program
  4159.  and call the specified subroutine whenever one or more of the conditions
  4160.  defined by the call mask occurs. When execution of the subroutine is
  4161.  completed, your program continues at the point of interruption.
  4162.  
  4163.  The call mask is a single integer value that defines which conditions cause
  4164.  an interrupt to the subroutine. Each of the first eight bits in the call
  4165.  mask corresponds to a specific mouse/keyboard condition, as listed in the
  4166.  following table.
  4167.  
  4168.  Mask bit    Condition
  4169.  ────────────────────────────────────────────────────────────────────────────
  4170.  0           Cursor position changes
  4171.  1           Left button pressed
  4172.  2           Left button released
  4173.  3           Right button pressed
  4174.  4           Right button released
  4175.  5           Shift key pressed during button press or release
  4176.  6           Ctrl key pressed during button press or release
  4177.  7           Alt key pressed during button press or release
  4178.  8-15        Not used
  4179.  
  4180.  To call the subroutine for any of the listed conditions, set the
  4181.  corresponding bit in the call mask to 1 and pass the mask as parameter M3%.
  4182.  You can select any combination of the listed conditions by setting the
  4183.  corresponding combination of mask bits. However, when using mask bits 5, 6,
  4184.  and 7, you must also set the mask bit that corresponds to the button(s)
  4185.  being pressed or released.
  4186.  
  4187.  To disable the subroutine for any of the listed conditions, set the
  4188.  corresponding bit(s) in the call mask to 0 and pass the mask as parameter
  4189.  M3%. A call to function 0 sets the call mask to 0; i.e., no mouse/keyboard
  4190.  conditions are specified, and consequently no calls to the subroutine are
  4191.  made.
  4192.  
  4193.  Before exiting the called subroutine be sure to execute a call to function 0
  4194.  to set the call mask to 0. Failure to reset the mask will result in the
  4195.  subroutine being executed whenever the last specified mouse/keyboard
  4196.  condition occurs.
  4197.  
  4198.  ────────────────────────────────────────
  4199.  Calling from interpreted BASIC programs
  4200.  ────────────────────────────────────────
  4201.  
  4202.  To use function 24 with the BASIC interpreter:
  4203.  
  4204.  1. Load an assembly language subroutine into the BASIC interpreter's data
  4205.     segment. All exits from the subroutine must use a far return instruction.
  4206.  
  4207.  2. Assign the entry address of the subroutine to an integer variable.
  4208.  
  4209.  3. Pass this variable to function 24 as the fourth (M4%) parameter.
  4210.  
  4211.  
  4212.  ────────────────────────────────────────
  4213.  Calling from high-level language
  4214.  programs
  4215.  ────────────────────────────────────────
  4216.  
  4217.  Example
  4218.  
  4219.  The following example calls function 24 from the BASIC interpreter. Assume
  4220.  that an assembly-language subroutine has been loaded into the BASIC
  4221.  interpreter's data segment and that the integer variable DRAW% has been
  4222.  assigned as the subroutine's entry address. The following BASIC statements
  4223.  set up calls to DRAW% any time the user presses the left mouse button.
  4224.  
  4225.  
  4226.  100     '
  4227.  200     ' Call subroutine DRAW when left
  4228.  300     ' mouse button pressed
  4229.  400     '
  4230.  500     M1%=24
  4231.  600     M3%=&H01
  4232.  700     M4%=DRAW
  4233.  800     CALL MOUSE (M1%, M2%, M3%, M4%)
  4234.  
  4235.  
  4236.  To use function 24 with a high-level language program:
  4237.  
  4238.  1. Link an assembly-language subroutine with the program's object file(s).
  4239.     All exits from the subroutine must use a far return instruction.
  4240.  
  4241.  2. Assign the entry address of the subroutine to an integer variable.
  4242.  
  4243.     In QuickBASIC programs and C small- and compact-model programs, the
  4244.     address is an offset only.
  4245.  
  4246.     In FORTRAN programs, Pascal programs, and C medium-, large-, and
  4247.     huge-model programs, the address consists of both segment and an offset.
  4248.  
  4249.  3. Pass this variable to function 24 as the fourth (M4%) parameter.
  4250.  
  4251.  
  4252.  ────────────────────────────────────────
  4253.  Calling from assembly-language programs
  4254.  ────────────────────────────────────────
  4255.  
  4256.  For information on using function 24 in assembly-language programs, refer to
  4257.  "Making Calls from Assembly-Language Programs" in Chapter 7, "Making Mouse
  4258.  Function Calls." Also, note that CX=user interrupt call mask, and ES:DX=user
  4259.  subroutine address.
  4260.  
  4261.  
  4262.  ────────────────────────────────────────────────────────────────────────────
  4263.  Function 25: Get User Alternate Interrupt Address
  4264.  
  4265.  Input                       Output
  4266.  ────────────────────────────────────────────────────────────────────────────
  4267.  M1%=25                      M3%=user interrupt call mask
  4268.  M3%=user interrupt          M4%=user subroutine address
  4269.       call mask                   (M4% will be zero if no interrupt
  4270.                                   call mask is returned, or it is
  4271.                                   invalid)
  4272.  
  4273.  Function 25 returns the interrupt address of the alternate mouse user
  4274.  subroutine identified by the specified call mask. Function call 25 may be
  4275.  used prior to a call to function 24 to retrieve, and later restore, the last
  4276.  alternate interrupt subroutine address.
  4277.  
  4278.  The interrupt call mask has the value described in function call 24.
  4279.  
  4280.  For assembly language users, the subroutine address is returned as BX:DX.
  4281.  
  4282.  Example
  4283.  
  4284.  
  4285.  100     '
  4286.  200     'Get user subroutine interrupt address
  4287.  300     '
  4288.  400     M1%=25
  4289.  500     M3%=&H01
  4290.  600     CALL MOUSE (M1%, M2%, M3%, M4%)
  4291.  
  4292.  
  4293.  
  4294.  ────────────────────────────────────────────────────────────────────────────
  4295.  Function 26: Set Mouse Sensitivity
  4296.  
  4297.  Input                       Output
  4298.  ────────────────────────────────────────────────────────────────────────────
  4299.  M1%=26                         --
  4300.  M2%=mickeys/pixel
  4301.       (horizontal)
  4302.  M3%=mickeys/pixel
  4303.       (vertical)
  4304.  M4%=threshold for
  4305.       double-speed
  4306.  
  4307.  Function 26 sets mouse-to-cursor movement sensitivity by defining the number
  4308.  of mickeys that are equal to a single pixel, and also by setting the
  4309.  double-speed threshold for the mouse. For more information on the mickey,
  4310.  refer to "Mouse Unit of Distance: The Mickey" in Chapter 5, "The Mouse
  4311.  Interface."
  4312.  
  4313.  The value of mickeys must be in the range of 1 to 100, where a value of 1
  4314.  specifies a mickey-to-pixel ratio of 1:1. The default value of mickeys per
  4315.  pixel is 50.
  4316.  
  4317.  The double-speed threshold, which is part of the mouse sensitivity, is
  4318.  described with function call 19. It is included in this function call so
  4319.  that you can set the mouse sensitivity with a single function call, instead
  4320.  of two separate calls (i.e., calls 15 and 19).
  4321.  
  4322.  Example
  4323.  
  4324.  
  4325.  100     '
  4326.  200     '  Set mouse sensitivity to 10 mickeys/pixel
  4327.  300     '  and 32 mickeys/second
  4328.  400     '
  4329.  500     M1%=26
  4330.  600     M2%=10
  4331.  700     M3%=10
  4332.  800     M4%=32
  4333.  900     CALL MOUSE (M1%, M2%, M3%, M4%)
  4334.  
  4335.  
  4336.  
  4337.  ────────────────────────────────────────────────────────────────────────────
  4338.  Function 27: Get Mouse Sensitivity
  4339.  
  4340.  Input                       Output
  4341.  ────────────────────────────────────────────────────────────────────────────
  4342.  M1%=27                      M2%=mickeys/pixel (horizontal)
  4343.                              M3%=mickeys/pixel (vertical)
  4344.                              M4%=threshold for double speed
  4345.  
  4346.  Function 27 returns the current setting of mouse mickeys-per-pixel and
  4347.  current threshold for double-speed mouse movement. The mouse sensitivity
  4348.  values are in mickeys, and are described in function call 26. The
  4349.  double-speed threshold is described in function call 19.
  4350.  
  4351.  Function call 27 may be used prior to a call to function 26 to retrieve, and
  4352.  later restore, the last mouse sensitivity parameters.
  4353.  
  4354.  Example
  4355.  
  4356.  
  4357.  100     '
  4358.  200     'Get mouse sensitivity and double-speed
  4359.  300     'threshold
  4360.  400     M1%=27
  4361.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4362.  
  4363.  
  4364.  
  4365.  ────────────────────────────────────────────────────────────────────────────
  4366.  Function 28: Set Mouse Interrupt Rate
  4367.  
  4368.  Input                               Output
  4369.  ────────────────────────────────────────────────────────────────────────────
  4370.  M1%=28                                 --
  4371.  M2%=interrupt rate
  4372.       (in interrupts/second)
  4373.  
  4374.  Function 28 operates only with the InPort mouse. Function 28 sets the rate
  4375.  at which the mouse driver polls the status of the mouse. Faster interrupt
  4376.  rates provide better resolution in graphics applications. Slower interrupt
  4377.  rates may allow applications to run faster.
  4378.  
  4379.  The interrupt rate is a single integer value that defines the rate in
  4380.  interrupts per second. Each of the first eight bits in the interrupt rate
  4381.  variable corresponds to a specific interrupt rate. Each of the interrupt
  4382.  rates are specified by setting the corresponding bit to 1. If more than one
  4383.  of the bits are set, the lowest order bit takes precedence. The value of
  4384.  each bit with respect to interrupt rate is listed in the following table.
  4385.  
  4386.  Rate bit  Maximum interrupt rate
  4387.  ────────────────────────────────────────────────────────────────────────────
  4388.  0         No interrupts allowed
  4389.  1         30 interrupts/second rate
  4390.  2         50 interrupts/second rate
  4391.  3         100 interrupts/second rate
  4392.  4         200 interrupts/second rate
  4393.  5-7       Not used
  4394.  
  4395.  Example
  4396.  
  4397.  
  4398.  100     '
  4399.  200     'Set mouse interrupt rate to 100/second
  4400.  300     '
  4401.  400     M1%=28
  4402.  500     M2%=&H08
  4403.  600     CALL MOUSE (M1%, M2%, M3%, M4%)
  4404.  
  4405.  
  4406.  
  4407.  ────────────────────────────────────────────────────────────────────────────
  4408.  Function 29: Set CRT Page Number
  4409.  
  4410.  Input                               Output
  4411.  ────────────────────────────────────────────────────────────────────────────
  4412.  M1%=29                                 --
  4413.  M2%=CRT page for
  4414.       mouse cursor display
  4415.  
  4416.  Function 29 specifies the CRT page on which the mouse cursor will be
  4417.  displayed.
  4418.  
  4419.  For information on the number of CRT pages available in each display mode
  4420.  your adapter supports, see the information that came with the graphics
  4421.  adapter.
  4422.  
  4423.  Example
  4424.  
  4425.  
  4426.  100     '
  4427.  200     'Display mouse cursor on page 3
  4428.  300     '
  4429.  400     M1%=29
  4430.  500     M2%=3
  4431.  600     CALL MOUSE (M1%, M2%, M3%, M4%)
  4432.  
  4433.  
  4434.  
  4435.  ────────────────────────────────────────────────────────────────────────────
  4436.  Function 30: Get CRT Page Number
  4437.  
  4438.  Input                       Output
  4439.  ────────────────────────────────────────────────────────────────────────────
  4440.  M1%=30                      M2%=CRT page number of
  4441.                                   current cursor display
  4442.  
  4443.  Function 30 returns the number of the CRT page on which the mouse cursor is
  4444.  displayed.
  4445.  
  4446.  Example
  4447.  
  4448.  
  4449.  100     '
  4450.  200     'Get CRT page number
  4451.  300     '
  4452.  400     M1%=30
  4453.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4454.  
  4455.  
  4456.  
  4457.  ────────────────────────────────────────────────────────────────────────────
  4458.  Function 31: Disable Mouse Driver
  4459.  
  4460.  Input                       Output
  4461.  ────────────────────────────────────────────────────────────────────────────
  4462.  M1%=31                      M1%=error status
  4463.                                   (-1 if error occurred;
  4464.                                   31 if no error occurred)
  4465.                              M2%=offset of old INT_33
  4466.                              M3%=segment of old INT_33
  4467.  
  4468.  Function 31 is used in the MOUSE OFF portion of your program to disable the
  4469.  mouse driver, and thus the mouse. When a call is made to function 31, you
  4470.  can restore the interrupt 33 value (to what it was before the mouse driver
  4471.  was enabled) by means of the M2% and M3% variables. All other vectors used
  4472.  by the mouse driver are removed.
  4473.  
  4474.  If this function cannot remove all mouse driver vectors, except the
  4475.  interrupt 33 vector, an error is indicated by returning -1 for M1%.
  4476.  
  4477.  Example
  4478.  
  4479.  
  4480.  100      '
  4481.  200      'Disable mouse driver
  4482.  300      '
  4483.  400     M1%=31
  4484.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4485.  
  4486.  
  4487.  When calling from assembly-language programs, use ES:BX for the address of
  4488.  the old INT_33 vector.
  4489.  
  4490.  
  4491.  ────────────────────────────────────────────────────────────────────────────
  4492.  Function 32: Enable Mouse Driver
  4493.  
  4494.  Input                       Output
  4495.  ────────────────────────────────────────────────────────────────────────────
  4496.  M1%=32                         --
  4497.  
  4498.  Function 32 is used in the MOUSE ON portion of your program to enable the
  4499.  mouse driver, and thus the mouse. When a call is made to function 32, the
  4500.  interrupt 33 value is set to the mouse interrupt vector and all other mouse
  4501.  driver vectors are installed.
  4502.  
  4503.  Example
  4504.  
  4505.  
  4506.  100      '
  4507.  200      'Enable mouse driver
  4508.  300      '
  4509.  400     M1%=32
  4510.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4511.  
  4512.  
  4513.  
  4514.  ────────────────────────────────────────────────────────────────────────────
  4515.  Function 33: Software Reset
  4516.  
  4517.  Input                       Output
  4518.  ────────────────────────────────────────────────────────────────────────────
  4519.  M1%=33                      M1%=-1 if mouse driver is installed,
  4520.                                   otherwise 33h.
  4521.                              M2%=2 (provided M1%=-1)
  4522.  
  4523.  Function 33 is similar to function 0 except that there is no initialization
  4524.  of mouse hardware or resetting of other display hardware dependent
  4525.  variables. Resets are confined to software only.
  4526.  
  4527.  A valid software reset is indicated by both returned values. M1% must be -1
  4528.  and M2% must be 2 or a valid reset.
  4529.  
  4530.  Example
  4531.  
  4532.  
  4533.  100      '
  4534.  200      'Reset software functions
  4535.  300      '
  4536.  400     M1%=33
  4537.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4538.  
  4539.  
  4540.  
  4541.  ────────────────────────────────────────────────────────────────────────────
  4542.  Function 34: Set Language For Messages
  4543.  
  4544.  Input                       Output
  4545.  ────────────────────────────────────────────────────────────────────────────
  4546.  M1%=34                         --
  4547.  M2%=Language number
  4548.  
  4549.  Function 34 operates only with the international version of the mouse
  4550.  driver. Function 34 allows you to specify the language in which messages and
  4551.  prompts from the mouse driver are displayed. The language is specified by a
  4552.  single integer in accordance with the following list:
  4553.  
  4554.  Number                      Language
  4555.  ────────────────────────────────────────────────────────────────────────────
  4556.  0                           English
  4557.  1                           French
  4558.  2                           Dutch
  4559.  3                           German
  4560.  4                           Swedish
  4561.  5                           Finnish
  4562.  6                           Spanish
  4563.  7                           Portuguese
  4564.  8                           Italian
  4565.  
  4566.  Example
  4567.  
  4568.  
  4569.  100      '
  4570.  200      'Set language for messages to Dutch
  4571.  300      '
  4572.  400     M1%=34
  4573.  500     M2%=2
  4574.  600     CALL MOUSE (M1%, M2%, M3%, M4%)
  4575.  
  4576.  
  4577.  
  4578.  ────────────────────────────────────────────────────────────────────────────
  4579.  Function 35: Get Language Number
  4580.  
  4581.  Input                       Output
  4582.  ────────────────────────────────────────────────────────────────────────────
  4583.  M1%=35                      M2%=the currently set language
  4584.  
  4585.  Function 35 operates only with the international version of the mouse
  4586.  driver. Function 35 returns the number of the language currently set in the
  4587.  mouse driver. Languages are specified by a single integer in accordance with
  4588.  the list in function 34.
  4589.  
  4590.  Example
  4591.  
  4592.  
  4593.  100      '
  4594.  200      'Get current language number
  4595.  300      '
  4596.  400     M1%=35
  4597.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4598.  
  4599.  
  4600.  
  4601.  ────────────────────────────────────────────────────────────────────────────
  4602.  Function 36: Get Driver Version, Mouse Type, and IRQ #
  4603.  
  4604.  Input                       Output
  4605.  ────────────────────────────────────────────────────────────────────────────
  4606.  M1%=36                      M2%=Mouse driver version number
  4607.                              M3%=Mouse type and IRQ#
  4608.  
  4609.  Function 36 gets the version number of the mouse driver, the type of mouse
  4610.  it requires, and the number of the interrupt request type. In the returned
  4611.  value of M2%, the high-order 8 bits contain the major version number, while
  4612.  the low-order 8 bits contain the minor version number. For example, function
  4613.  call 36 to version 6.10 would return the value 1552 (decimal), which is
  4614.  equal to 0610 (hexadecimal) for M2%.
  4615.  
  4616.  The mouse type is contained in the high-order bits of the returned value for
  4617.  M3%. A value of 1 indicates a bus mouse, a value of 2 indicates a serial
  4618.  mouse, a value of 3 indicates an InPort mouse, a value of 4 indicates a PS/2
  4619.  mouse, and a value of 5 indicates an HP mouse.
  4620.  
  4621.  The value for the interrupt request type is contained in the low-order bits
  4622.  of the value returned for M3%. A value of 0 indicates PS/2, a value in the
  4623.  range of 2 through 5, or 7, indicates a mouse interrupt.
  4624.  
  4625.  Example
  4626.  
  4627.  
  4628.  100      '
  4629.  200      'Get driver version, mouse type, and IRQ #
  4630.  300      '
  4631.  400     M1%=36
  4632.  500     CALL MOUSE (M1%, M2%, M3%, M4%)
  4633.  
  4634.  
  4635.  
  4636.  ═══════════════════════════════════════════════════════════════════════════
  4637.  7 Making Mouse Function Calls
  4638.  
  4639.  
  4640.  
  4641.  The statements and instructions required to call the mouse functions depend
  4642.  on the language you're using for your application program. This chapter
  4643.  explains how to make mouse function calls from the following types of
  4644.  programs:
  4645.  
  4646.   ■  BASIC programs running under the BASIC interpreter
  4647.  
  4648.   ■  Assembly-language programs
  4649.  
  4650.   ■  Programs in Microsoft high-level languages
  4651.  
  4652.  ────────────────────────────────────────
  4653.  Additional examples
  4654.  ────────────────────────────────────────
  4655.  
  4656.  This chapter also includes the BASIC source program listing for the Piano
  4657.  demonstration program that came in your Microsoft Mouse package.
  4658.  
  4659.  The last section in this chapter describes eight sample mouse cursors
  4660.  you can use in high-resolution graphics mode.
  4661.  
  4662.  
  4663.  ───────────────────────────────────────────────────────────────────────────
  4664.  Making Calls from the BASIC Interpreter
  4665.  
  4666.  To make a mouse function call from a BASIC program running under the BASIC
  4667.  interpreter:
  4668.  
  4669.   1  Assign the offset and segment of the BASIC entry point into the mouse
  4670.      driver to a pair of integer variables in your program. The mouse entry
  4671.      offset and segment are in memory. To get these values, insert the
  4672.      following statements into your program:
  4673.  
  4674.      10 DEF SEG=0
  4675.      20 MSEG=256*PEEK(51*4+3)+PEEK(51*4+2)
  4676.      30 MOUSE=256*PEEK(51*4+1)+PEEK(51*4)+2
  4677.      40 IF MSEG OR (MOUSE-2) THEN 60
  4678.      50 PRINT "Mouse Driver not found":END
  4679.      60 DEF SEG=MSEG
  4680.      70 IF PEEK(MOUSE-2)=207 then 50
  4681.  
  4682.      Be sure that these statements appear before any calls to mouse
  4683.      functions.
  4684.  
  4685.   2  Use the CALL statement to make the call. The statement should have the
  4686.      form
  4687.  
  4688.      CALL MOUSE(M1%, M2%, M3%, M4%)
  4689.  
  4690.      where MOUSE is the variable containing the offset of the BASIC entry
  4691.      point into the mouse driver, and M1%, M2%, M3%, and M4% are the names
  4692.      of the integer variables you have chosen for parameters in this call.
  4693.      (Constants and noninteger variables are not allowed.) All of the
  4694.      parameters must appear in the CALL statement even if no value is
  4695.      assigned to one or more of them.
  4696.  
  4697.      To ensure that the variables are integer variables, use the
  4698.      percent sign (%) as part of all the variable names. You may also use
  4699.      the DEFINT statement at the beginning of your program. For example, the
  4700.      statement
  4701.  
  4702.      10 DEFINT A-Z
  4703.  
  4704.      defines all variables as integer variables. If this statement appears
  4705.      at the beginning of the program, the variable names don't need to
  4706.      include the percent sign.
  4707.  
  4708.  
  4709.  Example
  4710.  
  4711.  Assuming that the variable MOUSE has the offset of the BASIC entry point
  4712.  into the mouse driver, use the following statements to set the cursor
  4713.  position to 320 (horizontal) and 100 (vertical):
  4714.  
  4715.  100  '
  4716.  200  '  Set cursor position to (320,100)
  4717.  300  '
  4718.  400  M1%=4          'Function number is 4
  4719.  500  M3%=320        'Horizontal coordinate
  4720.  600  M4%=100        'Vertical coordinate
  4721.  700  CALL MOUSE(M1%, M2%, M3%, M4%)
  4722.  
  4723.  Note  For additional examples of making calls from the BASIC interpreter,
  4724.  see the sample source code after the description of each function in
  4725.  Chapter 6, "Mouse Function Descriptions," and the section "Piano Program"
  4726.  Listing later in this chapter.
  4727.  
  4728.  
  4729.  ───────────────────────────────────────────────────────────────────────────
  4730.  Making Calls from Assembly-Language Programs
  4731.  
  4732.  To make a mouse function call from an assembly-language program:
  4733.  
  4734.   1  Include statements in your program that check if the mouse driver is
  4735.      installed. These statements must appear before any calls to mouse
  4736.      functions. (See the assembly-language program example on the next
  4737.      page.)
  4738.  
  4739.   2  Load the appropriate CPU registers (AX, BX, CX, DX, SI, DI, and/or ES)
  4740.      with the parameter values.
  4741.  
  4742.   3  Execute software interrupt 51 (33H).
  4743.  
  4744.  For all mouse functions except functions 9, 12, 16, 20, 22, and 23, the
  4745.  AX, BX, CX, and DX registers correspond to the M1%, M2%, M3%, and M4%
  4746.  parameters defined for the BASIC interpreter in Chapter 6, "Mouse Function
  4747.  Descriptions."
  4748.  
  4749.  The parameter definitions for functions 9, 12, 16, 20, 22, and 23 are
  4750.  given in the following table:
  4751.  
  4752. ╓┌──────────┌────────────────────────────────────┌───────────────────────────╖
  4753.  Function   Input                                Output
  4754.  ───────────────────────────────────────────────────────────────────────────
  4755.      9      AX = 9                                  -
  4756.             BX = cursor hot spot
  4757.                  (horizontal)
  4758.             CX = cursor hot spot (vertical)
  4759.             ES:DX = address of first element
  4760.             in screen and cursor masks array
  4761.  
  4762.     12      AX = 12                                 -
  4763.             CX = call mask
  4764.             ES:DX = subroutine address
  4765.  
  4766.     16      AX = 16                                 -
  4767.             CX = upper x screen coordinate
  4768.             DX = left y screen coordinate
  4769.  Function   Input                                Output
  4770.            DX = left y screen coordinate
  4771.             SI = lower x screen coordinate
  4772.             DI = right y screen coordinate
  4773.  
  4774.     20      AX = 20                              CX = old
  4775.             CX = new call mask                   call mask
  4776.             ES:DX = new subroutine address       ES:DX = old
  4777.                                                  subroutine
  4778.                                                  address
  4779.  
  4780.     22      AX = 22                                 -
  4781.             ES:DX = start of buffer address
  4782.  
  4783.     23      AX = 23                                 -
  4784.             ES:DX = start of buffer address
  4785.  
  4786.  Example
  4787.  
  4788.  ────────────────────────────────────────
  4789.  Assembly language program
  4790.  ────────────────────────────────────────
  4791.  
  4792.  The following assembly-language program puts an IBM Color/Graphics Adapter
  4793.  into 640 x 200 graphics mode and displays the default mouse cursor (the
  4794.  standard cursor shape described under "Sample Cursors" later in this
  4795.  chapter). Clicking the left mouse button returns the video display to
  4796.  80-column, black-and-white text mode, and ends the program.
  4797.  
  4798.  stack  segment stack   'stack'
  4799.                 db       256 dup(?)
  4800.  stack   ends
  4801.  ;
  4802.  data      segment public  'data'
  4803.            msg1    db   "Microsoft Mouse not found","$"
  4804.  
  4805.            msg2    db   "Press the left mouse button to EXIT","$"
  4806.  data      ends
  4807.  ;
  4808.  code     segment public   'code'
  4809.           assume cs:code, ds:data, es:data; ss:stack
  4810.  start:
  4811.           push  bp
  4812.           mov   bp,sp
  4813.           mov   ax,seg data      ;Set DS to the
  4814.           mov   ds,ax            ;data segment
  4815.  
  4816.           push  es               ;Save PSP segment address
  4817.           mov   ax,03533h        ;Get int 33h vector
  4818.           int   21h              ;by calling int 21
  4819.           mov   ax,es            ;Check segment and
  4820.           or    ax,bx            ;offset of int 33
  4821.           jnz   begin            ;vector. If 0 or pointing to
  4822.           mov   bl,es:[bx]       ;IRET, driver not installed
  4823.           cmp   bl,0cfh
  4824.           jne   begin            ;Exit
  4825.  
  4826.           mov   dx,offset msg1   ;Get not found message offset
  4827.           mov   ah,09h           ;Output message to screen
  4828.           int   21h
  4829.           pop   es
  4830.           jmp   short exit       ;Exit
  4831.  
  4832.  begin:
  4833.           mov   ax,0             ;Initialize mouse
  4834.           int   33h
  4835.           cmp   ax,0             ;Is mouse installed?
  4836.           jz    exit             ;No, exit
  4837.           mov   ax,0006h         ;Set up for 640x200 resolution
  4838.           int   10h              ;graphics mode (CGA mode 6)
  4839.           mov   ax,4             ;Function 4-set cursor position
  4840.           mov   cx,200           ;M3 = 200
  4841.           mov   dx,100           ;M4 = 100
  4842.           int   33h
  4843.           mov   ax,7             ;Function 7
  4844.           mov   cx,150           ;M3 = 150
  4845.           mov   dx,450           ;M4 = 450
  4846.           int   33h
  4847.           mov   ax,8             ;Function 8
  4848.           mov   cx,50            ;M3 = 50
  4849.           mov   dx,150           ;M4 = 150
  4850.           int   33h
  4851.           mov   ax,1             ;Show the mouse cursor
  4852.           int   33h
  4853.  
  4854.           mov   dx,offset msg2   ;Get exit message
  4855.           mov   ah,09h           ;Output message to screen
  4856.           int   21h
  4857.           xor   ax,ax
  4858.  
  4859.  around:
  4860.           mov   ax,3             ;Get mouse status
  4861.           int   33h
  4862.           cmp   bx,0001h         ;Left mouse button
  4863.           jne   around           ;pressed? Branch if not
  4864.  
  4865.           mov   ax,0
  4866.           int   33h              ;Reset mouse
  4867.           mov   ax,0003h         ;Set up 80x25
  4868.           int   10h              ;character text mode
  4869.  exit:
  4870.           mov   sp,bp
  4871.           pop   bp
  4872.           mov   ax,04c00h        ;Terminate
  4873.           int   21h
  4874.  ;
  4875.  code     ends
  4876.  end      start
  4877.  
  4878.  
  4879.  ───────────────────────────────────────────────────────────────────────────
  4880.  Making Calls from High-Level-Language Programs
  4881.  
  4882.  Mouse function calls from high-level-languages can be included as ordinary
  4883.  procedure calls in the source program. After the program is compiled, it
  4884.  must be linked with the Microsoft Mouse Library (MOUSE.LIB), which is
  4885.  included on the Microsoft Mouse Tools disk. MOUSE.LIB contains procedures
  4886.  that give access to all the mouse functions.
  4887.  
  4888.  This section describes how to make function calls from the following
  4889.  high-level languages:
  4890.  
  4891.   ■  Microsoft QuickBASIC
  4892.  
  4893.   ■  Microsoft Pascal (version 3.30 or later)
  4894.  
  4895.   ■  Microsoft FORTRAN (version 3.30 or later)
  4896.  
  4897.   ■  Microsoft C (version 3.0 or later)
  4898.  
  4899.  For information about linking programs written for earlier versions of
  4900.  the Microsoft Mouse Library, see Appendix B, "Linking Existing Mouse
  4901.  Programs with MOUSE.LIB (Version 6.0)."
  4902.  
  4903.  For information on accessing the mouse functions from a program written
  4904.  in Borland Turbo Pascal, see Appendix C, "Making Calls from Borland
  4905.  Turbo Pascal Programs."
  4906.  
  4907.  
  4908.  Making Calls from Microsoft QuickBASIC
  4909.  
  4910.  To make a mouse function call from a program in Microsoft QuickBASIC
  4911.  (version 1.0 or later):
  4912.  
  4913.   1  Include statements in your program that check if the mouse driver is
  4914.      installed. These statements must appear before any calls to mouse
  4915.      functions. (See the QuickBASIC program example on the next page.)
  4916.  
  4917.   2  Call the mouse library procedure "MOUSE" as a regular QuickBASIC
  4918.      external subroutine.
  4919.  
  4920.   3  Compile the program and link it with MOUSE.LIB.
  4921.  
  4922.      If you are using version 2.0 of the QuickBASIC compiler, you can
  4923.      compile and link in one step from within the QuickBASIC editor
  4924.      following the procedure given below. (For instructions on linking with
  4925.      MOUSE.LIB outside of the QuickBASIC editor, see your documentation on
  4926.      Microsoft QuickBASIC.)
  4927.  
  4928.  
  4929.  Linking with MOUSE.LIB within QuickBASIC
  4930.  
  4931.  To simultaneously compile a QuickBASIC program (version 2.0) and link the
  4932.  program with MOUSE.LIB, first set up a special library subroutine called
  4933.  "USERLIB.EXE".
  4934.  
  4935.  ────────────────────────────────────────
  4936.  Setting up USERLIB.EXE
  4937.  ────────────────────────────────────────
  4938.  
  4939.  To set up USERLIB.EXE:
  4940.  
  4941.   1  Create a QuickBASIC source file that contains the single statement:
  4942.  
  4943.      CALL MOUSE
  4944.  
  4945.   2  Compile this source file outside of the QuickBASIC editor. To do this,
  4946.      type the following at the DOS prompt:
  4947.  
  4948.      qb <filename>
  4949.  
  4950.      and press the ENTER key. (<filename> is the name of the source
  4951.      file.)
  4952.  
  4953.   3  Make sure the compiled QuickBASIC file, MOUSE.LIB, and the QuickBASIC
  4954.      utilities BUILDLIB.EXE and BRUN20.LIB are in the current directory.
  4955.  
  4956.   4  To create the USERLIB.EXE file, type the following at the DOS prompt:
  4957.  
  4958.      buildlib <filename>,userlib,,mouse;
  4959.  
  4960.      and press the ENTER key. (<filename> is the name of the compiled
  4961.      QuickBASIC file.)
  4962.  
  4963.  ────────────────────────────────────────
  4964.  Linking within QuickBASIC
  4965.  ────────────────────────────────────────
  4966.  
  4967.  To compile a QuickBASIC program and link it with MOUSE.LIB in one step:
  4968.  
  4969.   1  Make sure the USERLIB.EXE file is in the same directory as the
  4970.      QuickBASIC compiler (QB.EXE) before you start QuickBASIC.
  4971.  
  4972.   2  To start QuickBASIC, type qb/l (not qb) and press the ENTER key.
  4973.  
  4974.   3  Compile the mouse application program within the QuickBASIC editor.
  4975.      This also automatically links the program with MOUSE.LIB.
  4976.  
  4977.  
  4978.  Example
  4979.  
  4980.  ────────────────────────────────────────
  4981.  QuickBASIC program
  4982.  ────────────────────────────────────────
  4983.  
  4984.  The following program puts an IBM Color/Graphics Adapter into 640 x 200
  4985.  graphics mode and displays the default mouse cursor (the standard cursor
  4986.  shape described under "Sample Cursors" later in this chapter). This program
  4987.  calls the subroutine "chkdrv", which is shown in the assembly-language
  4988.  program that follows.
  4989.  
  4990.  ' Mouse library call test in QuickBASIC V2.0
  4991.  
  4992.   call chkdrv
  4993.  
  4994.   screen 0
  4995.  
  4996.   m1%=0               ' function 0
  4997.   call mouse(m1%,m2%,m3%,m4%)
  4998.   if ( m1% = 0 ) then
  4999.      print "Microsoft Mouse not found"
  5000.      end
  5001.   end if
  5002.  
  5003.   m1%=4               ' function 4
  5004.   m3%=200
  5005.   m4%=100
  5006.   call mouse(m1%,m2%,m3%,m4%)
  5007.  
  5008.   m1%=7               ' function 7
  5009.   m3%=150
  5010.   m4%=450
  5011.   call mouse(m1%,m2%,m3%,m4%)
  5012.  
  5013.   m1%=8               ' function 8
  5014.   m3%=50
  5015.   m4%=150
  5016.   call mouse(m1%,m2%,m3%,m4%)
  5017.  
  5018.   screen 2
  5019.  
  5020.   print "Cursor limited to the center of the screen."
  5021.   print "Press the left mouse button to EXIT."
  5022.  
  5023.   m1% = 1
  5024.   call mouse(m1%,m2%,m3%,m4%)
  5025.  
  5026.   m2% = 99
  5027.   while ( m2% <> 1 )
  5028.     m1% = 3
  5029.     call mouse(m1%,m2%,m3%,m4%)
  5030.   wend
  5031.  
  5032.   screen 0
  5033.  
  5034.   end
  5035.  
  5036.  ────────────────────────────────────────
  5037.  chkdrv subroutine
  5038.  ────────────────────────────────────────
  5039.  
  5040.  In the following assembly-language source program, "chkdrv" checks if the
  5041.  mouse driver is installed.
  5042.  
  5043.  ;
  5044.  mdata      segment byte public 'data'
  5045.             msg     db   "Mouse Driver not installed","$"
  5046.  mdata      ends
  5047.  
  5048.  mcode      segment para public 'CODE'
  5049.             assume  cs:mcode
  5050.  ;
  5051.             public  chkdrv
  5052.  ;
  5053.  chkdrv     proc    far
  5054.             push    bp
  5055.             push    es
  5056.  
  5057.             mov     ax,03533h      ;Get int 33h by
  5058.             int     21h            ;calling int 21
  5059.             mov     ax,es          ;Check segment and offset
  5060.             or      ax,bx          ;of int 33 vector. If
  5061.             jnz     back           ;0 or pointing to IRET,
  5062.             mov     bl,es:[bx]     ;driver not installed
  5063.             cmp     bl,0cfh
  5064.             jne     back           ;Exit
  5065.  
  5066.             mov     ax,seg mdata   ;Set up DS to
  5067.             mov     ds,ax          ;point to data seg
  5068.             mov     dx,offset msg  ;Get message
  5069.             mov     ah,09h         ;output to screen
  5070.             int     21h
  5071.             pop     es
  5072.             pop     bp
  5073.  
  5074.             mov     ax,04c00h      ;Terminate
  5075.             int     21h
  5076.  
  5077.    back:
  5078.             pop     es
  5079.             pop     bp
  5080.             ret
  5081.  chkdrv     endp
  5082.  ;
  5083.  mcode      ends
  5084.             end
  5085.  
  5086.  
  5087.  Making Calls from Microsoft Pascal
  5088.  
  5089.  To make a mouse function call from a program in Microsoft Pascal (version
  5090.  3.30 or later):
  5091.  
  5092.   1  Include statements in your program that check if the mouse driver is
  5093.      installed. These statements must appear before any calls to mouse
  5094.      functions. (See the Pascal program example below.)
  5095.  
  5096.   2  Declare the mouse library procedure "MOUSES" as an external procedure.
  5097.      The parameters can be declared as either INTEGER or WORD. Use one of
  5098.      the following statements to declare MOUSES as an external procedure:
  5099.  
  5100.      PROCEDURE MOUSES(VARS m1,m2,m3,m4:INTEGER);EXTERN;
  5101.  
  5102.      or
  5103.  
  5104.      PROCEDURE MOUSES(VARS m1,m2,m3,m4:WORD);EXTERN;
  5105.  
  5106.   3  Use Microsoft Pascal calling conventions to make the call.
  5107.  
  5108.   4  Link the compiled program with MOUSE.LIB. (For details about using the
  5109.      LINK command, see your documentation on Microsoft Pascal.)
  5110.  
  5111.  
  5112.  Example
  5113.  
  5114.  ────────────────────────────────────────
  5115.  Pascal program
  5116.  ────────────────────────────────────────
  5117.  
  5118.  The following program puts an IBM Color/Graphics Adapter into 640 x 200
  5119.  graphics mode and displays the default mouse cursor (the standard cursor
  5120.  shape described under "Sample Cursors" later in this chapter). This program
  5121.  calls two procedures, "graf" and "chkdrv". These procedures are shown in
  5122.  the assembly-language listing that follows this program.
  5123.  
  5124.  program mtest (output);
  5125.  
  5126.  procedure mouses(vars m1,m2,m3,m4:word);extern;
  5127.  procedure chkdrv;extern;
  5128.  procedure graf;extern;
  5129.  
  5130.  var
  5131.   m1, m2, m3, m4: word;
  5132.  
  5133.  begin {demo}
  5134.  
  5135.   chkdrv;              {Mouse driver installed?    }
  5136.                        {No, exit                   }
  5137.   M1:=0;               {Yes, initialize mouse      }
  5138.   mouses(m1,m2,m3,m4);
  5139.   if ( m1 = 0 ) then
  5140.      writeln('Microsoft Mouse not found')
  5141.   else
  5142.      begin
  5143.  
  5144.        m1 := 4;        {function call 4, set mouse }
  5145.        m3 := 200;      {horizontal cursor position }
  5146.        m4 := 100;      {vertical cursor position   }
  5147.        mouses( m1, m2, m3, m4 );
  5148.  
  5149.        m1 := 7;        {function call 7, set mouse }
  5150.        m3 := 150;      {minimum horizontal position}
  5151.        m4 := 450;      {maximum horizontal position}
  5152.        mouses( m1, m2, m3, m4 );
  5153.  
  5154.        m1 := 8;        {function call 8, set mouse }
  5155.        m3 := 50;       {minimum vertical position  }
  5156.        m4 := 150;      {maximum vertical position  }
  5157.        mouses( m1, m2, m3, m4 );
  5158.  
  5159.        graf;           {change into graphics mode  }
  5160.  
  5161.        writeln('Cursor limited to the center of the screen.');
  5162.        writeln('Press the left mouse button to EXIT.');
  5163.  
  5164.        m1 :=1;         {function call 1            }
  5165.        mouses(m1,m2,m3,m4);   {show mouse cursor   }
  5166.  
  5167.        m2 := 999;      {dummy value for loop       }
  5168.        repeat          {until ....                 }
  5169.          m1 := 3;      {function call 3            }
  5170.          mouses( m1, m2, m3, m4 ); {Get current mouse status}
  5171.        until m2 = 1;   {left mouse button pressed  }
  5172.  
  5173.      end
  5174.  
  5175.  end. {demo}
  5176.  
  5177.  ────────────────────────────────────────
  5178.  graf and chkdrv procedures
  5179.  ────────────────────────────────────────
  5180.  
  5181.  In the following assembly-language source program, "graf" changes the
  5182.  display mode to 640 x 200 graphics mode (CGA mode 6) and "chkdrv" checks if
  5183.  the mouse driver is installed.
  5184.  
  5185.  ;
  5186.  mdata      segment byte public 'data'
  5187.  
  5188.             msg     db   "Mouse Driver not installed","$"
  5189.  
  5190.  mdata      ends
  5191.  
  5192.  mcode      segment para public 'CODE'
  5193.             assume  cs:mcode
  5194.  ;
  5195.             public  graf
  5196.  ;
  5197.  graf       proc    far
  5198.             push    bp
  5199.             mov     ax,06h        ;Change to graphics
  5200.             int     10h           ;mode by calling
  5201.             pop     bp            ;int 10 service
  5202.             ret
  5203.  graf       endp
  5204.  ;
  5205.             public  chkdrv
  5206.  ;
  5207.  chkdrv     proc    far
  5208.             push    bp
  5209.             push    es
  5210.  
  5211.             mov     ax,03533h     ;Get int 33h by
  5212.             int     21h           ;calling int 21
  5213.             mov     ax,es         ;Check segment, offset
  5214.             or      ax,bx         ;of int 33 vector. If
  5215.             jnz     back          ;0 or pointing to IRET,
  5216.             mov     bl,es:[bx]    ;driver not installed
  5217.             cmp     bl,0cfh
  5218.             jne     back          ;Exit
  5219.  
  5220.             mov     ax,seg mdata  ;Set up DS to
  5221.             mov     ds,ax         ;point to data seg
  5222.             mov     dx,offset msg ;Get message
  5223.             mov     ah,09h        ;output to screen
  5224.             int     21h
  5225.             pop     es
  5226.             pop     bp
  5227.             mov     ax,04c00h     ;Terminate
  5228.             int     21h
  5229.  
  5230.    back:
  5231.             pop     es
  5232.             pop     bp
  5233.             ret
  5234.  chkdrv     endp
  5235.  ;
  5236.  mcode      ends
  5237.             end
  5238.  
  5239.  
  5240.  Making Calls from Microsoft FORTRAN
  5241.  
  5242.  To make a mouse function call from a program in Microsoft FORTRAN (version
  5243.  3.30 or later):
  5244.  
  5245.   1  Include statements in your program that check if the mouse driver is
  5246.      installed. These statements must appear before any calls to mouse
  5247.      functions. (See the FORTRAN program example below.)
  5248.  
  5249.   2  Call the mouse library procedure "MOUSES" as a regular FORTRAN external
  5250.      subroutine.
  5251.  
  5252.   3  Link the compiled program with MOUSE.LIB. (For details about using the
  5253.      LINK command, see your documentation on Microsoft FORTRAN.)
  5254.  
  5255.  
  5256.  Example
  5257.  
  5258.  ────────────────────────────────────────
  5259.  FORTRAN program
  5260.  ────────────────────────────────────────
  5261.  
  5262.  The following program puts an IBM Color/Graphics Adapter into 640 x 200
  5263.  graphics mode and displays the default mouse cursor (the standard cursor
  5264.  shape described under "Sample Cursors" later in this chapter). This program
  5265.  calls two assembly-language subroutines, "graf" and "chkdrv". (See the
  5266.  assembly-language program after the Pascal program example earlier in this
  5267.  chapter for the "graf" and "chkdrv" subroutine listings.)
  5268.  
  5269.        PROGRAM MTEST
  5270.  
  5271.  C
  5272.  C      -- Mouse Library calls test in MS FORTRAN V3.31 --
  5273.  C
  5274.        INTEGER*2   M1, M2, M3, M4
  5275.        EXTERNAL    GRAF, CHKDRV
  5276.  
  5277.  C      --  Call driver checking routine  --
  5278.        CALL CHKDRV()
  5279.  
  5280.  C      -- Mouse init call --
  5281.        M1 = 0
  5282.        CALL MOUSES(M1, M2, M3, M4)
  5283.        IF ( M1 .EQ. 0 ) THEN
  5284.             WRITE(*,*)' Microsoft Mouse not found'
  5285.             STOP
  5286.        ENDIF
  5287.  
  5288.  C      -- Place cursor in the center of the screen --
  5289.        M1 = 4
  5290.        M3 = 200
  5291.        M4 = 100
  5292.        CALL MOUSES(M1, M2, M3, M4)
  5293.  
  5294.  C      -- Set minimum and maximum horizontal position --
  5295.        M1 = 7
  5296.        M3 = 150
  5297.        M4 = 450
  5298.        CALL MOUSES(M1, M2, M3, M4)
  5299.  
  5300.  C      -- Set minimum and maximum vertical position --
  5301.        M1 = 8
  5302.        M3 = 50
  5303.        M4 = 150
  5304.        CALL MOUSES(M1, M2, M3, M4)
  5305.  
  5306.        CALL GRAF()
  5307.  
  5308.        WRITE(*,*) ' Cursor is limited to the center of the screen.'
  5309.        WRITE(*,*) ' Press the left mouse button to EXIT.'
  5310.  
  5311.        M1 = 1
  5312.        CALL MOUSES(M1, M2, M3, M4)
  5313.  
  5314.  C      -- Loop for left mouse button pressed  --
  5315.        M2 = 9999
  5316.  100      M1 = 3
  5317.           CALL MOUSES(M1, M2, M3, M4)
  5318.        IF ( M2 .NE. 1 ) GOTO 100
  5319.  
  5320.        STOP
  5321.        END
  5322.  
  5323.  
  5324.  Making Calls from Microsoft C
  5325.  
  5326.  To make a mouse function call from a program in Microsoft C (version 3.0 or
  5327.  later):
  5328.  
  5329.   1  Include statements in your program that check if the mouse driver is
  5330.      installed. These statements must appear before any calls to mouse
  5331.      functions. (See the C program example on the next page.)
  5332.  
  5333.   2  Call one of the following mouse library procedures as a regular C
  5334.      external routine:
  5335.  
  5336.      Use this
  5337.      procedure             To call from a
  5338.  ───────────────────────────────────────────────────────────────────────────
  5339.      CMOUSES               Small-model program
  5340.      CMOUSEC               Compact-model program
  5341.      CMOUSEM               Medium-model program
  5342.      CMOUSEL               Large- or huge-model program
  5343.  
  5344.      Parameters are declared as signed or unsigned integers. Since MOUSE.LIB
  5345.      requires that all parameters be passed by reference, precede each
  5346.      parameter name with "&" (address of).
  5347.  
  5348.   3  Link the compiled program with MOUSE.LIB. (For details about using the
  5349.      LINK command, see your documentation on Microsoft C.)
  5350.  
  5351.  
  5352.  Example
  5353.  
  5354.  ────────────────────────────────────────
  5355.  C program
  5356.  ────────────────────────────────────────
  5357.  
  5358.  The following program puts an IBM Color/Graphics Adapter into 640 x 200
  5359.  graphics mode and displays the default mouse cursor (the standard cursor
  5360.  shape described under "Sample Cursors" later in this chapter).
  5361.  
  5362.  #include <stdio.h>
  5363.  #include <dos.h>
  5364.  
  5365.  void chkdrv();
  5366.  void graf();
  5367.  
  5368.  main()
  5369.  {
  5370.    int m1, m2, m3, m4;
  5371.  
  5372.    chkdrv();            /* check for mouse driver   */
  5373.  
  5374.    m1 = 0;              /* initialize mouse         */
  5375.    cmouses(&m1, &m2, &m3, &m4);
  5376.  
  5377.    if ( m1 = 0 ) {
  5378.        printf("Microsoft Mouse not found");
  5379.        exit (-1);       /* exit, if mouse not found */
  5380.        }
  5381.  
  5382.    m1 = 4;              /* function call 4          */
  5383.    m3 = 200;            /* set mouse position at    */
  5384.    m4 = 100;            /* center of the screen     */
  5385.    cmouses(&m1, &m2, &m3, &m4);
  5386.  
  5387.    m1 = 7;              /* function call 7          */
  5388.    m3 = 150;            /* minimum horizontal value */
  5389.    m4 = 450;            /* maximum horizontal value */
  5390.    cmouses(&m1, &m2, &m3, &m4);
  5391.  
  5392.    m1 = 8;              /* function call 8          */
  5393.    m3 = 50;             /* minimum vertical value   */
  5394.    m4 = 150;            /* maximum vertical value   */
  5395.    cmouses(&m1, &m2, &m3, &m4);
  5396.  
  5397.    graf();
  5398.  
  5399.    printf("Cursor limited to the center of the screen.\n");
  5400.    printf("Press the left mouse button to EXIT.");
  5401.  
  5402.    m1 = 1;               /* Function 1, show cursor */
  5403.    cmouses(&m1, &m2, &m3, &m4);
  5404.  
  5405.    m2 = 0;               /* Loop until left mouse   */
  5406.  
  5407.    while ( m2 != 1 ) {   /* button is pressed       */
  5408.        m1 = 3;
  5409.        cmouses(&m1, &m2, &m3, &m4);
  5410.        }
  5411.  
  5412.    m1 = 2;
  5413.    cmouses(&m1, &m2, &m3, &m4);
  5414.  }
  5415.  
  5416.  void chkdrv()
  5417.  {
  5418.    union REGS inregs, outregs;
  5419.    struct SREGS segregs;
  5420.    long address;
  5421.    unsign char first_byte;
  5422.  
  5423.    inregs.x.ax = 0x3533;
  5424.    intdosx ( &inregs, &outregs, &segregs );
  5425.    address=(((long)segregs.es)||16)+(long)outregs.x.bx;
  5426.    first_byte=*(long far *)address;
  5427.    If ((address == 0) || (first_byte == 0xcf)){
  5428.        printf("Mouse driver not installed");
  5429.        exit();
  5430.        }
  5431.  
  5432.  }
  5433.  
  5434.  void graf()
  5435.  {
  5436.    union REGS cpuregs;
  5437.  
  5438.    cpuregs.x.ax = 0x0006;
  5439.    int86 ( 0x10, &cpuregs, &cpuregs );
  5440.  }
  5441.  
  5442.  
  5443.  ───────────────────────────────────────────────────────────────────────────
  5444.  Piano Program Listing
  5445.  
  5446.  This section presents the complete source code for the Piano demonstration
  5447.  program that came in your Microsoft Mouse package. The program is written
  5448.  in BASIC for the IBM Personal Computer's BASIC Interpreter. (The Piano
  5449.  source program listing is also in the file PIANO.BAS on the Microsoft Mouse
  5450.  Tools Disk.)
  5451.  
  5452.  The following is an explanation of the program details:
  5453.  
  5454. ╓┌─────────────────────┌─────────────────────────────────────────────────────╖
  5455.  Line numbers          Comments
  5456.  ───────────────────────────────────────────────────────────────────────────
  5457.  1000-1090             Copyright message
  5458.  
  5459.  1100-1160             Set up music, clear graphics screen to blue.
  5460.  
  5461.  1170-1250             Read in the frequencies for the various piano keys
  5462.  Line numbers          Comments
  5463. 1170-1250             Read in the frequencies for the various piano keys
  5464.  
  5465.  1260-1380             Link the mouse software and the program.
  5466.  
  5467.  1390-1430             Function 15 sets the mouse sensitivity. With this
  5468.                        setting, a horizontal movement of 1.6 inches moves
  5469.                        the cursor across the entire screen. This relatively
  5470.                        high sensitivity permits songs to be played rapidly.
  5471.                        Accuracy is no problem since the piano keys are
  5472.                        large.
  5473.  
  5474.  1440-1620             The integer array CURSOR contains the screen and
  5475.                        cursor masks, which define the shape and color of
  5476.                        the cursor. These statements define the screen mask;
  5477.                        the mask is set to all ones. The mask is logically
  5478.                        ANDed with the screen under the cursor.
  5479.  
  5480.  1630-1810             Define the cursor mask. The values are XORed with the
  5481.                        result of the AND operation to create the cursor
  5482.                        shape and color. In this case, the cursor shape is a
  5483.  Line numbers          Comments
  5484.                       shape and color. In this case, the cursor shape is a
  5485.                        north-pointing arrowhead. Its color is the inverse of
  5486.                        whatever is under it.
  5487.  
  5488.  1820-1860             Function 9 sets the cursor shape. It also defines the
  5489.                        cursor hot spot. In this case, the hot spot is the
  5490.                        tip of the arrowhead. The mouse software
  5491.                        automatically prevents the cursor hot spot from
  5492.                        leaving the screen.
  5493.  
  5494.  1870-1930             Read in the Microsoft logo from precalculated data
  5495.                        and place the data on the screen.
  5496.  
  5497.  1940-2150             Draw the white and black piano keys.
  5498.  
  5499.  2160-2200             Draw the QUIT box in the lower-right corner.
  5500.  
  5501.  2210-2240             Function 4 centers the cursor to just under the piano
  5502.                        keys
  5503.  
  5504.  Line numbers          Comments
  5505. 
  5506.  2250                  Function 1 turns on the cursor. The cursor appears on
  5507.                        the screen and can be moved using the mouse.
  5508.  
  5509.  2260-2290             Function 3 gives the status of the two mouse buttons
  5510.                        and the location of the cursor. This is probably the
  5511.                        most common mouse function used in applications.
  5512.  
  5513.  2300-2370             Some decisions are made. If both mouse buttons are
  5514.                        up, or if the cursor is not on the piano keyboard,
  5515.                        then any sound that might be playing is turned off.
  5516.  
  5517.  2380-2430             At this point, the mouse button is down when the
  5518.                        cursor is over the QUIT box. The program turns off
  5519.                        the cursor, clears the screen, then quits.
  5520.  
  5521.  2440-2510             The program has determined that a button is down and
  5522.                        the cursor is over the piano keyboard. These
  5523.                        statements determine which key the mouse cursor is
  5524.                        over.
  5525.  Line numbers          Comments
  5526.                       over.
  5527.  
  5528.  2520-2570             The note is played by the SOUND statement set with
  5529.                        the correct frequency. This note is played in the
  5530.                        background as the program loops back to line 2090.
  5531.  
  5532.  2580-2630             This data contains the correct frequencies to play
  5533.                        the musical notes.
  5534.  
  5535.  2640-3050             Data to draw the Microsoft logo using the PUT
  5536.                        statement.
  5537.  
  5538.  
  5539.  1000 '
  5540.  1010 ' THE VIRTUAL PIANO
  5541.  1020 '
  5542.  1030 ' COPYRIGHT (C) 1983 BY MICROSOFT CORPORATION
  5543.  1040 ' WRITTEN BY CHRIS PETERS
  5544.  1050 '
  5545.  1060 '--------------------------------------------
  5546.  1070 '
  5547.  1080 ' INITIALIZE
  5548.  1090 '
  5549.  1100 DEFINT A-Z
  5550.  1110 DIM CURSOR(15,1),FREQ(27,2),MICROSOFT(839)
  5551.  1120 KEY OFF
  5552.  1130 PLAY"MF"
  5553.  1140 SCREEN 1
  5554.  1150 COLOR 1,1
  5555.  1160 CLS
  5556.  1170 '
  5557.  1180 ' Read in the flat, normal, and sharp note frequencies
  5558.  1190 '
  5559.  1200 FOR J=0 TO 2
  5560.  1210 FOR I=0 TO 6
  5561.  1220 READ K
  5562.  1230 FREQ(I,J)=K : FREQ(I+7,J)=K*2 : FREQ(I+14,J)=K*4 :
  5563.       FREQ(I+21,J)=K*8
  5564.  1240 NEXT
  5565.  1250 NEXT
  5566.  1260 '
  5567.  1270 ' Determine mouse driver location; if not found, quit.
  5568.  1280 '
  5569.  1290 DEF SEG=0
  5570.  1300 MSEG=256*PEEK(51*4+3)+PEEK(51*4+2)  'Get mouse segment
  5571.  1310 MOUSE=256*PEEK(51*4+1)+PEEK(51*4)+2 'Get mouse offset
  5572.  1320 IF MSEG OR (MOUSE-2) THEN 1370
  5573.  1330 PRINT"Mouse: Microsoft Mouse driver not found"
  5574.  1340 PRINT
  5575.  1350 PRINT"Press any key to return to system"
  5576.  1360 I$=INKEY$ : IF I$="" THEN 1360 ELSE SYSTEM
  5577.  1370 DEF SEG=MSEG                       'Set mouse segment
  5578.  1375 IF PEEK(MOUSE-2)=207 THEN 1330
  5579.  1380 M1=0 : CALL MOUSE(M1,M2,M3,M4)     'Initialize mouse
  5580.  1390 '
  5581.  1400 ' Set Mouse sensitivity
  5582.  1410 '
  5583.  1420 M1 = 15 : M3=4 : M4=8
  5584.  1430 CALL MOUSE(M1,M2,M3,M4)
  5585.  1440 '
  5586.  1450 ' Define the "logical and" cursor mask
  5587.  1460 '
  5588.  1470 CURSOR( 0,0)=&HFFFF ' Binary 1111111111111111
  5589.  1480 CURSOR( 1,0)=&HFFFF ' Binary 1111111111111111
  5590.  1490 CURSOR( 2,0)=&HFFFF ' Binary 1111111111111111
  5591.  1500 CURSOR( 3,0)=&HFFFF ' Binary 1111111111111111
  5592.  1510 CURSOR( 4,0)=&HFFFF ' Binary 1111111111111111
  5593.  1520 CURSOR( 5,0)=&HFFFF ' Binary 1111111111111111
  5594.  1530 CURSOR( 6,0)=&HFFFF ' Binary 1111111111111111
  5595.  1540 CURSOR( 7,0)=&HFFFF ' Binary 1111111111111111
  5596.  1550 CURSOR( 8,0)=&HFFFF ' Binary 1111111111111111
  5597.  1560 CURSOR( 9,0)=&HFFFF ' Binary 1111111111111111
  5598.  1570 CURSOR(10,0)=&HFFFF ' Binary 1111111111111111
  5599.  1580 CURSOR(11,0)=&HFFFF ' Binary 1111111111111111
  5600.  1590 CURSOR(12,0)=&HFFFF ' Binary 1111111111111111
  5601.  1600 CURSOR(13,0)=&HFFFF ' Binary 1111111111111111
  5602.  1610 CURSOR(14,0)=&HFFFF ' Binary 1111111111111111
  5603.  1620 CURSOR(15,0)=&HFFFF ' Binary 1111111111111111
  5604.  1630 '
  5605.  1640 ' Define the "exclusive or" cursor mask
  5606.  1650 '
  5607.  1660 CURSOR( 0,1)=&H0300 ' Binary 0000001100000000
  5608.  1670 CURSOR( 1,1)=&H0300 ' Binary 0000001100000000
  5609.  1680 CURSOR( 2,1)=&H0FC0 ' Binary 0000111111000000
  5610.  1690 CURSOR( 3,1)=&H0FC0 ' Binary 0000111111000000
  5611.  1700 CURSOR( 4,1)=&H3FF0 ' Binary 0011111111110000
  5612.  1710 CURSOR( 5,1)=&H3FF0 ' Binary 0011111111110000
  5613.  1720 CURSOR( 6,1)=&HFCFC ' Binary 1111110011111100
  5614.  1730 CURSOR( 7,1)=&HC00C ' Binary 1100000000001100
  5615.  1740 CURSOR( 8,1)=&H0000 ' Binary 0000000000000000
  5616.  1750 CURSOR( 9,1)=&H0000 ' Binary 0000000000000000
  5617.  1760 CURSOR(10,1)=&H0000 ' Binary 0000000000000000
  5618.  1770 CURSOR(11,1)=&H0000 ' Binary 0000000000000000
  5619.  1780 CURSOR(12,1)=&H0000 ' Binary 0000000000000000
  5620.  1790 CURSOR(13,1)=&H0000 ' Binary 0000000000000000
  5621.  1800 CURSOR(14,1)=&H0000 ' Binary 0000000000000000
  5622.  1810 CURSOR(15,1)=&H0000 ' Binary 0000000000000000
  5623.  1820 '
  5624.  1830 ' Set the mouse cursor shape
  5625.  1840 '
  5626.  1850 M1 = 9 : M2 = 6 : M3 = 0
  5627.  1860 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  5628.  1870 '
  5629.  1880 ' Draw the MICROSOFT logo from pre-calculated data
  5630.  1890 '
  5631.  1900 FOR I=0 TO 779
  5632.  1910 READ MICROSOFT(I)
  5633.  1920 NEXT
  5634.  1930 PUT(62,0),MICROSOFT,PSET
  5635.  1940 '
  5636.  1950 ' Initialize keyboard size parameters
  5637.  1960 '
  5638.  1970 YL = 60 : WKL = 80 : BKL = 45 : KW = 15 :
  5639.       WKN = 21
  5640.  1980 XL = 320-KW*WKN : YH = YL + WKL : XH = 319 :
  5641.       BKW2=KW3
  5642.  1990 QX = 272 : QY = 176
  5643.  2000 '
  5644.  2010 ' Draw the white keys
  5645.  2020 '
  5646.  2030 LINE (XL,YL)-(XH,YH),3,BF
  5647.  2040 FOR I=XL TO XH STEP KW
  5648.  2050 LINE (I,YL)-(I,YH),0
  5649.  2060 NEXT
  5650.  2070 '
  5651.  2080 ' Draw the "black" keys
  5652.  2090 '
  5653.  2100 C=6
  5654.  2110 FOR X=XL TO XH STEP KW
  5655.  2120 C=C+1 : IF C=7 THEN C=0
  5656.  2130 IF C=0 OR C=3 THEN 2150
  5657.  2140 LINE(X-BKW2,YL)-(X+BKW2,YL+BKL),2,BF
  5658.  2150 NEXT
  5659.  2160 '
  5660.  2170 ' Draw the quit box
  5661.  2180 '
  5662.  2190 LINE(QX,QY)-(319,199),3,B
  5663.  2200 LOCATE 24,36 : PRINT"Quit";
  5664.  2210 '
  5665.  2220 ' Set mouse cursor location, then turn on cursor
  5666.  2230 '
  5667.  2240 M1 = 4 : M3 = 320 : M4 = 160 : CALL MOUSE(M1,M2,M3,M4)
  5668.  2250 M1 = 1 : CALL MOUSE(M1,M2,M3,M4)
  5669.  2260 '
  5670.  2270 ' MAIN LOOP
  5671.  2280 '
  5672.  2290 M1=3 : CALL MOUSE(M1,BT,MX,MY)  'Get mouse location
  5673.                                        and button status
  5674.  2300 IF (BT AND 2) THEN OTV=7 : GOTO 2340
  5675.                     'If right button down, set high octave
  5676.  2310 IF (BT AND 1) THEN OTV=0 : GOTO 2340
  5677.                     'If left button down, set lower octave
  5678.  2320 SOUND 442,0   'If both buttons up, turn off sound
  5679.  2330 GOTO 2290     'Keep looping...
  5680.  2340 MX = MX2      'Correct for medium resolution screen
  5681.  2350 IF MX <= XL OR MY < YL THEN 2320   'If above keyboard,
  5682.                                           turn off sound
  5683.  2360 IF MY <= YH THEN 2470              'If on keyboard,
  5684.                                           play sound
  5685.  2370 IF MY < QY OR MX < QX THEN 2320'   'If above quit box,
  5686.                                          turn off sound
  5687.  2380 '
  5688.  2390 ' Button down inside the quit box
  5689.  2400 '
  5690.  2410 M1=2 : CALL MOUSE(M1,M2,M3,M4)  'Turn off mouse cursor
  5691.  2420 CLS ' Clear screen
  5692.  2430 END ' Quit
  5693.  2440 '
  5694.  2450 ' Button down over keyboard, determine which key
  5695.  2460 '
  5696.  2470 WKY = (MX-XL)kW+OTV : R = 1        'Get which white
  5697.                                           key cursor is over
  5698.  2480 IF MY > YL+BKL THEN 2560           'Is it lower than
  5699.                                           the black keys?
  5700.  2490 MK=(MX-XL) MOD KW  ' No, get which side of key
  5701.  2500 IF MK <= BKW2 THEN R=0 : GOTO 2560 'Is it the left
  5702.                                           black key?
  5703.  2510 IF MK >= KW-BKW2 THEN R=2  ' Is it the right black key?
  5704.  2520 '
  5705.  2530 ' Play the note. For BASIC interpreter duration = 2
  5706.  2540 ' For BASIC compiler duration = 1
  5707.  2550 '
  5708.  2560 SOUND FREQ(WKY,R),2
  5709.  2570 GOTO 2290  ' Continue looping
  5710.  2580 '
  5711.  2590 ' Musical note frequencies
  5712.  2600 '
  5713.  2610 DATA 131,139,156,175,185,208,233
  5714.  2620 DATA 131,147,165,175,196,220,247
  5715.  2630 DATA 139,156,165,185,208,233,247
  5716.  2640 '
  5717.  2650 ' Data to draw the MICROSOFT logo
  5718.  2660 '
  5719.  2670 DATA 462,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  5720.  2680 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  5721.  2690 DATA 0,0,0,-193,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  5722.  2700 DATA 0,0,0,0,0,768,-1,0,0,0,0,3840,-1,-16129,0,
  5723.   -253,0,0,-193,240
  5724.  2710 DATA 0,0,0,0,0,0,0,0,0,-193,0,16128,4095,252,
  5725.   16128,-1,240, -256,-769,0
  5726.  2720 DATA 0,0,0,0,-193,240,768,-1,255,768,-1,1023,-1,
  5727.   -1,240,0,0,0,-193,192
  5728.  2730 DATA -256,4095,252,-253,-1,255,-256,-1,240,-253,
  5729.   -1,-1,768,-1,255,16128,-1,-3841,768,-1
  5730.  2740 DATA 1023,-1,-1,240,0,0,0,-193,192,-256,4095,252,
  5731.   -193,-1,-3841,-256,-1, 252,-1009,0
  5732.  2750 DATA -256,4032,-1,-16129,-253,-1,-1,768,-1,1023,
  5733.   -1,-1,240,0,0,0,-193,240,-253,4095
  5734.  2760 DATA 252,-3841,0,-961,-256,-1,255,0,0,0,3840,-1,
  5735.   -16129,-241,0,-253,960,-1,1023,-1
  5736.  2770 DATA -1,240,0,0,0,-193,240,-253,4095,1020,255,0,
  5737.   -253,-256,4032,-16129,-1,-1,-1,4092
  5738.  2780 DATA 4095,-16129,-4033,0,16128,1008,-1,1023,-1,-1,
  5739.   240,0,0,0,-193,252,-241,4095,1020,252
  5740.  2790 DATA 0,-256,-256,960,-15361,252,0,0,4095,1023,
  5741.   -16129,-16321,0,3840,1008,255,0,3840,252,0
  5742.  2800 DATA 0,0,0,-193,252,-241,4095,4092,240,0,16128,
  5743.   -64,192,-16129,0,0,0,3840,255,0
  5744.  2810 DATA 255,0,768,1020,255,0,3840,252,0,0,0,0,-193,
  5745.   255,-193,4095,4092,240,0,16128
  5746.  2820 DATA -64,192,-12289,-1,192,-241,-12289,-3841,0,
  5747.   255,0,768,1020,255,0,3840,252,0,0,0
  5748.  2830 DATA 0,-193,255,-193,4095,16380,192,0,3840,-16,
  5749.   960,-12289,240,0,0,-15553,-1,768,252,0
  5750.  2840 DATA 0,1023,255,0,3840,252,0,0,0,0,-193,-16129,
  5751.   -1,4095,16380,192,0,0,-256,4032
  5752.  2850 DATA -16129,0,0,0,768,-1,1008,252,0,0,1023,-1,
  5753.   255,3840,252,0,0,0,0,-3265
  5754.  2860 DATA -16129,-3073,4095,16380,192,0,0,-256,-1,4095,
  5755.   -1,0,-253,-16129,-1,1020,252,0,0,1023
  5756.  2870 DATA -1,255,3840,252,0,0,0,0,-3265,-3073,-3073,
  5757.   4095,16380,192,0,0,-256,-1,4095,240
  5758.  2880 DATA 0,0,-16321,-241,1023,252,0,0,1023,-1,255,
  5759.   3840,252,0,0,0,0,-4033,-3073,-15361
  5760.  2890 DATA 4095,16380,192,0,0,-256,-1,252,0,0,0,0,16128,
  5761.   -15361,252,0,0,1023,-1,255
  5762.  2900 DATA 3840,252,0,0,0,0,-4033,-1,-15361,4095,16380,192,
  5763.   0,0,-256,-1,4092,240,0,0
  5764.  2910 DATA -16321,768,-3073,252,0,0,1023,255,0,3840,252,0,
  5765.   0,0,0,-4033,-193,1023,4095,4092
  5766.  2920 DATA 240,0,0,-256,-64,4092,-1,192,-241,-16129,0,
  5767.   -3841,255,0,768,1020,255,0,3840,252
  5768.  2930 DATA 0,0,0,0,-4033,-193,1023,4095,4092,240,0,16128,
  5769.   -64,4032,255,0,0,0,16128,252
  5770.  2940 DATA -3841,255,0,768,1020,255,0,3840,252,0,0,0,0,
  5771.   -4033,-241,1020,4095,1020,252,0
  5772.  2950 DATA -256,-256,960,1023,252,0,0,16383,1023,-3841,
  5773.   -16321,0,3840,1008,255,0,3840,252,0,0
  5774.  2960 DATA 0,0,-4033,-241,1020,4095,1020,255,0,-253,-256,
  5775.   960,-16129,-1,-1,-1,16380,-1,-3841,-4033
  5776.  2970 DATA 0,16128,1008,255,0,3840,252,0,0,0,0,-4033,-253,
  5777.   1008,4095,252,-3841,0,-961,-256
  5778.  2980 DATA 192,-16129,0,0,0,3840,-1,-16129,-241,0,-253,960,
  5779.   255,0,3840,252,0,0,0,0
  5780.  2990 DATA -4033,-253,1008,4095,252,-193,768,-3841,-256,
  5781.   192,-16129,-1009,0,-256,4032,-1,255,-253,240,-193
  5782.  3000 DATA 768,255,0,3840,252,0,0,0,0,-4033,-256,960,4095,
  5783.   252,-253,-1,255,-256,192,-16129
  5784.  3010 DATA -253,-1,-1,768,-1,252,16128,-1,-3841,768,255,0,
  5785.   3840,252,0,0,0,0,-4033,-256
  5786.  3020 DATA 960,4095,252,16128,-1,240,-256,192,-16129,0,0,
  5787.   0,0,-193,192,768,-1,255,768,255
  5788.  3030 DATA 0,3840,252,0,0,0,0,0,0,0,0,0,768,-1,0,0,0,0,3840,-1
  5789.  3040 DATA -16129,0,0,0,0,-193,240,0,0,0,0,0,0,0,0,0,0,0,0,0
  5790.  3050 DATA 0,0,0,0,0,0,0,0,-193,240,0,0,0,0,0,0,0,0,0,0
  5791.  
  5792.  
  5793.  ───────────────────────────────────────────────────────────────────────────
  5794.  Sample Cursors
  5795.  
  5796.  This section describes the following sample graphics cursors:
  5797.  
  5798.   ■  Standard Cursor Shape
  5799.  
  5800.   ■  Up Arrow
  5801.  
  5802.   ■  Left Arrow
  5803.  
  5804.   ■  Check Mark
  5805.  
  5806.   ■  Pointing Hand
  5807.  
  5808.   ■  Diagonal Cross
  5809.  
  5810.   ■  Rectangular Cross
  5811.  
  5812.   ■  Hourglass
  5813.  
  5814.  These sample cursors illustrate the wide variety of cursor shapes that
  5815.  can be defined for use in application programs.
  5816.  
  5817.  The sample cursors are designed for high-resolution graphics mode.
  5818.  Each cursor is a white shape with a black outline on a transparent field.
  5819.  The shape typically suggests the type of action you may take with the
  5820.  mouse. For example, an arrow usually means "make a selection by pointing at
  5821.  an item."
  5822.  
  5823.  To use a sample cursor in an interpretive BASIC program, copy the
  5824.  BASIC statements presented for the cursor directly to your program. Type
  5825.  the statements exactly as shown, using line numbers that are consistent
  5826.  with your program's numbering scheme.
  5827.  
  5828.  To use a sample cursor in an assembly- or high-level-language program,
  5829.  define an array in your program and assign the values given for each cursor
  5830.  to the array elements. Assign the values in a way that will make their
  5831.  storage order identical to their storage order in a BASIC program.
  5832.  
  5833.  The statements in this section define only the cursor's shape. It is
  5834.  up to you to define the action associated with a cursor by including the
  5835.  necessary statements in your program.
  5836.  
  5837.  
  5838.  Standard Cursor Shape
  5839.  
  5840.  The standard cursor shape is a solid arrow that points up and to the left.
  5841.  The hot spot is just beyond the arrow's tip, so you can point to an item
  5842.  without covering it. The standard cursor is the most convenient shape when
  5843.  using the mouse to choose or select items from the screen.
  5844.  
  5845.   100 '
  5846.   200 ' Define the screen mask
  5847.   300 '
  5848.   400 CURSOR( 0,0)=&H3FFF 'Binary 0011111111111111
  5849.   500 CURSOR( 1,0)=&H1FFF 'Binary 0001111111111111
  5850.   600 CURSOR( 2,0)=&H0FFF 'Binary 0000111111111111
  5851.   700 CURSOR( 3,0)=&H07FF 'Binary 0000011111111111
  5852.   800 CURSOR( 4,0)=&H03FF 'Binary 0000001111111111
  5853.   900 CURSOR( 5,0)=&H01FF 'Binary 0000000111111111
  5854.  1000 CURSOR( 6,0)=&H00FF 'Binary 0000000011111111
  5855.  1100 CURSOR( 7,0)=&H007F 'Binary 0000000001111111
  5856.  1200 CURSOR( 8,0)=&H003F 'Binary 0000000000111111
  5857.  1300 CURSOR( 9,0)=&H001F 'Binary 0000000000011111
  5858.  1400 CURSOR(10,0)=&H01FF 'Binary 0000000111111111
  5859.  1500 CURSOR(11,0)=&H10FF 'Binary 0001000011111111
  5860.  1600 CURSOR(12,0)=&H30FF 'Binary 0011000011111111
  5861.  1700 CURSOR(13,0)=&HF87F 'Binary 1111100001111111
  5862.  1800 CURSOR(14,0)=&HF87F 'Binary 1111100001111111
  5863.  1900 CURSOR(15,0)=&HFC3F 'Binary 1111110000111111
  5864.  2000 '
  5865.  2100 ' Define the cursor mask
  5866.  2200 '
  5867.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  5868.  2400 CURSOR( 1,1)=&H4000 'Binary 0100000000000000
  5869.  2500 CURSOR( 2,1)=&H6000 'Binary 0110000000000000
  5870.  2600 CURSOR( 3,1)=&H7000 'Binary 0111000000000000
  5871.  2700 CURSOR( 4,1)=&H7800 'Binary 0111100000000000
  5872.  2800 CURSOR( 5,1)=&H7C00 'Binary 0111110000000000
  5873.  2900 CURSOR( 6,1)=&H7E00 'Binary 0111111000000000
  5874.  3000 CURSOR( 7,1)=&H7F00 'Binary 0111111100000000
  5875.  3100 CURSOR( 8,1)=&H7F80 'Binary 0111111110000000
  5876.  3200 CURSOR( 9,1)=&H78C0 'Binary 0111111111000000
  5877.  3300 CURSOR(10,1)=&H7C00 'Binary 0111110000000000
  5878.  3400 CURSOR(11,1)=&H4600 'Binary 0100011000000000
  5879.  3500 CURSOR(12,1)=&H0600 'Binary 0000011000000000
  5880.  3600 CURSOR(13,1)=&H0300 'Binary 0000001100000000
  5881.  3700 CURSOR(14,1)=&H0300 'Binary 0000001100000000
  5882.  3800 CURSOR(15,1)=&H0180 'Binary 0000000110000000
  5883.  3900 '
  5884.  4000 '  Set the mouse cursor shape, color, and hot
  5885.  4050 '  spot
  5886.  4100 '
  5887.  4200 M1% = 9
  5888.  4300 M2% = -1  ' Horizontal hot spot
  5889.  4400 M3% = -1  ' Vertical hot spot
  5890.  4500 CALL MOUSE(M1%,M2%,M3%,CURSOR(0,0))
  5891.  
  5892.  
  5893.  Up Arrow
  5894.  
  5895.  The up arrow is a solid, up-directed arrow with the hot spot at the tip.
  5896.  This shape is useful when directing a motion on the screen with the mouse.
  5897.  
  5898.   100 '
  5899.   200 '  Define the screen mask
  5900.   300 '
  5901.   400 CURSOR( 0,0)=&HF9FF 'Binary 1111100111111111
  5902.   500 CURSOR( 1,0)=&HF0FF 'Binary 1111000011111111
  5903.   600 CURSOR( 2,0)=&HE07F 'Binary 1110000001111111
  5904.   700 CURSOR( 3,0)=&HE07F 'Binary 1110000001111111
  5905.   800 CURSOR( 4,0)=&HC03F 'Binary 1100000000111111
  5906.   900 CURSOR( 5,0)=&HC03F 'Binary 1100000000111111
  5907.  1000 CURSOR( 6,0)=&H801F 'Binary 1000000000011111
  5908.  1100 CURSOR( 7,0)=&H801F 'Binary 1000000000011111
  5909.  1200 CURSOR( 8,0)=&H000F 'Binary 0000000000001111
  5910.  1300 CURSOR( 9,0)=&H000F 'Binary 0000000000001111
  5911.  1400 CURSOR(10,0)=&HF0FF 'Binary 1111000011111111
  5912.  1500 CURSOR(11,0)=&HF0FF 'Binary 1111000011111111
  5913.  1600 CURSOR(12,0)=&HF0FF 'Binary 1111000011111111
  5914.  1700 CURSOR(13,0)=&HF0FF 'Binary 1111000011111111
  5915.  1800 CURSOR(14,0)=&HF0FF 'Binary 1111000011111111
  5916.  1900 CURSOR(15,0)=&HF0FF 'Binary 1111000011111111
  5917.  2000 '
  5918.  2100 '  Define the cursor mask
  5919.  2200 '
  5920.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  5921.  2400 CURSOR( 1,1)=&H0600 'Binary 0000011000000000
  5922.  2500 CURSOR( 2,1)=&H0F00 'Binary 0000111100000000
  5923.  2600 CURSOR( 3,1)=&H0F00 'Binary 0000111100000000
  5924.  2700 CURSOR( 4,1)=&H1F80 'Binary 0001111110000000
  5925.  2800 CURSOR( 5,1)=&H1F80 'Binary 0001111110000000
  5926.  2900 CURSOR( 6,1)=&H3FC0 'Binary 0011111111000000
  5927.  3000 CURSOR( 7,1)=&H3FC0 'Binary 0011111111000000
  5928.  3100 CURSOR( 8,1)=&H7FE0 'Binary 0111111111100000
  5929.  3200 CURSOR( 9,1)=&H0600 'Binary 0000011000000000
  5930.  3300 CURSOR(10,1)=&H0600 'Binary 0000011000000000
  5931.  3400 CURSOR(11,1)=&H0600 'Binary 0000011000000000
  5932.  3500 CURSOR(12,1)=&H0600 'Binary 0000011000000000
  5933.  3600 CURSOR(13,1)=&H0600 'Binary 0000011000000000
  5934.  3700 CURSOR(14,1)=&H0600 'Binary 0000011000000000
  5935.  3800 CURSOR(15,1)=&H0000 'Binary 0000000000000000
  5936.  3900 '
  5937.  4000 '  Set the mouse cursor shape, color, and hot
  5938.  4050 '  spot
  5939.  4100 '
  5940.  4200 M1 = 9
  5941.  4300 M2 = 5  ' Horizontal hot spot
  5942.  4400 M3 = 0  ' Vertical hot spot
  5943.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  5944.  
  5945.  
  5946.  Left Arrow
  5947.  
  5948.  The left arrow is a solid, left-directed arrow with the hot spot at the
  5949.  tip. This shape is useful when directing a motion on the screen with the
  5950.  mouse. To generate a right arrow, just reverse the binary bit pattern for
  5951.  each array element and move the hot spot to the new tip. For example, the
  5952.  first element, Binary 1111111000011111 (&HFE1F), becomes Binary
  5953.  1111100001111111 (&HF87F).
  5954.  
  5955.   100 '
  5956.   200 '  Define the screen mask
  5957.   300 '
  5958.   400 CURSOR( 0,0)=&HFE1F 'Binary 1111111000011111
  5959.   500 CURSOR( 1,0)=&HF01F 'Binary 1111000000011111
  5960.   600 CURSOR( 2,0)=&H0000 'Binary 0000000000000000
  5961.   700 CURSOR( 3,0)=&H0000 'Binary 0000000000000000
  5962.   800 CURSOR( 4,0)=&H0000 'Binary 0000000000000000
  5963.   900 CURSOR( 5,0)=&HF01F 'Binary 1111000000011111
  5964.  1000 CURSOR( 6,0)=&HFE1F 'Binary 1111111000011111
  5965.  1100 CURSOR( 7,0)=&HFFFF 'Binary 1111111111111111
  5966.  1200 CURSOR( 8,0)=&HFFFF 'Binary 1111111111111111
  5967.  1300 CURSOR( 9,0)=&HFFFF 'Binary 1111111111111111
  5968.  1400 CURSOR(10,0)=&HFFFF 'Binary 1111111111111111
  5969.  1500 CURSOR(11,0)=&HFFFF 'Binary 1111111111111111
  5970.  1600 CURSOR(12,0)=&HFFFF 'Binary 1111111111111111
  5971.  1700 CURSOR(13,0)=&HFFFF 'Binary 1111111111111111
  5972.  1800 CURSOR(14,0)=&HFFFF 'Binary 1111111111111111
  5973.  1900 CURSOR(15,0)=&HFFFF 'Binary 1111111111111111
  5974.  2000
  5975.  2100 '  Define the cursor mask
  5976.  2200 '
  5977.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  5978.  2400 CURSOR( 1,1)=&H00C0 'Binary 0000000011000000
  5979.  2500 CURSOR( 2,1)=&H07C0 'Binary 0000011111000000
  5980.  2600 CURSOR( 3,1)=&H7FFE 'Binary 0111111111111110
  5981.  2700 CURSOR( 4,1)=&H07C0 'Binary 0000011111000000
  5982.  2800 CURSOR( 5,1)=&H07C0 'Binary 0000000011000000
  5983.  2900 CURSOR( 6,1)=&H0000 'Binary 0000000000000000
  5984.  3000 CURSOR( 7,1)=&H0000 'Binary 0000000000000000
  5985.  3100 CURSOR( 8,1)=&H0000 'Binary 0000000000000000
  5986.  3200 CURSOR( 9,1)=&H0000 'Binary 0000000000000000
  5987.  3300 CURSOR(10,1)=&H0000 'Binary 0000000000000000
  5988.  3400 CURSOR(11,1)=&H0000 'Binary 0000000000000000
  5989.  3500 CURSOR(12,1)=&H0000 'Binary 0000000000000000
  5990.  3600 CURSOR(13,1)=&H0000 'Binary 0000000000000000
  5991.  3700 CURSOR(14,1)=&H0000 'Binary 0000000000000000
  5992.  3800 CURSOR(15,1)=&H0000 'Binary 0000000000000000
  5993.  3900 '
  5994.  4000 '  Set the mouse cursor shape, color, and hot
  5995.  4050 '  spot
  5996.  4100 '
  5997.  4200 M1 = 9
  5998.  4300 M2 = 0   ' Horizontal hot spot
  5999.  4400 M3 = 3   ' Vertical hot spot
  6000.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  6001.  
  6002.  
  6003.  Check Mark
  6004.  
  6005.  The check mark is a solid figure with the hot spot in the center of the "V"
  6006.  formed by the check. This shape can be used when checking off items in a
  6007.  list with the mouse or while a program is checking some aspect of its
  6008.  operation.
  6009.  
  6010.   100 '
  6011.   200 '  Define the screen mask
  6012.   300 '
  6013.   400 CURSOR( 0,0)=&HFFF0 'Binary 1111111111110000
  6014.   500 CURSOR( 1,0)=&HFFE0 'Binary 1111111111100000
  6015.   600 CURSOR( 2,0)=&HFFCO 'Binary 1111111111000000
  6016.   700 CURSOR( 3,0)=&HFF81 'Binary 1111111110000001
  6017.   800 CURSOR( 4,0)=&HFF03 'Binary 1111111100000011
  6018.   900 CURSOR( 5,0)=&H0607 'Binary 0000011000000111
  6019.  1000 CURSOR( 6,0)=&H000F 'Binary 0000000000001111
  6020.  1100 CURSOR( 7,0)=&H001F 'Binary 0000000000011111
  6021.  1200 CURSOR( 8,0)=&HC03F 'Binary 1100000000111111
  6022.  1300 CURSOR( 9,0)=&HF07F 'Binary 1111000001111111
  6023.  1400 CURSOR(10,0)=&HFFFF 'Binary 1111111111111111
  6024.  1500 CURSOR(11,0)=&HFFFF 'Binary 1111111111111111
  6025.  1600 CURSOR(12,0)=&HFFFF 'Binary 1111111111111111
  6026.  1700 CURSOR(13,0)=&HFFFF 'Binary 1111111111111111
  6027.  1800 CURSOR(14,0)=&HFFFF 'Binary 1111111111111111
  6028.  1900 CURSOR(15,0)=&HFFFF 'Binary 1111111111111111
  6029.  2000 '
  6030.  2100 '  Define the cursor mask
  6031.  2200 '
  6032.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  6033.  2400 CURSOR( 1,1)=&H0006 'Binary 0000000000000110
  6034.  2500 CURSOR( 2,1)=&H000C 'Binary 0000000000001100
  6035.  2600 CURSOR( 3,1)=&H0018 'Binary 0000000000011000
  6036.  2700 CURSOR( 4,1)=&H0030 'Binary 0000000000110000
  6037.  2800 CURSOR( 5,1)=&H0060 'Binary 0000000001100000
  6038.  2900 CURSOR( 6,1)=&H70C0 'Binary 0111000011000000
  6039.  3000 CURSOR( 7,1)=&H1D80 'Binary 0001110110000000
  6040.  3100 CURSOR( 8,1)=&H0700 'Binary 0000011100000000
  6041.  3200 CURSOR( 9,1)=&H0000 'Binary 0000000000000000
  6042.  3300 CURSOR(10,1)=&H0000 'Binary 0000000000000000
  6043.  3400 CURSOR(11,1)=&H0000 'Binary 0000000000000000
  6044.  3500 CURSOR(12,1)=&H0000 'Binary 0000000000000000
  6045.  3600 CURSOR(13,1)=&H0000 'Binary 0000000000000000
  6046.  3700 CURSOR(14,1)=&H0000 'Binary 0000000000000000
  6047.  3800 CURSOR(15,1)=&H0000 'Binary 0000000000000000
  6048.  3900 '
  6049.  4000 '  Set the mouse cursor shape, color, and hot
  6050.  4050 '  spot
  6051.  4100 '
  6052.  4200 M1 = 9
  6053.  4300 M2 = 6   ' Horizontal hot spot
  6054.  4400 M3 = 7   ' Vertical hot spot
  6055.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  6056.  
  6057.  
  6058.  Pointing Hand
  6059.  
  6060.  The pointing hand is a solid figure with the hot spot at the tip of the
  6061.  extended finger. The pointing hand is another convenient shape to use when
  6062.  choosing or selecting items from the screen, especially if the items are
  6063.  represented by icons or symbols such as the keys of a piano keyboard or a
  6064.  calculator.
  6065.  
  6066.   100 '
  6067.   200 '  Define the screen mask
  6068.   300 '
  6069.   400 CURSOR( 0,0)=&HE1FF 'Binary 1110000111111111
  6070.   500 CURSOR( 1,0)=&HE1FF 'Binary 1110000111111111
  6071.   600 CURSOR( 2,0)=&HE1FF 'Binary 1110000111111111
  6072.   700 CURSOR( 3,0)=&HE1FF 'Binary 1110000111111111
  6073.   800 CURSOR( 4,0)=&HE1FF 'Binary 1110000111111111
  6074.   900 CURSOR( 5,0)=&HE000 'Binary 1110000000000000
  6075.  1000 CURSOR( 6,0)=&HE000 'Binary 1110000000000000
  6076.  1100 CURSOR( 7,0)=&HE000 'Binary 1110000000000000
  6077.  1200 CURSOR( 8,0)=&H0000 'Binary 0000000000000000
  6078.  1300 CURSOR( 9,0)=&H0000 'Binary 0000000000000000
  6079.  1400 CURSOR(10,0)=&H0000 'Binary 0000000000000000
  6080.  1500 CURSOR(11,0)=&H0000 'Binary 0000000000000000
  6081.  1600 CURSOR(12,0)=&H0000 'Binary 0000000000000000
  6082.  1700 CURSOR(13,0)=&H0000 'Binary 0000000000000000
  6083.  1800 CURSOR(14,0)=&H0000 'Binary 0000000000000000
  6084.  1900 CURSOR(15,0)=&H0000 'Binary 0000000000000000
  6085.  2000 '
  6086.  2100 '  Define the cursor mask
  6087.  2200 '
  6088.  2300 CURSOR( 0,1)=&H1E00 'Binary 0001111000000000
  6089.  2400 CURSOR( 1,1)=&H1200 'Binary 0001001000000000
  6090.  2500 CURSOR( 2,1)=&H1200 'Binary 0001001000000000
  6091.  2600 CURSOR( 3,1)=&H1200 'Binary 0001001000000000
  6092.  2700 CURSOR( 4,1)=&H1200 'Binary 0001001000000000
  6093.  2800 CURSOR( 5,1)=&H13FF 'Binary 0001001111111111
  6094.  2900 CURSOR( 6,1)=&H1249 'Binary 0001001001001001
  6095.  3000 CURSOR( 7,1)=&H1249 'Binary 0001001001001001
  6096.  3100 CURSOR( 8,1)=&HF249 'Binary 1111001001001001
  6097.  3200 CURSOR( 9,1)=&H9001 'Binary 1001000000000001
  6098.  3300 CURSOR(10,1)=&H9001 'Binary 1001000000000001
  6099.  3400 CURSOR(11,1)=&H9001 'Binary 1001000000000001
  6100.  3500 CURSOR(12,1)=&H8001 'Binary 1000000000000001
  6101.  3600 CURSOR(13,1)=&H8001 'Binary 1000000000000001
  6102.  3700 CURSOR(14,1)=&H8001 'Binary 1000000000000001
  6103.  3800 CURSOR(15,1)=&HFFFF 'Binary 1111111111111111
  6104.  3900 '
  6105.  4000 '  Set the mouse cursor shape, color, and hot
  6106.  4050 '  spot
  6107.  4100 '
  6108.  4200 M1 = 9
  6109.  4300 M2 = 5   ' Horizontal hot spot
  6110.  4400 M3 = 0   ' Vertical hot spot
  6111.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  6112.  
  6113.  
  6114.  Diagonal Cross
  6115.  
  6116.  The diagonal cross is a solid figure with the hot spot at the center of the
  6117.  cross. This shape is useful as a pointer in a game, or when canceling an
  6118.  operation or deleting an item from a list.
  6119.  
  6120.   100 '
  6121.   200 '  Define the screen mask
  6122.   300 '
  6123.   400 CURSOR( 0,0)=&H07E0 'Binary 0000011111100000
  6124.   500 CURSOR( 1,0)=&H0180 'Binary 0000000110000000
  6125.   600 CURSOR( 2,0)=&H0000 'Binary 0000000000000000
  6126.   700 CURSOR( 3,0)=&HC003 'Binary 1100000000000011
  6127.   800 CURSOR( 4,0)=&HF00F 'Binary 1111000000001111
  6128.   900 CURSOR( 5,0)=&HC003 'Binary 1100000000000011
  6129.  1000 CURSOR( 6,0)=&H0000 'Binary 0000000000000000
  6130.  1100 CURSOR( 7,0)=&H0180 'Binary 0000000110000000
  6131.  1200 CURSOR( 8,0)=&H07E0 'Binary 0000011111000000
  6132.  1300 CURSOR( 9,0)=&HFFFF 'Binary 1111111111111111
  6133.  1400 CURSOR(10,0)=&HFFFF 'Binary 1111111111111111
  6134.  1500 CURSOR(11,0)=&HFFFF 'Binary 1111111111111111
  6135.  1600 CURSOR(12,0)=&HFFFF 'Binary 1111111111111111
  6136.  1700 CURSOR(13,0)=&HFFFF 'Binary 1111111111111111
  6137.  1800 CURSOR(14,0)=&HFFFF 'Binary 1111111111111111
  6138.  1900 CURSOR(15,0)=&HFFFF 'Binary 1111111111111111
  6139.  2000 '
  6140.  2100 '  Define the cursor mask
  6141.  2200 '
  6142.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  6143.  2400 CURSOR( 1,1)=&H700E 'Binary 0111000000001110
  6144.  2500 CURSOR( 2,1)=&H1C38 'Binary 0001110000111000
  6145.  2600 CURSOR( 3,1)=&H0660 'Binary 0000011001100000
  6146.  2700 CURSOR( 4,1)=&H03C0 'Binary 0000001111000000
  6147.  2800 CURSOR( 5,1)=&H0660 'Binary 0000011001100000
  6148.  2900 CURSOR( 6,1)=&H1C38 'Binary 0001110000111000
  6149.  3000 CURSOR( 7,1)=&H700E 'Binary 0111000000001110
  6150.  3100 CURSOR( 8,1)=&H0000 'Binary 0000000000000000
  6151.  3200 CURSOR( 9,1)=&H0000 'Binary 0000000000000000
  6152.  3300 CURSOR(10,1)=&H0000 'Binary 0000000000000000
  6153.  3400 CURSOR(11,1)=&H0000 'Binary 0000000000000000
  6154.  3500 CURSOR(12,1)=&H0000 'Binary 0000000000000000
  6155.  3600 CURSOR(13,1)=&H0000 'Binary 0000000000000000
  6156.  3700 CURSOR(14,1)=&H0000 'Binary 0000000000000000
  6157.  3800 CURSOR(15,1)=&H0000 'Binary 0000000000000000
  6158.  3900 '
  6159.  4000 '  Set the mouse cursor shape, color, and hot
  6160.  4050 '  spot
  6161.  4100 '
  6162.  4200 M1 = 9
  6163.  4300 M2 = 7   ' Horizontal hot spot
  6164.  4400 M3 = 4   ' Vertical hot spot
  6165.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  6166.  
  6167.  
  6168.  Rectangular Cross
  6169.  
  6170.  The rectangular cross is a solid figure with the hot spot at the center of
  6171.  the cross. This shape is useful as a pointer in a game, or when inserting
  6172.  items into a list.
  6173.  
  6174.   100 '
  6175.   200 '  Define the screen mask
  6176.   300 '
  6177.   400 CURSOR( 0,0)=&HFC3F 'Binary 1111110000111111
  6178.   500 CURSOR( 1,0)=&HFC3F 'Binary 1111110000111111
  6179.   600 CURSOR( 2,0)=&HFC3F 'Binary 1111110000111111
  6180.   700 CURSOR( 3,0)=&H0000 'Binary 0000000000000000
  6181.   800 CURSOR( 4,0)=&H0000 'Binary 0000000000000000
  6182.   900 CURSOR( 5,0)=&H0000 'Binary 0000000000000000
  6183.  1000 CURSOR( 6,0)=&HFC3F 'Binary 1111110000111111
  6184.  1100 CURSOR( 7,0)=&HFC3F 'Binary 1111110000111111
  6185.  1200 CURSOR( 8,0)=&HFC3F 'Binary 1111110000111111
  6186.  1300 CURSOR( 9,0)=&HFFFF 'Binary 1111111111111111
  6187.  1400 CURSOR(10,0)=&HFFFF 'Binary 1111111111111111
  6188.  1500 CURSOR(11,0)=&HFFFF 'Binary 1111111111111111
  6189.  1600 CURSOR(12,0)=&HFFFF 'Binary 1111111111111111
  6190.  1700 CURSOR(13,0)=&HFFFF 'Binary 1111111111111111
  6191.  1800 CURSOR(14,0)=&HFFFF 'Binary 1111111111111111
  6192.  1900 CURSOR(15,0)=&HFFFF 'Binary 1111111111111111
  6193.  2000 '
  6194.  2100 '  Define the cursor mask
  6195.  2200 '
  6196.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  6197.  2400 CURSOR( 1,1)=&H0180 'Binary 0000000110000000
  6198.  2500 CURSOR( 2,1)=&H0180 'Binary 0000000110000000
  6199.  2600 CURSOR( 3,1)=&H0180 'Binary 0000000110000000
  6200.  2700 CURSOR( 4,1)=&H7FFE 'Binary 0111111111111110
  6201.  2800 CURSOR( 5,1)=&H0180 'Binary 0000000110000000
  6202.  2900 CURSOR( 6,1)=&H0180 'Binary 0000000110000000
  6203.  3000 CURSOR( 7,1)=&H0180 'Binary 0000000110000000
  6204.  3100 CURSOR( 8,1)=&H0000 'Binary 0000000000000000
  6205.  3200 CURSOR( 9,1)=&H0000 'Binary 0000000000000000
  6206.  3300 CURSOR(10,1)=&H0000 'Binary 0000000000000000
  6207.  3400 CURSOR(11,1)=&H0000 'Binary 0000000000000000
  6208.  3500 CURSOR(12,1)=&H0000 'Binary 0000000000000000
  6209.  3600 CURSOR(13,1)=&H0000 'Binary 0000000000000000
  6210.  3700 CURSOR(14,1)=&H0000 'Binary 0000000000000000
  6211.  3800 CURSOR(15,1)=&H0000 'Binary 0000000000000000
  6212.  3900 '
  6213.  4000 '  Set the mouse cursor shape, color, and hot
  6214.  4050 '  spot
  6215.  4100 '
  6216.  4200 M1 = 9
  6217.  4300 M2 = 7   ' Horizontal hot spot
  6218.  4400 M3 = 4   ' Vertical hot spot
  6219.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  6220.  
  6221.  
  6222.  Hourglass
  6223.  
  6224.  The hourglass is a solid figure with the hot spot at the center of the
  6225.  glass. This shape can be used to show that the operation in progress will
  6226.  take some time to complete.
  6227.  
  6228.   100 '
  6229.   200 '  Define the screen mask
  6230.   300 '
  6231.   500 CURSOR( 1,0)=&H0000 'Binary 0000000000000000
  6232.   600 CURSOR( 2,0)=&H0000 'Binary 0000000000000000
  6233.   700 CURSOR( 3,0)=&H0000 'Binary 0000000000000000
  6234.   800 CURSOR( 4,0)=&H8001 'Binary 1000000000000001
  6235.   900 CURSOR( 5,0)=&HC003 'Binary 1100000000000011
  6236.  1000 CURSOR( 6,0)=&HE007 'Binary 1110000000000111
  6237.  1100 CURSOR( 7,0)=&HF00F 'Binary 1111000000001111
  6238.  1200 CURSOR( 8,0)=&HE007 'Binary 1110000000000111
  6239.  1300 CURSOR( 9,0)=&HC003 'Binary 1100000000000011
  6240.  1400 CURSOR(10,0)=&H8001 'Binary 1000000000000001
  6241.  1500 CURSOR(11,0)=&H0000 'Binary 0000000000000000
  6242.  1600 CURSOR(12,0)=&H0000 'Binary 0000000000000000
  6243.  1700 CURSOR(13,0)=&H0000 'Binary 0000000000000000
  6244.  1800 CURSOR(14,0)=&H0000 'Binary 0000000000000000
  6245.  1900 CURSOR(15,0)=&HFFFF 'Binary 1111111111111111
  6246.  2000 '
  6247.  2100 '  Define the cursor mask
  6248.  2200 '
  6249.  2300 CURSOR( 0,1)=&H0000 'Binary 0000000000000000
  6250.  2400 CURSOR( 1,1)=&H7FFE 'Binary 0111111111111110
  6251.  2500 CURSOR( 2,1)=&H6006 'Binary 0110000000000110
  6252.  2600 CURSOR( 3,1)=&H300C 'Binary 0011000000001100
  6253.  2700 CURSOR( 4,1)=&H1818 'Binary 0001100000011000
  6254.  2800 CURSOR( 5,1)=&H0C30 'Binary 0000110000110000
  6255.  2900 CURSOR( 6,1)=&H0660 'Binary 0000011001100000
  6256.  3000 CURSOR( 7,1)=&H03C0 'Binary 0000001111000000
  6257.  3100 CURSOR( 8,1)=&H0660 'Binary 0000011001100000
  6258.  3200 CURSOR( 9,1)=&H0C30 'Binary 0000110000110000
  6259.  3300 CURSOR(10,1)=&H1998 'Binary 0001100110011000
  6260.  3400 CURSOR(11,1)=&H33CC 'Binary 0011001111001100
  6261.  3500 CURSOR(12,1)=&H67E6 'Binary 0110011111100110
  6262.  3600 CURSOR(13,1)=&H7FFE 'Binary 0111111111111110
  6263.  3700 CURSOR(14,1)=&H0000 'Binary 0000000000000000
  6264.  3800 CURSOR(15,1)=&H0000 'Binary 0000000000000000
  6265.  3900 '
  6266.  4000 '  Set the mouse cursor shape, color, and hot
  6267.  4050 '  spot
  6268.  4100 '
  6269.  4200 M1 = 9
  6270.  4300 M2 = 7   ' Horizontal hot spot
  6271.  4400 M3 = 7   ' Vertical hot spot
  6272.  4500 CALL MOUSE(M1,M2,M3,CURSOR(0,0))
  6273.  
  6274.  
  6275.  
  6276.  ═══════════════════════════════════════════════════════════════════════════
  6277.  8  Writing Mouse Programs for IBM EGA Modes
  6278.  
  6279.  
  6280.  
  6281.  If your application program includes mouse support for IBM enhanced
  6282.  graphics modes D, E, F, and 10, your program must interact with the IBM
  6283.  Enhanced Graphics Adapter (EGA) through the Microsoft EGA Register
  6284.  Interface Library (EGA.LIB). EGA.LIB is included on the Microsoft Mouse
  6285.  Tools disk. If your program tries to set the EGA registers directly, rather
  6286.  than through this interface, the mouse cursor will not be drawn correctly.
  6287.  
  6288.  The EGA Register Interface allows your program to write to and read
  6289.  from write-only registers on the EGA. You need this capability to use
  6290.  interrupt-driven graphics, such as the cursor update code.
  6291.  
  6292.  
  6293.  ───────────────────────────────────────────────────────────────────────────
  6294.  The EGA Register Interface Library
  6295.  
  6296.  The Microsoft EGA Register Interface Library consists of nine functions
  6297.  that can be called from assembly-language programs or from programs written
  6298.  in high-level languages such as Microsoft QuickBASIC, Pascal, FORTRAN, and
  6299.  C. These functions:
  6300.  
  6301.   ■  Read from or write to one or more of the EGA write-only registers
  6302.  
  6303.   ■  Define default values for EGA write-only registers or reset the
  6304.      registers to these default values
  6305.  
  6306.   ■  Check whether the EGA Register Interface is present and, if so, return
  6307.      its version number
  6308.  
  6309.  
  6310.  How the Interface Library Works
  6311.  
  6312.  The mouse driver loads the EGA Register Interface Library if it detects an
  6313.  EGA installed in the system. The interface maintains shadow maps (memory
  6314.  images) of the EGA write-only registers, which allow application programs
  6315.  to read these registers. The shadow maps are updated whenever your program
  6316.  calls one of the interface functions to set a register; therefore, the
  6317.  shadow maps always contain the last values written to the registers. When
  6318.  your program calls one of the interface functions to read a register, the
  6319.  function call returns the value stored in the shadow map.
  6320.  
  6321.  The code in the interface intercepts mode-change calls to the BIOS ROM
  6322.  (INT 10h with AH = 0) and updates the shadow maps and default register
  6323.  tables accordingly.
  6324.  
  6325.  
  6326.  ───────────────────────────────────────────────────────────────────────────
  6327.  How to Call the EGA Register Interface Library
  6328.  
  6329.  This section shows how to call functions in the EGA Register Interface
  6330.  Library from programs written in assembly language and high-level
  6331.  languages.
  6332.  
  6333.  
  6334.  Making Calls from Assembly-Language Programs
  6335.  
  6336.  To call EGA Register Interface functions from an assembly-language program:
  6337.  
  6338.   1  Load the AX, BX, CX, DX, and ES registers (as required) with the
  6339.      parameter values.
  6340.  
  6341.   2  Execute software interrupt 16 (10h).
  6342.  
  6343.  Values returned by the EGA Register Interface functions are placed in
  6344.  the registers.
  6345.  
  6346.  When called from assembly-language programs, functions F2, F3, F4, F5,
  6347.  and F7 expect ES:BX to be a table pointer.
  6348.  
  6349.  
  6350.  Example
  6351.  
  6352.  Use the following instructions to set the palette registers to the values
  6353.  in the array "mytable":
  6354.  
  6355.  mytable db 00h,01h,02h,03h,04h,05h,14h,07h
  6356.          db 38h,39h,3ah,3bh,3ch,3dh,3eh,3fh
  6357.          .
  6358.          .
  6359.          .
  6360.   mov ax, ds
  6361.   mov es, ax              ;set es to the data segment
  6362.   mov bx, offset mytable  ;now es:bx --> mytable
  6363.   mov cx, 0010h           ;starting at reg 0 for 16
  6364.   mov dx, 18h             ;18h = attribute chip
  6365.   mov ah, 0f3h            ;f3h = write register range
  6366.   int 10h                 ;go!
  6367.          .
  6368.          .
  6369.          .
  6370.  
  6371.  
  6372.  Making Calls from High-Level-Language Programs
  6373.  
  6374.  You can include EGA Register Interface function calls in QuickBASIC,
  6375.  Pascal, FORTRAN, and C programs as ordinary procedure calls.
  6376.  
  6377.  To make an EGA function call from a high-level-language program:
  6378.  
  6379.   1  Declare the appropriate procedure as an external procedure:
  6380.  
  6381.      For compiled BASIC and Pascal programs, use the procedure "EGA" if
  6382.      the argument addresses are in the program's data segment (short
  6383.      addresses), or the procedure "EGAS" if the arguments are in another
  6384.      segment (long addresses).
  6385.  
  6386.      For FORTRAN programs, use the procedure "EGAS".
  6387.  
  6388.      For C programs, use the procedure "cegas" for small-model
  6389.      programs, the procedure "cegam" for medium-model programs, or the
  6390.      procedure "cegal" for large-model programs.
  6391.  
  6392.      Your program must pass the addresses (not the values) of five
  6393.      integer arguments to these procedures, so be sure to include an
  6394.      appropriate parameter list in the declarations.
  6395.  
  6396.   2  Use the normal calling conventions to make the calls.
  6397.  
  6398.   3  Link the compiled program with EGA.LIB.
  6399.  
  6400.  All functions require five parameters: E1, E2, E3, E4, and E5. The
  6401.  following table shows how these parameters correspond to the registers
  6402.  listed in the function descriptions:
  6403.  
  6404.  Parameter             Register
  6405.  ───────────────────────────────────────────────────────────────────────────
  6406.  E1                    AH
  6407.  E2                    BX
  6408.  E3                    CX
  6409.  E4                    DX
  6410.  E5                    ES
  6411.  
  6412.  E5 is a dummy parameter for all functions except function FA (Interrogate
  6413.  Driver). For function FA, the value returned for ES is placed in E5.
  6414.  
  6415.  Use the following conventions when calling functions F2, F3, F4, F5,
  6416.  and F7 from a high-level-language program:
  6417.  
  6418.   ■  Procedures that use short argument addresses ("EGA", "cegas", and
  6419.      "cegam") set register ES to the value in register DS when they are
  6420.      called.
  6421.  
  6422.      Procedures that use long argument addresses ("EGAS" and "cegal")
  6423.      set register ES to the value of the segment passed as part of parameter
  6424.      E2.
  6425.  
  6426.   ■  In BASIC, FORTRAN, and Pascal programs, fill an integer array (packed 2
  6427.      bytes per integer) with the table values required by the function. Pass
  6428.      the first element of the array as parameter E2.
  6429.  
  6430.      In C programs, fill a character array with the table values
  6431.      required by the function. Pass either the name of the array or a
  6432.      pointer to the array as parameter E2.
  6433.  
  6434.  
  6435.  Examples
  6436.  
  6437.  In a Pascal program with long argument addresses, use the following
  6438.  statement to declare "EGAS" as an external procedure:
  6439.  
  6440.  PROCEDURE EGAS
  6441.  (VARS E1, E2, E3, E4, E5:INTEGER);
  6442.  EXTRN;
  6443.  
  6444.  Once the procedure has been declared, use the following statements to
  6445.  restore the default settings for the EGA registers:
  6446.  
  6447.  E1  :=  246  (*Function number is 246 = F6 (hexadecimal)*)
  6448.  EGAS(E1, E2, E3, E4, E5)
  6449.  
  6450.  In a small-model C program (version 3.0 or later), the following example
  6451.  restores the default settings for the EGA registers:
  6452.  
  6453.  int ah, bx, cx, dx, es;
  6454.  
  6455.  ah = 0xF6;              /* restore default settings */
  6456.  cegas(&ah, &bx, &cx, &dx, &es);
  6457.  
  6458.  In a QuickBASIC program, the following example prints the version number of
  6459.  the EGA Register Interface:
  6460.  
  6461.  ' Interrogate driver, get version number.
  6462.  '
  6463.  
  6464.         e1% = &h00FA
  6465.         e2% = 0
  6466.  
  6467.         call ega(e1%, e2%, e3%, e4%, e5%)
  6468.  
  6469.         if (e2% <> 0) then 100
  6470.         print "EGA Register Interface not found"
  6471.         end
  6472.  
  6473.  100    print "EGA Register Interface found, version "
  6474.         def seg = e5%
  6475.         majver = peek(e2%)
  6476.         minver = peek(e2% + 1)
  6477.         def seg
  6478.         print " = ";
  6479.         print majver;
  6480.         print ".";
  6481.         print minver
  6482.         def seg
  6483.  
  6484.  
  6485.  ───────────────────────────────────────────────────────────────────────────
  6486.  Restrictions on Use of the EGA Register Interface Library
  6487.  
  6488.  This section describes restrictions on the ways that application programs
  6489.  can use the EGA Register Interface Library.
  6490.  
  6491.  
  6492.  Calls to BIOS ROM Video Routines
  6493.  
  6494.  The EGA Register Interface Library only intercepts calls to the BIOS ROM
  6495.  video routines (INT 10h, AH = 13h or less) that change the screen mode
  6496.  (AH = 0). It does not intercept any other BIOS ROM video routine calls.
  6497.  However, any other BIOS ROM video routine calls should restore all
  6498.  registers, so there is no problem in using them.
  6499.  
  6500.  A call to interrupt 10h to set the color palette (AH = Bh) is an
  6501.  exception to this rule. Use EGA Register Interface function F5 to set the
  6502.  color palette. (For more information about function F5, see "EGA Register
  6503.  Interface Functions" later in this chapter.)
  6504.  
  6505.  
  6506.  Attribute Controller Registers
  6507.  
  6508.  Before your application program uses the Attribute Controller registers
  6509.  (I/O address 3C0h) in an extended interrupt 10h call, the program must set
  6510.  the Address or Data register flip-flop to the Address register (by doing an
  6511.  input from I/O port 3BAh or 3DAh). The flip-flop is always reset to this
  6512.  state when the program returns from the interrupt 10h call.
  6513.  
  6514.  An interrupt routine that accesses the attribute chip always leaves
  6515.  the flip-flop set to the Address register when the program returns from the
  6516.  interrupt call. Therefore, if your application program sets the flip-flop
  6517.  to the Data register and expects the flip-flop to remain in this state, the
  6518.  program must disable interrupts between the time it sets the flip-flop to
  6519.  the Data register state and the last time the flip-flop is assumed to be in
  6520.  this state.
  6521.  
  6522.  
  6523.  Sequencer Memory Mode Register
  6524.  
  6525.  When the Sequencer Memory Mode register (I/O address 3C5h, data register 4)
  6526.  is accessed, the sequencer produces a glitch on the CAS lines that may
  6527.  cause problems with video random-access memory (VRAM). As a result, your
  6528.  application program cannot use the EGA Register Interface to read from or
  6529.  write to this register. Instead, use the following procedure to safely
  6530.  alter this register:
  6531.  
  6532.   1  Disable interrupts.
  6533.  
  6534.   2  Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0.
  6535.  
  6536.   3  Read/modify/write the Sequencer Memory Mode register.
  6537.  
  6538.   4  Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1.
  6539.  
  6540.   5  Enable interrupts.
  6541.  
  6542.  
  6543.  Input Status Registers
  6544.  
  6545.  Your application program cannot use the EGA Register Interface to read
  6546.  Input Status registers 0 (I/O address 3C2h) and 1 (I/O address 3BAh or
  6547.  3DAh). If the program must read these registers, it should do so directly.
  6548.  
  6549.  
  6550.  Graphics Controller Miscellaneous Register
  6551.  
  6552.  When the Graphics Controller Miscellaneous register (I/O address 3CFh, data
  6553.  register 6) is accessed, a glitch on the CAS lines occurs that may cause
  6554.  problems with video random-access memory (VRAM). As a result, your
  6555.  application program should not use the EGA Register Interface to read from
  6556.  or write to this register.
  6557.  
  6558.  EGA Register Interface function F6 does not alter the state of the
  6559.  Graphics Controller Miscellaneous register. Use the following procedure to
  6560.  safely alter this register:
  6561.  
  6562.   1  Disable interrupts.
  6563.  
  6564.   2  Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0.
  6565.  
  6566.   3  Read/modify/write the Graphics Controller Miscellaneous register.
  6567.  
  6568.   4  Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1.
  6569.  
  6570.   5  Enable interrupts.
  6571.  
  6572.  
  6573.  ───────────────────────────────────────────────────────────────────────────
  6574.  EGA Register Interface Functions
  6575.  
  6576.  This section describes each EGA Register Interface function in detail. The
  6577.  following list shows these functions by function number:
  6578.  
  6579.  Number (Hex)          Function
  6580.  ───────────────────────────────────────────────────────────────────────────
  6581.  F0                    Read one register
  6582.  F1                    Write one register
  6583.  F2                    Read register range
  6584.  F3                    Write register range
  6585.  F4                    Read register set
  6586.  F5                    Write register set
  6587.  F6                    Revert to default registers
  6588.  F7                    Define default register table
  6589.  FA                    Interrogate driver
  6590.  
  6591.  Note  Calls F8h, F9h, and FBh through FFh are reserved.
  6592.  
  6593.  Each function description includes:
  6594.  
  6595.   ■  The parameters required to make the call (input) and the expected
  6596.      return values (output)
  6597.  
  6598.   ■  Any special considerations regarding the function
  6599.  
  6600.  If the function description does not specify an input for a parameter,
  6601.  you don't need to supply a value for that parameter before making the call.
  6602.  If the function description does not specify an output value for a
  6603.  parameter, the parameter's value is the same before and after the call.
  6604.  
  6605.  Caution  The EGA Register Interface does not check input values, so be sure
  6606.  that the values you load into the registers are correct before making a
  6607.  call.
  6608.  
  6609.  
  6610.  ───────────────────────────────────────────────────────────────────────────
  6611.  Function F0: Read One Register
  6612.  
  6613.  Function F0 reads data from a specified register on the EGA.
  6614.  
  6615.  Input:
  6616.  
  6617.  AH = F0h
  6618.  
  6619.  BX = Pointer for pointer/data chips:
  6620.  
  6621.          BH = 0
  6622.          BL = pointer
  6623.  
  6624.       Ignored for single registers
  6625.  
  6626.  DX = Port number:
  6627.  
  6628.       Pointer/data chips
  6629.  
  6630.          0h: CRT Controller (3?4h)
  6631.          8h: Sequencer (3C4h)
  6632.         10h: Graphics Controller (3CEh)
  6633.         18h: Attribute Controller (3C0h)
  6634.  
  6635.       Single registers
  6636.  
  6637.         20h: Miscellaneous Output register (3C2h)
  6638.         28h: Feature Control register (3?Ah)
  6639.         30h: Graphics 1 Position register (3CCh)
  6640.         38h: Graphics 2 Position register (3CAh)
  6641.  
  6642.       ? = B for monochrome modes or D for color modes
  6643.  
  6644.  Output:
  6645.  
  6646.  AX: Restored
  6647.  
  6648.  BH: Restored
  6649.  BL: Data
  6650.  
  6651.  DX: Restored
  6652.  
  6653.  All other registers restored
  6654.  
  6655.  
  6656.  Examples
  6657.  
  6658.  The following example saves the contents of the Sequencer Map
  6659.  Mask register in "myvalue":
  6660.  
  6661.  myvalue db  ?
  6662.  
  6663.   mov ah, 0f0h        ;f0 = read one register
  6664.   mov bx, 0002h       ;bh = 0 / bl = map mask
  6665.                       ;index
  6666.   mov dx, 0008h       ;dx = sequencer
  6667.   int 10h             ;get it!
  6668.   mov myvalue, bl     ;save it!
  6669.  
  6670.  The following example saves the contents of the Miscellaneous Output
  6671.  register in "myvalue":
  6672.  
  6673.  myvalue db  ?
  6674.  
  6675.   mov ah, 0f0h        ;f0 = read one register
  6676.   mov dx, 0020h       ;dx = miscellaneous output
  6677.                       ; register
  6678.   int 10h             ;get it!
  6679.   mov myvalue, bl     ;save it!
  6680.  
  6681.  
  6682.  ───────────────────────────────────────────────────────────────────────────
  6683.  Function F1: Write One Register
  6684.  
  6685.  Function F1 writes data to a specified register on the EGA.
  6686.  
  6687.  When your application program returns from a call to function F1, the
  6688.  contents of registers BH and DX are not restored. Your program must save
  6689.  and restore these registers itself if this is desired.
  6690.  
  6691.  Input:
  6692.  
  6693.  AH = F1h
  6694.  
  6695.  BL = Pointer for pointer/data chips
  6696.  
  6697.       or
  6698.  
  6699.       Data for single registers
  6700.  
  6701.  BH = Data for pointer/data chips (ignored for
  6702.       single registers)
  6703.  
  6704.  DX = Port number:
  6705.  
  6706.       Pointer/data chips
  6707.  
  6708.          0h: CRT Controller (3?4h)
  6709.          8h: Sequencer (3C4h)
  6710.         10h: Graphics Controller (3CEh)
  6711.         18h: Attribute Controller (3C0h)
  6712.  
  6713.       Single registers
  6714.  
  6715.         20h: Miscellaneous Output register (3C2h)
  6716.         28h: Feature Control register (3?Ah)
  6717.         30h: Graphics 1 Position register (3CCh)
  6718.         38h: Graphics 2 Position register (3CAh)
  6719.  
  6720.       ? = B for monochrome modes or D for color modes
  6721.  
  6722.  Output:
  6723.  
  6724.  AX: Restored
  6725.  
  6726.  BL: Restored
  6727.  BH: Not restored
  6728.  
  6729.  DX: Not restored
  6730.  
  6731.  All other registers restored
  6732.  
  6733.  
  6734.  Examples
  6735.  
  6736.  The following example writes the contents of "myvalue" into
  6737.  the CRT Controller Cursor Start register:
  6738.  
  6739.  myvalue db  3h
  6740.  
  6741.   mov ah, 0f1h    ; f1 = write one register
  6742.   mov bh, myvalue ; bh = data from myvalue
  6743.   mov bl, 000ah   ; bl = cursor start index
  6744.   mov dx, 0000h   ; dx = crt controller
  6745.   int 10h         ; write it!
  6746.  
  6747.  The following example writes the contents of "myvalue" into the Feature
  6748.  Control register:
  6749.  
  6750.  myvalue db  2h
  6751.  
  6752.   mov ah, 0f1h     ; f1 = write one register
  6753.   mov bl, myvalue  ; bl = data from myvalue
  6754.   mov dx, 0028h    ; dx = feature control
  6755.                    ; register
  6756.   int 10h          ; write it!
  6757.  
  6758.  
  6759.  ───────────────────────────────────────────────────────────────────────────
  6760.  Function F2: Read Register Range
  6761.  
  6762.  Function F2 reads data from a specified range of registers on the EGA. A
  6763.  range of registers is defined to be several registers on a single chip that
  6764.  have consecutive indexes. This call makes sense only for the pointer/data
  6765.  chips.
  6766.  
  6767.  Input:
  6768.  
  6769.  AH = F2h
  6770.  
  6771.  CH = Starting pointer value
  6772.  CL = Number of registers (must be > 1)
  6773.  
  6774.  DX = Port number:
  6775.  
  6776.        0h: CRT Controller (3?4h)
  6777.        8h: Sequencer (3C4h)
  6778.       10h: Graphics Controller (3CEh)
  6779.       18h: Attribute Controller (3C0h)
  6780.  
  6781.       ? = B for monochrome modes or D for color modes
  6782.  
  6783.  ES:BX = Points to table of one-byte entries (length =
  6784.          value in CL). On return, each entry is set to
  6785.          the contents of the corresponding register.
  6786.  
  6787.  Output:
  6788.  
  6789.  AX: Restored
  6790.  
  6791.  BX: Restored
  6792.  
  6793.  CX: Not restored
  6794.  
  6795.  DX: Restored
  6796.  
  6797.  ES: Restored
  6798.  
  6799.  All other registers restored
  6800.  
  6801.  
  6802.  Example
  6803.  
  6804.  The following example saves the contents of the Attribute
  6805.  Controller Palette registers in "paltable":
  6806.  
  6807.  paltable db  16 dup (?)
  6808.  
  6809.    mov ax, ds              ; assume paltable in
  6810.                            ;  data segment
  6811.    mov es, ax              ; es = data segment
  6812.    mov bx, offset paltable ; es:bx = paltable
  6813.                            ; address
  6814.    mov ah, 0f2h            ; f2 = read register
  6815.                            ; range
  6816.    mov cx, 0010h           ; ch = start index of 0
  6817.                            ; cl = 16 registers
  6818.                            ; to read
  6819.    mov dx, 0018h           ; dx = attribute
  6820.                            ; controller
  6821.    int 10h                 ; read them!
  6822.  
  6823.  
  6824.  ───────────────────────────────────────────────────────────────────────────
  6825.  Function F3: Write Register Range
  6826.  
  6827.  Function F3 writes data to a specified range of registers on the EGA. A
  6828.  range of registers is defined to be several registers on a single chip that
  6829.  have consecutive indexes. This call only makes sense for the pointer/data
  6830.  chips.
  6831.  
  6832.  Input:
  6833.  
  6834.  AH = F3h
  6835.  
  6836.  CH = Starting pointer value
  6837.  CL = Number of registers (must be > 1)
  6838.  
  6839.  DX = Port number
  6840.  
  6841.          0h: CRT Controller (3?4h)
  6842.          8h: Sequencer (3C4h)
  6843.         10h: Graphics Controller (3CEh)
  6844.         18h: Attribute Controller (3C0h)
  6845.  
  6846.       ? = B for monochrome modes or D for color modes
  6847.  
  6848.  ES:BX = Points to table of one-byte entries (length =
  6849.          value in CL). Each entry contains the value to be
  6850.          written to the corresponding register.
  6851.  
  6852.  Output:
  6853.  
  6854.  AX: Restored
  6855.  
  6856.  BX: Not restored
  6857.  
  6858.  CX: Not restored
  6859.  
  6860.  DX: Not restored
  6861.  
  6862.  ES: Restored
  6863.  
  6864.  All other registers restored
  6865.  
  6866.  
  6867.  Example
  6868.  
  6869.  The following example writes the contents of "cursloc" into
  6870.  the CRT Controller Cursor Location High and Cursor Location
  6871.  Low registers.
  6872.  
  6873.  cursloc db  01h, 00h          ; cursor at page
  6874.                                ; offset 0100h
  6875.  
  6876.         mov ax, ds             ; assume cursloc in
  6877.                                ;  data segment
  6878.         mov es, ax             ; es=data segment
  6879.         mov bx, offset cursloc ; es:bx=cursloc address
  6880.         mov ah, 0f3h           ; f3=write register
  6881.                                ;  range
  6882.         mov cx, 0e02h          ; ch=start index of 14
  6883.                                ; cl=2 registers to
  6884.                                ;  write
  6885.         mov dx, 0000h          ; dx=crt controller
  6886.         int 10h                ; write them!
  6887.  
  6888.  
  6889.  ───────────────────────────────────────────────────────────────────────────
  6890.  Function F4: Read Register Set
  6891.  
  6892.  Function F4 reads data from a set of registers on the EGA. A set of
  6893.  registers is defined to be several registers that may or may not have
  6894.  consecutive indexes, and that may or may not be on the same chip.
  6895.  
  6896.  Input:
  6897.  
  6898.  AH = F4h
  6899.  
  6900.  CX = Number of registers (must be > 1)
  6901.  
  6902.  ES:BX = Points to table of records with each entry in
  6903.          this format:
  6904.  
  6905.          Bytes 1-2: Port number
  6906.  
  6907.             Pointer/data chips
  6908.  
  6909.             0h: CRT Controller (3?4h)
  6910.             8h: Sequencer (3C4h)
  6911.            10h: Graphics Controller (3CEh)
  6912.            18h: Attribute Controller (3C0h)
  6913.  
  6914.             Single registers
  6915.  
  6916.            20h: Miscellaneous Output register (3C2h)
  6917.            28h: Feature Control register (3?Ah)
  6918.            30h: Graphics 1 Position register (3CCh)
  6919.            38h: Graphics 2 Position register (3CAh)
  6920.  
  6921.          ? = B for monochrome modes or D for color
  6922.              modes
  6923.  
  6924.          Byte 3: Pointer value (0 for single
  6925.                  registers)
  6926.  
  6927.          Byte 4: EGA Register Interface fills
  6928.                  in data read from register specified
  6929.                  in bytes 1-3.
  6930.  
  6931.  Output:
  6932.  
  6933.  AX: Restored
  6934.  
  6935.  BX: Restored
  6936.  
  6937.  CX: Not restored
  6938.  
  6939.  ES: Restored
  6940.  
  6941.  All other registers restored
  6942.  
  6943.  
  6944.  Example
  6945.  
  6946.  The following example saves the contents of the Miscellaneous
  6947.  Output register, Sequencer Memory Mode register, and CRT
  6948.  Controller Mode Control register in "results":
  6949.  
  6950.  outvals dw  0020h ; miscellaneous output register
  6951.          db  0     ; 0 for single registers
  6952.          db  ?     ; returned value
  6953.  
  6954.          dw  0008h ; sequencer
  6955.          db  04h   ; memory mode register index
  6956.          db  ?     ; returned value
  6957.  
  6958.          dw  0000h ; crt controller
  6959.          db  17h   ; mode control register index
  6960.          db  ?     ; returned value
  6961.  
  6962.  results db  3 dup (?)
  6963.  
  6964.          mov ax, ds             ; assume outvals in
  6965.                                 ;  data segment
  6966.          mov es, ax             ; es=data segment
  6967.          mov bx, offset outvals ; es:bx=outvals address
  6968.          mov ah, 0f4h           ; f4=read register set
  6969.          mov cx, 3              ; number of entries in
  6970.                                 ;  outvals
  6971.          int 10h                ; get values into
  6972.                                 ;  outvals!
  6973.          mov si, 3              ; move the returned
  6974.                                 ;  values from
  6975.          add si, offset outvals ;  outvals
  6976.          mov di, offset results ;  to results
  6977.          mov cx, 3              ; 3 values to move
  6978.  
  6979.  movloop: mov ax, [si]  ; move one value from outvals
  6980.          mov [di], ax   ;  to results
  6981.          add si, 4      ; skip to next source byte
  6982.          inc di         ; point to next destination
  6983.          loop movloop   ;  byte
  6984.  
  6985.  
  6986.  ───────────────────────────────────────────────────────────────────────────
  6987.  Function F5: Write Register Set
  6988.  
  6989.  Function F5 writes data to a set of registers on the EGA. A set of
  6990.  registers is defined to be several registers that may or may not have
  6991.  consecutive indexes, and that may or may not be on the same chip.
  6992.  
  6993.  Input:
  6994.  
  6995.  AH = F5h
  6996.  
  6997.  CX = Number of registers (must be > 1)
  6998.  
  6999.  ES:BX = Points to table of values with each entry in this format:
  7000.  
  7001.          Bytes 1-2: Port number
  7002.  
  7003.             Pointer/data chips
  7004.  
  7005.              0h: CRT Controller (3?4h)
  7006.              8h: Sequencer (3C4h)
  7007.             10h: Graphics Controller (3CEh)
  7008.             18h: Attribute Controller (3C0h)
  7009.  
  7010.             Single registers
  7011.  
  7012.             20h: Miscellaneous Output register (3C2h)
  7013.             28h: Feature Control register (3?Ah)
  7014.             30h: Graphics 1 Position register (3CCh)
  7015.             38h: Graphics 2 Position register (3CAh)
  7016.  
  7017.          ? = B for monochrome modes or D for color
  7018.              modes
  7019.  
  7020.          Byte 3: Pointer value (0 for single
  7021.                  registers)
  7022.  
  7023.          Byte 4: Data to be written to register
  7024.                  specified in bytes 1-3
  7025.  
  7026.  Output
  7027.  
  7028.  AX: Restored
  7029.  
  7030.  BX: Restored
  7031.  
  7032.  CX: Not restored
  7033.  
  7034.  ES: Restored
  7035.  
  7036.  All other registers restored
  7037.  
  7038.  
  7039.  Example
  7040.  
  7041.  The following example writes the contents of "outvals" to the
  7042.  Miscellaneous Output register, Sequencer Memory Mode register,
  7043.  and CRT Controller Mode Control register:
  7044.  
  7045.  outvals dw  0020h ; miscellaneous output register
  7046.          db  0     ; 0 for single registers
  7047.          db  0a7h  ; output value
  7048.  
  7049.          dw  0008h ; sequencer
  7050.          db  04h   ; memory mode register index
  7051.          db  03h   ; output value
  7052.  
  7053.          dw  0000h ; crt controller
  7054.          db  17h   ; mode control register index
  7055.          db  0a3h  ; output value
  7056.  
  7057.          mov ax, ds             ; assume outvals in
  7058.                                 ;  data segment
  7059.          mov es, ax             ; es=data segment
  7060.          mov bx, offset outvals ; es:bx=outvals address
  7061.          mov ah, 0f5h           ; f5=write register set
  7062.          mov cx, 3              ; number of entries in
  7063.                                 ;  outvals
  7064.          int 10h                ; write the registers!
  7065.  
  7066.  
  7067.  ───────────────────────────────────────────────────────────────────────────
  7068.  Function F6: Revert to Default Registers
  7069.  
  7070.  Function F6 restores the default settings of any registers that your
  7071.  application program has changed through the EGA Register Interface. The
  7072.  default settings are defined in a call to function F7.
  7073.  
  7074.  Input:
  7075.  
  7076.  AH = F6h
  7077.  
  7078.  Output:
  7079.  
  7080.  All registers restored
  7081.  
  7082.  Note  If your program makes an interrupt 10h (video display adapter) call
  7083.  to function 0 to set the display mode, the default register values will
  7084.  change to the BIOS values for the selected mode.
  7085.  
  7086.  
  7087.  Example
  7088.  
  7089.  The following example restores the default settings of the EGA registers:
  7090.  
  7091.           mov ah, 0f6h  ; f6 = revert to default
  7092.                         ;  registers
  7093.           int 10h       ; do it now!
  7094.  
  7095.  
  7096.  ───────────────────────────────────────────────────────────────────────────
  7097.  Function F7: Define Default Register Table
  7098.  
  7099.  Function F7 defines a table containing default values for any pointer/data
  7100.  chip or single register. If you define default values for a pointer/data
  7101.  chip, you must define them for all registers within that chip.
  7102.  
  7103.  Input:
  7104.  
  7105.  AH = F7h
  7106.  
  7107.  DX = Port number:
  7108.  
  7109.       Pointer/data chips
  7110.  
  7111.          0h: CRT Controller (3?4h)
  7112.          8h: Sequencer (3C4h)
  7113.         10h: Graphics Controller (3CEh)
  7114.         18h: Attribute Controller (3C0h)
  7115.  
  7116.       Single registers
  7117.  
  7118.         20h: Miscellaneous Output register (3C2h)
  7119.         28h: Feature Control register (3?Ah)
  7120.         30h: Graphics 1 Position register (3CCh)
  7121.         38h: Graphics 2 Position register (3CAh)
  7122.  
  7123.       ? = B for monochrome modes or D for color modes
  7124.  
  7125.  ES:BX = Points to table of one-byte entries. Each entry
  7126.          contains the default value for the corresponding
  7127.          register. The table must contain entries for all
  7128.          registers.
  7129.  
  7130.  Output:
  7131.  
  7132.  AX: Restored
  7133.  
  7134.  BX: Not restored
  7135.  
  7136.  DX: Not restored
  7137.  
  7138.  ES: Restored
  7139.  
  7140.  All other registers restored
  7141.  
  7142.  
  7143.  Examples
  7144.  
  7145.  The following example defines default values for the Attribute Controller:
  7146.  
  7147.  attrdflt db  00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h
  7148.           db  10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h
  7149.           db  08h, 00h, 0fh, 00h
  7150.  
  7151.           mov ax, ds              ; assume attrdflt in
  7152.                                   ;  data segment
  7153.           mov es, ax              ; es = data segment
  7154.           mov bx, offset attrdflt ; es:bx = attrdflt
  7155.                                   ;  address
  7156.           mov ah, 0f7h            ; f7 = define default
  7157.                                   ;  register table
  7158.           mov dx, 0018h           ; dx = attribute
  7159.                                   ;  controller
  7160.           int 10h                 ; do it!
  7161.  
  7162.  The following example defines a default value for the Feature Control
  7163.  register:
  7164.  
  7165.  featdflt db  00h
  7166.  
  7167.           mov ax, ds              ; assume featdflt in
  7168.                                   ;  data segment
  7169.           mov es, ax              ; es = data segment
  7170.           mov bx, offset featdflt ; es:bx = featdflt
  7171.                                   ;  address
  7172.           mov ah, 0f7h            ; f7 = define default
  7173.                                   ;  register table
  7174.           mov dx, 0028h           ; dx = feature control
  7175.                                   ;  register
  7176.           int 10h                 ; do it!
  7177.  
  7178.  
  7179.  ───────────────────────────────────────────────────────────────────────────
  7180.  Function FA: Interrogate Driver
  7181.  
  7182.  Function FA interrogates the mouse driver and returns a value specifying
  7183.  whether or not the mouse driver is present.
  7184.  
  7185.  Input:
  7186.  
  7187.  AH = FAh
  7188.  
  7189.  BX = 0
  7190.  
  7191.  Output:
  7192.  
  7193.  AX: Restored
  7194.  
  7195.  BX = 0 if mouse driver is not present
  7196.  
  7197.  ES:BX: Pointer to EGA Register Interface version number,
  7198.         if present:
  7199.  
  7200.          Byte 1: Major release number
  7201.          Byte 2: Minor release number (in 1/100ths)
  7202.  
  7203.  
  7204.  Example
  7205.  
  7206.  The following example interrogates the mouse driver and
  7207.  displays the results:
  7208.  
  7209.  gotmsg db  "mouse driver found", 0dh, 0ah, 24h
  7210.  nopmsg db  "mouse driver not found", 0dh, 0ah, 24h
  7211.  revmsg db  "revision $"
  7212.  crlf   db  0dh, 0ah, 24h
  7213.  
  7214.  ten    db  10
  7215.  
  7216.         mov bx, 0             ; must be 0 for this call
  7217.         mov ah, 0fah          ; fa = interrogate driver
  7218.         int 10h               ; interrogate!
  7219.         or  bx, bx            ; bx = 0 ?
  7220.         jnz found             ; branch if driver present
  7221.         mov dx, offset nopmsg ; assume nopmsg in data
  7222.                               ;  segment
  7223.         mov ah, 09h           ; 9 = print string
  7224.         int 21h               ; output not found message
  7225.         jmp continue          ; that all for now
  7226.  
  7227.  found: mov dx, offset gotmsg ; assume gotmsg in data
  7228.                               ;  segment
  7229.         mov ah, 09h           ; 9 = print string
  7230.         int 21h               ; output found message
  7231.         mov dx, offset revmsg ; assume revmsg in data
  7232.                               ;  segment
  7233.         mov ah, 09h           ; 9 = print string
  7234.         int 21h               ; output "revision "
  7235.         mov dl, es:[bx]       ; dl = major release number
  7236.         add dl, "0"           ; convert to ascii
  7237.         mov ah, 2             ; 2 = display character
  7238.         int 21h               ; output major release
  7239.                               ;  number
  7240.         mov dl, "."           ; dl = "."
  7241.         mov ah, 2             ; 2 = display character
  7242.         int 21h               ; output a period
  7243.         mov al, es:[bx+1]     ; al = minor release number
  7244.         xor ah, ah            ; ah = 0
  7245.         idiv ten              ; al = 10ths, ah = 100ths
  7246.         mov bx, ax            ; save ax in bx
  7247.         mov dl, al            ; dl = 10ths
  7248.         add dl, "0"           ; convert to ascii
  7249.         mov ah, 2             ; 2 = display character
  7250.         int 21h               ; output minor release 10ths
  7251.         mov dl, bh            ; dl = 100ths
  7252.         add dl, "0"           ; convert to ascii
  7253.         mov ah, 2             ; 2 = display character
  7254.         int 21h               ; output minor release
  7255.                               ;  100ths
  7256.         mov dx, offset crlf   ; assume crlf in data
  7257.                               ;  segment
  7258.         mov ah, 09h           ; 9 = print string
  7259.         int 21h               ; output end of line
  7260.  continue:                    ; the end
  7261.  
  7262.  
  7263.  
  7264.  ═══════════════════════════════════════════════════════════════════════════
  7265.  Appendices
  7266.  
  7267.  
  7268.  
  7269.  ═══════════════════════════════════════════════════════════════════════════
  7270.  Appendix A  Mouse Command Line Switches
  7271.  
  7272.  
  7273.  
  7274.  This appendix describes the mouse command line switches you can use to
  7275.  customize the operation of the Control Panel and the mouse driver.
  7276.  
  7277.  
  7278.  ───────────────────────────────────────────────────────────────────────────
  7279.  Control Panel Switches
  7280.  
  7281.  The Control Panel (CPANEL.EXE) is a memory-resident program that allows you
  7282.  to adjust the mouse sensitivity level-the ratio of cursor movement to
  7283.  actual mouse movement. (For information on using the Control Panel, see
  7284.  Chapter 4, "Moving the Mouse," in your Microsoft Mouse User's Guide.)
  7285.  
  7286.  Whenever you invoke the Control Panel, the program reserves memory for
  7287.  the area of the screen the Control Panel overlays. The amount of memory
  7288.  needed depends on the type of display adapter used and the complexity of
  7289.  the image the Control Panel overlays. The Control Panel has a default size
  7290.  for the overlay buffer, but you can use a command line switch to change the
  7291.  amount of memory reserved by the Control Panel. If your system beeps when
  7292.  you activate the Control Panel, the screen buffer is not large enough.
  7293.  
  7294.  Use one of the following command line switches to change the size of
  7295.  the buffer, depending on the type of display adapter installed in your
  7296.  system:
  7297.  
  7298.  Use this switch       For this display adapter
  7299.  ───────────────────────────────────────────────────────────────────────────
  7300.  /C<n>                 IBM Color/Graphics Adapter
  7301.  /E<n>                 IBM Enhanced Graphics Adapter
  7302.  /H<n>                 Hercules display adapter
  7303.  /M<n>                 IBM Monochrome Adapter
  7304.  /A<n>                 AT&T 6300 display adapter
  7305.  
  7306.  where <n> is a number in the range 0 to 9. The larger the number, the
  7307.  larger the screen overlay buffer. If no switch is specified, the default
  7308.  value is /E7.
  7309.  
  7310.  The size of the buffer required depends on the mode of the screen the
  7311.  Control Panel overlays. For example, screens displayed in the enhanced
  7312.  graphics modes require a larger Control Panel overlay buffer than screens
  7313.  displayed in text modes.
  7314.  
  7315.  In general, use a value in the range 0 to 4 if the Control Panel will
  7316.  overlay only text screens; use a value in the range 5 to 9 if the Control
  7317.  Panel will overlay graphics screens.
  7318.  
  7319.  The following table shows how many bytes of memory are occupied by the
  7320.  Control Panel and buffer for each possible switch setting:
  7321.  
  7322.     Setting  │                                Switch
  7323.              │   /M            /H           /A            /C           /E
  7324.  ────────────┼──────────────────────────────────────────────────────────────
  7325.     0        │   9712         14240        14992          9360         9360
  7326.     1        │   9760         14288        15040          9456         9456
  7327.     2        │   9808         14336        15088          9552         9552
  7328.     3        │   9856         14384        15136          9744         9744
  7329.     4        │   9904         14432        15184         10128        10128
  7330.     5        │   9952         14480        15232         11872        19088
  7331.     6        │  10000         14528        15280         12128        19344
  7332.     7        │  10048         14576        15328         14768        29168
  7333.     8        │  10096         14624        15376         15024        29424
  7334.     9        │  10144         14672        15424         15280        29680
  7335.  
  7336.  ────────────────────────────────────────
  7337.  Using a Control Panel switch
  7338.  ────────────────────────────────────────
  7339.  
  7340.  Use a Control Panel switch to specify the size of the overlay buffer when
  7341.  you load the Control Panel into memory. If the Control Panel is already in
  7342.  memory, you must first to remove the Control Panel from memory.
  7343.  
  7344.  To remove the Control Panel from memory:
  7345.  
  7346.   ■  Type cpanel off
  7347.  
  7348.  To specify a screen buffer size when you load the Control Panel:
  7349.  
  7350.   ■  Type cpanel followed by the appropriate switch.
  7351.  
  7352.      For example, to specify the largest possible screen buffer for the
  7353.      area the Control Panel overlays on a CGA system, you would type
  7354.      cpanel/C9
  7355.  
  7356.  
  7357.  ───────────────────────────────────────────────────────────────────────────
  7358.  Mouse Driver Switches
  7359.  
  7360.  Use mouse driver command line switches to:
  7361.  
  7362.   ■  Specify the sensitivity of the mouse
  7363.  
  7364.   ■  Set the interrupt rate (for the InPort(R) Mouse only)
  7365.  
  7366.   ■  Tell the mouse driver the type and location of the Microsoft mouse
  7367.      installed in your system so the driver can bypass its usual procedure
  7368.      for determining mouse hardware configuration
  7369.  
  7370.   ■  Disable the mouse driver or remove it from memory
  7371.  
  7372.  ────────────────────────────────────────
  7373.  Using a mouse driver switch
  7374.  ────────────────────────────────────────
  7375.  
  7376.  You can add mouse driver command line switches to the mouse command lines
  7377.  in the AUTOEXEC.BAT or CONFIG.SYS file, or you can type mouse and the
  7378.  command line switches at the DOS prompt. If you type one or more switches
  7379.  at the DOS prompt, there must be a space between mouse and each switch.
  7380.  
  7381.  The following sections describe how to use the mouse driver command
  7382.  line switches.
  7383.  
  7384.  
  7385.  Specifying Mouse Sensitivity
  7386.  
  7387.  Use the following command line switches to set mouse sensitivity levels:
  7388.  
  7389.  Use this switch    To set
  7390.  ───────────────────────────────────────────────────────────────────────────
  7391.  /S<nnn>            Horizontal and vertical sensitivity
  7392.  /H<nnn>            Horizontal sensitivity only
  7393.  /V<nnn>            Vertical sensitivity only
  7394.  /D<nnn>            Double-speed threshold
  7395.  
  7396.  where <nnn> is a number in the range 0 to 100.
  7397.  
  7398.  The switches for the horizontal and vertical sensitivity are
  7399.  interpreted in the same manner as a Control Panel setting. The double-
  7400.  speed-threshold switch determines the threshold speed for doubling the
  7401.  cursor's motion on the screen. Setting a double-speed threshold makes it
  7402.  easier to move the cursor to widely-separated images on the screen. (You
  7403.  can also use mouse function 19 to build this feature into an application
  7404.  program. For more information, see the description of function 19 in
  7405.  Chapter 6, "Mouse Function Descriptions.")
  7406.  
  7407.  
  7408.  Setting the Interrupt Rate for the InPort Mouse
  7409.  
  7410.  If you are using an InPort Mouse, you can use one of the following command
  7411.  line switch settings to specify the interrupt rate for the mouse:
  7412.  
  7413.  Switch Setting                 Interrupt Rate
  7414.  ───────────────────────────────────────────────────────────────────────────
  7415.  /R0                            disabled
  7416.  /R1                            30Hz (default)
  7417.  /R2                            50Hz
  7418.  /R3                            100Hz
  7419.  /R4                            200Hz
  7420.  
  7421.  
  7422.  Specifying the Type and Location of the Mouse
  7423.  
  7424.  The command line switches described in this section direct the mouse driver
  7425.  to bypass its usual search to determine the mouse hardware configuration
  7426.  and to look for a particular type of Microsoft Mouse at a particular I/O
  7427.  port.
  7428.  
  7429.  This feature is useful if:
  7430.  
  7431.   ■  The mouse driver has trouble determining which port the mouse is
  7432.      connected to, given your system's configuration
  7433.  
  7434.   ■  More than one InPort device is connected to your computer
  7435.  
  7436.   ■  You want to decrease the time required to load the mouse driver
  7437.  
  7438.  The following table lists each switch you can use to tell the mouse
  7439.  driver to look for a particular mouse hardware configuration:
  7440.  
  7441.  Use this switch       To look for
  7442.  ───────────────────────────────────────────────────────────────────────────
  7443.  /B                    Bus or InPort Mouse at primary InPort address
  7444.  /I1                   InPort Mouse at primary InPort address
  7445.  /I2                   InPort Mouse at secondary InPort address
  7446.  /C1                   Serial mouse on COM1
  7447.  /C2                   Serial Mouse on COM2
  7448.  
  7449.  
  7450.  Disabling or Removing the Mouse Driver
  7451.  
  7452.  If necessary, you can disable the mouse driver or remove it from memory.
  7453.  Before you disable or remove the mouse driver, you need to remove the
  7454.  Control Panel from memory and end any Mouse Menu program you are using.
  7455.  
  7456.  To remove the Control Panel from memory:
  7457.  
  7458.   ■  Type cpanel off
  7459.  
  7460.  To end a Microsoft Expert Mouse Menu program:
  7461.  
  7462.   ■  Type filename off
  7463.  
  7464.      where filename is the name of the Expert Mouse Menu program.
  7465.  
  7466.  To end a Mouse Menu program that you wrote yourself:
  7467.  
  7468.   ■  Type menu off
  7469.  
  7470.  To disable or remove the mouse driver from memory:
  7471.  
  7472.   ■  Type mouse off
  7473.  
  7474.  If the mouse driver is MOUSE.SYS, it is disabled; if the mouse driver
  7475.  is MOUSE.COM, it is removed from memory.
  7476.  
  7477.  
  7478.  
  7479.  ═══════════════════════════════════════════════════════════════════════════
  7480.  Appendix B  Linking Existing Mouse Programs with MOUSE.LIB (Version 6.0)
  7481.  
  7482.  
  7483.  
  7484.  If you have a high-level language program that links with an earlier
  7485.  version of the Microsoft Mouse Library, you may have to modify the program
  7486.  to link it with the new MOUSE.LIB (version 6.0) on the Microsoft Mouse
  7487.  Tools disk.
  7488.  
  7489.  Version 6.0 of MOUSE.LIB functions the same as the previous mouse
  7490.  library (version 5.03), except that version 6.0 has the following new
  7491.  features:
  7492.  
  7493.   ■  New mouse functions 20, 21, 22, 23, 29, and 30
  7494.  
  7495.   ■  The fourth parameter (M4%) of mouse function 9 must be passed by
  7496.      reference (instead of by value).
  7497.  
  7498.   ■  Mouse function 16 requires four parameters (instead of five).
  7499.  
  7500.  If your program doesn't call function 9 or 16, you can link it with
  7501.  MOUSE.LIB (version 6.0) without modification.
  7502.  
  7503.  If your program calls function 9 or 16, you must modify the program so
  7504.  that it conforms with the new interface definitions before you can link it
  7505.  with MOUSE.LIB (version 6.0). If you do not plan to call any of the new
  7506.  mouse functions in your program, you may want to link the program with a
  7507.  previous version of the mouse library.
  7508.  
  7509.  Note  Version 5.03 of the Microsoft Mouse Library is included on the
  7510.  Microsoft Mouse Tools disk in the file OLDMOUSE.LIB.
  7511.  
  7512.  
  7513.  
  7514.  ═══════════════════════════════════════════════════════════════════════════
  7515.  Appendix C  Making Calls from Borland Turbo Pascal Programs
  7516.  
  7517.  
  7518.  
  7519.  To call mouse functions from a program in Borland Turbo Pascal, use the
  7520.  procedure shown below to pass the correct parameters to the mouse driver.
  7521.  Include this procedure in your code, then call the mouse functions by
  7522.  passing values into this procedure.
  7523.  
  7524.  Procedure Mouse ( Var m1, m2, m3, m4, m5 : integer );
  7525.  
  7526.  Var
  7527.     CpuReg: record of
  7528.                AX, BX, CX, DX, BP,
  7529.                SI, DI, DS, ES, FLAGS: integer;
  7530.             end;
  7531.  
  7532.  begin {mouse}
  7533.  
  7534.    if m1 >= 0 then
  7535.        begin
  7536.          CpuReg.AX := m1;          {Load parameters  }
  7537.          CpuReg.BX := m2;          { into appropriate}
  7538.          CpuReg.CX := m3;          { registers       }
  7539.  
  7540.          if (m1 = 9) or (m1 = 12) or (m1 = 20)
  7541.            or (m1 = 22) or (m1 = 23) then
  7542.            begin
  7543.               CpuReg.DX := ofs (m4); {m4 = pointer of }
  7544.               CpuReg.ES := seg (m4); { the address of }
  7545.            end;                      { the user array }
  7546.                                      { or subroutine  }
  7547.  
  7548.         else if m1 = 16
  7549.            begin
  7550.               CpuReg.CX := m2; {Left  x coordinate}
  7551.               CpuReg.DX := m3; {Upper y coordinate}
  7552.               CpuReg.SI := m4; {Right x coordinate}
  7553.               CpuReg.DI := m5; {Lower y coordinate}
  7554.            end;
  7555.         else
  7556.               CpuReg.DX := m4;
  7557.  
  7558.         intr ($33, CpuReg);    {Call mouse driver }
  7559.                                { at interrupt 33h }
  7560.  
  7561.         if (m1 = 20) then      {Special returns   }
  7562.            m2:= CpuReg.ES;
  7563.  
  7564.         m1 := CpuReg.AX;       {Return values back}
  7565.         m2 := CpuReg.BX;       { to parameters    }
  7566.         m3 := CpuReg.CX;
  7567.         m4 := CpuReg.DX;
  7568.  
  7569.       end;
  7570.  
  7571.  end; {mouse}
  7572.  
  7573.  
  7574.  
  7575.  ═══════════════════════════════════════════════════════════════════════════
  7576.  Appendix D  Using the Hercules Graphics Card with Mouse Programs
  7577.  
  7578.  
  7579.  
  7580.  Before you use the Hercules Monochrome Graphics Card with a program that
  7581.  has built-in mouse support, you must do the following:
  7582.  
  7583.   1  Put the Hercules card into graphics mode (if necessary, see the
  7584.      documentation that came with your Hercules card).
  7585.  
  7586.   2  Store a 6 in memory location 40h:49h if the Hercules card is using CRT
  7587.      page 0. Store a 5 in memory location 40h:49h if the Hercules card is
  7588.      using CRT page 1.
  7589.  
  7590.   3  Call mouse function 0 to set the mouse cursor boundaries and CRT page
  7591.      number to the appropriate values.
  7592.