From: "J. Marshall" <a_revelation@hotmail.com>
Subject: Re: Mouse driver for Ada... how?
Date: 1999/06/02
Date: 1999-06-02T00:00:00+00:00 [thread overview]
Message-ID: <928358735.459.102@news.remarQ.com> (raw)
In-Reply-To: 8bg53.656$HD.140382@typhoon-sf.snfc21.pbi.net
Thank you very much for the information. I appreciate your time and input.
Jim Marshall
tmoran@bix.com wrote in message
<8bg53.656$HD.140382@typhoon-sf.snfc21.pbi.net>...
>> So I had hoped to find some existing code examples.
>Here's the spec of a (very old) mouse driver for DOS. It uses the
>INT 33 services. In Windows you'd use the WM_MOUSEMOVE,
>WM_LBUTTONDOWN, etc. events. If you don't have an OS service
>available, don't have a vendor supplied driver, and are reduced to
>handling a serial byte stream yourself, your first need is to find
>what bytes your mouse (trackball) sends. It's probably not too
>complex, and thus not too hard to write code to process it.
>
>with system;
>
>package mouse is -- low level mouse driver interface
> -- uses int33 functions
> -- 16#00#: reset
> -- 16#0B#: read motion counters
> -- 16#03#: get mouse position and button status
> -- (ignore logical position from this)
> -- In 1987 this interface was standard and supported
> -- by all PC mice.
> type state is
> record
> x,y:integer;
> left_button,middle_button,right_button:boolean;
> end record;
> -- x,y measured in mickeys
> -- button flags are true iff button is currently depressed
>
> current:state :=
> (x | y => 0,left_button | middle_button | right_button => FALSE);
>
> driver_missing:exception; -- will be raised at initialization
> -- iff mouse driver is detected not present
> -- ie if int33=0 or int33 points to an IRET
>
> procedure check; -- updates current (nop if mouse driver is missing)
>
> -- The public record 'current' is used, rather than having 'out'
> -- parameters to the 'check' routine, for simplicity and efficiency.
> -- There is no way with this interface to have more than one mouse
> -- per OS task, so the generality of out parameters, or a generic
> -- mouse package, would be spurious.
>
> procedure reset;
>
> procedure hide_cursor;
>
> procedure show_cursor;
>
> procedure horizontal_range(min,max:in natural);
>
> procedure vertical_range(min,max:in natural);
>
> type graphic_cursor_bits is array(integer range <>) of system.word;
> subtype normal_graphic_cursor_bits is graphic_cursor_bits(0 .. 15);
> subtype hot_spot_offsets is integer range -16 .. 16;
>
> procedure set_graphic_cursor_words(screen_mask:in graphic_cursor_bits;
> cursor_mask:in graphic_cursor_bits;
> x_hot_spot :in hot_spot_offsets;
> y_hot_spot :in hot_spot_offsets);
>
> procedure Set_Cursor_Position(X,Y:in Integer);
>
>end mouse;
next prev parent reply other threads:[~1999-06-02 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-01 0:00 Mouse driver for Ada... how? J. Marshall
1999-06-01 0:00 ` Steve Doiel
1999-06-02 0:00 ` J. Marshall
1999-06-02 0:00 ` tmoran
1999-06-02 0:00 ` J. Marshall [this message]
1999-06-02 0:00 ` Gautier
1999-06-02 0:00 ` Gautier
1999-06-02 0:00 ` J. Marshall
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox