home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / binaries / ibm / pc / archives / 4831 < prev    next >
Encoding:
Text File  |  1992-11-12  |  2.9 KB  |  98 lines

  1. Newsgroups: comp.binaries.ibm.pc.archives
  2. Path: sparky!uunet!cpqhou!reneg
  3. From: reneg@cpqhou.compaq.com (Rene Gaudet)
  4. Subject: Re: Apple IIe emulator for the PC
  5. Organization: Compaq Computer Corporation
  6. Date: Fri, 13 Nov 92 04:15:05 GMT
  7. Message-ID: <1992Nov13.041505.27692@cpqhou.compaq.com>
  8. References: <1992Nov11.093249.4247@nntp.hut.fi>
  9. Lines: 87
  10.  
  11. > Lets say I have access to an Apple II computer and a IBM computer.
  12. > How do I get an image of an Apple floppy onto my MSDOS hard disk?
  13. > Through a serial cable, I guess. However, how do I make an image file
  14. > out of the Apple disk? What program or utility can create the image?
  15.  
  16. Here is what I have found to be an easy way to transfer disk images
  17. from apple to the .DSK format on the PC.  Assuming you have a serial
  18. card for the apple 2 as well as comm software.  
  19.  
  20. 1) Use shrinkit to compress the Disk into an archive on your apple.
  21. 2) Transfer the compressed file to the PC using a comm program on
  22.    each end, such as ProTerm and Telix.
  23. 3) Use nulib to extract the compressed file into a disk image file on your PC.
  24. 4) Run the mapper program listed below on the disk image file, it reorders 
  25.    the prodos sectors to DOS sectors.
  26.  
  27. The apple 2 emulator, shrinkit and nulib are available at cco.caltech.edu.
  28.  
  29. /* Code starts here: It's not pretty, but it works.
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33.  
  34.  
  35. /*
  36.  *  Map a disk image in Prodos block ordering to DOS 3.3 block ordering
  37.  *    usage:  mapper old_image  new_image
  38.  */
  39.  
  40. void main (argc, argv)
  41.     int   argc;
  42.     char  *argv[];
  43. {
  44. unsigned char buf[4096];
  45. int track;
  46. FILE *i, *o;
  47.  
  48.     if (argc < 3) {
  49.       printf ("MAPPER Utility for Apple disk images\n");
  50.       printf ("Converts ProDOS sectors to DOS 3.3 sectors\n");
  51.       printf ("Mapper Usage: \n");
  52.       printf ("mapper <inputfile> <outputfile>");
  53.       exit(1);
  54.     }
  55.     i = fopen(argv[1],"r+b");
  56.     if (i == NULL)
  57.     {
  58.         printf("Error opening file %s for input\n",argv[2]);
  59.         exit(1);
  60.     }
  61.     o = fopen(argv[2],"w+b");
  62.     if (o == NULL)
  63.     {
  64.         printf("Error opening file %s for output\n",argv[3]);
  65.         exit(1);
  66.     }
  67.  
  68.  
  69.     for (track = 0; track < 35; track++) {
  70.         if (fread(buf, 1, 4096, i) != 4096) {
  71.             perror("bad read");
  72.             exit(1);
  73.         }
  74.  
  75.         fwrite(buf,1 , 256, o);
  76.         fwrite(&buf[0xE00],1 , 256, o);
  77.         fwrite(&buf[0xD00],1 , 256, o);
  78.         fwrite(&buf[0xC00],1 , 256, o);
  79.         fwrite(&buf[0xB00],1 , 256, o);
  80.         fwrite(&buf[0xA00],1 , 256, o);
  81.         fwrite(&buf[0x900],1 , 256, o);
  82.         fwrite(&buf[0x800],1 , 256, o);
  83.         fwrite(&buf[0x700],1 , 256, o);
  84.         fwrite(&buf[0x600],1 , 256, o);
  85.         fwrite(&buf[0x500],1 , 256, o);
  86.         fwrite(&buf[0x400],1 , 256, o);
  87.         fwrite(&buf[0x300],1 , 256, o);
  88.         fwrite(&buf[0x200],1 , 256, o);
  89.         fwrite(&buf[0x100],1 , 256, o);
  90.         fwrite(&buf[0xF00],1 , 256, o);
  91.     }
  92. }
  93.  
  94. Rene Gaudet
  95. reneg@cpqhou.se.hou.compaq.com
  96.  
  97.