I would like to know if it's possible to write a function for C++ using 32bit inline asm in order to get unbuffered input. I was able to use 16 bit asm on my dos compiler, but using the same call locks up all of my win32 compilers such as Code Warrior, VC6, and Dev C
My 16 bit code was something like
From there I would process the scan code to do what task that I needed. I cannot get unbuffered input at all using standard c++. Could someone explain why this code won't work with 32 bit compilers or possibly provide a snippit of inline code that I could use with the aforementioned compilers.
The apps are all console.
TIA
My 16 bit code was something like
unsigned short GETCH(void)
{
unsigned short raw;
_asm
{
mov ah,0x10
mov raw,ax
int 0x16
}
return raw;
}
From there I would process the scan code to do what task that I needed. I cannot get unbuffered input at all using standard c++. Could someone explain why this code won't work with 32 bit compilers or possibly provide a snippit of inline code that I could use with the aforementioned compilers.
The apps are all console.
TIA
Check out the following of Win32 APIs:
ReadConsole()
ReadConsoleInput()
PeekConsoleInout()
If you have to use DOS interrupt, either you can use VWIN32 VxD (but I don't know if it supports keyboard interrupt.) or you have to code it in old 16-bit way.
ReadConsole()
ReadConsoleInput()
PeekConsoleInout()
If you have to use DOS interrupt, either you can use VWIN32 VxD (but I don't know if it supports keyboard interrupt.) or you have to code it in old 16-bit way.
That should read 1 character from console in AL (ebx holds handle for STDIN):
invoke GetConsoleMode ebx, addr oldstate
invoke SetConsoleMode ebx, 0
push 0
mov edx, esp
push 0
mov ecx, esp
invoke ReadConsole ebx, ecx, 1, edx, 0
invoke SetConsoleMode ebx, oldstate
pop ecx
pop edx
and eax,eax
jz @F
movzx eax,cl
@@:
Thanks to you both for the feedback. I'll give the info a try.