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.
Hi!
I'm a real newbie, I wan't to create very primitive OS! I can't seem to get it how to output character by writing to memory in real mode. I did it like this:
Is it posible to "mount" ethernet device into memory and then send some data packet? For example I wan't to send ARP packet, I just fill the buffer with this ethernet+ARP header:
And send it! How can I "mount" network card into memory so I can send data!! Does different network cards have different hardware interupts? How can I control thous hardware interupts? Thank you!
In realmode segmentation only allows you to access chunks of memory that are 64KB in size, you have to move the segment around. In realmode you may as well use the BIOS for writing to the screen as it's just easier.
It is not possible to "mount" hardware, the hardware does not operate on the UNIX level of thinking, you have to detect the card on the PCI bus, determine it's IRQ, IO Ports and/or memory mapped registers then you need a driver that understands how to manipulate those 3 things to drive the card.
Thank you!
Can you please show me how to write in real mode to memory! I know its not as easy as it would be with BIOS, but I want to get the basic idea how to do it, so I can later learn how to enter PMODE and then write to memory!
you have to detect the card on the PCI bus, determine it's IRQ, IO Ports and/or memory mapped registers then you need a driver that understands how to manipulate those 3 things to drive the card.
So is it posible to do this in real mode? But when I write to memory to output character I don't have to detect anything right? And do you know any very simle example how to do this three things? Thank you!
AR wrote:
It is not possible to "mount" hardware, the hardware does not operate on the UNIX level of thinking, you have to detect the card on the PCI bus, determine it's IRQ, IO Ports and/or memory mapped registers then you need a driver that understands how to manipulate those 3 things to drive the card.
i suggest you look at the FAQ for a quick understanding of network cards (at least those for which we have enough information available).
What you call "mounting" in the hardware world is called "memory-mapped registers". Sometimes available, sometimes it's not (for instance, with the NE2000 network card, you need to send every byte of your packet through a "data port" to make it available to the card).
First of all you're moving to 0xB80000 ... it's 0xB8000.
Remember that every character has two bytes. First is the char, second is the attributes. So to write your char you should write 0x66 to 0xB8000 and attributes at 0xB8001 ( for example 0x02 or 0x20 )
Ouch. i didn't notice it was even that bad. I suggest you got yourself a small book about assembler programming, or print and study the "Art of Assembly" (should be in the FAQ's links or in QuickLinkz)
; using BIOS to display character
mov al, 0x40 ; ASCII code of the character
mov bl, 0x07 ; Text attribute
mov ah, 0x0E ; Teletype function
mov bh, 0x00 ; Page number
; Call the BIOS interrupt
int 0x10