home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_45.arc / PR-GRAPH.ARC / DUMP.C < prev    next >
Text File  |  1988-03-20  |  2KB  |  94 lines

  1. /* DUMP.C - include for printer setup and screen dump in Herc graphics mode.
  2.    Originally supported an article in Micro Cornucopia Magazine Issue #44.
  3.    This version has altered setup_gr_line which accepts printer mode as a
  4.    parameter. */
  5.  
  6.  
  7. char prn_out (unsigned char X)                  /* send character to printer */
  8. {
  9.   _DX = 0;   /* specify first parallel printer */
  10.   _AL = X;
  11.   _AH = 0;
  12.   geninterrupt (0x17);
  13.   return (_AH);
  14. }  /* prn_out */
  15.  
  16.  
  17.  
  18. void prn_setup ()
  19. {
  20.   prn_out (27);  prn_out (109);  prn_out (0); /* standard mode for Panasonic */
  21.   prn_out (27);  prn_out ('@');/* reset printer-doesn't affect previous line */
  22.   prn_out (13);                                           /* carriage return */
  23.   prn_out (27);  prn_out ('A');  prn_out (8);                 /* set 8/72 LF */
  24. /*  prn_out (27);  prn_out ('2'); */            /* for LV-1210/1215 printers */
  25.   prn_out (10);
  26. }  /* prn_setup */
  27.  
  28.  
  29.  
  30.  
  31. void get_line (int line_num, unsigned char buffer [348])
  32. {
  33.   int col;
  34.  
  35.   for (col=0; col<348; col++)
  36.     buffer [col] = ~peekb (0xb000, 0x2000 * (col % 4) + 90 * (col / 4)
  37.                            + line_num);                    /* get video byte */
  38. }  /* get_line */
  39.  
  40.  
  41.  
  42.  
  43. void setup_gr_line (char p_mode, int width)
  44. {
  45.   prn_out (27);
  46.   prn_out (p_mode);
  47.   prn_out (width % 256);
  48.   prn_out (width / 256);
  49. }  /* setup_gr_line */
  50.  
  51.  
  52.  
  53.  
  54. void print_blank (int width)
  55. {
  56.   int i;
  57.  
  58.   setup_gr_line (width, 75);
  59.   for (i=0; i<width; i++)
  60.     prn_out (0);
  61. }  /* print_blank */
  62.  
  63.  
  64.  
  65.  
  66.  
  67. void print_line (unsigned char buffer [348])
  68. {
  69.   int i;
  70.  
  71.   print_blank (60);
  72.   setup_gr_line (348, 75);
  73.   for (i=347; i>=0; i--)
  74.     prn_out (buffer [i]);
  75.   prn_out (10);
  76. }  /* print_line */
  77.  
  78.  
  79.  
  80.  
  81. void dump_screen ()
  82. {
  83.   int i;
  84.   char line_buf [348];
  85.  
  86.   prn_setup ();
  87.   for (i=0; i<90; i++)
  88.   {
  89.     get_line (i, line_buf);
  90.     print_line (line_buf);
  91.   }
  92. }  /* dump_screen */
  93.  
  94.