home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / falcon / program / x_debug / drivers / testscr.c < prev    next >
C/C++ Source or Header  |  1992-11-08  |  1KB  |  64 lines

  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <osbind.h>
  6. #include "driver.h"
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10. long basepage,result;
  11. struct driver driver;
  12. char buf[100];
  13. int mode;
  14.  
  15.     printf("X-Debug Screen Driver Test Program 1.0\n");
  16.     if (argc!=2)
  17.         {
  18.         printf("usage: testscr <driver.scr>\n");
  19.         return 10;
  20.         }
  21.     mode=0;
  22.  
  23.     sprintf(buf+1,"VER=%x BUF=%lx MODE=%x",1,&driver,mode);
  24.     buf[0]=(char)strlen(buf);
  25.     
  26.     basepage=Pexec(3,argv[1],buf,"\0\0");
  27.     if (basepage<0)
  28.         {
  29.         printf("Cannot load %s\n",argv[1]);
  30.         return 10;
  31.         }
  32.     
  33.     result=Pexec(4,NULL,basepage,NULL);
  34.     printf("\nmain() returned %ld\n\n",result);
  35.     if (result)
  36.         return 0;
  37.     printf("Address   : $%lX\n",driver.address);
  38.     printf("Planes    : %d\n",driver.planes);
  39.     printf("Bytes/line: %d\n",driver.bytesperline);
  40.     printf("Pixel size: %dx%d\n",(int)(driver.width),(int)(driver.height));
  41.     printf("GEM output: %s\n",driver.gem ? "Yes" : "No" );
  42.     printf("TOS output: %s\n",driver.tos ? "Yes" : "No" );
  43.     printf("RAM       : $%lX-$%lX\n",driver.start,driver.end);
  44.     
  45.     if (driver.font!=-1)
  46.         printf("ERROR: font not -1\n");
  47.     if (driver.width>1280)
  48.         printf("ERROR: wider than 1280\n");
  49.     if (driver.height>1024)
  50.         printf("ERROR: taller than 1024\n");
  51.     
  52.     printf("\n\nInitialise Y/N?");
  53.     gets(buf);
  54.     if ( (buf[0]=='y') || (buf[0]=='Y') )
  55.         {
  56.         short init;
  57.         init=driver.init();
  58.         if (init)
  59.             printf("init() returned %d\n",(int)init);
  60.         }
  61.     return 0;
  62.     
  63. }
  64.