Main > Main Forum
USB vs PS/2 vs COM vs LPT
<< < (17/43) > >>
Osirus23:

--- Quote from: EvilNuff on September 23, 2010, 07:05:33 pm ---
You're a troll. 


--- End quote ---

Yes. Now will everyone please stop. Just STOP.
Marsupial:
I personally find MonMotha's posts very interesting.
MonMotha:

--- Quote from: Driver-Man on September 23, 2010, 06:46:19 pm ---It is ALWAYS emulated, or at least that's the Windows default settings. Would you like me to compile that program which reads port 0x60 so you can see it will work with your USB keyboard just the same, in either Windows or Linux?

--- End quote ---

You're welcome to try.  It will crash on NT (incl. 2k/XP and Vista/7).  NT does not allow userspace processes to perform in/out instructions.  Linux doesn't either unless you call iopl or similar.

Incidentally, accessing the parallel port in this manner will, too.

Such a program would run on Win9x, but I don't think you'll get USB HID keyboard data except on Win95 RTM (which didn't include USB support).  I'm not 100% sure of that, but I think even Win9x disables legacy emulation since it wants direct access to the USB HCI to enable non-HID boot protocol devices to function.  You may also run into all sorts of issues with both Windows and your application simultaneously trying to do I/O to the same locations, and you definitely won't be able to use interrupts.

If your computer comes with no "legacy" keyboard port, you do NOT have a "keyboard controller" on the motherboard.  The BIOS will emulate accesses to the IO ports used by the keyboard controller unless the OS tells it otherwise.  Even if you DO have a "legacy" keyboard port, the BIOS still intervenes in order to provide merged PS/2 and USB HID data via that interface to anything that still uses it (which is pretty much just DOS and some bootloaders).

MAME does not have separate routines for PS/2 and USB input.  MAME *does* use the APIs provided by Windows (or whatever OS is hosting it) for accessing the keyboard data.  You actually don't have a choice, and it would stupid to do it any other way as it wouldn't take into account things other than PS/2 and USB keyboards if you banged on the registers directly like you seem to want to do.  What if the user has a Bluetooth keyboard?  How about an old Sun keyboard hooked up to the parallel port (Linux supports this!)?  What about on-screen keyboards?

I suspect at this point you're either trolling or someone who hasn't programmed a PC since 1990.  One of the core functions of a"real" OS (i.e. something that doesn't just provide a thin wrapper around a fixed architecture) is that it abstracts away hardware functions like this.
saint:

--- Quote from: Osirus23 on September 23, 2010, 09:46:31 pm ---
--- Quote from: EvilNuff on September 23, 2010, 07:05:33 pm ---
You're a troll. 


--- End quote ---

Yes. Now will everyone please stop. Just STOP.


--- End quote ---

So, why do I let a thread like this keep going?

Despite the condescending/patronizing attitude, it has generated some pretty interesting technical discussions. Until it gets to a point where the rules are being broken I don't see the need to moderate it. Sort the wheat from the chaff if this kind of thing interests you, or bail on the thread if it doesn't :)

--- saint
Driver-Man:

--- Quote from: MonMotha ---You're welcome to try.  It will crash on NT (incl. 2k/XP and Vista/7).  NT does not allow userspace processes to perform in/out instructions.  Linux doesn't either unless you call iopl or similar.

--- End quote ---


--- Code: ---void main(){
  while(inportb (0x60)!=1)
    printf("\nKey: %i", inportb(0x60));
}

--- End code ---
DOWNLOAD: inC-kbd.zip (kbd.c + kbd.exe)
http://www.mediafire.com/?sd73z3qllhw1e10


Tested it now on WinXP, with both PS/2 and USB,
even with Macinotsh (USB) keyboard,
on Desktop, on Laptop,
and also with 2 keyboards in the same time.

It works.



--- Quote ---I suspect at this point you're either trolling or someone who hasn't programmed a PC since 1990.

--- End quote ---

Troll? What are you accusing me of?


Green Goblin: -"Well, to each his own. I chose my path, you chose the way of the hero. And they found you amusing for a while, the people of this city. But the one thing they love more than a hero is to see a hero fail, fall, die trying. In spite of everything you've done for them, eventually they will hate you. Why bother?"
Navigation
Message Index
Next page
Previous page

Go to full version