Thread: outportb

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516

    outportb

    guys, outportb in dos.h takes in the port id and the value to be written rite. what i want to ask is that how can i get the port ids of some standard devices like the sound output and for the visual display card and devices of that type. first of all,are the values standard for all computers, for these standard devices??
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    You'd be in for a lot of work here. Yes, video cards are almost certainly located at the same ports on every PC, assuming you're dealing with a standard (VGA, VESA...). Unfortunately, accessing sound cards is a very different matter.

    Modern soundcards reside on the PCI bus and are tricky to find, let alone identify. They don't tend to have a standard interface so you'd need to accomodate for many different models. Older soundcards were ISA and tended to follow Creative Labs's rule of hanging around port 220h, as well as being mostly 100% Soundblaster compatible, so they used the same interface.

    The PC speaker, perhaps the only consistent sound interface across all PCs, is easier to use, although you'd have to know your stuff to get it to play wave files.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So what is your OS and Compiler PING?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    thanks for the reply SMurf. by the way,i dont use a sound card. i intend to take the output directly from sound output of the motherboard onto the speakers. And i use borland 3.0 turbo c++ and my OS is win98SE.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  5. #5
    www.entropysink.com
    Join Date
    Feb 2002
    Posts
    603
    I don't know if this helps, but...

    http://www.peltonweb.com/docs/asm_ports.htm

    edit>> As you can see, they do tend to differ across different PC families.
    Visit entropysink.com - It's what your PC is made for!

  6. #6
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    actually i am having trouble accessing the sound output of the motherboard. i am not sure how to test whether the sound blaster is located at a certain location or not. could anyone help ??
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  7. #7
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    how exactly are you going to accomplish this ping...sound would be a product of software which makes a call to the OS which trys to interact with the sound card...which isn't there...so where are you pulling this sound from?


    (unless you mean you have a ac97 codec chip on your mobo?)
    PHP and XML
    Let's talk about SAX

  8. #8
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    so you're saying you have onboard ac97 sound?
    PHP and XML
    Let's talk about SAX

  9. #9
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    yes..it is ac97
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  10. #10
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    ok, sorry about the double post, neither showed up originally for some reason. Who makes the chip? You may be able to contact them and see if that chip requests a certain irq...other than that it's going to vary from motherboard to motherboard and your program won't be portable. There's a reason for using higher level languages, this is one of them.
    PHP and XML
    Let's talk about SAX

  11. #11
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    i am not sure about the make of the chip. can u help me with how i can check whether the sound output is actually located at a certain port. i tried out some things and did some research in the past 3-4 days and i think i can be certain of the fact that it is between 220h and 230h. i am not sure about how i can test whether the output is located at a certain port. any help will be appreciated
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  12. #12
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    well, the easiest way (since it is probably difficult to tell what data is actually sound) would be to write an app in C and assembly. Use assembly to store what you think might be sound data into a register (just try the ports sequentially), then use the return from your chunk of assembly in a win-api call for sound output (or whatever OS you're using). Maybe there's a way to put sound to the speakers in assembly but you'd probably have to know what port the sound card is listening on...which is what you're trying to figure out here so that wouldn't work.
    PHP and XML
    Let's talk about SAX

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well it would help if you didn't keep tying your feet together with that old compiler, and started using something more appropriate for your operating system.

    It's not like there's any shortage of good quality free compilers available.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  14. #14
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    i have dev c++ and i use it sometimes. But i dont know how to use things like dos interrupts and stuff with it. Actually, i dont use that compiler all the time. only when i have to work with interrupts and things like that, i use the borland compiler, otherwise, i stick to dev c++.
    by the way, i dont have a sound card Waldo,i am trying to take the output directly from the sound output on my Mobo. i tried using outportb to send different values to the ports between 220h and 230h, but there was no sound from the speakers. maybe that is not the correct way to check the port where it is located.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  15. #15
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > But i dont know how to use things like dos interrupts and stuff with it.
    That's because you CANT use DOS interrupts, and because you DONT need to either.

    Everything you need to do is available somewhere in the win32 API - like for example if windows can play sounds through your ac97 sound system, then a program written in dev-c++ using appropriate win32 API calls will also be able to play sounds as well, without any need to go messing about with interrupts and ports.

    What's more, your programs will have a much better chance of working on many other machines as well, rather than just people with machines identical to yours.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. High Speed IRQ Timer/Clock in C
    By andrewwan1980 in forum C Programming
    Replies: 7
    Last Post: 01-16-2008, 05:21 AM
  2. WAV file problems...
    By snerl in forum C Programming
    Replies: 4
    Last Post: 06-11-2003, 03:00 PM
  3. Need help on Serial Port programming!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 06-04-2002, 05:02 PM
  4. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM
  5. outportb(); Variables?
    By SavesTheDay in forum C Programming
    Replies: 3
    Last Post: 02-15-2002, 04:19 PM