Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 40 → Rev 41

/install/input.c
1,37 → 1,37
/*
* input keyboard routines used by the Svarog386 installer.
* Copyright (C) 2016 Mateusz Viste
*/
 
#ifndef input_h_sentinel
#define input_h_sentinel
 
#include <dos.h>
#include "input.h" /* include self for control */
 
/* waits for a keypress and return it. Returns 0x1xx for extended keys */
int input_getkey(void) {
union REGS regs;
int res;
regs.h.ah = 0x08;
int86(0x21, &regs, &regs);
res = regs.h.al;
if (res == 0) { /* extended key - poll again */
regs.h.ah = 0x08;
int86(0x21, &regs, &regs);
res = regs.h.al | 0x100;
}
return(res);
}
 
 
/* poll the keyboard, and return the next input key in buffer, or -1 if none */
int input_getkeyifany(void) {
union REGS regs;
regs.h.ah = 0x0B;
int86(0x21, &regs, &regs);
if (regs.h.al == 0xFF) return(input_getkey());
return(-1);
}
 
#endif
/*
* input keyboard routines used by the Svarog386 installer.
* Copyright (C) 2016 Mateusz Viste
*/
 
#ifndef input_h_sentinel
#define input_h_sentinel
 
#include <dos.h>
#include "input.h" /* include self for control */
 
/* waits for a keypress and return it. Returns 0x1xx for extended keys */
int input_getkey(void) {
union REGS regs;
int res;
regs.h.ah = 0x08;
int86(0x21, &regs, &regs);
res = regs.h.al;
if (res == 0) { /* extended key - poll again */
regs.h.ah = 0x08;
int86(0x21, &regs, &regs);
res = regs.h.al | 0x100;
}
return(res);
}
 
 
/* poll the keyboard, and return the next input key in buffer, or -1 if none */
int input_getkeyifany(void) {
union REGS regs;
regs.h.ah = 0x0B;
int86(0x21, &regs, &regs);
if (regs.h.al == 0xFF) return(input_getkey());
return(-1);
}
 
#endif
/install/input.h
1,11 → 1,11
/*
* input keyboard routines used by the Svarog386 installer.
* Copyright (C) 2016 Mateusz Viste
*/
 
/* waits for a keypress and return it. Returns 0 for extended keystroke, then
function must be called again to return scan code. */
int input_getkey(void);
 
/* poll the keyboard, and return the next input key if any, or -1 */
int input_getkeyifany(void);
/*
* input keyboard routines used by the Svarog386 installer.
* Copyright (C) 2016 Mateusz Viste
*/
 
/* waits for a keypress and return it. Returns 0 for extended keystroke, then
function must be called again to return scan code. */
int input_getkey(void);
 
/* poll the keyboard, and return the next input key if any, or -1 */
int input_getkeyifany(void);