writing my first isr
Posted: Mon Aug 13, 2007 3:39 pm
hi
im just writing my first isr, the keyboard handler:
i first remap the PICs:
with
then i hook the isr,unmask the keyboard irq, load the idt, and enable interrupts:
the isr looks as follows:
when i press a key, "HELLO" is printed to the screen only once (so no second "HELLO" for the release). when i press a key repeatedly, nothing happens..what could be the problem here??
thanks
martin
im just writing my first isr, the keyboard handler:
i first remap the PICs:
Code: Select all
procedure remap_pics(offset1: dword; offset2: dword); @nodisplay; @noalignstack;
begin remap_pics;
push(eax);
mov(ICW1_INIT+ICW1_ICW4,al);
out(al,PIC1_COMMAND);
out(al,PIC2_COMMAND);
mov(offset1,eax);
out(al,PIC1_DATA);
mov(offset2,eax);
out(al,PIC2_DATA);
mov(%100,al);
out(al,PIC1_DATA);
mov(2,al);
out(al,PIC2_DATA);
mov(ICW4_8086,al);
out(al,PIC1_DATA);
out(al,PIC2_DATA);
mov(%11111111,al); //let's mask
out(al,PIC1_DATA); //all interrupts on master
out(al,PIC2_DATA); //and on slave
pop(eax);
end remap_pics;
Code: Select all
PIC1_COMMAND: text:="$20";
PIC1_DATA: text:="$21";
PIC2_COMMAND: text:="$A0";
PIC2_DATA: text:="$A1";
PIC_EOI: text:="$20";
ICW1_ICW4: text:="$1";
ICW_SINGLE: text:="$2";
ICW1_INTERVAL4: text:="$4";
ICW1_LEVEL: text:="$8";
ICW1_INIT: text:="$10";
ICW4_8086: text:="$1";
ICW4_AUTO: text:="$2";
ICW4_BUF_SLAVE: text:="$8";
ICW4_BUF_MASTER: text:="$C";
ICW4_SFNM: text:="$10";
Code: Select all
mov(0,eax);
mov(cseg,ax);
hook_int($21,INTERRUPT,eax,&key_int);
mov(%11111101,al);
out(al,$21);
lidt(idt);
sti;
hlt;
Code: Select all
procedure key_int; @nodisplay; @noalignstack; @noframe;
begin key_int;
putstring("HELLO");
mov($20,al);
out(al,PIC1_COMMAND);
out(al,PIC2_COMMAND);
sti;
iret();
end key_int;
thanks
martin