• R/O
  • SSH
  • HTTPS

svardos:


File Info

Rev. 619
Size 861 bytes
Time 2022-02-04 20:00:12
Author mateuszviste
Log Message

moved head files to trunk

Content

/*
 * input keyboard routines used by the SvarDOS 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
Show on old repository browser