PIC

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.
Post Reply
hanoi

PIC

Post 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
hanoi

Re:PIC

Post by hanoi »

workz ;D
Whatever5k

Re:PIC

Post by Whatever5k »

hanoi:
Think before writing something, you already filled another thread unnecessarily!
jrfritz

Re:PIC

Post by jrfritz »

Could I see the code that works? the asm and c function?
hanoi

Re:PIC

Post 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
hanoi

Re:PIC

Post 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
jrfritz

Re:PIC

Post by jrfritz »

Probly a problem with your kprintf...

I have a good kprintf in my Pk0.3:

http://gd.tuwien.ac.at/opsys/linux/sourceforge-sorted/fF/fritzos/Prekernel0-3.zip

And other old FritzOSes:

http://gd.tuwien.ac.at/opsys/linux/sourceforge-sorted/fF/fritzos/
pskyboy

Re:PIC

Post 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
Post Reply