Author Topic: How to use assembler language to control netcard to receive or send data?  (Read 15778 times)

Offline 委座

  • Jr. Member
  • *
  • Posts: 3
Hello everyone:
    I just wrote a little system kernel in IA-32,I hope my system can connect internet.So,please tell me how i can use assembler language to control netcard to receive or send data?Please help me,thank you very much!!
                                                                                                                   Best wishes
                                                                                                   

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Well, "in" and "out" I suppose, but you probably knew that. Depends on "which card" of course. Some info here (as always):

http://wiki.osdev.org/Main_Page

MenuetOS (the 32-bit version) will connect. When I last tried it, my card was not supported. I recall that there was some nice documentation on how to add a card if your card wasn't supported. Essentially "find a C driver and re-write it in asm", as I recall. I think that's how I'd approach it if I were in your position - see how Linux does it for "my card" and try to extract the "essentials".

If I were smarter than I actually am, I'd probably design the "interface" before I tried to implement the details for "my card", in order to ease the transition to "any card". In reality, I'd probably code up specifics for "my card" and plan to work out the interface later... which I'd probably never get to...

The "usual thing" (seems pretty similar between Windows and Linux, at least) is socket(), connect(), read(), write(), bind(), listen(), accept()... Complicated enough to program for an existing OS! Probably sensible to do it the "same way", but what's the sense of writing your own OS if it's going to be just like some other OS? A lot of decisions involved in OS design! I suspect that once you've got the design worked out, implementing it - in asm or any other language - is probably the "easy part"... although still a pile of work!

Let us know how it goes.

Best,
Frank


Offline 委座

  • Jr. Member
  • *
  • Posts: 3
Hello sir:
    Thanks for your suggestions,and the website is very useful.But I am not a patient people?and my understanding abilty is not very good,please help me once again,can you share your assembler language code which uses to control netcard to receive or send data with me?
                                                                                                          Best wishes
                                                                                                          Thankyou