mario
March 28, 2007, 4:21pm
21
Indeed!
KevinJackson:
[color=indigo]Masters Mario and Mitchell:Thanks for the suggestion of C versus C++, I’ll give that some consideration. I’m not familiar with a MOVSX instruction; perhaps someone’s using the X as a variable since MOVS comes in three flavors: MOVSB (8 bit Byte), MOVSW (16 bit Word) and MOVSD (32 bit DWord). At least those are the mnemonics used by MASM and the Phar Lap Protected Mode x86 Assembler that I’m familiar with. But I digress…
No it’s an actual instruction, it means extend the sign when moving from example a byte to 4 byte register.
KevinJackson:
[color=indigo]Masters Mario and Mitchell:Now for MY two cents worth. Although a well written compiler can probably do a great job of making instruction pipelining work well for superscalar processors, I’m not convinced that the compiler (in collusion with the OS) doesn’t throw all that performance gain away by introducing MANY other inefficiencies. Take for example the situation that started this thread. I’m simply trying to get raw (non linebuffered) keystrokes from the keyboard, yet we’re having to set up the “console” as though it’s a UART (a quaint anachronism and an abstraction), then calling cin.get(), fgetchar() or read(), any of which probably take dozens if not hundreds of CPU instructions to execute, when the PC’s BIOS could make that data readily available with a couple of instructions. Surely the console Resource Manager’s interrupt handler (devc-con?) is getting keyboard data and moving it into an interrupt input buffer on a keystroke by keystroke basis and I hope SOMEDAY to find a computationally efficient way to get to that data WITHOUT having to wait for an Enter key to be pressed but so far that technique has eluded me.
That situation has nothing to do with the C language. In C you could actually make the int call to the bios directory int86(…). As for not having to wait for and enter key, or any other key for that matter which is more inline with real-time programming. You need to look at ionotify, that mean the OS will send you a message when a key was pressed no need to way or even poll.