📄 mouse.c
字号:
/*
* LittleOS
* Copyright (C) 1998 Eran Rundstein (talrun@actcom.co.il)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
** Mouse driver 0.0.2
** Written by Eran Rundstein (talrun@actcom.co.il)
** For LittleOS
** Known Limitations:
** Only supports mice on COM port 1
*/
#include <kernel.h>
#define MOUSE_IRQ_COM1 4
#define MOUSE_IRQ_COM2 3
#define COM1_PORT 0x3f8
#define COM2_PORT 0x2f8
#define max_screen_x 79
#define max_screen_y 24
extern int c_x,c_y;
static unsigned int MOUSE_IRQ=MOUSE_IRQ_COM1;
static unsigned int MOUSE_COM=COM1_PORT;
static unsigned int bytepos=0, coordinate;
static unsigned char mpacket[3];
static signed int mouse_x=40, mouse_y=12,mo_x=40,mo_y=12;
static unsigned char mouse_button1, mouse_button2;
static signed int horiz_sensitivity, vert_sensitivity;
static int mo_c=0;
unsigned int microsoft_mouse_handler(unsigned long irq)
{
unsigned int mbyte=inb(MOUSE_COM);
int i;
ushort *vid = (ushort *)VIDEO_ADDR;
int scx,scy;
scx=c_x;
scy=c_y;
vid[mo_x+mo_y*80]=mo_c;
mo_c = vid[mouse_x+mouse_y*80];
vid[mouse_x+mouse_y*80]=((int)'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -