home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_44.arc / DUMP.C < prev    next >
Text File  |  1988-09-15  |  2KB  |  86 lines

  1. /* Micro Cornucopia Issue #44 */
  2. /* DUMP.C - tests screen to printer dump in Herc graphics mode */
  3.  
  4.  
  5. #include <stdio.h>
  6.  
  7. void prn_out (unsigned char X)
  8. {
  9.   _DX = 0;                                 /* specify first parallel printer */
  10.   _AL = X;
  11.   _AH = 0;                                           /* service 0 - byte out */
  12.   geninterrupt (0x17);                                  /* printer interrupt */
  13. }  /* prn_out */
  14.  
  15.  
  16.  
  17. void prn_setup ()
  18. {
  19.   prn_out (27);  prn_out (109);  prn_out (0); /* standard mode for Panasonic */
  20.   prn_out (27);  prn_out ('@');/*reset printer - doesn't affect previous line*/
  21.   prn_out (13);                                           /* carriage return */
  22.   prn_out (27);  prn_out ('A');  prn_out (8);                 /* set 8/72 LF */
  23. }  /* prn_setup */
  24.  
  25.  
  26.  
  27. void get_line (int line_num, unsigned char buffer [348])
  28. {
  29.   int col;
  30.  
  31.   for (col=0; col<348; col++)
  32.     buffer [col] = ~peekb (0xb000, 0x2000 * (col % 4) + 90 * (col / 4)
  33.                            + line_num);                    /* get video byte */
  34. }  /* get_line */
  35.  
  36.  
  37.  
  38. void setup_gr_line (int width)
  39. {
  40.   prn_out (27);
  41.   prn_out (75);                                                /* set 60 dpi */
  42.   prn_out (width % 256);               /* these two lines set # graphics ... */
  43.   prn_out (width / 256);                             /* ... chars to be sent */
  44. }  /* setup_gr_line */
  45.  
  46.  
  47.  
  48. void print_blank (int width)
  49. {
  50.   int i;
  51.  
  52.   setup_gr_line (width);
  53.   for (i=0; i<width; i++)
  54.     prn_out (0);                /* print blanks and hold print head position */
  55. }  /* print_blank */
  56.  
  57.  
  58.  
  59. void print_line (unsigned char buffer [348])
  60. {
  61.   int i;
  62.  
  63.   print_blank (60);
  64.   setup_gr_line (348);
  65.   for (i=347; i>=0; i--)                  /* print line in buffer, backwards */
  66.     prn_out (buffer [i]);
  67.   prn_out (10);                                                 /* line feed */
  68. }  /* print_line */
  69.  
  70.  
  71.  
  72. void dump_screen ()
  73. {
  74.   int i;
  75.   char line_buf [348];                      /* holds a column of video bytes */
  76.  
  77.   prn_setup ();                                         /* ready the printer */
  78.   for (i=0; i<90; i++)                 /* print each of the 90 video columns */
  79.   {
  80.     get_line (i, line_buf);
  81.     print_line (line_buf);
  82.   }
  83. }  /* dump_screen */
  84.  
  85.  
  86.