#include <sys/process.h>
#include <sys/bios.h>
#include "pcurs.h"

int main() {
  int button;
  int c;

  if (initscr())
    return -1;

  while(1) {
    button = key_press_check();
    if (button & 2) /* start button */
      break;
    if (button == 4) /* A button */
      keyb_setmode(TERMINAL_MODE);
    if (button == 8) /* B button */
      keyb_setmode(PDAKB_MODE);
    c = getch();
    if (c >= 0 && c < 256) 
      addch(c);
    sys_wait(5);
  }

  endwin();
  return 0;
}
