Page 1 of 1
PIC
Posted: Thu Dec 26, 2002 8:18 am
by hanoi
hey
i wrote a PIC-remap function but it didn't work..
Then i copied the one from the FAQ
it didn't work to..
what to do?
i used it like this:
remap_PIC(0x20,0x28);
setVector(0x21, (void *)(frmKBD));
k_printf("press a key");
asm:
_frmKBD
pusha
pushf
call _KBD
popf
popa
iret
C:
void KBD()
{
unsigned char t;
t = inp(0x60);
outp(0x20,0x20);
k_printf("\n...and now turn around!");
return;
}
thx, dunno what's wrong
Re:PIC
Posted: Thu Dec 26, 2002 8:54 am
by hanoi
workz ;D
Re:PIC
Posted: Thu Dec 26, 2002 9:19 am
by Whatever5k
hanoi:
Think before writing something, you already filled another thread unnecessarily!
Re:PIC
Posted: Thu Dec 26, 2002 11:31 am
by jrfritz
Could I see the code that works? the asm and c function?
Re:PIC
Posted: Thu Dec 26, 2002 12:50 pm
by hanoi
ok:
this for PIC-remap
void PIC()
{
outp(0x20, 0x11);
outp(0xA0, 0x11);
outp(0x21, 0x20);
outp(0xA1, 0x28);
outp(0x21, 0x04);
outp(0xA1, 0x02);
outp(0x21, 0x01);
outp(0xA1, 0x01);
outp(0x21, 0x01);
outp(0xA1, 0x01);
return;
}
as someone showed here
void KBD()
{
unsigned char t;
t = inp(0x60);
outp(0x20,0x20);
k_printf("...and now turn around!\n");
return;
}
irq handler:
[extern _KBD]
[global _frmKBD]
_frmKBD:
pusha
pushf
call _KBD
popf
popa
Re:PIC
Posted: Thu Dec 26, 2002 12:56 pm
by hanoi
i know that's not belonging to this thread but abless told me not to open a new thread if i have a question but to think...well..here is my prob:
i splitted the Kernel into a few files..
but now i get 3rd exception(13) and running in bogus memory if i just run k_printf("somewhat") or something
that's a bit annoying..
maybe you know why
Re:PIC
Posted: Thu Dec 26, 2002 2:49 pm
by jrfritz
Re:PIC
Posted: Fri Dec 27, 2002 8:14 am
by pskyboy
When you say you split your kernel up into files im assuming you mean the source code. If you have compiled it into seperate files and are loading them it will probably be that the data segment and code segment registers are wrong. If it is your soucre then make sure that you have compiled each file into an object and linked them all together.
It's not as silly as it sounds i forgot to compile a Object Module in before and wondered why the hell it kept crashing with page faults.
Peter