home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Emulation / ABeeb / Patches / pch.c < prev    next >
C/C++ Source or Header  |  1996-12-06  |  725b  |  42 lines

  1. #include <stdio.h>
  2. #include <fcntl.h>
  3.  
  4. main()
  5. {
  6.     unsigned char    x [ 16384 ];
  7.     FILE                *fd;
  8.  
  9.     printf("Patching your ROM image (OS1.2p1.rom) into one that will allow xdfs support...\n");
  10.  
  11.     if (NULL == (fd = fopen ( "OS1.2p1.rom", "r"))) {
  12.         printf("Um, couldn't find a file called \"OS1.2p1.rom\", sorry\n");
  13.         return 0;
  14.     }
  15.     fread (x, 1, 16384, fd);
  16.  
  17.     fclose(fd);
  18.  
  19.     if (NULL == (fd = fopen ( "OS1.2p1.rom", "w"))) {
  20.         printf("Um, couldn't create output file \"OS1.2p1.rom\", sorry\n");
  21.         return 0;
  22.     }
  23.  
  24.     /*
  25.      * The OSFILE trap
  26.      */
  27.  
  28.     x [ 0x327d ] = 0x22;
  29.  
  30.     /*
  31.      * The OSFSC trap
  32.      */
  33.  
  34.     x [ 0x31b1 ] = 0x02;
  35.  
  36.     fseek ( fd, 0, SEEK_SET );
  37.     fwrite (x, 1, 16384, fd);
  38.     fclose ( fd );
  39.  
  40.     printf("Patch applied successfully. Bye.\n");
  41. }
  42.