summaryrefslogtreecommitdiffstats
path: root/loader/kon2/include
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-09-11 16:17:23 +0000
committerMatt Wilson <msw@redhat.com>1999-09-11 16:17:23 +0000
commitec0a82a9f0ebfbfa97df65b9637f1e32068b1dd0 (patch)
tree42861a8021cde06c3b5a0f89b584870c762138f2 /loader/kon2/include
parent67b133020bb2a5ba90005ac6da55a0d5d1424799 (diff)
downloadanaconda-ec0a82a9f0ebfbfa97df65b9637f1e32068b1dd0.tar.gz
anaconda-ec0a82a9f0ebfbfa97df65b9637f1e32068b1dd0.tar.xz
anaconda-ec0a82a9f0ebfbfa97df65b9637f1e32068b1dd0.zip
Initial revision
Diffstat (limited to 'loader/kon2/include')
-rw-r--r--loader/kon2/include/child.h37
-rw-r--r--loader/kon2/include/config.h71
-rw-r--r--loader/kon2/include/defs.h40
-rw-r--r--loader/kon2/include/errors.h41
-rw-r--r--loader/kon2/include/fnld.h65
-rw-r--r--loader/kon2/include/getcap.h59
-rw-r--r--loader/kon2/include/interface.h94
-rw-r--r--loader/kon2/include/mem.h103
-rw-r--r--loader/kon2/include/mouse.h58
-rw-r--r--loader/kon2/include/setutmp.h36
-rw-r--r--loader/kon2/include/sock.h37
-rw-r--r--loader/kon2/include/term.h40
-rw-r--r--loader/kon2/include/vc.h124
-rw-r--r--loader/kon2/include/version.h1
-rw-r--r--loader/kon2/include/vga.h147
-rw-r--r--loader/kon2/include/vt.h128
16 files changed, 1081 insertions, 0 deletions
diff --git a/loader/kon2/include/child.h b/loader/kon2/include/child.h
new file mode 100644
index 000000000..7a760c875
--- /dev/null
+++ b/loader/kon2/include/child.h
@@ -0,0 +1,37 @@
+ /*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* child -- child process (run startup command and execute shell) */
+
+#ifndef CHILD_H
+#define CHILD_H
+
+extern void ChildInit(void);
+extern void ChildStart(FILE *errfp);
+extern void ChildCleanup(void);
+
+#endif
diff --git a/loader/kon2/include/config.h b/loader/kon2/include/config.h
new file mode 100644
index 000000000..9a8f7143d
--- /dev/null
+++ b/loader/kon2/include/config.h
@@ -0,0 +1,71 @@
+
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992, 1993 MAEDA Atusi (mad@math.keio.ac.jp)
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ NOTE: This is automatically generated config.
+ >>>>>>>>>>>>>> DO NOT EDIT !! <<<<<<<<<<<<<<
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+
+/* build MINI KON */
+#define MINI_KON
+
+/* Support VGA driver */
+#define HAS_VGA
+
+/* Support J31SX driver */
+#define HAS_J31SX
+
+/* Support MOUSE driver */
+#undef HAS_MOUSE
+
+/* Install Minix/V font loader */
+#define FLD_MINIX
+
+/* Install $fontx2 font loader */
+#define FLD_BDF
+
+/* Install .bdf font loader */
+#define FLD_FONTX2
+
+/* Install J3100ROM font loader */
+#define FLD_J31ROM
+
+/* Use ROM font */
+#define USE_ROMFONT
+#endif
+
+#ifdef MINI_KON
+#undef USE_ROMFONT
+#define USE_ROMFONT
+#endif
+
diff --git a/loader/kon2/include/defs.h b/loader/kon2/include/defs.h
new file mode 100644
index 000000000..6cd90187e
--- /dev/null
+++ b/loader/kon2/include/defs.h
@@ -0,0 +1,40 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* defs.h -- global definition */
+
+#ifndef DEFS_H
+#define DEFS_H
+
+#undef FALSE
+#undef TRUE
+typedef enum {FALSE, TRUE} bool;
+
+#define FAILURE (-1)
+#define SUCCESS (0)
+
+#endif
diff --git a/loader/kon2/include/errors.h b/loader/kon2/include/errors.h
new file mode 100644
index 000000000..f4bfc1e18
--- /dev/null
+++ b/loader/kon2/include/errors.h
@@ -0,0 +1,41 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1993 by MAEDA Atusi (mad@math.keio.ac.jp)
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef ERRORS_H
+#define ERRORS_H
+
+#define error kon_error
+
+extern void Perror(const char *message); /* perror(message) */
+extern void PerrorExit(const char *message); /* perror(message) and die */
+extern void fatal(const char *format, ...); /* print error message and die */
+extern void error(const char *format, ...); /* print error message */
+extern void warn(const char *format, ...); /* print warning message */
+extern void message(const char *format, ...); /* print message */
+
+#endif
diff --git a/loader/kon2/include/fnld.h b/loader/kon2/include/fnld.h
new file mode 100644
index 000000000..cdf94181d
--- /dev/null
+++ b/loader/kon2/include/fnld.h
@@ -0,0 +1,65 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* fnld.h -- font information */
+
+#ifndef FNLD_H
+#define FNLD_H
+
+#include <interface.h>
+#include <defs.h>
+
+struct fontRegs {
+ u_int (*addr)(u_char ch1, u_char ch2);
+ u_int size;
+ char *registry, *bitmap;
+ u_char high, width, sign0, sign1, stat;
+};
+
+struct langInfo {
+ u_char
+ sb,
+ db,
+ sc;
+};
+
+extern struct langInfo lInfo;
+
+#define FR_ATTACH 1
+#define FR_PROXY 2
+
+extern struct fontRegs fSRegs[], fDRegs[];
+extern struct fontRegs *sbFReg, *dbFReg;
+
+extern u_char *FontLoad(u_char *fbuff, int fd, struct fontInfo *fi);
+extern u_char *GetShmem(char type);
+extern void DownShmem(char type);
+extern void FontAttach(void);
+extern void FontDetach(bool);
+extern int CodingByRegistry(char *);
+
+#endif
diff --git a/loader/kon2/include/getcap.h b/loader/kon2/include/getcap.h
new file mode 100644
index 000000000..41e380482
--- /dev/null
+++ b/loader/kon2/include/getcap.h
@@ -0,0 +1,59 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* getcap library - read configuration file and invoke initializer function */
+
+#ifndef GETCAP_H
+#define GETCAP_H
+
+#include <defs.h>
+
+/* Initializer function should return 0 on success, -1 on failure. */
+typedef int (initializer)(const char *);
+
+/* Define initializer function func for capability name. If def_value is nil,
+ then the entry of the name must exist in configuration file. An error is
+ flagged if no entry is found. If def_value is non-nil and no entry is found
+ in configuration file, then func is invoked with def_value. */
+extern void DefineCap(const char *name, initializer *func, const char *def_value);
+
+/* Delete all initializer functions. */
+extern void CapInit(void);
+
+/* Read configuration file named filename and invoke initializer function for each entry.
+ Return 0 on success, -1 on failure. */
+extern int ReadConfig(const char *filename);
+
+/* Set value for capability capName. Return 0 on success, -1 if capName not defined. */
+extern int SetCapArg(const char *capName, const char *value);
+
+#define MAX_COLS 256 /* maximum line length of config file */
+
+/* Utility function that return 1 if confstr is "On" and 0 if "OFF". */
+extern bool BoolConf(const char *confstr);
+
+#endif
diff --git a/loader/kon2/include/interface.h b/loader/kon2/include/interface.h
new file mode 100644
index 000000000..46d8aad29
--- /dev/null
+++ b/loader/kon2/include/interface.h
@@ -0,0 +1,94 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* interface.h -- communication protocol definition */
+
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include <sys/types.h>
+
+/* 通信制御キャラクタ */
+#define STR_NAK "\x15"
+#define CHR_NAK 0x15
+#define STR_ACK "\x06"
+#define CHR_ACK 0x06
+
+/* 通信内容の識別子 */
+#define CHR_SFONT 0x81
+#define CHR_WFONT 0x89
+
+#define CHR_SFLD 0x80
+#define CHR_DBC 0x20
+#define CHR_DFLD (CHR_SFLD|CHR_DBC)
+
+#define CHR_LOAD 'L'
+#define CHR_UNLOAD 'U'
+#define CHR_STAT 'S'
+#define CHR_DISCONNECT 'D'
+#define CHR_TEXTMODE 'T'
+#define CHR_GRAPHMODE 'G'
+#define CHR_RESTART 'R'
+
+#define MAX_SOCKET_NAME 14
+#define SOCKET_BASENAME "/tmp/.kon"
+
+#define SHMEM_NAME CONFIG_NAME
+
+/* 制御キャラクタの最大長 */
+#define MAX_CTRLCHAR 80
+
+/*
+extern char socketName[MAX_SOCKET_NAME+1];
+*/
+
+struct messageHeader {
+ u_char cno, /* client number */
+ cmd; /* command */
+};
+
+struct fontInfo {
+ u_int size;
+ u_char high, width, type;
+};
+
+struct fontLoaderRegs {
+ u_int (*addr)(u_char ch1, u_char ch2);
+ u_int max;
+};
+
+extern struct fontLoaderRegs fldSRegs[], fldDRegs[];
+
+extern void SocketKill(int);
+extern int SocketRecCommand(int, struct messageHeader *);
+extern int SocketSendCommand(int, char);
+extern int SocketClientOpen(void);
+extern int SocketSendData(u_char *buff, int size, int fd);
+extern int CheckLoadedFont(char type);
+extern int SetFont(char *prog, u_char *font, struct fontInfo *fi);
+
+#endif
diff --git a/loader/kon2/include/mem.h b/loader/kon2/include/mem.h
new file mode 100644
index 000000000..4294c1656
--- /dev/null
+++ b/loader/kon2/include/mem.h
@@ -0,0 +1,103 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* mem -- memory handling libraries */
+
+#ifndef MEM_H
+#define MEM_H
+
+static inline
+ void PortOutw(u_short value, u_short port)
+{
+ __asm__ ("outw %0,%1"
+ ::"a" ((u_short) value),
+ "d" ((u_short) port));
+}
+
+static inline
+ void PortOutb(char value, u_short port)
+{
+ __asm__ ("outb %0,%1"
+ ::"a" ((char) value),
+ "d" ((u_short) port));
+}
+
+static inline
+ void lzero(void *head, int n)
+{
+ __asm__ ("cld\n\t"
+ "rep\n\t"
+ "stosl"
+ ::"a" (0),
+ "c" (n>>2),
+ "D" ((long)head)
+ :"cx","di");
+}
+
+static inline
+ void bmove(void *dst, void *src, int n)
+{
+ __asm__ ("cld\n\t"
+ "rep\n\t"
+ "movsb\n\t"
+ ::"c" (n),
+ "D" ((long)dst),
+ "S" ((long)src)
+ :"cx","di","si");
+}
+
+static inline
+ void brmove(void *dst, void *src, int n)
+{
+ __asm__ ("std\n\t"
+ "rep\n\t"
+ "movsb\n\t"
+ ::"c" (n),
+ "D" ((long)dst),
+ "S" ((long)src)
+ :"cx","di","si");
+}
+
+static inline
+ void bzero2(void *head, int n)
+{
+ __asm__ ("cld\n\t"
+ "rep\n\t"
+ "stosb"
+ ::"a" (0),
+ "c" (n),
+ "D" ((long)head)
+ :"cx","di");
+}
+
+extern u_char PortInb(u_short);
+extern void wzero(void *, int);
+extern void wmove(void *, void *, int);
+extern void lmove(void *, void *, int);
+extern void SafeFree(void **);
+
+#endif
diff --git a/loader/kon2/include/mouse.h b/loader/kon2/include/mouse.h
new file mode 100644
index 000000000..6c01006ca
--- /dev/null
+++ b/loader/kon2/include/mouse.h
@@ -0,0 +1,58 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* mouse.h -- mouse driver interface */
+#ifndef MOUSE_H
+#define MOUSE_H
+
+#include <defs.h>
+
+#define MOUSE_LFT 4
+#define MOUSE_MID 2
+#define MOUSE_RGT 1
+#define MOUSE_LIFETIME 55 /* 5.5 seconds */
+
+struct mouseInfo {
+ bool has_mouse;
+ char x, y,
+ dx, dy,
+ sx, sy,
+ sw,
+ stat;
+};
+
+extern struct mouseInfo mInfo;
+extern int mouseFd;
+
+extern void MouseInit(void);
+extern int MouseStart(void);
+extern void MouseGetPacket(u_char *, int);
+extern void MouseCleanup(void);
+extern void MouseSetRfd(int);
+extern void MouseResetRfd(int);
+
+#endif
diff --git a/loader/kon2/include/setutmp.h b/loader/kon2/include/setutmp.h
new file mode 100644
index 000000000..1b1f1eb66
--- /dev/null
+++ b/loader/kon2/include/setutmp.h
@@ -0,0 +1,36 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* setutmp -- set/reset utmp entry */
+
+#ifndef SETUTMP_H
+#define SETUTMP_H
+
+extern void SetUtmp(char *tty);
+extern void ResetUtmp(char *tty);
+
+#endif
diff --git a/loader/kon2/include/sock.h b/loader/kon2/include/sock.h
new file mode 100644
index 000000000..fe5248e41
--- /dev/null
+++ b/loader/kon2/include/sock.h
@@ -0,0 +1,37 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* sock -- socket interface module */
+
+#ifndef SOCK_H
+#define SOCK_H
+
+extern int SocketInit(char*);
+extern void SocketInterface(int);
+extern void FontShmGet(u_char);
+
+#endif
diff --git a/loader/kon2/include/term.h b/loader/kon2/include/term.h
new file mode 100644
index 000000000..3890ad8c8
--- /dev/null
+++ b/loader/kon2/include/term.h
@@ -0,0 +1,40 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* term -- multiplexer main module */
+
+#ifndef TERM_H
+#define TERM_H
+
+/* Do initialization before reading config file */
+extern void TermInit(int argc, const char *argv[]);
+
+extern void TermStart(void); /* start procesing */
+extern void TermRestart(int fd); /* restart kon (args are read from fd) */
+extern int masterPty; /* master pseudo-tty file descriptor */
+
+#endif
diff --git a/loader/kon2/include/vc.h b/loader/kon2/include/vc.h
new file mode 100644
index 000000000..601155307
--- /dev/null
+++ b/loader/kon2/include/vc.h
@@ -0,0 +1,124 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* vc -- high-level console driver */
+
+#ifndef VC_H
+#define VC_H
+
+#define ATTR_ULINE 0x80 /* under line */
+#define ATTR_REVERSE 0x40 /* reverse */
+#define ATTR_HIGH 0x20 /* high */
+
+#define LATCH_S 0x0 /* single byte char */
+#define LATCH_1 0x20 /* double byte char 1st byte */
+#define LATCH_2 0x40 /* double byte char 2nd byte */
+
+#define CLEAN_S 0x80
+#define CODEIS_1 LATCH_1
+#define CODEIS_2 LATCH_2
+#define LANG_CODE 0x0F
+/*
+#define LANG_DCODE LANG_CODE|CODEIS_1
+#define LANG_SCODE LANG_CODE
+*/
+
+extern void ConsoleInit(const char *video_type);
+extern void ConsoleStart(void);
+extern void ConsoleCleanup(void);
+extern void TextClearAll(void);
+extern void TextClearEol(u_char);
+extern void TextClearEos(u_char);
+extern void TextDeleteChar(int);
+extern void TextInsertChar(int);
+extern void TextMoveDown(int top, int btm, int line);
+extern void TextMoveUp(int top, int btm, int line);
+extern void TextMode(void);
+extern void GraphMode(void);
+extern void ScrollUp(int);
+extern void ScrollDown(int);
+extern void TextWput(u_char ch1, u_char ch2);
+extern void TextSput(u_char ch);
+extern void TextReverse(int fx, int fy, int tx, int ty);
+extern void TextRefresh(void);
+extern void TextInvalidate(void);
+extern void TextCopy(int fx, int fy, int tx, int ty);
+extern void TextPaste(void);
+extern void PollCursor(bool wakeup); /* Called to wakeup, or every 0.1 sec when idle */
+extern void Beep(void);
+
+struct cursorInfo {
+ short kanji; /* 漢字の上にあれば TRUE */
+ u_int addr; /* VRAM アドレス */
+ bool sw; /* FALSE なら表示禁止 */
+ int interval; /* 点滅間隔 */
+ int count; /* 点滅用カウント */
+ bool shown; /* 表示中フラグ */
+};
+
+/* video driver interface */
+struct videoInfo {
+ bool
+ has_hard_scroll; /* ハードスクロールが使えるかどうか */
+ void
+ (*init)(void), /* 初期化 */
+ (*text_mode)(void), /* テキストモードに切替え */
+ (*graph_mode)(void), /* グラフィックモードに切替え */
+ (*wput)(u_char *code, u_char fc, u_char bc), /* 漢字出力 */
+ (*sput)(u_char *code, u_char fc, u_char bc), /* ANK出力 */
+ (*set_cursor_address)(struct cursorInfo *c, u_int x, u_int y),
+ /* カーソル c のアドレスを (x,y) に設定 */
+ (*set_address)(u_int i),
+ /* 文字書き込みアドレスを i 文字目に設定 */
+ (*cursor)(struct cursorInfo *), /* カーソルをトグル */
+ (*clear_all)(void), /* 画面クリア */
+ (*screen_saver)(bool), /* スクリーンブランク/アンブランク */
+ (*detatch)(void), /* ドライバ解放 */
+ /* ハードスクロールが使えなければ以下はNULL */
+ (*set_start_address)(void), /* 表示開始アドレス設定 */
+ (*hard_scroll_up)(int lines), /* ハードスクロールアップ */
+ (*hard_scroll_down)(int lines); /* ハードスクロールダウン */
+};
+
+struct dispInfo {
+ int
+ gsize;
+ short
+ gxdim,
+ gydim,
+ txmax,
+ tymax,
+ glineChar, /* text 1行分の graph 行数 */
+ glineByte, /* graph 1行分のバイト数 */
+ tlineByte; /* text 1行分のバイト数 */
+};
+
+extern struct dispInfo dInfo;
+extern struct cursorInfo cInfo;
+extern struct videoInfo vInfo;
+
+#endif
diff --git a/loader/kon2/include/version.h b/loader/kon2/include/version.h
new file mode 100644
index 000000000..e50b625c6
--- /dev/null
+++ b/loader/kon2/include/version.h
@@ -0,0 +1 @@
+#define VERSION "ver.0.3.8 (98/03/09)"
diff --git a/loader/kon2/include/vga.h b/loader/kon2/include/vga.h
new file mode 100644
index 000000000..734c5a700
--- /dev/null
+++ b/loader/kon2/include/vga.h
@@ -0,0 +1,147 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* vga.h -- definitions used in video drivers */
+
+#ifndef VGA_H
+#define VGA_H
+
+/* Sequencer */
+#define VGASEQ_ADDR 0x3C4
+#define VGASEQ_DATA 0x3C5
+#define VGASEQ_CNT 5
+
+/* CRT controller */
+/*
+#define VGACRT_ADDR 0x3D4
+#define VGACRT_DATA 0x3D5
+*/
+#define CGACRT_ADDR 0x3D4
+#define CGACRT_DATA 0x3D5
+#define VGACRT_CNT 25
+#define CGACRT_CNT 25
+
+/* Graphics controller */
+#define VGAGRP_ADDR 0x3CE
+#define VGAGRP_DATA 0x3CF
+#define VGAGRP_CNT 9
+
+/* Attribute controller */
+#define VGAATTR_A_O 0x3C0
+#define VGAATTR_DATA 0x3C1
+#define VGAATTR_CNT 21
+#define EGAATTR_CNT 20
+
+#if defined(linux)
+#define GRAPH_BASE 0xA0000
+#elif defined(__FreeBSD__)
+#define GRAPH_BASE 0x0
+#endif
+#define FONT_SIZE 0x2000
+
+#define VGA_FONT_SIZE 128
+#define VGA_FONT_HEIGHT 16
+
+#define NUM_VIDEOH_INFO 4
+#define NUM_VIDEOV_INFO 4
+
+/* DAC Palette */
+#define VGAPAL_OADR 0x3C8
+#define VGAPAL_IADR 0x3C7
+#define VGAPAL_DATA 0x3C9
+
+/* Misc */
+#define VGAMISC_IN 0x3CC
+#define VGAMISC_OUT 0x3C2
+
+/* Input Stat 1 */
+/*#define VGAST1_ADDR 0x3DA*/
+
+#define MAX_PELS 16
+
+struct vgaRegs {
+ u_char crt[VGACRT_CNT],
+ att[VGAATTR_CNT],
+ gra[VGAGRP_CNT],
+ seq[VGASEQ_CNT],
+ mis;
+};
+
+struct pelRegs {
+ u_char red[MAX_PELS],
+ grn[MAX_PELS],
+ blu[MAX_PELS];
+};
+
+union videoTimings {
+ struct {
+ int hDot, hStart, hEnd, hTotal;
+ int vLine, vStart, vEnd, vTotal;
+ int txmax, tymax, i;
+ } m;
+ int v[NUM_VIDEOH_INFO+NUM_VIDEOV_INFO+1];
+};
+
+static inline
+ void VgaOutByte(u_char value)
+{
+ __asm__ ("movb %%al, %%ah\n\t"
+ "movb $8, %%al\n\t"
+ "outw %%ax, %w1"
+ :/* no outputs */
+ :"a" ((u_char) value),
+ "d" ((u_short)VGAGRP_ADDR));
+}
+
+extern u_int vgaCrtAddr, vgaCrtData, vgaSt1Addr;
+
+extern int LineComp9, LineComp8, gramHead;
+extern struct vgaRegs regText, regGraph;
+extern struct videoInfo SvgaInfo;
+
+void VgaSetRegisters(struct vgaRegs *regs);
+void VgaInit(void);
+void VgaTextMode(void);
+void VgaGraphMode(void);
+void VgaWput(u_char *code, u_char fc, u_char bc);
+void VgaSput(u_char *code, u_char fc, u_char bc);
+void VgaWputFm(u_char *code, u_char fc, u_char bc);
+void VgaSputFm(u_char *code, u_char fc, u_char bc);
+void VgaHardScrollUp(int line);
+void VgaHardScrollDown(int line);
+void VgaSetCursorAddress(struct cursorInfo *ci, u_int x, u_int y);
+void VgaSetAddress(u_int p);
+void VgaCursor(struct cursorInfo *ci);
+void VgaClearAll(void);
+void VgaScreenSaver(bool blank);
+int VgaReadPels(const char *str);
+int VgaReadNewRegs(const char *str, union videoTimings *);
+int VgaAttach(void);
+void VgaDetach(void);
+void VgaDefaultCaps();
+void VgaLoadRomFont(char *);
+#endif
diff --git a/loader/kon2/include/vt.h b/loader/kon2/include/vt.h
new file mode 100644
index 000000000..e019568a3
--- /dev/null
+++ b/loader/kon2/include/vt.h
@@ -0,0 +1,128 @@
+/*
+ * KON2 - Kanji ON Console -
+ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* vt -- VT emulator */
+
+#ifndef VT_H
+#define VT_H
+
+#include <defs.h>
+#include <fnld.h>
+
+struct _con_info {
+ short
+ x,
+ y,
+ xmax, /* 79 */
+ ymin, /* 0:スクロール開始行 */
+ ymax, /* 29 */
+ tab; /* 8 */
+ u_char
+ fcol, /* フォアグランド */
+ bcol, /* バックグランド */
+ attr, /* 文字属性 */
+ sb, /* 1 byte code フォント番号 */
+ db, /* 2 byte code フォント番号 */
+ knj1; /* 漢字キャラクタ第 1 byte */
+ void (*esc)(u_char);
+ enum {
+ CS_LEFT,
+ CS_RIGHT,
+ CS_GRAPH,
+ CS_DBCS} trans, g[2];
+ enum {
+ SL_NONE,
+ SL_ENTER,
+ SL_LEAVE} sl;
+ bool
+ soft,
+ ins,
+ active,
+ wrap,
+ text_mode;
+};
+
+extern struct _con_info con;
+
+#define CODE_2022 0 /* 2022 のみに従う*/
+#define CODE_EUC 1 /* EUC にも従う */
+#define CODE_SJIS 2 /* SJIS にも従う */
+
+#define G0_SET 0
+#define G1_SET 0x80
+
+extern void VtInit(void);
+extern void VtStart(void);
+extern void VtEmu(const char*, int nchars);
+extern void VtCleanup(void);
+
+#define sjistojis(ch, cl)\
+{\
+ ch -= (ch > 0x9F) ? 0xB1: 0x71;\
+ ch = ch * 2 + 1;\
+ if (cl > 0x9E) {\
+ cl = cl - 0x7E;\
+ ch ++;\
+ } else {\
+ if (cl > 0x7E) cl --;\
+ cl -= 0x1F;\
+ }\
+}
+
+#define jistosjis(ch, cl)\
+{\
+ if (ch & 1) cl = cl + (cl > 0x5F ? 0x20:0x1F);\
+ else cl += 0x7E;\
+ ch = ((ch - 0x21) >> 1) + 0x81;\
+ if (ch > 0x9F) ch += 0x40;\
+}
+
+/*
+ derived from Mule:codeconv.c to support "ESC $(0" sequence
+ thanks to K.Handa <handa@etl.go.jp>
+ */
+
+#define muletobig5(type, m1, m2)\
+{\
+ unsigned code = (m1 - 0x21) * 94 + (m2 - 0x21);\
+\
+ if (type == DF_BIG5_1) code += 0x16F0;\
+ m1 = code / 157 + 0xA1;\
+ m2 = code % 157;\
+ m2 += m2 < 0x3F ? 64 : 98;\
+}
+
+enum {
+ DF_GB2312,
+ DF_JISX0208,
+ DF_KSC5601,
+ DF_JISX0212,
+ DF_BIG5_0,
+ DF_BIG5_1
+ };
+
+#endif