Keyboards

 BBS: The MOONFLOWER
Date: 07-25-93 (22:22)             Number: 101
From: ADAM LUSSIER #42 @1619074    Refer#: NONE
  To: TIGER #68 @1310007*1          Recvd: YES 
Subj: Keyboards                      Conf: (125) The Progra

Re: Reading keyboard. > I need a way to read a 101 key keyboard using interrupts. I have used > the functions &H0 and &H10 of interrupt 16, but I have problems reading F11 > and F12. Are there any other functions I can use to read the keystroke's > ASCII code and scan code? Thanks! Yes, there is an easier way. Depeding on the language you are using, you just have to read a key without echo(getch() in C, ReadKey in Pascal, and INKEY$ in BASIC). Now, make a program that has a while loop(usually use ESC to end the loop ASCII code 27). Press the keys away, and you will get output. The output will have a blank space, then a character. The blank space is nul(ASCII code 0). All you have to do is check for both characters, and you can read the keys. Sample in BASIC: Done$ = "f" While Done$ = "f" a$ = inkey$ If a$ = Chr$(27) then Done$ = "t" Print a$ Wend This will give you the output. Example: run the program and press the Up Arrow Key. The output will look like this. H Notice the space... This is the nul character, and it also returns 'H'. Just check for both, and you have uparrow. This is one of the standard ways of doing things. It goes through BIOS, so you may run into some problems if alot of graphics are involved. But for the general application, it works pretty good. The Church In Realization of Human Perfection. (619) 697-6834 Matthew 5:48 "Be Ye Therefore Perfect, even as your Father in Heaven is Perfect." A Christian/Pagan Educational BBS. Fido: 1:202/1709 Vnet: 6794 $$
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET