Mouse Location Always Zero

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Mouse Location Always Zero

Post by Octacone »

Ch4ozz wrote:Your unmasking for all interrupts looks wrong to me:

Code: Select all

outportb(0x21, 0x0);
outportb(0xA1, 0x0);
Change it to:

Code: Select all

outportb(0x20, 0x0);
outportb(0xA0, 0x0);
Nothing. :/ 0000000
Also I've followed one timer related tutorial.
And I get this "not passed" message.

Code: Select all

int timer_ticks = 0;

void timer_phase(int hz)
{
    int divisor = 1193180 / hz;       /* Calculate our divisor */
    outportb(0x43, 0x36);             /* Set our command byte 0x36 */
    outportb(0x40, divisor & 0xFF);   /* Set low byte of divisor */
    outportb(0x40, divisor >> 8);     /* Set high byte of divisor */
}

void timer_handler(struct regs *r)
{
    timer_ticks++;

    /* Every 18 clocks (approximately 1 second), we will
    *  display a message on the screen */
    if (timer_ticks % 18 == 0) {
        writeOutput("One second has passed");
    } else {
    	writeOutput("not passed...");
    }
}

void timer_install()
{
    irq_install_handler(0, timer_handler);
}

void timer_wait(int ticks)
{
    unsigned long eticks;

    eticks = timer_ticks + ticks;
    while(timer_ticks < eticks);
}

Could that be related? I am supposed to get "1 second has passed" message. IRQ troubles?

IDT output from Bochs:
Interrupt Descriptor Table (base=0x0000000000000000, limit=0):

Error I am getting:
(0).[259291843] [0x0000000000115148] 0008:0000000000115148 (unk. ctxt): mov dword ptr ss:[esp], 0x00114c30 ; c70424304c1100
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Mouse Location Always Zero

Post by Octacone »

Still getting 3rd exception 13 no resolution with Bochs. :(
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
Combuster
Member
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

Post by Combuster »

<Insert all the response from the previous time you got that error here>
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply