Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsutsui/ca0f50df10f2064423e8a2bb4854f3f7 to your computer and use it in GitHub Desktop.
Save tsutsui/ca0f50df10f2064423e8a2bb4854f3f7 to your computer and use it in GitHub Desktop.
WIP diff to support DEC special graphics characters (i.e. terminfo smacs/rmacs/acsc support) using dumb ASCII characters, mostly for box drawing on sysinst(8)
Index: sys/arch/x68k/dev/ite.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/dev/ite.c,v
retrieving revision 1.68
diff -u -p -d -r1.68 ite.c
--- sys/arch/x68k/dev/ite.c 28 May 2022 10:36:22 -0000 1.68
+++ sys/arch/x68k/dev/ite.c 18 Jun 2022 13:50:03 -0000
@@ -1430,6 +1430,10 @@ iteputchar(int c, struct ite_softc *ip)
ip->G0 = CSET_JISROMA;
ip->escape = 0;
return;
+ case '0': /* dec special graphics */
+ ip->G0 = CSET_DECGRAPH;
+ ip->escape = 0;
+ return;
case 'A': /* British or ISO-Latin-1 */
case 'H': /* Swedish */
case 'K': /* German */
@@ -2311,6 +2315,62 @@ itecheckwrap(struct ite_softc *ip)
#endif
}
+/*
+ * A convertion table from DEC special graphics characters to ASCII characters.
+ * Mostly for box drawing on sysinst(8).
+ */
+const int ite_decgraph2ascii[128] = {
+ /* same as ASCII from 0x00 to 0x5e */
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,
+
+ /* special characters from 0x5f to 0x7e */
+ ' ', /* 0x5f NBSP */
+ '*', /* 0x60 diamond */
+ ' ', /* 0x61 medium shade */
+ ' ', /* 0x62 HT */
+ ' ', /* 0x63 FF */
+ ' ', /* 0x64 CR */
+ ' ', /* 0x65 LF */
+ ' ', /* 0x66 degree symbol */
+ ' ', /* 0x67 plus-minus sign */
+ ' ', /* 0x68 NL */
+ ' ', /* 0x69 VT */
+ '+', /* 0x6a box drawings up left */
+ '+', /* 0x6b box drawings down left */
+ '+', /* 0x6c box drawings down right */
+ '+', /* 0x6d box drawings up right */
+ '+', /* 0x6e box drawings vertical horizontal */
+ '~', /* 0x6f scan line 1 */
+ '-', /* 0x70 scan line 3 */
+ '-', /* 0x71 scan line 5 */
+ '-', /* 0x72 scan line 7 */
+ '_', /* 0x73 scan line 9 */
+ '+', /* 0x74 box drawings vertical right */
+ '+', /* 0x75 box drawings vertical left */
+ '+', /* 0x76 box drawings horizontal up */
+ '+', /* 0x77 box drawings horizontal down */
+ '|', /* 0x78 box drawings vertical */
+ '<', /* 0x79 less than or equal to */
+ '>', /* 0x7a greater than or equal to */
+ ' ', /* 0x7b pi */
+ ' ', /* 0x7c not equal */
+ ' ', /* 0x7d pound sign */
+ '.', /* 0x7e middle dot */
+ /* end of special graphics */
+ 0x7f
+};
+
#endif
#if NITE > 0 && NKBD > 0
Index: sys/arch/x68k/dev/ite_tv.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/dev/ite_tv.c,v
retrieving revision 1.17
diff -u -p -d -r1.17 ite_tv.c
--- sys/arch/x68k/dev/ite_tv.c 8 Feb 2018 09:05:18 -0000 1.17
+++ sys/arch/x68k/dev/ite_tv.c 18 Jun 2022 13:50:03 -0000
@@ -296,6 +296,8 @@ tv_putc_nm(struct ite_softc *ip, int ch,
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -325,6 +327,8 @@ tv_putc_in(struct ite_softc *ip, int ch,
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -356,6 +360,8 @@ tv_putc_bd(struct ite_softc *ip, int ch,
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -405,6 +411,8 @@ tv_putc_ul(struct ite_softc *ip, int ch,
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -440,6 +448,8 @@ tv_putc_bd_in(struct ite_softc *ip, int
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -475,6 +485,8 @@ tv_putc_ul_in(struct ite_softc *ip, int
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -517,6 +529,8 @@ tv_putc_bd_ul(struct ite_softc *ip, int
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
@@ -564,6 +578,8 @@ tv_putc_bd_ul_in(struct ite_softc *ip, i
/* singlebyte character */
if (*ip->GL == CSET_JISKANA)
ch |= 0x80;
+ if (*ip->GL == CSET_DECGRAPH && ch < 0x80)
+ ch = ite_decgraph2ascii[ch];
f = tv_font[ch];
/* draw plane */
Index: sys/arch/x68k/dev/itevar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/dev/itevar.h,v
retrieving revision 1.15
diff -u -p -d -r1.15 itevar.h
--- sys/arch/x68k/dev/itevar.h 10 Oct 2012 17:49:50 -0000 1.15
+++ sys/arch/x68k/dev/itevar.h 18 Jun 2022 13:50:03 -0000
@@ -223,6 +223,7 @@ enum tab_size { TABSIZE = 8 };
#define CSET_JIS1978 (3|CSET_MULTI) /* iso2022jp old jis kanji */
#define CSET_JIS1983 (4|CSET_MULTI) /* iso2022jp new jis kanji */
#define CSET_JIS1990 (5|CSET_MULTI) /* iso2022jp hojo kanji */
+#define CSET_DECGRAPH 6 /* DEC special graphics characters */
struct consdev;
@@ -256,4 +257,7 @@ extern unsigned char kern_font[];
extern unsigned char kbdled;
void ite_set_glyph(void);
void kbd_setLED(void);
+
+/* DEC special graphics character to ASCII table for box drawing etc. */
+extern const int ite_decgraph2ascii[];
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment