home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- #include "bbc.h"
-
- #include "cell.h"
- #include "coordmap.h"
-
- #define MAXROW 1024
- #define MAXCOL 1280
-
- extern int Nrows;
- extern int Ncols;
-
- extern void InitBoard(void);
- extern long GetCell(int, int, int);
- extern void SetCell(int, int, int, long);
-
- int justboard = 1;
-
- static int colfact, rowfact;
-
- static void Plot(int row, int column, long top, long bottom)
- {
- int x, y;
-
- x = column * colfact + colfact/2;
- y = row * rowfact + rowfact/2;
-
- if (x & HOLE)
- bbc_circle(x, y, 10);
- }
-
- int main(int argc, char *argv[])
- {
- int r, c, rp, cp, i1, i2, i3, i4;
- long x, y;
- FILE *fp;
-
- bbc_mode(12);
-
- fp = fopen(argv[1], "rb");
-
- rp = fgetc(fp);
- cp = fgetc(fp);
- Ncols = (rp & 0xff) | ((cp << 8) & 0xff00);
- colfact = MAXCOL / Ncols;
-
- rp = fgetc(fp);
- cp = fgetc(fp);
- Nrows = (rp & 0xff) | ((cp << 8) & 0xff00);
- rowfact = MAXROW / Nrows;
-
- InitBoard();
-
- for (r = 0; r < Nrows; r++)
- for (c = 0; c < Ncols; c++)
- {
- i1 = fgetc(fp);
- i2 = fgetc(fp);
- i3 = fgetc(fp);
- i4 = fgetc(fp);
-
- x = (long)i1 | (((long)i2) << 8) |
- (((long)i3) << 16) | (((long)i4) << 24);
-
- SetCell(r, c, TOP, x);
-
- i1 = fgetc(fp);
- i2 = fgetc(fp);
- i3 = fgetc(fp);
- i4 = fgetc(fp);
-
- x = (long)i1 | (((long)i2) << 8) |
- (((long)i3) << 16) | (((long)i4) << 24);
-
- SetCell(r, c, BOTTOM, x);
- }
-
- fclose(fp);
-
- for (r = 0; r < Nrows; r++)
- for (c = 0; c < Ncols; c++)
- {
- x = GetCell(r, c, TOP);
- y = GetCell(r, c, BOTTOM);
-
- if (x || y)
- Plot(r, c, x, y);
- }
- }
-