| 1 | /* IBM1130 CONSOLE OUTPUT TO ASCII CONVERSION TABLE \r |
| 2 | *\r |
| 3 | * (C) Copyright 2002, Brian Knittel.\r |
| 4 | * You may freely use this program, but: it offered strictly on an AS-IS, AT YOUR OWN\r |
| 5 | * RISK basis, there is no warranty of fitness for any purpose, and the rest of the\r |
| 6 | * usual yada-yada. Please keep this notice and the copyright in any distributions\r |
| 7 | * or modifications.\r |
| 8 | *\r |
| 9 | * This is not a supported product, but I welcome bug reports and fixes.\r |
| 10 | * Mail to sim@ibm1130.org\r |
| 11 | */\r |
| 12 | \r |
| 13 | #define _0_ '\0'\r |
| 14 | \r |
| 15 | #define CENT_ '\xA2' /* cent and not: standard DOS mapping */\r |
| 16 | #define NOT_ '\xAC'\r |
| 17 | #define IGNR_ '\xFF'\r |
| 18 | #define CRLF_ '\r'\r |
| 19 | \r |
| 20 | #define COUT_IS_CTRL 0x01 /* conout characters with bit 1 set are controls: */\r |
| 21 | \r |
| 22 | #define COUT_CTRL_BLACK 0x04 /* none or one of these bits */\r |
| 23 | #define COUT_CTRL_RED 0x08\r |
| 24 | \r |
| 25 | #define COUT_CTRL_LINEFEED 0x02 /* plus none or one of these bits */\r |
| 26 | #define COUT_CTRL_BACKSPACE 0x10\r |
| 27 | #define COUT_CTRL_SPACE 0x20\r |
| 28 | #define COUT_CTRL_TAB 0x40\r |
| 29 | #define COUT_CTRL_RETURN 0x80\r |
| 30 | \r |
| 31 | #ifdef _MSC_VER\r |
| 32 | # pragma warning(disable:4245) /* enable int->char demotion warning caused by characters with high-bit set */\r |
| 33 | #endif\r |
| 34 | \r |
| 35 | static unsigned char conout_to_ascii[] = /* console output code to ASCII */\r |
| 36 | {\r |
| 37 | /* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */\r |
| 38 | /* 00 */ '.', IGNR_,CENT_, '\n', '@', IGNR_,'%', _0_, _0_, IGNR_,_0_, _0_, _0_, _0_, _0_, _0_,\r |
| 39 | /* 10 */ 'F', '\b', 'f', _0_, 'G', _0_, 'g', _0_, 'B', _0_, 'b', _0_, 'C', _0_, 'c', _0_,\r |
| 40 | /* 20 */ 'I', ' ', 'i', _0_, 'H', _0_, 'h', _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_,\r |
| 41 | /* 30 */ 'D', _0_, 'd', _0_, 'E', _0_, 'e', _0_, _0_, _0_, _0_, _0_, 'A', _0_, 'a', _0_,\r |
| 42 | /* 40 */ '$', '\t', '!', _0_, '&', _0_, '>', _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_,\r |
| 43 | /* 50 */ 'O', _0_, 'o', _0_, 'P', _0_, 'o', _0_, 'K', _0_, 'k', _0_, 'L', _0_, 'l', _0_,\r |
| 44 | /* 60 */ 'R', _0_, 'r', _0_, 'Q', _0_, 'q', _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_,\r |
| 45 | /* 70 */ 'M', _0_, 'm', _0_, 'N', _0_, 'n', _0_, _0_, _0_, _0_, _0_, 'J', _0_, 'j', _0_,\r |
| 46 | /* 80 */ ',', CRLF_, ':', _0_, '-', _0_, '?', _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_,\r |
| 47 | /* 90 */ 'W', _0_, 'w', _0_, 'X', _0_, 'x', _0_, 'S', _0_, 's', _0_, 'T', _0_, 't', _0_,\r |
| 48 | /* A0 */ 'Z', _0_, 'z', _0_, 'Y', _0_, 'y', _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_,\r |
| 49 | /* B0 */ 'U', _0_, 'u', _0_, 'V', _0_, 'v', _0_, _0_, _0_, _0_, _0_, '/', _0_, '_', _0_,\r |
| 50 | /* C0 */ '#', _0_, '=', _0_, '0', _0_, '|', _0_, _0_, _0_, _0_, _0_, 'J', _0_, 'j', _0_,\r |
| 51 | /* D0 */ '6', _0_, ';', _0_, '7', _0_, '*', _0_, '2', _0_, '+', _0_, '3', _0_, '<', _0_,\r |
| 52 | /* E0 */ '9', _0_, '"', _0_, '8', _0_, '\'', _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_, _0_,\r |
| 53 | /* F0 */ '4', _0_, NOT_, _0_, '5', _0_, ')', _0_, _0_, _0_, _0_, _0_, '1', _0_, '(', _0_,\r |
| 54 | };\r |
| 55 | \r |
| 56 | #ifdef _MSC_VER\r |
| 57 | # pragma warning(default:4245) /* enable int->char demotion warning */\r |
| 58 | #endif\r |