Mouse Location Always Zero
Mouse Location Always Zero
I used this tutorial for my mouse driver: http://forum.osdev.org/viewtopic.php?t=10247
When I use my debug tool to see if the mouse has moved, I always get zero for both x and y.
I've been debugging for past two days and can not find what the issue is. :/
What could be a problem.
When I use my debug tool to see if the mouse has moved, I always get zero for both x and y.
I've been debugging for past two days and can not find what the issue is. :/
What could be a problem.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
-
- Member
- Posts: 190
- Joined: Tue Aug 26, 2008 11:24 am
- GitHub: https://github.com/sebihepp
Re: Mouse Location Always Zero
Do you have working interrupts?
I think the irq_install could be a common mistake, because it uses 12 as IRQ. In PMode there are Exceptions from 0x0 to 0x1F, so you need to remap the PIC. An the 12 is therefore not the 12. Exception, but the twelvth line of the PIC. Perhaps that's your mistake?
I think the irq_install could be a common mistake, because it uses 12 as IRQ. In PMode there are Exceptions from 0x0 to 0x1F, so you need to remap the PIC. An the 12 is therefore not the 12. Exception, but the twelvth line of the PIC. Perhaps that's your mistake?
Re: Mouse Location Always Zero
Yeah I think my interrupts are working fine.sebihepp wrote:Do you have working interrupts?
I think the irq_install could be a common mistake, because it uses 12 as IRQ. In PMode there are Exceptions from 0x0 to 0x1F, so you need to remap the PIC. An the 12 is therefore not the 12. Exception, but the twelvth line of the PIC. Perhaps that's your mistake?
I have a function that remaps IRQs.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Mouse Location Always Zero
Having code doesn't mean it works . The fact that you're not even telling us if you're getting interrupt 44 strongly suggests it doesn't.
Hint: If you have to write "I think" you usually did something wrong you could have already fixed.
Hint: If you have to write "I think" you usually did something wrong you could have already fixed.
Re: Mouse Location Always Zero
How am I supposed to tell if I am getting interrupt 44 when I don't have a way of seeing that.Combuster wrote:Having code doesn't mean it works . The fact that you're not even telling us if you're getting interrupt 44 strongly suggests it doesn't.
Hint: If you have to write "I think" you usually did something wrong you could have already fixed.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Mouse Location Always Zero
Well, make a way to see it then. You really should have debugging services implemented prior to going into graphics. Its better to implement a protocol now rather then later on when it becomes much more harder. Options include, but are not limited to (1) display something on the screen, anything; (2) serial output; (3) stay in text mode and print the mouse status and interrupt information. In the long term, serial output is the way to go. Never assume your code works - verify that it actually works.
You mentioned using a debugging tool, so what prevents you from using it to check this?
With that said, sebihepp is right - looking over the code, it can't be simply copied and pasted. Depending on your architecture and where your PIC maps physical irq 12 to, your code will be slightly different. IIRC the way most tutorials map the PIC would map physical irq 12 to logical irq 44 but again, its all up to what you did in your code.
You mentioned using a debugging tool, so what prevents you from using it to check this?
With that said, sebihepp is right - looking over the code, it can't be simply copied and pasted. Depending on your architecture and where your PIC maps physical irq 12 to, your code will be slightly different. IIRC the way most tutorials map the PIC would map physical irq 12 to logical irq 44 but again, its all up to what you did in your code.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: Mouse Location Always Zero
neon wrote:Well, make a way to see it then. You really should have debugging services implemented prior to going into graphics. Its better to implement a protocol now rather then later on when it becomes much more harder. Options include, but are not limited to (1) display something on the screen, anything; (2) serial output; (3) stay in text mode and print the mouse status and interrupt information. In the long term, serial output is the way to go. Never assume your code works - verify that it actually works.
You mentioned using a debugging tool, so what prevents you from using it to check this?
With that said, sebihepp is right - looking over the code, it can't be simply copied and pasted. Depending on your architecture and where your PIC maps physical irq 12 to, your code will be slightly different. IIRC the way most tutorials map the PIC would map physical irq 12 to logical irq 44 but again, its all up to what you did in your code.
Yeah, I made a simple debugger that talks to QEMU's serial console. I can output text and see the output while my OS is running.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Mouse Location Always Zero
So you know how to check if the interrupt is firing.
Re: Mouse Location Always Zero
Maybe, I only have my IDT ready, no external interrupts inside assembly.iansjack wrote:So you know how to check if the interrupt is firing.
Also when I initialize my keyboard I can type and see the text, but when I move my mouse characters appear on the screen like I typed them.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Mouse Location Always Zero
I "remade" my interrupts, now I am getting infinite restart loop. I can see my GUI for a second and then it restarts again and again.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Mouse Location Always Zero
That doesn't say much. Run it in Bochs and show us the log messages,thehardcoreOS wrote:I "remade" my interrupts, now I am getting infinite restart loop. I can see my GUI for a second and then it restarts again and again.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Mouse Location Always Zero
That is a very very good idea. Bosch has one really nice debugger.omarrx024 wrote:That doesn't say much. Run it in Bochs and show us the log messages,thehardcoreOS wrote:I "remade" my interrupts, now I am getting infinite restart loop. I can see my GUI for a second and then it restarts again and again.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: Mouse Location Always Zero
Bochs output:
When I use QEMU I get infinite restart loop and when I use Bochs it works just fine.
Code: Select all
using log file bochsout.log
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
<bochs:1> c
(0).[240243672] [0x0000000000000003] 0008:0000000100000003 (unk. ctxt): lock push ebx ; f053
Next at t=240243673
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Mouse Location Always Zero
Bochs works just fine, yes, but not your code. It still restarts the CPU on bochs, on the account of executing garbage memory.thehardcoreOS wrote:when I use Bochs it works just fine.
Re: Mouse Location Always Zero
Ummm... What could be the problem then.Combuster wrote:Bochs works just fine, yes, but not your code. It still restarts the CPU on bochs, on the account of executing garbage memory.thehardcoreOS wrote:when I use Bochs it works just fine.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader