Re: [Eric-develop] We can read scan codes in Win32 :/
Status: Pre-Alpha
Brought to you by:
andrew_turner
|
From: Andrew T. <zo...@i4...> - 2001-08-31 23:31:04
|
Ismail PAZARBASI wrote: > Guys, > > > > I wrote a code in Win32 platform, that can read from keyboard > microcontroller' s port 0x60 (96), and can write there too. However, > actually, I did not try to write anything to keyboard... You will also need to write to port 0x64 to reset, enable, disable, run the self test on the keyboard. > > > > The thing that it makes now is simple. There is a function in a C > code, that is reading from 0x60, this is the last pressed key's scan > code. then there is another function to match the scan codes to ascii > codes is called... We can read scan code, convert it into ascii... > > > > What I want to do exactly? > > > > I want to first, check if keyboard is present. Then, check if keyboard > buffer is full. If it is, what is it? Did kernel processed it? If no, it > is not full (=empty), keep tracking it. When user presses a key, > keyboard writes some code (I dont remember it, it is in my bookmarks.), > and we invoke kernel' s keyread function (I examined test directory in > CVSROOT, and I realized that io.cpp!! Dammit guys, I have been searching > for such thing for days, and it was on there, under my hands for 3 weeks > :p :) Kernel then starts to check when key will be released, and is > there another key being pressed. Meanwhile, kernel' s keyboard driver's > asciimatch function matches scancode to ascii character, and checks for > kernel' s command list for any special meaning of the key (e.g. > alt+function keys in FreeBSD console changes ttys). There is also one > more point here: is key pressed alone? or pressed with modifier keys > (alt, altgr, ctrl, shift)... Keyboard then stops reading, when user > releases key kernel stops. > > > > The Mach Thing: > > > > I tried but failed to download MachOS. I don' t know why, I could not do > it. I could not find server (I have found address from yahoo! and > cmu.edu). I want to have it. You guys have any URLs? Is there keyboard > stuff inside Mach kernel currently? (PS: I need source, there are > hundereds of sites offering *free* suggestions, knowledge, 2 lines of > examples...) > > > > Establishing Our Development Environment: > > > > I would like to have source code of the kernel released. And I need that > bootloader also, I think. I want to migrate current kernel code with > keyboard*ed* code. Because, I cannot try this code neither in my home, > nor in work. Computer fails to stop interrupt serverices, or, I have a > trouble with the code that I cannot see. I have grabbed two codes: one > from a Linux source, implementation of "unsigned char inb(short)" > function, and one from Eric' s "test2/io.cpp" in CVS tree. The source is released from the sourceforge project page. I'm using grub to load the kernel. > > > > After this point, I mean reading from keyboard, we can simply try to > code in Eric environment. I believe we can use something at least we can > write our names to screen with keyboard :p Anyway, seriously, we need a > loader, I think it will be ELF, is this right? If it is so, we can use > lots of compatible binaries. We also need filesystem support, Memory management, etc.... > > > > Finally, guys, I want to be enlightened about kernel' s current status, > and utility (i.e. can we use it for a few stupid commands?). I am so > excited right now, and I realized I really wrote this mail very untidy.... When we can read from the keyboard then we could programe some internal commands. > > > > Summary: We have a Win32 source/binary to read from keyboard, the > scancode, and convert it into ASCII.. Win32 codes are available in C and > Assembler (MASM) formats. Note that assembler source can only read codes > and saves them into stack. We don' t have ANSI C/C++, AT&T assembler > codes right now. I hope we will :/ Because it did not work in my FreeBSD > box, and a Red Hat Linux box in my school. It failed with "Bus error", > at the line where we try to read from 0x60. Kernels might be restricting > us to read, or my code is wrong. Code is at below, take a look. > > > > short port = 0x69; > > unsigned char nKeyScanCode=0; > > > > // Initialization is cool > > > > __asm__ __volatile__("inb %%dx,%%al;outb %%al,$0x80":"=a" > (nKeyScanCode):"d" (port)); > > > > there is another code, i grabbed from somewhere else (I dunno where it > was, but from a Linux source site) > > > > __asm__ __volatile__("in%B0 (%1)": "=a" (nKeyScanCode) : "d" > (port)); > > > > > > So, what can we do now? If you send me the code I will try it in the eric kernel. Andrew. |