/**********************************************
 * KEYDEFS - Test/Demo for keydefs.h02 module *
 **********************************************/
 
//Specify System Header using -H option
#include <keydef.h02>

char key;  //Key value

main:
  putstr("PRESS KEYS TO SEE DEFINITIONS"); newlin();
  while() {
    key = getchr();
    if (!key) continue;
    select (key) {
      case keys.bckspc: putstr("BACKSPACE");
      case keys.break:  putstr("BREAK");
      case keys.clear:  putstr("CLEAR");
      case keys.copy:   putstr("COPY");
      case keys.delete: putstr("DELETE");
      case keys.down:   putstr("DOWN");
      case keys.escape: putstr("ESCAPE");
      case keys.fn1:    putstr("F1");
      case keys.fn2:    putstr("F2");
      case keys.fn3:    putstr("F3");
      case keys.fn4:    putstr("F4");
      case keys.fn5:    putstr("F5");
      case keys.fn6:    putstr("F6");
      case keys.fn7:    putstr("F7");
      case keys.fn8:    putstr("F8");
      case keys.fn9:    putstr("F9");
      case keys.fn10:   putstr("F10");
      case keys.fn11:   putstr("F11");
      case keys.fn12:   putstr("F12");
      case keys.help:   putstr("HELP");
      case keys.home:   putstr("HOME");
      case keys.insert: putstr("INSERT");
      case keys.left:   putstr("LEFT");
      case keys.lnfd:   putstr("LINE FEED");
      case keys.right:  putstr("RIGHT");
      case keys.return: putstr("RETURN");
      case keys.shfrtn: putstr("SHIFT-RETURN");
      case keys.run:    putstr("RUN");
      case keys.rvsoff: putstr("RVS-OFF");
      case keys.rvson:  putstr("RVS-ON");
      case keys.shfspc: putstr("SHIFT-SPACE");
      case keys.tab:    putstr("TAB");
      case keys.shftab: putstr("SHIFT-TAB");
      case keys.up:     putstr("UP");
      case ' ':         putstr("SPACE");
      default: if (key > ' ' and key <> #DELKEY) putchr(key);
    }
    putstr(" ["); prbyte(key); putstr("] ");    
    if (key == #ESCKEY) break;
  }
  goto exit;
