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.
but i cannot understand what this code does ?
any help can be help full -- I understand y its used but i cannot understand the code itself for ex 'outb 0x20, 0x11;' why is it used ?? etc
The code is for "remapping the PIC".
When a PC is first booted, IRQs from hardware devices end up having the same interrupt numbers as CPU exception codes. This is completely unworkable. Fortunately, the Programmable Interrupt Controller chip is programmable. So you can change (to some degree) which IRQs map into which CPU interrupt numbers, by sending some codes to the PIC chip. You don't want to use any of the first 32 CPU interrupts. But the next 16 are free for you to use for IRQs. So that is what this code does. It uses PIC-specific commands (in the form of special bytes to particular IO ports) to tell the PIC to map the 16 IRQs to CPU interrupt numbers 0x20 to 0x2f.
I have another question - i am looking at various tutorials and OS examples but they all end up looking alike - did they copy from a tutorial or do the actually think same !!
Technology is here to make things easier not harder.
packet50071 wrote:I have another question - i am looking at various tutorials and OS examples but they all end up looking alike - did they copy from a tutorial or do the actually think same !!
The manufacturer of a device intends for it to be used in one fairly specific way. You can change the comments a little if you want, but there is really only one possible set of commands you can send -- unless you do it wrong. There are many many ways to do it wrong.
packet50071 wrote:nah i am not talking about this - i am talking about the name of the functions used in all their code and stuff like that . any way forget about it
I have noticed this alot too. It actually has advantages b/c some people are lazy with comments and others have way too many and the combination usually lets you figure out what the code is doing.
Also if you ever see hardcoded numbers used in the middle you can usually google: <the #> osdev
and find another tutorial explaining where it came from