From c3ab03ddcf08c0e57fe7b0221fd48c746c20fd0e Mon Sep 17 00:00:00 2001 From: pjsk6rqfy <747282718@qq.com> Date: Fri, 1 Jul 2022 09:09:21 +0800 Subject: [PATCH] ADD file via upload --- mouse.s | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 mouse.s diff --git a/mouse.s b/mouse.s new file mode 100644 index 0000000..558eb08 --- /dev/null +++ b/mouse.s @@ -0,0 +1,49 @@ +.globl mouse_interrupt +mouse_interrupt: + pushl %eax + pushl %ebx + pushl %ecx + pushl %edx + push %ds + movl $0x10,%eax + mov %ax,%ds !为后面的call做准备 + inb %ax,%ds + !call readmouse !调用c函数进行细致处理 + +!鼠标对应数据寄存器端口是$0x60,通过inb命令将该数据寄存器中 +!存放的一个字节信息读入到寄存器AL中, +!用户对鼠标的全部信息包含在这一个字节的数据编码里 +xor %eax,%eax + inb $0x60,%al + pushl %eax + call readmouse + addl $4,%esp + +xor %eax,%eax + inb $0x60,%al + pushl %eax + call readmouse + addl $4,%esp + +xor %eax,%eax + inb $0x60,%al !读入鼠标数据 + pushl %eax + call readmouse + addl $4,%esp + +xor %eax,%eax + inb $0x60,%al + pushl %eax + call readmouse + addl $4,%esp +!在mouse_interupt 处理完中断以后,给8259A发送结束中断(EOI)指令 + movb $0x20,%al + outb %al,$0xA0 + outb %al,$0x20 + + pop %ds + popl %edx + popl %ecx + popl %ebx + popl %eax + iret \ No newline at end of file