Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-12-2005, 01:35 PM   #1 (permalink)
jyrka
Registered User
 
Join Date: Jun 2005
Posts: 1
jyrka is on a distinguished road
mouse

i dont know much about C but i need to get access to my
PS/2 mouse driver. i found this:
Mouse driver functions are accessed through interrupt 33h. The following code sequence portrays what a typical call to the mouse driver looks like in assembly language:

MOV AX,5
MOV BX,l
INT 33H
TEST BX,l
Jz NOT_DEPRESSED

In general, function codes are passed in register AX, and other parameters in BX, CX, and DX. This particular sequence calls function 5 to retrieve the status of the right mouse button (BX=l for the right button, BX=O for the left). On return, bit I of the BX register is tested and a branch is made if it's set to 0, indicating the button is not currently depressed.

can anyone explain it and maby lighten me a lil bout syntax of accessing registers?
jyrka is offline   Reply With Quote
Old 02-20-2006, 11:08 AM   #2 (permalink)
Hamlin
Jedi Master
 
Hamlin's Avatar
 
Join Date: Feb 2006
Location: Denver, CO
Posts: 15
Hamlin is on a distinguished road
Are you looking for enlightenment concerning register access in C or ASM?

Unfortunately, under the current Windows regime a lot of 16-bit programming can no longer be performed do to the restrictions Windows places on direct access to the hardware.

In the meantime, the code snippet you've posted portrays a test of whether or not the right mouse button is depressed. When the interrupt returns, the BX register will contain the number of button presses ( between 0 and 32767 ), CX will contain the horizontal position at the last press, DX will contain the vertical position at last press, and AX will contain a bitfield detailing the status which is described like so:

Bit 0 - 1 = left button down, 0 = left button up
Bit 1 - 1 = right button down, 0 = right button up
Bit 2 - Unused
Bit 3 - Unused
Bit 4 - Unused
Bit 5 - Unused
Bit 6 - Unused
Bit 7 - Unused

Regardless, trying to access interrupt 33h under Windows outside of 16-bit DOS mode programs will certainly cause an error.

If you tell me why you need access to the mouse driver, I can probably help you out some, and maybe come up with a way around the problem you're trying to solve.
Hamlin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
global mouse hook in .net G_Zola MS Technologies ( ASP, VB, C#, .NET ) 0 05-13-2005 02:06 AM
Mouse or Drag Handlers sde MS Technologies ( ASP, VB, C#, .NET ) 0 06-05-2004 08:57 AM


All times are GMT -8. The time now is 07:30 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting