[comp.os.msdos.programmer] Ascii codes for 'Alt' keychords

bobmon@iuvax.cs.indiana.edu (RAMontante) (12/16/90)

olasov@cs.columbia.edu (Ben Olasov) <1990Dec14.221221.20958@cs.columbia.edu> :
| I can't find them anywhere (I know I'm probably looking in the wrong
| places) - does anyone have them in emailable form?
| 
| (If you even have the code for 'Alt-F5' it would be great!)

My old turbo pascal book lists <ALT>-<F5> as "27 108", the 27 being an
ESCape character.  Other shifted, ctrl'd, and alt'd function keys range
from "27 84" through "27 113".

Also in Norton's 'Programmer's Guide to the PC'.

6600m00n@ucsbuxa.ucsb.edu (Steelworker) (12/16/90)

In article <1990Dec14.221221.20958@cs.columbia.edu> olasov@cs.columbia.edu (Benjamin Olasov) writes:

}   I can't find them anywhere (I know I'm probably looking in the wrong
}   places) - does anyone have them in emailable form?
}
}   (If you even have the code for 'Alt-F5' it would be great!)
}
}   Ben

The way keyboard input works in turbo c is this-
The function  getch() returns 0 on a special key hit.  ( ie function
keys, pageup, page down, etc) The next call to getch will return the 
"scan code" of the key hit.   You need to do some experimentation to
figure out what all the codes are, or find some list.   I wrote a
program that that prints out the scan code and ascii value of
keys pressed, among other things. 

/*****************************************************************/
/*  No copyright, whatsoever */

#include <bios.h>
#include <stdio.h>

main()
{
    int i=0;

    while((char)i != 27) {
        i=bioskey(0); /* get a key if is one waiting, else return 0 */
	/* High byte of i is the scan code, the low byte is the ascii*/
        if(i!=0)
             printf("%x %x\n",i,bioskey(2));  /* second  call is to get */
					      /* mod key states */
    }
}

/********************************************************************/


If you don't have turbo-c, then use some interrupt function to
call interrupt  16 hex  with 0 in _AX for bioskey(0),
16 hex, _AX = 2 for bioskey(2);
Return value for both is in AX, I believe.

( and for those of you with extended keyboards, you can add 0x10 to
the numbers and get extended codes as well!)

Good luck,
Robert Blair
6600m00n@ucsbuxa.ucsb.edu

jsd@boreal.rice.edu (Shawn Joel Dube) (12/16/90)

In article <1990Dec14.221221.20958@cs.columbia.edu>, olasov@cs.columbia.edu (Benjamin Olasov) writes:
|> I can't find them anywhere (I know I'm probably looking in the wrong
|> places) - does anyone have them in emailable form?
|> 
|> (If you even have the code for 'Alt-F5' it would be great!)
|> 

run the following (if you don't know, its TurboPascal)

uses crt;
repeat 
 writeln(ord(readkey));
until 5=4;
end.

Press whatever key you want, and the ascii value shows on the screen.
( Its that easy :-) )


-- 
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
r     ___     _              "...but then there was the         r
r    /__     | \              possibility that they were        r
r   ___/hawn |__\ube          LaRouche democrats which, of      r
r  jsd@owlnet.rice.edu        course, were better off dead."    r
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

yh@cs.Princeton.EDU (Yoichi Hamazaki) (12/18/90)

In article <1990Dec14.221221.20958@cs.columbia.edu> olasov@cs.columbia.edu (Ben Olasov) writes:
>I can't find Ascii codes for 'Alt' keychords anywhere (I know I'm probably looking in the wrong
>places) - does anyone have them in emailable form?

ASCII == Americal Standard Cord for Information Interchange.

Is 'alt' key standard? Many of keyboard has no 'alt' key.
(I know IBM-PC has one, but its a IBM's feture, not a standard)

If 'alt' key is not standard, no standard cord exist!!
--
 Yoichi HAMAZAKI	Dept. computer science, Princeton Univ.
			(from Electrotechnical Lab. (ETL), Japan)
 E-mail:	yh@princeton.EDU
 Ham:		W2/JR1OQY (2m & 70cm)

tcs@mailer.jhuapl.edu (Carl Schelin) (12/19/90)

In article <1990Dec14.221221.20958@cs.columbia.edu>, olasov@cs.columbia.edu (Benjamin Olasov) says:
>
>I can't find them anywhere (I know I'm probably looking in the wrong
>places) - does anyone have them in emailable form?
>
>(If you even have the code for 'Alt-F5' it would be great!)
>
>Ben

Since I don't get out much, this may be a little late, however...

I always used the table in the back of the Basic manual I 
received with my PC. I have two or three of these little green books
kicking around the house now.

I believe (from checking my Norton Guides Turbo C++ Database] that
the scancode is 00+6C or NULL+108. So check for a NULL, if it is, check
for 108. If you get 108, you have an Alt-F5 (that's assuming I have my
information correct. It sounds right but without testing... :).

Carl Schelin
tcs@mailer.jhuapl.edu
 

metal@triton.unm.edu (Brad Basler) (12/19/90)

In article <1990Dec18.184731.1411@aplcen.apl.jhu.edu> tcs@mailer.jhuapl.edu (Carl Schelin) writes:

\I can't find them anywhere (I know I'm probably looking in the wrong
\places) - does anyone have them in emailable form?

\(If you even have the code for 'Alt-F5' it would be great!)

     I couldn't find a reference to them either so I had to write out
a program to print out their decimal value.  This is what I got.

   F1 - F10  :  NULL+59 - NULL+68
     w/ shift:  NULL+84 - NULL+93
     w/ ctrl :  NULL+94 - NULL+103
     w/ alt  :  NULL+104 - NULL+113

From this I get "alt-F5" == NULL+108.


     I was unable to get the original post so I'm not sure if this is
exactly what you wanted.

\Ben

                               <2B>
                               aka Brad Basler (student for life >-( )
                                   metal@hydra.unm.edu

horstman@sjsumcs.sjsu.edu (Cay Horstmann) (12/19/90)

In article <5409@rossignol.Princeton.EDU> yh@cs.Princeton.EDU (Yoichi Hamazaki) writes:
>In article <1990Dec14.221221.20958@cs.columbia.edu> olasov@cs.columbia.edu (Ben Olasov) writes:
>>I can't find Ascii codes for 'Alt' keychords anywhere (I know I'm probably looking in the wrong
>>places) - does anyone have them in emailable form?
>
>ASCII == Americal Standard Cord for Information Interchange.
>
>Is 'alt' key standard? Many of keyboard has no 'alt' key.
>(I know IBM-PC has one, but its a IBM's feture, not a standard)
>
>If 'alt' key is not standard, no standard cord exist!!
>--
> Yoichi HAMAZAKI	Dept. computer science, Princeton Univ.


No reason to exhibit the charm Princetonians are famous for :-)

The key codes returned by the Alt-keys can be found in the same reference
that lists the codes for cursor keys. I use the PS/2 Hardware Technical 
Reference (a blue ring binder).  It goes into some  detail how the scan codes
differ for various IBM keyboards (each one having been announced as the 
"standard" keyboard to end all keyboards). 

Actually, in a pinch you can write a small program that calls the DOS
interrupt (one of the very low-numbered services.) It returns a zero byte,
then when you call it again the extended code of that key combination.

Cay

bright@nazgul.UUCP (Walter Bright) (12/21/90)

In article <1990Dec14.221221.20958@cs.columbia.edu> olasov@cs.columbia.edu (Ben Olasov) writes:
/I can't find them anywhere (I know I'm probably looking in the wrong
/places) - does anyone have them in emailable form?
/(If you even have the code for 'Alt-F5' it would be great!)

When I've needed to know such stuff, I couldn't find it either. It turned
out to be a pretty simple C program to read the keyboard and output the
hex values. This also makes it immune from errors in the manual!

I suggest this approach, as you are probably writing a program to read
the keyboard anyway.