home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / FSGFX.ZIP / HERCMOU.C < prev    next >
C/C++ Source or Header  |  1990-03-06  |  30KB  |  1,461 lines

  1. #define REQUEST 0        /* request port */
  2. #define RELEASE 1        /* release port */
  3. #define BPORT    0x03b4        /* beginning port */
  4. #define EPORT    0x03ba        /* ending port */
  5. /*
  6. #define INCL_BASE    1
  7. #define INCL_DOSDEVICES 1
  8. */
  9. #include "os2.h"
  10. #include "stdlib.h"
  11.  
  12.  
  13. #define HERCCONTROL     0x03b8
  14. #define HERCSTATUS      0x03bA
  15. #define HERC6845INDEX   0x3b4
  16. #define HERC6845DATA    0x3b5
  17.  
  18.  
  19. #define CPAGEMASK       0x80
  20. #define CBLINKMASK      0x10
  21. #define CBLANKMASK      0x08
  22. #define CMODEMASK       0x02
  23.  
  24. #define SRETRACE        0x80
  25. #define SDOTS           0x08
  26. #define SSYNC           0x01
  27.  
  28. #define    OR        0
  29. #define XOR        1
  30. #define AND        2
  31.  
  32.         unsigned char uchar;
  33.  
  34. void extern far pascal HC_GFX(PCH);
  35. void extern far pascal HC_TXT(PCH);
  36. void extern far pascal CLR_GFX(PCH);
  37.  
  38.  
  39. VIOPHYSBUF viopbBuf;
  40. PCH    pchscreen;
  41. USHORT    fstatus;
  42.  
  43. MOUEVENTINFO MouEvent;
  44. SCALEFACT  mousc;
  45.  
  46. unsigned char testit[8][8] = 
  47.         {    { 0,0,1,1,1,0,0,0 },
  48.             { 0,0,1,1,1,0,0,0 },
  49.             { 0,0,1,1,1,0,0,0 },
  50.             { 0,0,1,1,1,0,0,0 },
  51.             { 0,0,1,1,1,0,0,0 },
  52.             { 0,0,1,1,1,0,0,0 },
  53.             { 0,0,1,1,1,0,0,0 },
  54.             { 0,0,1,1,1,0,0,0 }    };
  55.  
  56. unsigned char alphabet[128][8][8] =
  57.  
  58. /*     */    {
  59.  
  60.         {       { 0,0,0,0,0,0,0,0 },
  61.             { 0,0,0,0,0,0,0,0 },
  62.             { 0,0,0,0,0,0,0,0 },
  63.             { 0,0,0,0,0,0,0,0 },
  64.             { 0,0,0,0,0,0,0,0 },
  65.             { 0,0,0,0,0,0,0,0 },
  66.             { 0,0,0,0,0,0,0,0 },
  67.             { 0,0,0,0,0,0,0,0 }     },
  68.  
  69. /*  !  */    {       { 0,0,0,1,1,0,0,0 },
  70.             { 0,0,0,1,1,0,0,0 },
  71.             { 0,0,0,1,1,0,0,0 },
  72.             { 0,0,0,1,1,0,0,0 },
  73.             { 0,0,0,1,1,0,0,0 },
  74.             { 0,0,0,0,0,0,0,0 },
  75.             { 0,0,0,1,1,0,0,0 },
  76.             { 0,0,0,1,1,0,0,0 }     },
  77. /*  "  */
  78.  
  79.         {       { 0,0,0,0,0,0,0,0 },
  80.             { 0,0,0,1,1,0,0,0 },
  81.             { 0,0,0,1,1,0,0,0 },
  82.             { 0,0,0,0,0,0,0,0 },
  83.             { 0,0,0,0,0,0,0,0 },
  84.             { 0,0,0,0,0,0,0,0 },
  85.             { 0,0,0,0,0,0,0,0 },
  86.             { 0,0,0,0,0,0,0,0 }     },
  87. /*  #  */
  88.  
  89.         {       { 0,0,1,0,0,1,0,0 },
  90.             { 0,0,1,0,0,1,0,0 },
  91.             { 1,1,1,1,1,1,1,1 },
  92.             { 0,0,1,0,0,1,0,0 },
  93.             { 0,0,1,0,0,1,0,0 },
  94.             { 1,1,1,1,1,1,1,1 },
  95.             { 0,0,1,0,0,1,0,0 },
  96.             { 0,0,1,0,0,1,0,0 }     },
  97. /*  $  */
  98.         {       { 0,0,0,1,1,0,0,0 },
  99.             { 0,0,1,1,1,1,0,0 },
  100.             { 0,1,0,0,0,0,0,0 },
  101.             { 0,0,1,1,1,0,0,0 },
  102.             { 0,0,0,0,0,1,0,0 },
  103.             { 0,1,0,0,0,0,1,0 },
  104.             { 0,0,1,1,1,1,0,0 },
  105.             { 0,0,0,1,1,0,0,0 }     },
  106.  
  107. /*  %  */
  108.  
  109.         {       { 1,1,0,0,0,0,0,1 },
  110.             { 1,1,0,0,0,0,1,0 },
  111.             { 0,0,0,0,0,1,0,0 },
  112.             { 0,0,0,0,1,0,0,0 },
  113.             { 0,0,0,1,0,0,0,0 },
  114.             { 0,0,1,0,0,0,0,0 },
  115.             { 0,1,0,0,0,0,1,1 },
  116.             { 1,0,0,0,0,0,1,1 }     },
  117. /*  &  */
  118.  
  119.         {       { 0,0,0,0,0,0,0,0 },
  120.             { 0,0,0,0,0,0,0,0 },
  121.             { 0,0,0,0,0,0,0,0 },
  122.             { 0,0,0,0,0,0,0,0 },
  123.             { 0,0,0,0,0,0,0,0 },
  124.             { 0,0,0,0,0,0,0,0 },
  125.             { 0,0,0,0,0,0,0,0 },
  126.             { 0,0,0,0,0,0,0,0 }     },
  127. /*  `  */
  128.  
  129.         {       { 0,0,0,0,0,0,0,0 },
  130.             { 0,0,0,0,0,0,0,0 },
  131.             { 0,0,1,0,0,0,0,0 },
  132.             { 0,0,1,0,0,0,0,0 },
  133.             { 0,0,0,1,0,0,0,0 },
  134.             { 0,0,0,0,0,0,0,0 },
  135.             { 0,0,0,0,0,0,0,0 },
  136.             { 0,0,0,0,0,0,0,0 }     },
  137. /*  (  */
  138.  
  139.         {       { 0,0,0,0,1,0,0,0 },
  140.             { 0,0,0,1,0,0,0,0 },
  141.             { 0,0,1,0,0,0,0,0 },
  142.             { 0,0,1,0,0,0,0,0 },
  143.             { 0,0,1,0,0,0,0,0 },
  144.             { 0,0,1,0,0,0,0,0 },
  145.             { 0,0,0,1,0,0,0,0 },
  146.             { 0,0,0,0,1,0,0,0 }     },
  147. /*  )  */
  148.  
  149.         {       { 0,0,0,1,0,0,0,0 },
  150.             { 0,0,0,0,1,0,0,0 },
  151.             { 0,0,0,0,0,1,0,0 },
  152.             { 0,0,0,0,0,1,0,0 },
  153.             { 0,0,0,0,0,1,0,0 },
  154.             { 0,0,0,0,0,1,0,0 },
  155.             { 0,0,0,0,1,0,0,0 },
  156.             { 0,0,0,1,0,0,0,0 }     },
  157. /*  *  */
  158.  
  159.         {       { 1,0,0,0,0,0,0,1 },
  160.             { 0,1,0,0,0,0,1,0 },
  161.             { 0,0,1,1,1,1,0,0 },
  162.             { 0,0,1,1,1,1,1,1 },
  163.             { 1,1,1,1,1,1,0,0 },
  164.             { 0,0,1,1,1,1,0,0 },
  165.             { 0,1,0,0,0,0,1,0 },
  166.             { 1,0,0,0,0,0,0,1 }     },
  167. /*  +  */
  168.  
  169.         {       { 0,0,0,0,0,0,0,0 },
  170.             { 0,0,0,0,0,0,0,0 },
  171.             { 0,0,0,1,0,0,0,0 },
  172.             { 0,0,0,1,0,0,0,0 },
  173.             { 0,1,1,1,1,1,0,0 },
  174.             { 0,0,0,1,0,0,0,0 },
  175.             { 0,0,0,1,0,0,0,0 },
  176.             { 0,0,0,0,0,0,0,0 }     },
  177. /* 0,0 */
  178.  
  179.         {       { 0,0,0,0,0,0,0,0 },
  180.             { 0,0,0,0,0,0,0,0 },
  181.             { 0,0,0,0,0,0,0,0 },
  182.             { 0,0,0,0,0,0,0,0 },
  183.             { 0,0,0,0,0,0,0,0 },
  184.             { 0,0,0,0,1,0,0,0 },
  185.             { 0,0,0,0,1,0,0,0 },
  186.             { 0,0,0,1,0,0,0,0 }     },
  187. /*  -  */
  188.  
  189.         {       { 0,0,0,0,0,0,0,0 },
  190.             { 0,0,0,0,0,0,0,0 },
  191.             { 0,0,0,0,0,0,0,0 },
  192.             { 1,1,1,1,1,1,1,1 },
  193.             { 0,0,0,0,0,0,0,0 },
  194.             { 0,0,0,0,0,0,0,0 },
  195.             { 0,0,0,0,0,0,0,0 },
  196.             { 0,0,0,0,0,0,0,0 }     },
  197. /*  .  */
  198.  
  199.         {       { 0,0,0,0,0,0,0,0 },
  200.             { 0,0,0,0,0,0,0,0 },
  201.             { 0,0,0,0,0,0,0,0 },
  202.             { 0,0,0,0,0,0,0,0 },
  203.             { 0,0,0,0,0,0,0,0 },
  204.             { 0,0,0,0,0,0,0,0 },
  205.             { 0,0,0,0,0,0,0,0 },
  206.             { 0,0,0,1,0,0,0,0 }     },
  207. /*  /  */
  208.  
  209.         {       { 0,0,0,0,0,0,0,1 },
  210.             { 0,0,0,0,0,0,1,0 },
  211.             { 0,0,0,0,0,1,0,0 },
  212.             { 0,0,0,0,1,0,0,0 },
  213.             { 0,0,0,1,0,0,0,0 },
  214.             { 0,0,1,0,0,0,0,0 },
  215.             { 0,1,0,0,0,0,0,0 },
  216.             { 1,0,0,0,0,0,0,0 }     },
  217. /*  0  */
  218.  
  219.         {       { 0,0,0,1,1,0,0,0 },
  220.             { 0,0,1,0,0,1,0,0 },
  221.             { 0,1,0,0,1,0,1,0 },
  222.             { 1,0,0,1,0,0,0,1 },
  223.             { 1,0,1,0,0,0,0,1 },
  224.             { 0,1,0,0,0,0,1,0 },
  225.             { 0,0,1,0,0,1,0,0 },
  226.             { 0,0,0,1,1,0,0,0 }     },
  227. /*  1  */
  228.  
  229.         {       { 0,0,0,1,1,0,0,0 },
  230.             { 0,0,1,0,1,0,0,0 },
  231.             { 0,0,0,0,1,0,0,0 },
  232.             { 0,0,0,0,1,0,0,0 },
  233.             { 0,0,0,0,1,0,0,0 },
  234.             { 0,0,0,0,1,0,0,0 },
  235.             { 0,0,0,0,1,0,0,0 },
  236.             { 0,0,1,1,1,1,1,0 }     },
  237. /*  2  */
  238.  
  239.         {       { 0,0,1,1,1,0,0,0 },
  240.             { 0,1,0,0,0,1,0,0 },
  241.             { 0,0,0,0,0,0,1,0 },
  242.             { 0,0,0,0,0,0,1,0 },
  243.             { 0,0,0,0,0,1,0,0 },
  244.             { 0,0,0,0,1,0,0,0 },
  245.             { 0,0,0,1,0,0,0,0 },
  246.             { 0,0,1,1,1,1,1,0 }     },
  247. /*  3  */
  248.  
  249.         {       { 0,0,1,1,1,0,0,0 },
  250.             { 0,1,0,0,0,1,0,0 },
  251.             { 1,0,0,0,0,0,1,0 },
  252.             { 0,0,0,0,0,1,0,0 },
  253.             { 0,0,0,1,1,1,0,0 },
  254.             { 1,0,0,0,0,1,1,0 },
  255.             { 0,1,0,0,0,1,0,0 },
  256.             { 0,0,1,1,1,0,0,0 }     },
  257. /*  4  */
  258.  
  259.         {       { 0,0,0,1,1,0,0,0 },
  260.             { 0,0,1,0,1,0,0,0 },
  261.             { 0,1,0,0,1,0,0,0 },
  262.             { 1,0,0,0,1,0,0,0 },
  263.             { 1,1,1,1,1,1,1,1 },
  264.             { 0,0,0,0,1,0,0,0 },
  265.             { 0,0,0,0,1,0,0,0 },
  266.             { 0,0,0,0,1,0,0,0 }     },
  267. /*  5  */
  268.  
  269.         {       { 0,1,1,1,1,1,1,0 },
  270.             { 0,1,0,0,0,0,0,0 },
  271.             { 0,1,0,0,0,0,0,0 },
  272.             { 0,1,1,1,1,0,0,0 },
  273.             { 0,0,0,0,0,1,0,0 },
  274.             { 0,0,0,0,0,0,1,0 },
  275.             { 0,0,0,0,0,0,1,0 },
  276.             { 0,1,1,1,1,1,0,0 }     },
  277. /*  6  */
  278.  
  279.         {       { 0,0,0,1,1,1,0,0 },
  280.             { 0,0,1,0,0,0,0,0 },
  281.             { 0,1,0,0,0,0,0,0 },
  282.             { 0,1,0,0,0,0,0,0 },
  283.             { 0,1,1,1,1,1,0,0 },
  284.             { 0,1,0,0,0,0,1,0 },
  285.             { 0,1,0,0,0,0,1,0 },
  286.             { 0,0,1,1,1,1,0,0 }     },
  287. /*  7  */
  288.  
  289.         {       { 0,1,1,1,1,1,1,0 },
  290.             { 0,0,0,0,0,0,1,0 },
  291.             { 0,0,0,0,0,0,1,0 },
  292.             { 0,0,0,0,0,1,0,0 },
  293.             { 0,0,0,0,1,0,0,0 },
  294.             { 0,0,0,1,0,0,0,0 },
  295.             { 0,0,1,0,0,0,0,0 },
  296.             { 0,1,0,0,0,0,0,0 }     },
  297. /*  8  */
  298.  
  299.         {       { 0,0,1,1,1,1,0,0 },
  300.             { 0,1,0,0,0,0,1,0 },
  301.             { 0,1,0,0,0,0,1,0 },
  302.             { 0,0,1,1,1,1,0,0 },
  303.             { 0,1,0,0,0,0,1,0 },
  304.             { 0,1,0,0,0,0,1,0 },
  305.             { 0,1,0,0,0,0,1,0 },
  306.             { 0,0,1,1,1,1,0,0 }     },
  307. /*  9  */
  308.  
  309.         {       { 0,0,1,1,1,1,0,0 },
  310.             { 0,1,0,0,0,0,1,0 },
  311.             { 0,1,0,0,0,0,1,0 },
  312.             { 0,0,1,1,1,1,1,0 },
  313.             { 0,0,0,0,0,1,0,0 },
  314.             { 0,0,0,0,1,0,0,0 },
  315.             { 0,0,0,1,0,0,0,0 },
  316.             { 0,1,1,0,0,0,0,0 }     },
  317. /*  :  */
  318.  
  319.         {       { 0,0,0,0,0,0,0,0 },
  320.             { 0,0,0,0,0,0,0,0 },
  321.             { 0,0,0,1,0,0,0,0 },
  322.             { 0,0,0,0,0,0,0,0 },
  323.             { 0,0,0,0,0,0,0,0 },
  324.             { 0,0,0,1,0,0,0,0 },
  325.             { 0,0,0,0,0,0,0,0 },
  326.             { 0,0,0,0,0,0,0,0 }     },
  327.  
  328. /*  ;  */
  329.  
  330.         {       { 0,0,0,0,0,0,0,0 },
  331.             { 0,0,0,0,0,0,0,0 },
  332.             { 0,0,0,1,0,0,0,0 },
  333.             { 0,0,0,0,0,0,0,0 },
  334.             { 0,0,0,0,0,0,0,0 },
  335.             { 0,0,0,1,0,0,0,0 },
  336.             { 0,0,0,0,0,0,0,0 },
  337.             { 0,0,0,0,0,0,0,0 }     },
  338. /*  <  */
  339.  
  340.         {       { 0,0,0,1,0,0,0,0 },
  341.             { 0,0,1,0,0,0,0,0 },
  342.             { 0,1,0,0,0,0,0,0 },
  343.             { 1,0,0,0,0,0,0,0 },
  344.             { 1,0,0,0,0,0,0,0 },
  345.             { 0,1,0,0,0,0,0,0 },
  346.             { 0,0,1,0,0,0,0,0 },
  347.             { 0,0,0,1,0,0,0,0 }     },
  348. /*  =  */
  349.  
  350.         {       { 0,0,0,0,0,0,0,0 },
  351.             { 0,0,0,0,0,0,0,0 },
  352.             { 0,1,1,1,1,1,1,0 },
  353.             { 0,0,0,0,0,0,0,0 },
  354.             { 0,0,0,0,0,0,0,0 },
  355.             { 0,1,1,1,1,1,1,0 },
  356.             { 0,0,0,0,0,0,0,0 },
  357.             { 0,0,0,0,0,0,0,0 }     },
  358. /*  >  */
  359.  
  360.         {       { 0,0,0,0,1,0,0,0 },
  361.             { 0,0,0,0,0,1,0,0 },
  362.             { 0,0,0,0,0,0,1,0 },
  363.             { 0,0,0,0,0,0,0,1 },
  364.             { 0,0,0,0,0,0,0,1 },
  365.             { 0,0,0,0,0,0,1,0 },
  366.             { 0,0,0,0,0,1,0,0 },
  367.             { 0,0,0,0,1,0,0,0 }     },
  368. /*  ?  */
  369.  
  370.         {       { 0,0,0,1,1,0,0,0 },
  371.             { 0,0,1,0,0,1,0,0 },
  372.             { 0,1,0,0,0,0,1,0 },
  373.             { 0,1,0,0,0,0,1,0 },
  374.             { 0,0,0,0,0,1,0,0 },
  375.             { 0,0,0,0,1,0,0,0 },
  376.             { 0,0,0,0,0,0,0,0 },
  377.             { 0,0,0,0,1,0,0,0 }     },
  378. /*  @  */
  379.  
  380.         {       { 0,0,0,0,0,0,0,0 },
  381.             { 0,0,0,0,0,0,0,0 },
  382.             { 0,0,0,0,0,0,0,0 },
  383.             { 0,0,0,0,0,0,0,0 },
  384.             { 0,0,0,0,0,0,0,0 },
  385.             { 0,0,0,0,0,0,0,0 },
  386.             { 0,0,0,0,0,0,0,0 },
  387.             { 0,0,0,0,0,0,0,0 }     },
  388.  
  389. /*  A  */
  390.  
  391.         {       { 0,0,0,1,1,0,0,0 },
  392.             { 0,0,1,0,0,1,0,0 },
  393.             { 0,1,0,0,0,0,1,0 },
  394.             { 0,1,0,0,0,0,1,0 },
  395.             { 0,1,1,1,1,1,1,0 },
  396.             { 0,1,0,0,0,0,1,0 },
  397.             { 0,1,0,0,0,0,1,0 },
  398.             { 0,1,0,0,0,0,1,0 }     },
  399.  
  400. /*  B  */
  401.  
  402.         {       { 0,1,1,1,1,1,0,0 },
  403.             { 0,1,0,0,0,0,1,0 },
  404.             { 0,1,0,0,0,0,1,0 },
  405.             { 0,1,1,1,1,1,0,0 },
  406.             { 0,1,0,0,0,1,0,0 },
  407.             { 0,1,0,0,0,0,1,0 },
  408.             { 0,1,0,0,0,0,1,0 },
  409.             { 0,1,1,1,1,1,0,0 }     },
  410.  
  411. /*  C  */
  412.         {       { 0,0,1,1,1,1,0,0 },
  413.             { 0,1,0,0,0,0,1,0 },
  414.             { 0,1,0,0,0,0,0,0 },
  415.             { 0,1,0,0,0,0,0,0 },
  416.             { 0,1,0,0,0,0,0,0 },
  417.             { 0,1,0,0,0,0,0,0 },
  418.             { 0,1,0,0,0,0,1,0 },
  419.             { 0,0,1,1,1,1,0,0 }     },
  420. /*  D  */
  421.  
  422.         {       { 0,1,1,1,1,1,0,0 },
  423.             { 0,1,0,0,0,0,1,0 },
  424.             { 0,1,0,0,0,0,1,0 },
  425.             { 0,1,0,0,0,0,1,0 },
  426.             { 0,1,0,0,0,0,1,0 },
  427.             { 0,1,0,0,0,0,1,0 },
  428.             { 0,1,0,0,0,0,1,0 },
  429.             { 0,1,1,1,1,1,0,0 }     },
  430. /*  E  */
  431.  
  432.         {       { 0,1,1,1,1,1,1,0 },
  433.             { 0,1,0,0,0,0,0,0 },
  434.             { 0,1,0,0,0,0,0,0 },
  435.             { 0,1,1,1,1,0,0,0 },
  436.             { 0,1,0,0,0,0,0,0 },
  437.             { 0,1,0,0,0,0,0,0 },
  438.             { 0,1,0,0,0,0,0,0 },
  439.             { 0,1,1,1,1,1,1,0 }     },
  440. /*  F  */
  441.  
  442.         {       { 0,1,1,1,1,1,1,0 },
  443.             { 0,1,0,0,0,0,0,0 },
  444.             { 0,1,0,0,0,0,0,0 },
  445.             { 0,1,1,1,1,0,0,0 },
  446.             { 0,1,0,0,0,0,0,0 },
  447.             { 0,1,0,0,0,0,0,0 },
  448.             { 0,1,0,0,0,0,0,0 },
  449.             { 0,1,0,0,0,0,0,0 }     },
  450. /*  G  */
  451.  
  452.         {       { 0,0,0,1,1,0,0,0 },
  453.             { 0,0,1,0,0,1,0,0 },
  454.             { 0,1,0,0,0,0,1,0 },
  455.             { 0,1,0,0,0,0,0,0 },
  456.             { 0,1,0,0,1,1,0,0 },
  457.             { 0,1,0,0,0,0,1,0 },
  458.             { 0,0,1,0,0,1,1,0 },
  459.             { 0,0,0,1,1,0,1,0 }     },
  460. /*  H  */
  461.  
  462.         {       { 0,1,0,0,0,0,1,0 },
  463.             { 0,1,0,0,0,0,1,0 },
  464.             { 0,1,0,0,0,0,1,0 },
  465.             { 0,1,1,1,1,1,1,0 },
  466.             { 0,1,0,0,0,0,1,0 },
  467.             { 0,1,0,0,0,0,1,0 },
  468.             { 0,1,0,0,0,0,1,0 },
  469.             { 0,1,0,0,0,0,1,0 }     },
  470. /*  I  */
  471.  
  472.         {       { 0,0,1,1,1,0,0,0 },
  473.             { 0,0,0,1,0,0,0,0 },
  474.             { 0,0,0,1,0,0,0,0 },
  475.             { 0,0,0,1,0,0,0,0 },
  476.             { 0,0,0,1,0,0,0,0 },
  477.             { 0,0,0,1,0,0,0,0 },
  478.             { 0,0,0,1,0,0,0,0 },
  479.             { 0,0,1,1,1,0,0,0 }     },
  480. /*  J  */
  481.  
  482.         {       { 0,0,0,0,1,1,1,0 },
  483.             { 0,0,0,0,0,1,0,0 },
  484.             { 0,0,0,0,0,1,0,0 },
  485.             { 0,0,0,0,0,1,0,0 },
  486.             { 0,0,0,0,0,1,0,0 },
  487.             { 0,1,0,0,0,1,0,0 },
  488.             { 0,1,0,0,0,1,0,0 },
  489.             { 0,0,1,1,1,0,0,0 }     },
  490. /*  K  */
  491.  
  492.         {       { 0,1,0,0,0,1,0,0 },
  493.             { 0,1,0,0,1,0,0,0 },
  494.             { 0,1,0,1,0,0,0,0 },
  495.             { 0,1,1,0,0,0,0,0 },
  496.             { 0,1,1,1,0,0,0,0 },
  497.             { 0,1,0,0,1,0,0,0 },
  498.             { 0,1,0,0,0,1,0,0 },
  499.             { 0,1,0,0,0,0,1,0 }     },
  500. /*  L  */
  501.  
  502.         {       { 0,1,0,0,0,0,0,0 },
  503.             { 0,1,0,0,0,0,0,0 },
  504.             { 0,1,0,0,0,0,0,0 },
  505.             { 0,1,0,0,0,0,0,0 },
  506.             { 0,1,0,0,0,0,0,0 },
  507.             { 0,1,0,0,0,0,0,0 },
  508.             { 0,1,0,0,0,0,0,0 },
  509.             { 0,1,1,1,1,1,1,0 }     },
  510. /*  M  */
  511.  
  512.         {       { 0,1,0,0,0,0,1,0 },
  513.             { 0,1,1,0,0,1,1,0 },
  514.             { 0,1,0,1,1,0,1,0 },
  515.             { 0,1,0,0,0,0,1,0 },
  516.             { 0,1,0,0,0,0,1,0 },
  517.             { 0,1,0,0,0,0,1,0 },
  518.             { 0,1,0,0,0,0,1,0 },
  519.             { 0,1,0,0,0,0,1,0 }     },
  520. /*  N  */
  521.  
  522.         {       { 0,1,0,0,0,0,1,0 },
  523.             { 0,1,1,0,0,0,1,0 },
  524.             { 0,1,1,0,0,0,1,0 },
  525.             { 0,1,0,1,0,0,1,0 },
  526.             { 0,1,0,0,1,0,1,0 },
  527.             { 0,1,0,0,0,1,1,0 },
  528.             { 0,1,0,0,0,1,1,0 },
  529.             { 0,1,0,0,0,0,1,0 }     },
  530. /*  O  */
  531.         {       { 0,0,0,1,1,0,0,0 },
  532.             { 0,0,1,0,0,1,0,0 },
  533.             { 0,1,0,0,0,0,1,0 },
  534.             { 1,0,0,0,0,0,0,1 },
  535.             { 1,0,0,0,0,0,0,1 },
  536.             { 0,1,0,0,0,0,1,0 },
  537.             { 0,0,1,0,0,1,0,0 },
  538.             { 0,0,0,1,1,0,0,0 }     },
  539. /*  P  */
  540.  
  541.         {       { 0,1,1,1,1,1,0,0 },
  542.             { 0,1,0,0,0,0,1,0 },
  543.             { 0,1,0,0,0,0,1,0 },
  544.             { 0,1,1,1,1,1,0,0 },
  545.             { 0,1,0,0,0,0,0,0 },
  546.             { 0,1,0,0,0,0,0,0 },
  547.             { 0,1,0,0,0,0,0,0 },
  548.             { 0,1,0,0,0,0,0,0 }     },
  549.  
  550. /*  Q  */
  551.         {       { 0,0,0,1,1,0,0,0 },
  552.             { 0,0,1,0,0,1,0,0 },
  553.             { 0,1,0,0,0,0,1,0 },
  554.             { 1,0,0,0,0,0,0,1 },
  555.             { 1,0,0,0,0,0,0,1 },
  556.             { 0,1,0,0,1,0,1,0 },
  557.             { 0,0,1,0,0,1,0,0 },
  558.             { 0,0,0,1,1,0,1,1 }     },
  559.  
  560. /*  R  */
  561.         {       { 0,1,1,1,1,1,0,0 },
  562.             { 0,1,0,0,0,0,1,0 },
  563.             { 0,1,0,0,0,0,1,0 },
  564.             { 0,1,1,1,1,1,0,0 },
  565.             { 0,1,0,0,0,1,0,0 },
  566.             { 0,1,0,0,0,0,1,0 },
  567.             { 0,1,0,0,0,0,1,0 },
  568.             { 0,1,0,0,0,0,1,0 }     },
  569.  
  570. /*  S  */
  571.  
  572.         {       { 0,0,1,1,1,1,0,0 },
  573.             { 0,1,0,0,0,0,1,0 },
  574.             { 0,1,0,0,0,0,0,0 },
  575.             { 0,0,1,1,1,1,0,0 },
  576.             { 0,0,0,0,0,0,1,0 },
  577.             { 0,0,0,0,0,0,1,0 },
  578.             { 0,1,0,0,0,0,1,0 },
  579.             { 0,0,1,1,1,1,0,0 }     },
  580.  
  581.  
  582. /*  T  */
  583.  
  584.         {       { 1,1,1,1,1,1,1,0 },
  585.             { 1,0,0,1,0,0,1,0 },
  586.             { 0,0,0,1,0,0,0,0 },
  587.             { 0,0,0,1,0,0,0,0 },
  588.             { 0,0,0,1,0,0,0,0 },
  589.             { 0,0,0,1,0,0,0,0 },
  590.             { 0,0,0,1,0,0,0,0 },
  591.             { 0,0,1,1,1,0,0,0 }     },
  592. /*  U  */
  593.  
  594.         {       { 0,1,0,0,0,0,1,0 },
  595.             { 0,1,0,0,0,0,1,0 },
  596.             { 0,1,0,0,0,0,1,0 },
  597.             { 0,1,0,0,0,0,1,0 },
  598.             { 0,1,0,0,0,0,1,0 },
  599.             { 0,1,0,0,0,0,1,0 },
  600.             { 0,1,0,0,0,0,1,0 },
  601.             { 0,0,1,1,1,1,0,0 }     },
  602. /*  V  */
  603.  
  604.         {       { 0,1,0,0,0,0,1,0 },
  605.             { 0,1,0,0,0,0,1,0 },
  606.             { 0,1,0,0,0,0,1,0 },
  607.             { 0,1,0,0,0,0,1,0 },
  608.             { 0,1,0,0,0,0,1,0 },
  609.             { 0,1,0,0,0,0,1,0 },
  610.             { 0,0,1,0,0,1,0,0 },
  611.             { 0,0,0,1,1,0,0,0 }     },
  612. /*  W  */
  613.  
  614.         {       { 0,1,0,0,0,0,0,1 },
  615.             { 0,1,0,0,0,0,0,1 },
  616.             { 0,1,0,0,0,0,0,1 },
  617.             { 0,1,0,0,0,0,0,1 },
  618.             { 0,1,0,0,0,0,0,1 },
  619.             { 0,1,0,0,1,0,0,1 },
  620.             { 0,1,0,1,0,1,0,1 },
  621.             { 0,0,1,0,0,0,1,0 }     },
  622. /*  X  */
  623.  
  624.         {       { 1,0,0,0,0,0,0,1 },
  625.             { 0,1,0,0,0,0,1,0 },
  626.             { 0,0,1,0,0,1,0,0 },
  627.             { 0,0,0,1,1,0,0,0 },
  628.             { 0,0,0,1,1,0,0,0 },
  629.             { 0,0,1,0,0,1,0,0 },
  630.             { 0,1,0,0,0,0,1,0 },
  631.             { 1,0,0,0,0,0,0,1 }     },
  632. /*  Y  */
  633.  
  634.         {       { 1,0,0,0,0,0,1,0 },
  635.             { 1,0,0,0,0,0,1,0 },
  636.             { 0,1,0,0,0,1,0,0 },
  637.             { 0,0,1,0,1,0,0,0 },
  638.             { 0,0,0,1,0,0,0,0 },
  639.             { 0,0,0,1,0,0,0,0 },
  640.             { 0,0,0,1,0,0,0,0 },
  641.             { 0,0,0,1,0,0,0,0 }     },
  642. /*  Z  */
  643.  
  644.         {       { 1,1,1,1,1,1,1,0 },
  645.             { 1,0,0,0,0,0,1,0 },
  646.             { 0,0,0,0,0,1,0,0 },
  647.             { 0,0,0,0,1,0,0,0 },
  648.             { 0,0,0,1,0,0,0,0 },
  649.             { 0,0,1,0,0,0,0,0 },
  650.             { 0,1,0,0,0,0,1,0 },
  651.             { 1,1,1,1,1,1,1,0 }     },
  652. /*  [  */
  653.  
  654.         {       { 1,1,1,1,0,0,0,0 },
  655.             { 1,0,0,0,0,0,0,0 },
  656.             { 1,0,0,0,0,0,0,0 },
  657.             { 1,0,0,0,0,0,0,0 },
  658.             { 1,0,0,0,0,0,0,0 },
  659.             { 1,0,0,0,0,0,0,0 },
  660.             { 1,0,0,0,0,0,0,0 },
  661.             { 1,1,1,1,0,0,0,0 }     },
  662. /*  \  */
  663.  
  664.         {       { 1,0,0,0,0,0,0,0 },
  665.             { 0,1,0,0,0,0,0,0 },
  666.             { 0,0,1,0,0,0,0,0 },
  667.             { 0,0,0,1,0,0,0,0 },
  668.             { 0,0,0,0,1,0,0,0 },
  669.             { 0,0,0,0,0,1,0,0 },
  670.             { 0,0,0,0,0,0,1,0 },
  671.             { 0,0,0,0,0,0,0,1 }     },
  672. /*  ]  */
  673.  
  674.         {       { 0,0,0,1,1,1,1,0 },
  675.             { 0,0,0,0,0,0,1,0 },
  676.             { 0,0,0,0,0,0,1,0 },
  677.             { 0,0,0,0,0,0,1,0 },
  678.             { 0,0,0,0,0,0,1,0 },
  679.             { 0,0,0,0,0,0,1,0 },
  680.             { 0,0,0,0,0,0,1,0 },
  681.             { 0,0,0,1,1,1,1,0 }     },
  682. /*  ^  */
  683.  
  684.         {       { 0,0,0,1,0,0,0,0 },
  685.             { 0,0,1,0,1,0,0,0 },
  686.             { 0,1,0,0,0,1,0,0 },
  687.             { 1,0,0,0,0,0,1,0 },
  688.             { 0,0,0,0,0,0,0,0 },
  689.             { 0,0,0,0,0,0,0,0 },
  690.             { 0,0,0,0,0,0,0,0 },
  691.             { 0,0,0,0,0,0,0,0 }     },
  692. /*  _  */
  693.  
  694.         {       { 0,0,0,0,0,0,0,0 },
  695.             { 0,0,0,0,0,0,0,0 },
  696.             { 0,0,0,0,0,0,0,0 },
  697.             { 0,0,0,0,0,0,0,0 },
  698.             { 0,0,0,0,0,0,0,0 },
  699.             { 0,0,0,0,0,0,0,0 },
  700.             { 0,0,0,0,0,0,0,0 },
  701.             { 1,1,1,1,1,1,1,1 }     },
  702. /*  `  */
  703.  
  704.         {       { 0,0,1,0,0,0,0,0 },
  705.             { 0,0,1,0,0,0,0,0 },
  706.             { 0,0,0,1,0,0,0,0 },
  707.             { 0,0,0,0,0,0,0,0 },
  708.             { 0,0,0,0,0,0,0,0 },
  709.             { 0,0,0,0,0,0,0,0 },
  710.             { 0,0,0,0,0,0,0,0 },
  711.             { 0,0,0,0,0,0,0,0 }     },
  712. /*  a  */
  713.  
  714.         {       { 0,0,0,0,0,0,0,0 },
  715.             { 0,1,1,1,1,0,0,0 },
  716.             { 0,0,0,0,0,1,0,0 },
  717.             { 0,0,0,0,0,0,1,0 },
  718.             { 0,1,1,1,1,1,1,0 },
  719.             { 1,0,0,0,0,0,1,0 },
  720.             { 1,0,0,0,0,1,1,0 },
  721.             { 0,1,1,1,1,0,1,0 }     },
  722. /*  b  */
  723.  
  724.         {       { 1,1,0,0,0,0,0,0 },
  725.             { 0,1,0,0,0,0,0,0 },
  726.             { 0,1,0,0,0,0,0,0 },
  727.             { 0,1,0,0,0,0,0,0 },
  728.             { 0,1,1,1,1,1,0,0 },
  729.             { 0,1,0,0,0,0,1,0 },
  730.             { 0,1,1,0,0,0,1,0 },
  731.             { 1,1,0,1,1,1,0,0 }     },
  732. /*  c  */
  733.  
  734.         {       { 0,0,0,0,0,0,0,0 },
  735.             { 0,0,0,0,0,0,0,0 },
  736.             { 0,0,1,1,1,1,0,0 },
  737.             { 0,1,0,0,0,0,1,0 },
  738.             { 1,0,0,0,0,0,0,0 },
  739.             { 1,0,0,0,0,0,0,0 },
  740.             { 0,1,0,0,0,0,1,0 },
  741.             { 0,0,1,1,1,1,0,0 }     },
  742. /*  d  */
  743.  
  744.         {       { 0,0,0,0,0,1,1,0 },
  745.             { 0,0,0,0,0,1,0,0 },
  746.             { 0,0,0,0,0,1,0,0 },
  747.             { 0,0,0,0,0,1,0,0 },
  748.             { 0,1,1,1,1,1,0,0 },
  749.             { 1,0,0,0,0,1,0,0 },
  750.             { 1,0,0,0,1,1,0,0 },
  751.             { 0,1,1,1,0,1,1,0 }     },
  752. /*  e  */
  753.  
  754.         {       { 0,0,0,0,0,0,0,0 },
  755.             { 0,0,0,0,0,0,0,0 },
  756.             { 0,0,1,1,1,0,0,0 },
  757.             { 0,1,0,0,0,1,0,0 },
  758.             { 1,1,1,1,1,1,1,0 },
  759.             { 1,0,0,0,0,0,0,0 },
  760.             { 1,0,0,0,0,0,1,0 },
  761.             { 0,1,1,1,1,1,0,0 }     },
  762. /*  f  */
  763.  
  764.         {       { 0,0,0,1,1,0,0,0 },
  765.             { 0,0,1,0,0,1,0,0 },
  766.             { 0,0,1,0,0,0,0,0 },
  767.             { 0,0,1,0,0,0,0,0 },
  768.             { 1,1,1,1,1,0,0,0 },
  769.             { 0,0,1,0,0,0,0,0 },
  770.             { 0,0,1,0,0,0,0,0 },
  771.             { 0,1,1,1,0,0,0,0 }     },
  772. /*  g  */
  773.  
  774.         {       { 0,0,0,0,0,0,0,0 },
  775.             { 0,0,1,1,1,0,0,0 },
  776.             { 0,1,0,0,0,1,1,0 },
  777.             { 0,1,0,0,0,1,0,0 },
  778.             { 0,0,1,1,1,1,0,0 },
  779.             { 0,0,0,0,0,1,0,0 },
  780.             { 0,1,0,0,0,1,0,0 },
  781.             { 0,0,1,1,1,0,0,0 }     },
  782. /*  h  */
  783.  
  784.         {       { 1,1,0,0,0,0,0,0 },
  785.             { 0,1,0,0,0,0,0,0 },
  786.             { 0,1,0,0,0,0,0,0 },
  787.             { 0,1,0,1,1,0,0,0 },
  788.             { 0,1,1,0,0,1,0,0 },
  789.             { 0,1,0,0,0,0,1,0 },
  790.             { 0,1,0,0,0,0,1,0 },
  791.             { 1,1,0,0,0,0,1,0 }     },
  792. /*  i  */
  793.  
  794.         {       { 0,0,0,0,0,0,0,0 },
  795.             { 0,0,0,1,0,0,0,0 },
  796.             { 0,0,0,0,0,0,0,0 },
  797.             { 0,0,1,1,0,0,0,0 },
  798.             { 0,0,0,1,0,0,0,0 },
  799.             { 0,0,0,1,0,0,0,0 },
  800.             { 0,0,0,1,0,0,0,0 },
  801.             { 0,0,1,1,1,0,0,0 }     },
  802. /*  j  */
  803.  
  804.         {       { 0,0,0,0,0,0,0,0 },
  805.             { 0,0,0,0,1,0,0,0 },
  806.             { 0,0,0,0,0,0,0,0 },
  807.             { 0,0,0,1,1,0,0,0 },
  808.             { 0,0,0,0,1,0,0,0 },
  809.             { 0,0,0,0,1,0,0,0 },
  810.             { 1,0,0,0,1,0,0,0 },
  811.             { 0,1,1,1,0,0,0,0 }     },
  812. /*  k  */
  813.  
  814.         {       { 1,1,0,0,0,0,0,0 },
  815.             { 0,1,0,0,0,0,0,0 },
  816.             { 0,1,0,0,0,0,0,0 },
  817.             { 0,1,0,1,0,0,0,0 },
  818.             { 0,1,1,0,0,0,0,0 },
  819.             { 0,1,1,0,0,0,0,0 },
  820.             { 0,1,0,1,0,0,0,0 },
  821.             { 1,1,0,0,1,0,0,0 }     },
  822. /*  l  */
  823.  
  824.         {       { 1,1,0,0,0,0,0,0 },
  825.             { 0,1,0,0,0,0,0,0 },
  826.             { 0,1,0,0,0,0,0,0 },
  827.             { 0,1,0,0,0,0,0,0 },
  828.             { 0,1,0,0,0,0,0,0 },
  829.             { 0,1,0,0,0,0,0,0 },
  830.             { 0,1,0,0,0,0,0,0 },
  831.             { 1,1,1,0,0,0,0,0 }     },
  832. /*  m  */
  833.  
  834.         {       { 0,0,0,0,0,0,0,0 },
  835.             { 0,0,0,0,0,0,0,0 },
  836.             { 0,0,0,0,0,0,0,0 },
  837.             { 1,0,1,0,0,1,0,0 },
  838.             { 1,1,0,1,1,0,1,0 },
  839.             { 1,0,0,1,0,0,1,0 },
  840.             { 1,0,0,1,0,0,1,0 },
  841.             { 1,0,0,1,0,0,1,0 }     },
  842. /*  n  */
  843.  
  844.         {       { 0,0,0,0,0,0,0,0 },
  845.             { 0,0,0,0,0,0,0,0 },
  846.             { 0,0,0,0,0,0,0,0 },
  847.             { 1,0,1,1,0,0,0,0 },
  848.             { 0,1,0,0,1,0,0,0 },
  849.             { 0,1,0,0,1,0,0,0 },
  850.             { 0,1,0,0,1,0,0,0 },
  851.             { 0,1,0,0,1,0,0,0 }     },
  852. /*  o  */
  853.  
  854.         {       { 0,0,0,0,0,0,0,0 },
  855.             { 0,0,0,0,0,0,0,0 },
  856.             { 0,0,1,1,1,0,0,0 },
  857.             { 0,1,0,0,0,1,0,0 },
  858.             { 1,0,0,0,0,0,1,0 },
  859.             { 1,0,0,0,0,0,1,0 },
  860.             { 0,1,0,0,0,1,0,0 },
  861.             { 0,0,1,1,1,0,0,0 }     },
  862. /*  p  */
  863.  
  864.         {       { 0,0,0,0,0,0,0,0 },
  865.             { 1,0,1,1,1,0,0,0 },
  866.             { 0,1,0,0,0,1,0,0 },
  867.             { 0,1,0,0,0,1,0,0 },
  868.             { 0,1,1,1,1,0,0,0 },
  869.             { 0,1,0,0,0,0,0,0 },
  870.             { 0,1,0,0,0,0,0,0 },
  871.             { 1,1,1,0,0,0,0,0 }     },
  872. /*  q  */
  873.  
  874.         {       { 0,0,0,0,0,0,0,0 },
  875.             { 0,1,1,1,0,1,0,0 },
  876.             { 1,0,0,0,1,0,0,0 },
  877.             { 1,0,0,0,1,0,0,0 },
  878.             { 0,1,1,1,1,0,0,0 },
  879.             { 0,0,0,0,1,0,0,0 },
  880.             { 0,0,0,0,1,0,0,0 },
  881.             { 0,0,0,1,1,1,0,0 }     },
  882. /*  r  */
  883.  
  884.         {       { 0,0,0,0,0,0,0,0 },
  885.             { 0,0,0,0,0,0,0,0 },
  886.             { 0,0,0,0,0,0,0,0 },
  887.             { 1,1,0,1,1,0,0,0 },
  888.             { 0,1,1,0,0,1,0,0 },
  889.             { 0,1,0,0,0,0,0,0 },
  890.             { 0,1,0,0,0,0,0,0 },
  891.             { 1,1,1,0,0,0,0,0 }     },
  892. /*  s  */
  893.  
  894.         {       { 0,0,0,0,0,0,0,0 },
  895.             { 0,1,1,1,0,0,0,0 },
  896.             { 1,0,0,0,1,0,0,0 },
  897.             { 1,0,0,0,0,0,0,0 },
  898.             { 0,1,1,1,0,0,0,0 },
  899.             { 0,0,0,0,1,0,0,0 },
  900.             { 1,0,0,0,1,0,0,0 },
  901.             { 0,1,1,1,0,0,0,0 }     },
  902.  
  903. /*  t  */
  904.  
  905.         {       { 0,0,0,0,0,0,0,0 },
  906.             { 0,0,0,0,0,0,0,0 },
  907.             { 0,0,1,0,0,0,0,0 },
  908.             { 1,1,1,1,1,0,0,0 },
  909.             { 0,0,1,0,0,0,0,0 },
  910.             { 0,0,1,0,0,0,0,0 },
  911.             { 0,0,1,0,0,1,0,0 },
  912.             { 0,0,0,1,1,0,0,0 }     },
  913. /*  u  */
  914.  
  915.         {       { 0,0,0,0,0,0,0,0 },
  916.             { 0,0,0,0,0,0,0,0 },
  917.             { 0,0,0,0,0,0,0,0 },
  918.             { 1,0,0,0,0,1,0,0 },
  919.             { 1,0,0,0,0,1,0,0 },
  920.             { 1,0,0,0,0,1,0,0 },
  921.             { 1,0,0,0,1,1,0,0 },
  922.             { 0,1,1,1,0,1,1,0 }     },
  923. /*  v  */
  924.  
  925.         {       { 0,0,0,0,0,0,0,0 },
  926.             { 0,0,0,0,0,0,0,0 },
  927.             { 0,0,0,0,0,0,0,0 },
  928.             { 1,0,0,0,0,0,1,0 },
  929.             { 1,0,0,0,0,0,1,0 },
  930.             { 0,1,0,0,0,1,0,0 },
  931.             { 0,0,1,0,1,0,0,0 },
  932.             { 0,0,0,1,0,0,0,0 }     },
  933. /*  w  */
  934.  
  935.         {       { 0,0,0,0,0,0,0,0 },
  936.             { 0,0,0,0,0,0,0,0 },
  937.             { 0,0,0,0,0,0,0,0 },
  938.             { 1,0,0,0,0,0,1,0 },
  939.             { 1,0,0,0,0,0,1,0 },
  940.             { 1,0,0,1,0,0,1,0 },
  941.             { 1,0,0,1,0,0,1,0 },
  942.             { 0,1,1,0,1,1,0,0 }     },
  943. /*  x  */
  944.  
  945.         {       { 0,0,0,0,0,0,0,0 },
  946.             { 0,0,0,0,0,0,0,0 },
  947.             { 0,0,0,0,0,0,0,0 },
  948.             { 1,0,0,0,1,0,0,0 },
  949.             { 0,1,0,1,0,0,0,0 },
  950.             { 0,0,1,0,0,0,0,0 },
  951.             { 0,1,0,1,0,0,0,0 },
  952.             { 1,0,0,0,1,0,0,0 }     },
  953. /*  y  */
  954.  
  955.         {       { 0,0,0,0,0,0,0,0 },
  956.             { 0,0,0,0,0,0,0,0 },
  957.             { 1,0,0,0,1,0,0,0 },
  958.             { 1,0,0,0,1,0,0,0 },
  959.             { 0,1,1,1,1,0,0,0 },
  960.             { 0,0,0,0,1,0,0,0 },
  961.             { 0,0,0,1,0,0,0,0 },
  962.             { 0,1,1,0,0,0,0,0 }     },
  963. /*  z  */
  964.  
  965.         {       { 0,0,0,0,0,0,0,0 },
  966.             { 0,0,0,0,0,0,0,0 },
  967.             { 1,1,1,1,1,1,0,0 },
  968.             { 1,0,0,0,1,0,0,0 },
  969.             { 0,0,0,1,0,0,0,0 },
  970.             { 0,0,1,0,0,0,0,0 },
  971.             { 0,1,0,0,0,1,0,0 },
  972.             { 1,1,1,1,1,1,0,0 }     }    };
  973.  
  974. cursor[8][8] = 
  975.         {       { 1,1,1,1,1,1,1,0 },
  976.             { 1,1,1,1,1,1,0,0 },
  977.             { 1,1,1,1,1,0,0,0 },
  978.             { 1,1,1,1,1,0,0,0 },
  979.             { 1,1,1,1,1,1,0,0 },
  980.             { 1,1,0,0,1,1,1,0 },
  981.             { 1,0,0,0,0,1,1,1 },
  982.             { 0,0,0,0,0,0,1,0 }    };
  983.  
  984. char temp[] = 
  985. "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz                                       ";
  986.  
  987. extern g_puts(int x, int y, char *message);
  988. extern g_gets(int x, int y, char *message);
  989. extern g_utc(int x, int y, char zchar);
  990. extern g_mode(int mode);
  991.  
  992. int oldx,oldy = 0;
  993.  
  994. int mode = 0;
  995.  
  996.  
  997. char blank[] = "                                    ";
  998.  
  999. int mousex = 0;
  1000. int mousey = 0;
  1001. int oldmousex = 0;
  1002. int oldmousey = 0;
  1003.  
  1004. unsigned MouHandle;    /* mouse logical handle */
  1005.  
  1006. int mouseminx = 0;
  1007. int mouseminy = 0;
  1008. int mousemaxx = 719;
  1009. int mousemaxy = 347;
  1010. /*
  1011.       msbpress(0, &bstat, &bcount, &x, &y);
  1012.       msbreles(0, &bstat, &bcount, &x, &y);
  1013. */
  1014.  
  1015. extern  int main(int argc,char * *argv);
  1016. extern  int g_puts(int locx,int locy,char *message);
  1017. extern  int g_gets(int locx,int locy,char *temp);
  1018. extern  int drawline(int startx,int starty,int endx,int endy);
  1019. extern  int makedot(int x,int y);
  1020. extern  int g_mode(int x);
  1021. extern  int convertuchartobin(unsigned char a,char *temp);
  1022. extern  int g_utc(int locx,int locy,char zchar);
  1023. extern  int mycursor(int locx,int locy);
  1024. extern  int msinitgrph(void );
  1025. extern  int msshowcur(void );
  1026. extern  int mshidecur(void );
  1027. extern  int setgraph(void );
  1028. extern  int maintaincursor(void );
  1029. extern  int msvbounds(int vubounds,int vlbounds);
  1030. extern  int mshbounds(int hlbounds,int hrbounds);
  1031.  
  1032. main(int argc, char *argv[])
  1033. {
  1034.         unsigned char a;
  1035.         int x,y,i,j;
  1036.  
  1037.     setgraph();
  1038.     g_mode(OR);
  1039.                    
  1040.  
  1041.     g_puts(0,0,"happy birthday ");
  1042.     g_puts(-1,-1,"chotist breath ");
  1043.  
  1044.     msvbounds(100,150);
  1045.     mshbounds(100,200);
  1046.  
  1047.     msinitgrph();
  1048.     msshowcur();
  1049.  
  1050.     do
  1051.     {
  1052.                 /* wait for a mouse event */
  1053.     if(kbhit())
  1054.         {
  1055.         if(getche() == 'h')
  1056.             {
  1057.             HC_GFX(pchscreen);
  1058.             msinitgrph();
  1059.             msshowcur();
  1060.             }
  1061.         }
  1062.  
  1063.     maintaincursor(); 
  1064.  
  1065.         /* exit if both buttons down */                
  1066.     } while ((MouEvent.fs & 0x14) != 0x14) ;
  1067.     
  1068.     MouClose(MouHandle);        /* release mouse handle */
  1069.     mshidecur(); 
  1070.     g_puts(-1,-1,"Have a Mice Day!");
  1071.     getch();
  1072.         HC_TXT(pchscreen);
  1073.     DosPortAccess(0, RELEASE, BPORT, EPORT);
  1074.     DosFreeSeg(viopbBuf.asel[1]);
  1075.  
  1076. }
  1077.         
  1078. g_puts(locx,locy,message)
  1079. int locx;
  1080. int locy;
  1081. char message[];
  1082. {
  1083.  
  1084.     int i,x,y;
  1085.     int letter;
  1086.     char zchar;
  1087.     unsigned char mask;
  1088.     i = 0;
  1089.  
  1090.     if (locx < 0)
  1091.         locx = oldx;
  1092.     if (locy < 0)
  1093.         locy = oldy;
  1094.     
  1095.     while(message[i] != 0)
  1096.     {
  1097.     letter = message[i++] - ' ';
  1098.         for(y = 0; y<8; y++)
  1099.         {
  1100.             for(x = 7; x>=0; x--)
  1101.             {
  1102.             if(alphabet[letter][y][x])
  1103.                 makedot(locx+x,locy+y);
  1104.             }
  1105.         }
  1106.     if(locx <= 711)
  1107.         locx += 8;
  1108.     else
  1109.         locx = 0;
  1110.     }
  1111.     oldx = locx;
  1112.     oldy = locy;
  1113. }
  1114.  
  1115. g_gets(locx,locy,temp)
  1116. int locx;
  1117. int locy;
  1118. char temp[];
  1119. {
  1120.     int i,x,y,stuff;
  1121.     int letter;
  1122.     char zchar;
  1123.     unsigned char mask;
  1124.     i = 0;
  1125.     zchar = 0;
  1126.     letter = 0;
  1127.     
  1128.     if (locx < 0)
  1129.         locx = oldx;
  1130.     if (locy < 0)
  1131.         locy = oldy;
  1132.  
  1133.     
  1134.     while(zchar != 0x0D)
  1135.     {
  1136.     
  1137.     g_mode(XOR);
  1138.     g_utc(locx,locy,'_');
  1139.     while(!kbhit());
  1140.     g_utc(locx,locy,'_');
  1141.     g_mode(OR);
  1142.     zchar = getch();
  1143.  
  1144.         switch( zchar )
  1145.         {
  1146.         case 0x0D:        /* final carriage return? */
  1147.             break;    
  1148.         case 0x00:        /* control code? */
  1149.             getch();    /* eat next char */
  1150.             break;
  1151.         case 0x08:        /* backspace? */
  1152.             stuff = mode;
  1153.             g_mode(AND);
  1154.             letter = 0;
  1155.  
  1156.             if(locx >= 8)
  1157.                 locx -= 8;
  1158.             else
  1159.                 locx = locx;
  1160.  
  1161.                 if(i > 0)
  1162.                 {
  1163.                 temp[--i] = 0;
  1164.                     for(y = 0; y<8; y++)
  1165.                     {
  1166.                         for(x = 7; x>=0; x--)
  1167.                             makedot(locx+x,locy+y);
  1168.                     }
  1169.                 }
  1170.             g_mode(stuff);
  1171.             break;    
  1172.         default:
  1173.             break;
  1174.         }
  1175.  
  1176.     if((zchar >= ' ') && (zchar <= 'z'))
  1177.         {
  1178.         letter = zchar - ' ';
  1179.         temp[i++] = zchar;
  1180.             for(y = 0; y<8; y++)
  1181.             {
  1182.                 for(x = 7; x>=0; x--)
  1183.                 {
  1184.                 if(alphabet[letter][y][x])
  1185.                     makedot(locx+x,locy+y);
  1186.                 }
  1187.             }
  1188.         if(locx <= 711)
  1189.             locx += 8;
  1190.         else
  1191.             locx = 0;
  1192.         }
  1193.     }
  1194.     temp[i] = 0;
  1195.     oldx = locx;
  1196.     oldy = locy;
  1197. }
  1198.  
  1199.  
  1200. drawline(startx, starty, endx, endy)
  1201.   int startx, starty, endx, endy;
  1202. {
  1203. register int t, distance;
  1204. int xerr=0, yerr=0, delta_x, delta_y;
  1205. int incx, incy;
  1206.  
  1207. delta_x=endx-startx;
  1208. delta_y=endy-starty;
  1209. if(delta_x>0) incx=1;
  1210. else if(delta_x==0) incx = 0;
  1211. else incx = -1;
  1212.  
  1213. if (delta_y>0) incy=1;
  1214. else if(delta_y == 0) incy = 0;
  1215. else incy = -1;
  1216.  
  1217. delta_x=abs(delta_x);
  1218. delta_y=abs(delta_y);
  1219. if(delta_x>delta_y) distance=delta_x;
  1220. else distance = delta_y;
  1221.  
  1222. for(t=0; t<=distance+1; t++)
  1223.    {
  1224.      makedot(startx,starty);
  1225.      xerr+=delta_x;
  1226.      yerr+=delta_y;
  1227.      if(xerr>distance) {
  1228.         xerr-=distance;
  1229.         startx+=incx;
  1230.     }
  1231.     if(yerr>distance)  {
  1232.        yerr -= distance;
  1233.        starty += incy;
  1234.        }
  1235.    }
  1236. }
  1237. makedot(x,y)
  1238. int x;
  1239. int y;
  1240. {
  1241.       int spot;
  1242.         spot = (0x2000 * (y % 4)) + (90 * (y / 4)) + (x/8);
  1243.         uchar = 0x80 >> (x % 8 );
  1244.     if(mode == OR)
  1245.             *(pchscreen+spot) =  *(pchscreen+spot) | uchar; 
  1246.     else if(mode == XOR)
  1247.             *(pchscreen+spot) =  *(pchscreen+spot) ^ uchar; 
  1248.     else if(mode == AND)
  1249.         *(pchscreen+spot) =  *(pchscreen+spot) & uchar; 
  1250.  
  1251. }
  1252.  
  1253. g_mode(x)
  1254. int x;
  1255. {
  1256.     mode = x;
  1257. }
  1258. convertuchartobin(a,temp)
  1259. unsigned char a;
  1260. char temp[];
  1261. {
  1262.         int i;
  1263.         unsigned char b;
  1264.         b = 0x80;
  1265.         for(i = 0; i<8; i++)
  1266.                 {
  1267.                 if(a & b)
  1268.                         temp[i] = '1';
  1269.                 else
  1270.                         temp[i] = '0';
  1271.                 b = b >> 1;
  1272.                 }
  1273. }
  1274.  
  1275. g_utc(locx,locy,zchar)
  1276. int locx;
  1277. int locy;
  1278. char zchar;
  1279. {
  1280.     int i,x,y;
  1281.     int letter;
  1282.     i = 0;
  1283.  
  1284.     if (locx < 0)
  1285.         locx = oldx;
  1286.     if (locy < 0)
  1287.         locy = oldy;
  1288.  
  1289.     if((zchar >= ' ') && (zchar <= 'z'))
  1290.     {
  1291.     letter = zchar - ' ';
  1292.         for(y = 0; y<8; y++)
  1293.         {
  1294.             for(x = 7; x>=0; x--)
  1295.             {
  1296.             if(alphabet[letter][y][x])
  1297.                 makedot(locx+x,locy+y);
  1298.             }
  1299.         }
  1300.     }
  1301.     if(locx <= 711)
  1302.         locx += 8;
  1303.     oldx = locx;
  1304.     oldy = locy;
  1305. }
  1306.  
  1307. mycursor(locx,locy)
  1308. int locx;
  1309. int locy;
  1310. {
  1311.     int i,x,y;
  1312.     int letter;
  1313.     i = 0;
  1314.     for(y = 0; y<8; y++)
  1315.     {
  1316.         for(x = 7; x>=0; x--)
  1317.         {
  1318.         if(cursor[y][x])
  1319.             makedot(locx+x,locy+y);
  1320.         }
  1321.     }
  1322. }
  1323. msinitgrph()
  1324. {
  1325.     unsigned Status;    /*returned from API */
  1326.     int WaitOption = 1;    /* 1 = block for event, 
  1327.                    0 = do not block */
  1328.                    /* open mouse device */
  1329.     Status = MouOpen(0L, &MouHandle);
  1330.  
  1331.  
  1332.  
  1333.     mousex = mouseminx + ((mousemaxx - mouseminx) /2);
  1334.     mousey = mouseminy + ((mousemaxy - mouseminy) /2);
  1335.  
  1336.     oldmousex = mousex;
  1337.     oldmousey = mousey;
  1338.  
  1339.  
  1340.     if(Status)            /* exit if no mouse */
  1341.     {    printf("\nMouOpen failed.\n");
  1342.         exit(1);
  1343.     }
  1344.     Status = 0;
  1345.     Status = Status | 0x300;
  1346.     MouSetDevStatus(&Status, MouHandle);
  1347. }
  1348.  
  1349. msshowcur()
  1350. {
  1351.     mycursor(mousex,mousey);
  1352. }
  1353.  
  1354. mshidecur()
  1355. {
  1356.     int temp;
  1357.     temp = mode;
  1358.     g_mode(XOR);
  1359.     mycursor(oldmousex,oldmousey);
  1360.     g_mode(temp);
  1361. }
  1362.  
  1363. setgraph()
  1364. {
  1365.     viopbBuf.pBuf = 0xB0000L;
  1366.     viopbBuf.cb   = 0x8000;
  1367.  
  1368.  
  1369.     VioScrLock(LOCKIO_WAIT, &fstatus, 0);
  1370.     VioGetPhysBuf(&viopbBuf,0);
  1371.     VioScrUnLock(0);
  1372.     pchscreen = MAKEP(viopbBuf.asel[0],0);
  1373.         
  1374.     if(DosPortAccess(0, REQUEST, BPORT, EPORT))
  1375.     {
  1376.         printf("\nDosPortAccess failed.\n");
  1377.         exit(1);
  1378.     }
  1379.     VioGetPhysBuf(&viopbBuf,0);
  1380.  
  1381.     HC_GFX(pchscreen); 
  1382. }
  1383.  
  1384. maintaincursor()
  1385. {
  1386.     int temp;
  1387.     int WaitOption = 1;    /* 1 = block for event, 
  1388.                    0 = do not block */
  1389.  
  1390.     MouReadEventQue(&MouEvent, &WaitOption, MouHandle);
  1391.  
  1392.     mousex = mousex + MouEvent.col;
  1393.     mousey = mousey + MouEvent.row;
  1394.  
  1395.     if(mousex < mouseminx)
  1396.         mousex = mouseminx;
  1397.     if(mousex > mousemaxx)
  1398.         mousex = mousemaxx;
  1399.     if(mousey < mouseminy)
  1400.         mousey = mouseminy;
  1401.     if (mousey >mousemaxy)
  1402.         mousey = mousemaxy; 
  1403.  
  1404.     temp = mode;
  1405.     g_mode(XOR); 
  1406.     mycursor(oldmousex,oldmousey);
  1407.     mycursor(mousex,mousey);
  1408.     oldmousex = mousex;
  1409.     oldmousey = mousey;
  1410.  
  1411.     g_mode(temp);  
  1412. }
  1413.  
  1414. msvbounds(vubounds,vlbounds)
  1415. int vubounds;
  1416. int vlbounds;
  1417. {
  1418.     if(vubounds > vlbounds)
  1419.         vubounds = vlbounds;
  1420.     if(vlbounds > 347)
  1421.         vlbounds = 347;
  1422.     if(vubounds < 0)
  1423.         vubounds = 0;
  1424.  
  1425.     mouseminy = vubounds;
  1426.     mousemaxy = vlbounds;
  1427. }
  1428.  
  1429. mshbounds(hlbounds,hrbounds)
  1430. int hlbounds;
  1431. int hrbounds;
  1432. {
  1433.     if(hlbounds > hrbounds)
  1434.         hlbounds = hrbounds;
  1435.     if(hrbounds > 719)
  1436.         hrbounds = 719;
  1437.     if(hlbounds < 0)
  1438.         hlbounds = 0;
  1439.  
  1440.     mouseminx = hlbounds;
  1441.     mousemaxx = hrbounds;
  1442. }
  1443.  
  1444. msbpress(button, bstat, bcount, x, y)
  1445. int button;
  1446. int *bstat;
  1447. int *bcount;
  1448. int *x;
  1449. int *y;
  1450. {
  1451. }
  1452.  
  1453. msbreles(button, bstat, bcount, x, y)
  1454. int button;
  1455. int *bstat;
  1456. int *bcount;
  1457. int *x;
  1458. int *y;
  1459. {
  1460. }
  1461.