Applications: update the plato bits, add other Makefiles
authorAlan Cox <alan@linux.intel.com>
Fri, 7 Sep 2018 21:13:14 +0000 (22:13 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 7 Sep 2018 21:13:14 +0000 (22:13 +0100)
Applications/games/fweep.c
Applications/plato/Makefile.6502 [new file with mode: 0644]
Applications/plato/Makefile.68000 [new file with mode: 0644]
Applications/plato/Makefile.6809 [new file with mode: 0644]
Applications/plato/fuzix/key.h [new file with mode: 0644]

index f412c7b..5b2698d 100644 (file)
@@ -15,6 +15,8 @@
 
 #define IVERSION "fe0.01"
 
+#define WORD(x)                ((uint16_t)(x))
+
 #define VERSION        3
 
 #if (VERSION == 8)
@@ -23,13 +25,22 @@ typedef uint16_t obj_t;
 
 #elif (VERSION > 3)
 #define PACKED_SHIFT   2
-typedef uin16_t obj_t;
+typedef uint16_t obj_t;
 
 #else                          /*  */
 #define PACKED_SHIFT   1
 typedef uint8_t obj_t;
 
 #endif                         /*  */
+
+
+#if VERSION > 2
+#define SHIFT1         4
+#define SHIFT2         5
+#else
+#define        SHIFT1          2
+#define SHIFT2         3
+
 typedef char boolean;
 typedef uint8_t byte;
 typedef struct {
@@ -58,10 +69,10 @@ const char zscii_conv_2[128] = {
 };
 
 #if (VERSION == 1)
-const char alpha[78] =
+char alpha[78] =
     "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789.,!?_#'\"/\\<-:()";
 #else
-const char alpha[78] =
+char alpha[78] =
     "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ^0123456789.,!?_#'\"/\\-:()";
 #endif
 
@@ -354,6 +365,20 @@ boolean verify_checksum(void)
        return 1;
 }
 
+/* This is a pain but strictly speaking a game is entitled to change its
+   alphabet on the fly! */
+static void sync_alphabet(void)
+{
+#if VERSION >= 5
+       char *p = alpha;
+       uint16_t r;
+       if ((r = alphabet_table) != 0) {
+               while(p != alpha + 78)
+                       *p++ = read8(r++);
+       }
+#endif
+}
+       
 uint32_t text_print(uint32_t address);
 void zch_print(int z)
 {
@@ -410,7 +435,7 @@ void zch_print(int z)
 #endif         
        } else {
                if (alphabet_table)
-                       char_print(read8
+                       char_print(read8low
                                   (alphabet_table + z + (zch_shift * 26) -
                                    6));
 
@@ -656,27 +681,123 @@ input_again:
        return 13;
 }
 
+/*
+       A description of the parsing pieces
+       
+       There is a dictionary header which gives word separator codes. These
+       (typicaly . , and " ) are symbols that become their own word.
+       
+       After this the dictionary consists of records that start with 2 zwords
+       of encoding text then data, (3 then data for V4+). The dictionary is
+       ordered (in zscii terms).
+       
+       We take our input and split it up into words, by spaces, with the
+       dictonary header bytes counting as their own word
+       
+       Each input word has to end up encoded as zscii (6 zchars, or 9 for 4+)
+       Any trailing bytes are packed out with z char 5. Upper case is turned
+       lower case. Partial encodings (eg shifts are simply chopped at the byte
+       space runs out).
+
+       Each computed zscii word is looked up in the dictioary and a parse table
+       generated that gives the parsing info (num words, length, position,
+       dictionary entry)               
+ */
+
 /* FIXME: stop using uint64_t */
 uint64_t dictionary_get(uint16_t addr)
 {
        uint64_t v = 0;
        int c = VERSION > 3 ? 6 : 4;
        while (c--)
-               v = (v << 8) | read8(addr++);
+               v = (v << 8) | read8low(addr++);
        return v;
 }
 
+/* We encode the string into a byte run, then pack it after. The output
+   buffer must be len + 2 bytes long to keep it simple.
+   
+   The old V1 and V2 games expect pairs of shifted chars to use shift lock
+   characters. We don't yet handle that */
+void encode(uint8_t *text, uint8_t *out, int len)
+{
+       uint8_t *cp;
+       sync_alphabet();
+       while((c = *text++) && len > 0) {
+               if (isupper(c))
+                       c = tolower(c);
+               cp = strchr(alpha, c);
+               if (cp == NULL) {
+                       *out++ = 6;
+                       *out++ = c >> 3;
+                       *out++ = c & 31;
+                       len -= 3;
+                       continue;
+               }
+               c = cp - alpha; /* bit code + bank */
+               if (c < 26) {
+                       *out++ = c + 6;
+                       len--;
+               } else if (c < 52) {
+                       *out++ = SHIFT1;
+                       *out++ = c - 20;
+               } else {
+                       *out++ = SHIFT2;
+                       *out++ = c - 46;        /* -52 + 6 */
+               }
+               len -= 2;
+       }
+       while(len-- > 0)
+               *out++ = 5;
+}
+
+/* Pack a block of text. Len is in words (zscsii triples) */
+void packscii(uint8_t *in, uint16_t *out, int len)
+{
+       while(len) {
+               uint16_t w = (WORD(*in) << 10) | (WORD(in[1]) << 5) | in [2];
+               *out++ = w;
+               len --;
+       }
+       out[-1] |= 0x8000;      /* End marker */
+}
+
+void dictionary_get(uint16_t addr, uint16_t *buf)
+{
+       *buf++ = read16low(addr);
+       addr += 2;
+       *buf++ = read16low(addr)
+#if VERSION > 3
+       addr += 2;
+       *buf++ = read16low(addr);
+#endif
+}              
+
+/*
+       Parse logic
+       
+       skip spaces
+       if symbol in specials - encode just it as a word
+       else
+               while !space && !specials)
+                       add to word
+               encode word
+       endif
+*/
+       
 uint64_t dictionary_encode(uint8_t * text, int len)
 {
        /* FIXME: stop using uint64_t */
        uint64_t v = 0;
        int c = VERSION > 3 ? 9 : 6;
        int i;
+       const uint8_t *al = alpha;
+
+       sync_alphabet();
 
-       /* FIXME: memory direct reference still here */
-       const uint8_t *al =
-           (alphabet_table ? (const uint8_t *) memory +
-            alphabet_table : (const uint8_t *) alpha);
        while (c && len && *text) {
 
                // Since line breaks cannot be in an input line of text, and VAR:252 is only available in version 5, line breaks need not be considered here.
diff --git a/Applications/plato/Makefile.6502 b/Applications/plato/Makefile.6502
new file mode 100644 (file)
index 0000000..cf15c99
--- /dev/null
@@ -0,0 +1,34 @@
+PLATFORM = 6502
+CC = cl65
+ASM = ca65
+LINKER = cl65
+CFLAGS = -t none -O -D__STDC__ -c -O -I../../Library/include -I../../Library/include/6502
+LINKER_OPT = -L../../Library/libs -C ../../Library/libs/ld65-$(TARGET).cfg
+ASM_OPT = -o
+CRT0 = ../../Library/libs/crt0_6502.o
+CRT0NS = ../../Library/libs/crt0nostdio_6502.o
+
+.SUFFIXES: .c .o
+SRCS = io_base.c keyboard_base.c plato.c protocol.c screen_base.c terminal.c \
+       touch_base.c
+
+FSRCS = font.c io.c keyboard.c scale.c screen.c splash.c \
+       terminal_char_load.c touch.c
+
+INC = io.h keyboard.h plato_key.h protocol.h screen.h terminal.h touch.h
+
+OBJS = $(SRCS:.c=.rel)
+FOBJS = $(patsubst fuzix/%.c,%.rel, $(FSRCS))
+
+all:    plato
+
+plato: $(OBJS) $(FOBJS)
+       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $^ c6502.lib -m $@.map
+
+$(OBJS) : $(INC)
+
+$(FOBJS) : $(INC)
+
+clean:
+       rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ plato
+       (cd fuzix; rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ )
diff --git a/Applications/plato/Makefile.68000 b/Applications/plato/Makefile.68000
new file mode 100644 (file)
index 0000000..6e34e76
--- /dev/null
@@ -0,0 +1,46 @@
+PLATFORM = 68000
+CC = m68k-uclinux-gcc
+ASM = m68k-uclinux-as
+AR = m68k-uclinux-ar
+LINKER = m68k-uclinux-ld
+CFLAGS = -fno-strict-aliasing -fomit-frame-pointer -fno-builtin -msoft-float -Wall -m68000 -Os -I../../Library/include -I../../Library/include/68000
+LINKER_OPT = -L../../Library/libs -lc68000
+LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name))
+LINKER_OPT += --emit-relocs -L$(LIBGCCDIR) -lgcc -T ../../Library/elf2flt.ld
+CRT0 = ../../Library/libs/crt0_68000.o
+CRT0NS = ../../Library/libs/crt0nostdio_68000.o
+# For now while we get going. Really we want to use some kind of elf2zmagic
+# with relocs.
+ELF2FUZIX = elf2flt
+.SUFFIXES: .c .o
+
+SRCS = io_base.c keyboard_base.c plato.c protocol.c screen_base.c terminal.c \
+       touch_base.c
+
+FSRCS = font.c io.c keyboard.c scale.c screen.c splash.c \
+       terminal_char_load.c touch.c
+
+INC = io.h keyboard.h plato_key.h protocol.h screen.h terminal.h touch.h
+
+all:    plato
+
+OBJS = $(SRCS:.c=.o)
+FOBJS = $(patsubst fuzix/%.c,%.o, $(FSRCS))
+
+plato: $(OBJS) $(FOBJS)
+       $(LINKER) $(LINKER_OPT) -o sccz80 $(OBJS) $(FOBJS)
+
+$(OBJS):
+       $(CC) $(COPT) $(CFLAGS) -c $< -o $@
+
+$(FOBJS):
+       $(CC) $(COPT) $(CFLAGS) -c $< -o $@
+
+
+$(OBJS) : $(INC)
+
+$(FOBJS) : $(INC)
+
+clean:
+       rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ plato
+       (cd fuzix; rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ )
diff --git a/Applications/plato/Makefile.6809 b/Applications/plato/Makefile.6809
new file mode 100644 (file)
index 0000000..28e5412
--- /dev/null
@@ -0,0 +1,46 @@
+PLATFORM = 6809
+CC = m6809-unknown-gcc
+ASM = m6809-unknown-as
+AR = m6809-unknown-ar
+LINKER = m6809-unknown-ld
+CFLAGS =  -I../../Library/include -I../../Library/include/6809 -Wall -pedantic -fno-strict-aliasing
+COPT = -Os
+LINKER_OPT = --oformat=raw -L../../Library/libs -lc6809
+LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name))
+CRT0 = ../../Library/libs/crt0_6809.o
+LINKER_OPT += -L$(LIBGCCDIR) -lgcc -Map=ld09.map 
+LINKER_OPT += --script=../util/$(TARGET).link $(CRT0)
+ASM_OPT = -o
+
+.SUFFIXES: .c .o
+
+SRCS = io_base.c keyboard_base.c plato.c protocol.c screen_base.c terminal.c \
+       touch_base.c
+
+FSRCS = font.c io.c keyboard.c scale.c screen.c splash.c \
+       terminal_char_load.c touch.c
+
+INC = io.h keyboard.h plato_key.h protocol.h screen.h terminal.h touch.h
+
+all:    plato
+
+OBJS = $(SRCS:.c=.o)
+FOBJS = $(patsubst fuzix/%.c,%.o, $(FSRCS))
+
+plato: $(OBJS) $(FOBJS)
+       $(LINKER) $(LINKER_OPT) -o sccz80 $(OBJS) $(FOBJS)
+
+$(OBJS):
+       $(CC) $(COPT) $(CFLAGS) -c $< -o $@
+
+$(FOBJS):
+       $(CC) $(COPT) $(CFLAGS) -c $< -o $@
+
+
+$(OBJS) : $(INC)
+
+$(FOBJS) : $(INC)
+
+clean:
+       rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ plato
+       (cd fuzix; rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ )
diff --git a/Applications/plato/fuzix/key.h b/Applications/plato/fuzix/key.h
new file mode 100644 (file)
index 0000000..0d0fbbe
--- /dev/null
@@ -0,0 +1,409 @@
+/**
+ * key.h
+ * Keyboard Translation Tables
+ */
+
+#include "../plato_key.h"
+
+#ifndef KEY_H
+#define KEY_H
+
+/**
+ *
+ * KEY_H generated by mk_ascii_key_h.c
+ */
+
+
+unsigned char key_to_pkey[] = {
+       PKEY_NOKEY,             /* 0x00 NUL */
+       PKEY_ANS,               /* 0x01 CTRL-A */
+       PKEY_BACK,              /* 0x02 CTRL-B */
+       PKEY_COPY,              /* 0x03 CTRL-C */
+       PKEY_DATA,              /* 0x04 CTRL-D */
+       PKEY_EDIT,              /* 0x05 CTRL-E */
+       PKEY_FONT,              /* 0x06 CTRL-F */
+       PKEY_DIVIDE,            /* 0x07 CTRL-G */
+       PKEY_ERASE,             /* 0x08 CTRL-H */
+       PKEY_HELP,              /* 0x09 CTRL-I */
+       PKEY_NEXT,              /* 0x0a CTRL-J */
+       PKEY_NOKEY,             /* 0x0b CTRL-K */
+       PKEY_LAB,               /* 0x0c CTRL-L */
+       PKEY_NEXT,              /* 0x0d CTRL-M */
+       PKEY_NEXT,              /* 0x0e CTRL-N */
+       PKEY_NOKEY,             /* 0x0f CTRL-O */
+       PKEY_SUPER,             /* 0x10 CTRL-P */
+       PKEY_SQUARE,            /* 0x11 CTRL-Q */
+       PKEY_ERASE,             /* 0x12 CTRL-R */
+       PKEY_STOP,              /* 0x13 CTRL-S */
+       PKEY_TERM,              /* 0x14 CTRL-T */
+       PKEY_NOKEY,             /* 0x15 CTRL-U */
+       PKEY_NOKEY,             /* 0x16 CTRL-V */
+       PKEY_NOKEY,             /* 0x17 CTRL-W */
+       PKEY_MULTIPLY,          /* 0x18 CTRL-X */
+       PKEY_SUB,               /* 0x19 CTRL-Y */
+       PKEY_NOKEY,             /* 0x1a CTRL-Z */
+       PKEY_NOKEY,             /* 0x1b ESC */
+       PKEY_NOKEY,             /* 0x1c */
+       PKEY_NOKEY,             /* 0x1d */
+       PKEY_NOKEY,             /* 0x1e */
+       PKEY_NOKEY,             /* 0x1f */
+       PKEY_SPACE,             /* 0x20 SPACE */
+       PKEY_EXCLAMATION,       /* 0x21 ! */
+       PKEY_QUOTE,             /* 0x22 " */
+       PKEY_POUND,             /* 0x23 # */
+       PKEY_DOLLAR,            /* 0x24 $ */
+       PKEY_PERCENT,           /* 0x25 % */
+       PKEY_AMPERSAND,         /* 0x26 & */
+       PKEY_APOSTROPHE,        /* 0x27 ' */
+       PKEY_PARENTHESIS_LEFT,  /* 0x28 ( */
+       PKEY_PARENTHESIS_RIGHT, /* 0x29 ) */
+       PKEY_ASTERISK,          /* 0x2a * */
+       PKEY_PLUS,              /* 0x2b + */
+       PKEY_COMMA,             /* 0x2c , */
+       PKEY_MINUS,             /* 0x2d - */
+       PKEY_PERIOD,            /* 0x2e . */
+       PKEY_SLASH,             /* 0x2f / */
+       PKEY_0,                 /* 0x30 0 */
+       PKEY_1,                 /* 0x31 1 */
+       PKEY_2,                 /* 0x32 2 */
+       PKEY_3,                 /* 0x33 3 */
+       PKEY_4,                 /* 0x34 4 */
+       PKEY_5,                 /* 0x35 5 */
+       PKEY_6,                 /* 0x36 6 */
+       PKEY_7,                 /* 0x37 7 */
+       PKEY_8,                 /* 0x38 8 */
+       PKEY_9,                 /* 0x39 9 */
+       PKEY_COLON,             /* 0x3a : */
+       PKEY_SEMICOLON,         /* 0x3b ; */
+       PKEY_LESS_THAN,         /* 0x3c < */
+       PKEY_EQUALS,            /* 0x3d = */
+       PKEY_GREATER_THAN,      /* 0x3e > */
+       PKEY_QUESTION_MARK,     /* 0x3f ? */
+       PKEY_AT,                /* 0x40 @ */
+       PKEY_A,                 /* 0x41 A */
+       PKEY_B,                 /* 0x42 B */
+       PKEY_C,                 /* 0x43 C */
+       PKEY_D,                 /* 0x44 D */
+       PKEY_E,                 /* 0x45 E */
+       PKEY_F,                 /* 0x46 F */
+       PKEY_G,                 /* 0x47 G */
+       PKEY_H,                 /* 0x48 H */
+       PKEY_I,                 /* 0x49 I */
+       PKEY_J,                 /* 0x4a J */
+       PKEY_K,                 /* 0x4b K */
+       PKEY_L,                 /* 0x4c L */
+       PKEY_M,                 /* 0x4d M */
+       PKEY_N,                 /* 0x4e N */
+       PKEY_O,                 /* 0x4f O */
+       PKEY_P,                 /* 0x50 P */
+       PKEY_Q,                 /* 0x51 Q */
+       PKEY_R,                 /* 0x52 R */
+       PKEY_S,                 /* 0x53 S */
+       PKEY_T,                 /* 0x54 T */
+       PKEY_U,                 /* 0x55 U */
+       PKEY_V,                 /* 0x56 V */
+       PKEY_W,                 /* 0x57 W */
+       PKEY_X,                 /* 0x58 X */
+       PKEY_Y,                 /* 0x59 Y */
+       PKEY_Z,                 /* 0x5a Z */
+       PKEY_BRACKET_LEFT,      /* 0x5b [ */
+       PKEY_SLASH,             /* 0x5c / */
+       PKEY_BRACKET_RIGHT,     /* 0x5d ] */
+       PKEY_CIRCUMFLEX,        /* 0x5e ^ */
+       PKEY_UNDERSCORE,        /* 0x5f _ */
+       PKEY_GRAVE,             /* 0x60 ` */
+       PKEY_a,                 /* 0x61 a */
+       PKEY_b,                 /* 0x62 b */
+       PKEY_c,                 /* 0x63 c */
+       PKEY_d,                 /* 0x64 d */
+       PKEY_e,                 /* 0x65 e */
+       PKEY_f,                 /* 0x66 f */
+       PKEY_g,                 /* 0x67 g */
+       PKEY_h,                 /* 0x68 h */
+       PKEY_i,                 /* 0x69 i */
+       PKEY_j,                 /* 0x6a j */
+       PKEY_k,                 /* 0x6b k */
+       PKEY_l,                 /* 0x6c l */
+       PKEY_m,                 /* 0x6d m */
+       PKEY_n,                 /* 0x6e n */
+       PKEY_o,                 /* 0x6f o */
+       PKEY_p,                 /* 0x70 p */
+       PKEY_q,                 /* 0x71 q */
+       PKEY_r,                 /* 0x72 r */
+       PKEY_s,                 /* 0x73 s */
+       PKEY_t,                 /* 0x74 t */
+       PKEY_u,                 /* 0x75 u */
+       PKEY_v,                 /* 0x76 v */
+       PKEY_w,                 /* 0x77 w */
+       PKEY_x,                 /* 0x78 x */
+       PKEY_y,                 /* 0x79 y */
+       PKEY_z,                 /* 0x7a z */
+       PKEY_LEFT_CURLY_BRACE,  /* 0x7b { */
+       PKEY_BAR,               /* 0x7c | */
+       PKEY_RIGHT_CURLY_BRACE, /* 0x7d } */
+       PKEY_TILDE,             /* 0x7e ~ */
+       PKEY_ERASE,             /* 0x7f DEL */
+};
+
+unsigned char shiftlock_key_to_pkey[] = {
+       PKEY_NOKEY,             /* 0x00 NUL */
+       PKEY_ANS,               /* 0x01 CTRL-A */
+       PKEY_BACK,              /* 0x02 CTRL-B */
+       PKEY_COPY,              /* 0x03 CTRL-C */
+       PKEY_DATA,              /* 0x04 CTRL-D */
+       PKEY_EDIT,              /* 0x05 CTRL-E */
+       PKEY_FONT,              /* 0x06 CTRL-F */
+       PKEY_DIVIDE,            /* 0x07 CTRL-G */
+       PKEY_ERASE,             /* 0x08 CTRL-H */
+       PKEY_HELP,              /* 0x09 CTRL-I */
+       PKEY_NOKEY,             /* 0x0a CTRL-J */
+       PKEY_NOKEY,             /* 0x0b CTRL-K */
+       PKEY_LAB,               /* 0x0c CTRL-L */
+       PKEY_NEXT,              /* 0x0d CTRL-M */
+       PKEY_NEXT,              /* 0x0e CTRL-N */
+       PKEY_NOKEY,             /* 0x0f CTRL-O */
+       PKEY_SUPER,             /* 0x10 CTRL-P */
+       PKEY_SQUARE,            /* 0x11 CTRL-Q */
+       PKEY_ERASE,             /* 0x12 CTRL-R */
+       PKEY_STOP,              /* 0x13 CTRL-S */
+       PKEY_TERM,              /* 0x14 CTRL-T */
+       PKEY_NOKEY,             /* 0x15 CTRL-U */
+       PKEY_NOKEY,             /* 0x16 CTRL-V */
+       PKEY_NOKEY,             /* 0x17 CTRL-W */
+       PKEY_MULTIPLY,          /* 0x18 CTRL-X */
+       PKEY_SUB,               /* 0x19 CTRL-Y */
+       PKEY_NOKEY,             /* 0x1a CTRL-Z */
+       PKEY_NOKEY,             /* 0x1b ESC */
+       PKEY_NOKEY,             /* 0x1c */
+       PKEY_NOKEY,             /* 0x1d */
+       PKEY_NOKEY,             /* 0x1e */
+       PKEY_NOKEY,             /* 0x1f */
+       PKEY_SPACE,             /* 0x20 SPACE */
+       PKEY_EXCLAMATION,       /* 0x21 ! */
+       PKEY_QUOTE,             /* 0x22 " */
+       PKEY_POUND,             /* 0x23 # */
+       PKEY_DOLLAR,            /* 0x24 $ */
+       PKEY_PERCENT,           /* 0x25 % */
+       PKEY_AMPERSAND,         /* 0x26 & */
+       PKEY_APOSTROPHE,        /* 0x27 ' */
+       PKEY_PARENTHESIS_LEFT,  /* 0x28 ( */
+       PKEY_PARENTHESIS_RIGHT, /* 0x29 ) */
+       PKEY_ASTERISK,          /* 0x2a * */
+       PKEY_PLUS,              /* 0x2b + */
+       PKEY_COMMA,             /* 0x2c , */
+       PKEY_MINUS,             /* 0x2d - */
+       PKEY_PERIOD,            /* 0x2e . */
+       PKEY_SLASH,             /* 0x2f / */
+       PKEY_0,                 /* 0x30 0 */
+       PKEY_1,                 /* 0x31 1 */
+       PKEY_2,                 /* 0x32 2 */
+       PKEY_3,                 /* 0x33 3 */
+       PKEY_4,                 /* 0x34 4 */
+       PKEY_5,                 /* 0x35 5 */
+       PKEY_6,                 /* 0x36 6 */
+       PKEY_7,                 /* 0x37 7 */
+       PKEY_8,                 /* 0x38 8 */
+       PKEY_9,                 /* 0x39 9 */
+       PKEY_COLON,             /* 0x3a : */
+       PKEY_SEMICOLON,         /* 0x3b ; */
+       PKEY_LESS_THAN,         /* 0x3c < */
+       PKEY_EQUALS,            /* 0x3d = */
+       PKEY_GREATER_THAN,      /* 0x3e > */
+       PKEY_QUESTION_MARK,     /* 0x3f ? */
+       PKEY_AT,                /* 0x40 @ */
+       PKEY_a,                 /* 0x41 A */
+       PKEY_b,                 /* 0x42 B */
+       PKEY_c,                 /* 0x43 C */
+       PKEY_d,                 /* 0x44 D */
+       PKEY_e,                 /* 0x45 E */
+       PKEY_f,                 /* 0x46 F */
+       PKEY_g,                 /* 0x47 G */
+       PKEY_h,                 /* 0x48 H */
+       PKEY_i,                 /* 0x49 I */
+       PKEY_j,                 /* 0x4a J */
+       PKEY_k,                 /* 0x4b K */
+       PKEY_l,                 /* 0x4c L */
+       PKEY_m,                 /* 0x4d M */
+       PKEY_n,                 /* 0x4e N */
+       PKEY_o,                 /* 0x4f O */
+       PKEY_p,                 /* 0x50 P */
+       PKEY_q,                 /* 0x51 Q */
+       PKEY_r,                 /* 0x52 R */
+       PKEY_s,                 /* 0x53 S */
+       PKEY_t,                 /* 0x54 T */
+       PKEY_u,                 /* 0x55 U */
+       PKEY_v,                 /* 0x56 V */
+       PKEY_w,                 /* 0x57 W */
+       PKEY_x,                 /* 0x58 X */
+       PKEY_y,                 /* 0x59 Y */
+       PKEY_z,                 /* 0x5a Z */
+       PKEY_BRACKET_LEFT,      /* 0x5b [ */
+       PKEY_SLASH,             /* 0x5c / */
+       PKEY_BRACKET_RIGHT,     /* 0x5d ] */
+       PKEY_CIRCUMFLEX,        /* 0x5e ^ */
+       PKEY_UNDERSCORE,        /* 0x5f _ */
+       PKEY_GRAVE,             /* 0x60 ` */
+       PKEY_A,                 /* 0x61 a */
+       PKEY_B,                 /* 0x62 b */
+       PKEY_C,                 /* 0x63 c */
+       PKEY_D,                 /* 0x64 d */
+       PKEY_E,                 /* 0x65 e */
+       PKEY_F,                 /* 0x66 f */
+       PKEY_G,                 /* 0x67 g */
+       PKEY_H,                 /* 0x68 h */
+       PKEY_I,                 /* 0x69 i */
+       PKEY_J,                 /* 0x6a j */
+       PKEY_K,                 /* 0x6b k */
+       PKEY_L,                 /* 0x6c l */
+       PKEY_M,                 /* 0x6d m */
+       PKEY_N,                 /* 0x6e n */
+       PKEY_O,                 /* 0x6f o */
+       PKEY_P,                 /* 0x70 p */
+       PKEY_Q,                 /* 0x71 q */
+       PKEY_R,                 /* 0x72 r */
+       PKEY_S,                 /* 0x73 s */
+       PKEY_T,                 /* 0x74 t */
+       PKEY_U,                 /* 0x75 u */
+       PKEY_V,                 /* 0x76 v */
+       PKEY_W,                 /* 0x77 w */
+       PKEY_X,                 /* 0x78 x */
+       PKEY_Y,                 /* 0x79 y */
+       PKEY_Z,                 /* 0x7a z */
+       PKEY_LEFT_CURLY_BRACE,  /* 0x7b { */
+       PKEY_BAR,               /* 0x7c | */
+       PKEY_RIGHT_CURLY_BRACE, /* 0x7d } */
+       PKEY_TILDE,             /* 0x7e ~ */
+       PKEY_ERASE,             /* 0x7f DEL */
+};
+
+unsigned char esc_key_to_pkey[] = {
+       PKEY_NOKEY,             /* 0x00 NUL */
+       PKEY_NOKEY,             /* 0x01 CTRL-A */
+       PKEY_BACK1,             /* 0x02 CTRL-B */
+       PKEY_COPY1,             /* 0x03 CTRL-C */
+       PKEY_DATA1,             /* 0x04 CTRL-D */
+       PKEY_EDIT1,             /* 0x05 CTRL-E */
+       PKEY_NOKEY,             /* 0x06 CTRL-F */
+       PKEY_NOKEY,             /* 0x07 CTRL-G */
+       PKEY_HELP1,             /* 0x08 CTRL-H */
+       PKEY_NOKEY,             /* 0x09 CTRL-I */
+       PKEY_NOKEY,             /* 0x0a CTRL-J */
+       PKEY_NOKEY,             /* 0x0b CTRL-K */
+       PKEY_LAB1,              /* 0x0c CTRL-L */
+       PKEY_NEXT1,             /* 0x0d CTRL-M */
+       PKEY_NEXT1,             /* 0x0e CTRL-N */
+       PKEY_NOKEY,             /* 0x0f CTRL-O */
+       PKEY_SUPER1,            /* 0x10 CTRL-P */
+       PKEY_ACCESS,            /* 0x11 CTRL-Q */
+       PKEY_ERASE1,            /* 0x12 CTRL-R */
+       PKEY_STOP1,             /* 0x13 CTRL-S */
+       PKEY_TERM,              /* 0x14 CTRL-T */
+       PKEY_NOKEY,             /* 0x15 CTRL-U */
+       PKEY_NOKEY,             /* 0x16 CTRL-V */
+       PKEY_NOKEY,             /* 0x17 CTRL-W */
+       PKEY_NOKEY,             /* 0x18 CTRL-X */
+       PKEY_SUB1,              /* 0x19 CTRL-Y */
+       PKEY_NOKEY,             /* 0x1a CTRL-Z */
+       PKEY_NOKEY,             /* 0x1b ESC */
+       PKEY_NOKEY,             /* 0x1c */
+       PKEY_NOKEY,             /* 0x1d */
+       PKEY_NOKEY,             /* 0x1e */
+       PKEY_NOKEY,             /* 0x1f */
+       PKEY_NOKEY,             /* 0x20 SPACE */
+       PKEY_NOKEY,             /* 0x21 ! */
+       PKEY_NOKEY,             /* 0x22 " */
+       PKEY_NOKEY,             /* 0x23 # */
+       PKEY_NOKEY,             /* 0x24 $ */
+       PKEY_NOKEY,             /* 0x25 % */
+       PKEY_NOKEY,             /* 0x26 & */
+       PKEY_NOKEY,             /* 0x27 ' */
+       PKEY_NOKEY,             /* 0x28 ( */
+       PKEY_NOKEY,             /* 0x29 ) */
+       PKEY_NOKEY,             /* 0x2a * */
+       PKEY_NOKEY,             /* 0x2b + */
+       PKEY_NOKEY,             /* 0x2c , */
+       PKEY_NOKEY,             /* 0x2d - */
+       PKEY_NOKEY,             /* 0x2e . */
+       PKEY_NOKEY,             /* 0x2f / */
+       PKEY_NOKEY,             /* 0x30 0 */
+       PKEY_NOKEY,             /* 0x31 1 */
+       PKEY_NOKEY,             /* 0x32 2 */
+       PKEY_NOKEY,             /* 0x33 3 */
+       PKEY_NOKEY,             /* 0x34 4 */
+       PKEY_NOKEY,             /* 0x35 5 */
+       PKEY_NOKEY,             /* 0x36 6 */
+       PKEY_NOKEY,             /* 0x37 7 */
+       PKEY_NOKEY,             /* 0x38 8 */
+       PKEY_NOKEY,             /* 0x39 9 */
+       PKEY_NOKEY,             /* 0x3a : */
+       PKEY_NOKEY,             /* 0x3b ; */
+       PKEY_NOKEY,             /* 0x3c < */
+       PKEY_NOKEY,             /* 0x3d = */
+       PKEY_NOKEY,             /* 0x3e > */
+       PKEY_NOKEY,             /* 0x3f ? */
+       PKEY_NOKEY,             /* 0x40 @ */
+       PKEY_NOKEY,             /* 0x41 A */
+       PKEY_NOKEY,             /* 0x42 B */
+       PKEY_NOKEY,             /* 0x43 C */
+       PKEY_NOKEY,             /* 0x44 D */
+       PKEY_NOKEY,             /* 0x45 E */
+       PKEY_NOKEY,             /* 0x46 F */
+       PKEY_NOKEY,             /* 0x47 G */
+       PKEY_NOKEY,             /* 0x48 H */
+       PKEY_NOKEY,             /* 0x49 I */
+       PKEY_NOKEY,             /* 0x4a J */
+       PKEY_NOKEY,             /* 0x4b K */
+       PKEY_NOKEY,             /* 0x4c L */
+       PKEY_NOKEY,             /* 0x4d M */
+       PKEY_NOKEY,             /* 0x4e N */
+       PKEY_NOKEY,             /* 0x4f O */
+       PKEY_NOKEY,             /* 0x50 P */
+       PKEY_NOKEY,             /* 0x51 Q */
+       PKEY_NOKEY,             /* 0x52 R */
+       PKEY_NOKEY,             /* 0x53 S */
+       PKEY_NOKEY,             /* 0x54 T */
+       PKEY_NOKEY,             /* 0x55 U */
+       PKEY_NOKEY,             /* 0x56 V */
+       PKEY_NOKEY,             /* 0x57 W */
+       PKEY_NOKEY,             /* 0x58 X */
+       PKEY_NOKEY,             /* 0x59 Y */
+       PKEY_NOKEY,             /* 0x5a Z */
+       PKEY_NOKEY,             /* 0x5b [ */
+       PKEY_NOKEY,             /* 0x5c / */
+       PKEY_NOKEY,             /* 0x5d ] */
+       PKEY_NOKEY,             /* 0x5e ^ */
+       PKEY_NOKEY,             /* 0x5f _ */
+       PKEY_NOKEY,             /* 0x60 ` */
+       PKEY_NOKEY,             /* 0x61 a */
+       PKEY_NOKEY,             /* 0x62 b */
+       PKEY_NOKEY,             /* 0x63 c */
+       PKEY_NOKEY,             /* 0x64 d */
+       PKEY_NOKEY,             /* 0x65 e */
+       PKEY_NOKEY,             /* 0x66 f */
+       PKEY_NOKEY,             /* 0x67 g */
+       PKEY_NOKEY,             /* 0x68 h */
+       PKEY_NOKEY,             /* 0x69 i */
+       PKEY_NOKEY,             /* 0x6a j */
+       PKEY_NOKEY,             /* 0x6b k */
+       PKEY_NOKEY,             /* 0x6c l */
+       PKEY_NOKEY,             /* 0x6d m */
+       PKEY_NOKEY,             /* 0x6e n */
+       PKEY_NOKEY,             /* 0x6f o */
+       PKEY_NOKEY,             /* 0x70 p */
+       PKEY_NOKEY,             /* 0x71 q */
+       PKEY_NOKEY,             /* 0x72 r */
+       PKEY_NOKEY,             /* 0x73 s */
+       PKEY_NOKEY,             /* 0x74 t */
+       PKEY_NOKEY,             /* 0x75 u */
+       PKEY_NOKEY,             /* 0x76 v */
+       PKEY_NOKEY,             /* 0x77 w */
+       PKEY_NOKEY,             /* 0x78 x */
+       PKEY_NOKEY,             /* 0x79 y */
+       PKEY_NOKEY,             /* 0x7a z */
+       PKEY_NOKEY,             /* 0x7b { */
+       PKEY_NOKEY,             /* 0x7c | */
+       PKEY_NOKEY,             /* 0x7d } */
+       PKEY_NOKEY,             /* 0x7e ~ */
+};
+
+#endif                         /* KEY_H */