*/
PS/2 Mouse ('Real' mode) (no int 33h) v0.02
Submitted By:
MI_7
Rating:





(
Rate It)
This program is made for people who want to make their own
drivers for an PS/2 port without using the int 33h. ( easy to
understand example, I hope ;) ) For use in own OS or MS-DOS
enviroment. This is educational perpose version and the effects
of the program are undefined. By downloading the program the
downloader downloads it at his own risk.
NOTE: Some downloads must be obtained through publishers´s site.
Do you want to get your software listed on this site? Go to our
submissions area.
Screenshot
Details
Number of downloads:
2099
Comments (4)
Little but efficient code !




Posted on Sunday, March 05, 2006
It is very pleasant to have in few lines
of assembly language the solution which
allows me to continue my os development.
A big thank you !
i need help




Posted by: emily anna on Monday, May 07, 2007
exellent code, could you help me traslating this into tc?? i have tried a lot, but it wont work.i got this
#include <stdio.h>
#include <dos.h>
#include <conio.h>
char sp2;
void CHKPRT(){
char exit=0,ap;
asm xor cx, cx
do{
asm in al, 0x64
asm mov ap,al
if ((ap&2)==0)
{exit=1;
}
}while (exit==0);
}
void PS2SET(){
asm mov al, 0xa8
asm out 0x64, al
CHKPRT();
}
void WMOUS(){
asm mov al, 0xd4//; write to mouse device instead of to keyboard
asm out 0x64, al//; write to keyboardcontroller
CHKPRT();//; check if command is progressed (demand!)
}
voidMBUFFUL (){
char exit=0,ap;
asm xor cx, cx
do {
asmin al, 0x64 //; read from keyboardcontroller
asm mov ap,al
if ((ap&0x20)==0)
{exit=1;
}
}while (exit==0);
}
void CHKMOUS(){
char exit=0,ap;
sp2=-1;
asm xor cx, cx
do{
asm in al, 0x64//read from keyboardcontroller
asm mov ap,al
if ((ap&1)!=0)
{exit=1;
}
sp2++;
}while (exit==0); // check if controller buffer (60h) has data
}
voidACTMOUS(){
WMOUS();
asm moval, 0xf4 //; Command to activate mouse itselve (Stream mode)
asmout0x60, al //; write ps/2 controller output port (activate mouse)
CHKPRT();//; check if command is progressed (demand!)
CHKMOUS();//; check if a byte is available
}
void DKEYB(){
asm mov al, 0xad//; Disable Keyboard
asm out 0x64, al//; write to keyboardcontroller
CHKPRT(); //; check if command is progressed (demand!)
}
void EKEYB(){
asm mov al , 0xae//; Disable Keyboard
asm out 0x64, al//; write to keyboardcontroller
CHKPRT(); //; check if command is progressed (demand!)
}
void GETB(){
char ps;
do{
CHKMOUS();
}while(sp2!=0);
DKEYB();
asm in al, 0x60//; read ps/2 controller output port (mousebyte)
asm mov ps,al
EKEYB();//; enable keyboard
printf("\n%d",ps);
}
int main(void)
{
char b, d =0;
PS2SET();
WMOUS();
GETB();
do {
clrscr();
GETB();
GETB();
GETB();
} while(d==0);
return 0;
}
My Appreciation




Posted by: Maxinator on Thursday, October 11, 2007
I cant say, how much i thank you, i searched for exemples overall in the net, because my selfwritten-code based on the ralf-browns-list didnt work, but i couldnt find anything. I also searched programmersheaven archives, but it seems, like i oversaw your code, or i thought, id dont work as well, because when i first searched fpr ps/2-mouse-drivers i tested it while running xp and now i always test the drivers with my own written OS, for that a also needed this piece of code. THANKS..
P.S.: This is my 5th search. Between the over searches there was a gap of around some weeks or even months.
Well this is not the best place to ask for my help..




Posted by: MI-7 on Tuesday, November 20, 2007
For questions and stuff you can contact me by internal mail of programmersheaven or by email.
email: MI-7@badassdummies.nl
the main fault i see in your tc script is that you use the asm not in the right way.
you can use this as following:
asm {
xor ax,ax
}
if you want to use variables of c in the asm for in or output you can do that as follows:
char vari;
asm {
mov AH, vari
cmp AH, 0
}
and as i remember its not easy to use the asm command in tc. this should be enabled, if it isnt by default, somewhere at the compiler settings.
[this is what i remembered at this moment so it might be a little bit different]
I can help better by mail,irc,msn and such.
Greetz MI_7
Add Your Rating