home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / LATTIC_3.LZH / EXAMPLES / PRT.C < prev    next >
C/C++ Source or Header  |  1990-05-14  |  1KB  |  69 lines

  1. /*
  2.  * Emulate the Scrdmp() comnmand
  3.  *
  4.  * lc -L prt.c
  5.  *
  6.  * Copyright (c) 1990 HiSoft
  7.  */
  8.  
  9. #include <osbind.h>
  10. #include <stdlib.h>
  11. #include <linea.h>
  12.  
  13. enum {MONO_ATARI, COLOUR_ATARI, DAISY, EPSON};
  14.  
  15. #define _prt_cnt    0x4ee
  16.  
  17. int lock(void)
  18. {
  19.     *(short *)_prt_cnt=1;    /* lock out ALT-Help handler */
  20. }
  21.  
  22. int main(void)
  23. {
  24.     static struct
  25.     {
  26.         char *blkptr;
  27.         unsigned short offset;
  28.         unsigned short width;
  29.         unsigned short height;
  30.         unsigned short left;
  31.         unsigned short right;
  32.         unsigned short srcres;
  33.         unsigned short dstres;
  34.         unsigned short *colpal;
  35.         unsigned short type;
  36.         unsigned short port;
  37.         char *masks;
  38.     } prt;
  39.     short palette[16];
  40.     short conf=Setprt(-1);
  41.     register int i;
  42.     
  43.     prt.blkptr=Physbase();    /* dump the physical screen */
  44.  
  45.     if (conf&1)
  46.         abort();            /* can't handle daisywheels */
  47.     else if (conf&4)
  48.         prt.type=EPSON;
  49.     else if (conf&2)
  50.         prt.type=COLOUR_ATARI;
  51.     else 
  52.         prt.type=MONO_ATARI;
  53.  
  54.     for (i=16; i--; )
  55.         palette[i]=Setcolor(i,-1);
  56.         
  57.     prt.colpal=palette;        /* get palette */
  58.     prt.port=(conf&16)>>4;    /* port */
  59.     prt.srcres=Getrez();    /* screen resolution */
  60.     prt.dstres=(conf&8)>>3;    /* printer resolution */
  61.     linea0();                /* init Line-A for _MAX */
  62.     prt.width=V_X_MAX;        /* find screen width */
  63.     prt.height=V_Y_MAX;        /* and height */
  64.  
  65.     Supexec(lock);            /* lock out ALT-Help */
  66.  
  67.     return Prtblk(&prt);    /* and dump */
  68. }
  69.