ext_keys.c
来自「由8051/8096/8099/8048单片机汇编工具、 汇编语言、摩托罗拉m」· C语言 代码 · 共 57 行
C
57 行
/*
** ext_getch()
**
** A getch() work-alike for use with extended keyboards.
**
** Parameters: none
**
** Returns: Extended key code as follows:
** 0->255 Normal key
** 256->511 Numeric pad key or Function key
** 512->767 Cursor pad key or Numeric pad
** "duplicate" key (Enter, /, *, -, +)
**
** Original Copyright 1992 by Bob Stout as part of
** the MicroFirm Function Library (MFL)
**
** This subset version is hereby donated to the public domain.
*/
#include <dos.h>
#include <ctype.h>
#define LoByte(x) ((unsigned char)((x) & 0xff))
#define HiByte(x) ((unsigned char)((unsigned short)(x) >> 8))
int ext_getch(void)
{
int key;
union REGS regs;
regs.h.ah = 0x10;
int86(0x16, ®s, ®s);
key = regs.x.ax;
switch (LoByte(key))
{
case 0:
key = HiByte(key) + 256;
break;
case 0xe0:
key = HiByte(key) + 512;
break;
default:
if (0xe0 == HiByte(key))
key = LoByte(key) + 512;
else
{
if (ispunct(LoByte(key)) && HiByte(key) > 0x36)
key = LoByte(key) + 512;
else key = LoByte(key);
}
}
return key;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?