home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / education / a / autopcb / !AutoPCB / c / PCBVDU < prev    next >
Text File  |  1991-03-24  |  2KB  |  91 lines

  1. #include <stdio.h>
  2.  
  3. #include "bbc.h"
  4.  
  5. #include "cell.h"
  6. #include "coordmap.h"
  7.  
  8. #define MAXROW 1024
  9. #define MAXCOL 1280
  10.  
  11. extern int Nrows;
  12. extern int Ncols;
  13.  
  14. extern void InitBoard(void);
  15. extern long GetCell(int, int, int);
  16. extern void SetCell(int, int, int, long);
  17.  
  18. int justboard = 1;
  19.  
  20. static int colfact, rowfact;
  21.  
  22. static void Plot(int row, int column, long top, long bottom)
  23. {
  24.   int x, y;
  25.  
  26.   x = column * colfact + colfact/2;
  27.   y = row * rowfact + rowfact/2;
  28.  
  29.   if (x & HOLE)
  30.     bbc_circle(x, y, 10);
  31. }
  32.  
  33. int main(int argc, char *argv[])
  34. {
  35.   int r, c, rp, cp, i1, i2, i3, i4;
  36.   long x, y;
  37.   FILE *fp;
  38.  
  39.   bbc_mode(12);
  40.  
  41.   fp = fopen(argv[1], "rb");
  42.  
  43.   rp = fgetc(fp);
  44.   cp = fgetc(fp);
  45.   Ncols = (rp & 0xff) | ((cp << 8) & 0xff00);
  46.   colfact = MAXCOL / Ncols;
  47.  
  48.   rp = fgetc(fp);
  49.   cp = fgetc(fp);
  50.   Nrows = (rp & 0xff) | ((cp << 8) & 0xff00);
  51.   rowfact = MAXROW / Nrows;
  52.  
  53.   InitBoard();
  54.  
  55.   for (r = 0; r < Nrows; r++)
  56.     for (c = 0; c < Ncols; c++)
  57.     {
  58.       i1 = fgetc(fp);
  59.       i2 = fgetc(fp);
  60.       i3 = fgetc(fp);
  61.       i4 = fgetc(fp);
  62.  
  63.       x = (long)i1 | (((long)i2) << 8) |
  64.         (((long)i3) << 16) | (((long)i4) << 24);
  65.  
  66.       SetCell(r, c, TOP, x);
  67.  
  68.       i1 = fgetc(fp);
  69.       i2 = fgetc(fp);
  70.       i3 = fgetc(fp);
  71.       i4 = fgetc(fp);
  72.  
  73.       x = (long)i1 | (((long)i2) << 8) |
  74.         (((long)i3) << 16) | (((long)i4) << 24);
  75.  
  76.       SetCell(r, c, BOTTOM, x);
  77.     }
  78.  
  79.   fclose(fp);
  80.  
  81.   for (r = 0; r < Nrows; r++)
  82.     for (c = 0; c < Ncols; c++)
  83.     {
  84.       x = GetCell(r, c, TOP);
  85.       y = GetCell(r, c, BOTTOM);
  86.  
  87.       if (x || y)
  88.         Plot(r, c, x, y);
  89.     }
  90. }
  91.