home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / apple2 / 23430 < prev    next >
Encoding:
Text File  |  1992-11-05  |  3.0 KB  |  105 lines

  1. Newsgroups: comp.sys.apple2
  2. Path: sparky!uunet!cpqhou!reneg
  3. From: reneg@cpqhou.compaq.com (Rene Gaudet)
  4. Subject: Re: *** WANTED: APL2EM Apple Emulator Info ***
  5. Organization: Compaq Computer Corporation
  6. Date: Thu, 05 Nov 92 14:46:48 GMT
  7. Message-ID: <1992Nov05.144648.14321@cpqhou.compaq.com>
  8. References: <1d1jfoINN1u4@haydn.crhc.uiuc.edu>
  9. Lines: 94
  10.  
  11. > NNTP-Posting-Host: haydn.crhc.uiuc.edu
  12. > I also have a question as to how to transfer a Apple disk image
  13. > to the the APL2EM's .DSK format. Can you use a standard null-modem
  14. > cable with some kind of serial transfer protocol (ie, xmodem)?
  15. > Also what utility on the Apple do you use to convert the entire
  16. > disk image into a single file (in this case, a .DSK format)?
  17. > I believe the .DSK format is a pure binary image without
  18. > any special checksums, headers, etc.
  19. > Any help would be appreciated!
  20. > Thanks
  21.  
  22. Here is what I have found to be an easy way to transfer disk images
  23. from apple to the .DSK format on the PC.
  24.  
  25. 1) Use shrinkit to compress the Disk into an archive on your apple.
  26. 2) Transfer the the compressed file to the PC using a comm program on
  27.    each end, such as ProTerm and Telix.
  28. 3) Use nulib to extract the compressed file into a disk image file on your PC.
  29. 4) Run the mapper program listed below on the disk image file, it reorders 
  30.    the prodos sectors to DOS sectors.
  31.  
  32. Both shrinkit and nulib are available at cco.caltech.edu.
  33.  
  34. /* Code starts here: It's not pretty, but it works.
  35.  
  36. #include <stdio.h>
  37. #include <stdlib.h>
  38.  
  39.  
  40. /*
  41.  *  Map a disk image in Prodos block ordering to DOS 3.3 block ordering
  42.  *    usage:  mapper old_image  new_image
  43.  */
  44.  
  45. void main (argc, argv)
  46.     int   argc;
  47.     char  *argv[];
  48. {
  49. unsigned char buf[4096];
  50. int track;
  51. FILE *i, *o;
  52.  
  53.     if (argc < 3) {
  54.       printf ("MAPPER Utility for Apple disk images\n");
  55.       printf ("Converts ProDOS sectors to DOS 3.3 sectors\n");
  56.       printf ("Mapper Usage: \n");
  57.       printf ("mapper <inputfile> <outputfile>");
  58.       exit(1);
  59.     }
  60.     i = fopen(argv[1],"r+b");
  61.     if (i == NULL)
  62.     {
  63.         printf("Error opening file %s for input\n",argv[2]);
  64.         exit(1);
  65.     }
  66.     o = fopen(argv[2],"w+b");
  67.     if (o == NULL)
  68.     {
  69.         printf("Error opening file %s for output\n",argv[3]);
  70.         exit(1);
  71.     }
  72.  
  73.  
  74.     for (track = 0; track < 35; track++) {
  75.         if (fread(buf, 1, 4096, i) != 4096) {
  76.             perror("bad read");
  77.             exit(1);
  78.         }
  79.  
  80.         fwrite(buf,1 , 256, o);
  81.         fwrite(&buf[0xE00],1 , 256, o);
  82.         fwrite(&buf[0xD00],1 , 256, o);
  83.         fwrite(&buf[0xC00],1 , 256, o);
  84.         fwrite(&buf[0xB00],1 , 256, o);
  85.         fwrite(&buf[0xA00],1 , 256, o);
  86.         fwrite(&buf[0x900],1 , 256, o);
  87.         fwrite(&buf[0x800],1 , 256, o);
  88.         fwrite(&buf[0x700],1 , 256, o);
  89.         fwrite(&buf[0x600],1 , 256, o);
  90.         fwrite(&buf[0x500],1 , 256, o);
  91.         fwrite(&buf[0x400],1 , 256, o);
  92.         fwrite(&buf[0x300],1 , 256, o);
  93.         fwrite(&buf[0x200],1 , 256, o);
  94.         fwrite(&buf[0x100],1 , 256, o);
  95.         fwrite(&buf[0xF00],1 , 256, o);
  96.     }
  97. }
  98.  
  99.  
  100. Rene Gaudet
  101. reneg@cpqhou.se.hou.compaq.com
  102.