IBM: MULE read Atari 127k on IBM

From: Mike Todd (snyder10@convex1.tcs.tulane.edu)
Date: 09/19/94-05:00:40 AM Z


From: snyder10@convex1.tcs.tulane.edu (Mike Todd)
Subject: IBM: MULE read Atari 127k on IBM
Date: Mon Sep 19 05:00:40 1994

In article <1994Mar14.210036.30361@dcc.uchile.cl> svillase@dcc.dcc.uchile.cl (Sergio Cristian Villaseca Carrasco) writes:
>Hello:
>
>I need the MULE program (or better the C source code) which allows to
>read an Atari 1050 diskette (127Kb) from a PC disk drive.
>It was posted some time ago, but I lost it due to a problem with my
>hard drive.
>If anyone could e-mail it to me I would really appreciate it.

Here it is...

-----8<---cut here---8<-----
#include "dos.h"
#include "ctype.h"
#include "stdio.h"
#include "string.h"
#include "io.h"
/* Turbo C 1.5 source code for the IBM side. OK, I just slopped this out!
So what! First guy who whines about it, I find out where he lives &
kill his dog <g>! I don't need this program & didn't even the first
time I wrote it, just trying to be a nice guy.
Most everytime I've asked someone with a stock 1050
to even test a simple code fragment, zero response.  You reap what you 
sow:
SOW=>0 ergo REAP=>this. I'm thinking of adding Atari to IBM transfers
I mainly did the retrieval code on this side so I could compare the 
before
& after files. I'l U/L the Action! source code with it's done.
I don't have FTP access anymore so the only place this will appear is the
Internet message base. If someone doesn't snag it & send it to the 
archives
it's gone forever 'cause I'm a little bored with it. */
main(argc, argv)
int argc;
char *argv[];
{
int choice;
if (argc!=3)
        {
        printf("   Mule file transfer program by Rick Cortese 
3/30/93\n");
        printf("   for transfering IBM<>Atari 1050:  Use upper case\n");
        printf("       Usage:  MULE [R,W] [DRIVE:]FILENAME\n");
        printf("   This program only uses drive A: ");
        printf("to avoid hard drive heartaches!\n");
        printf("   if you leave out the drive, it'll look at the\n");
        printf("   DEFAULT drive for the file to be transfered.\n");
        printf("   I seem to have left out an &, !, or [] here and 
there,\n");
        printf("   but the program works fine for me. If you're 
worried,\n");
        printf("   just write protect & reset your computer after 
use\n");
        printf("   The disk used for the transfers should be 
formatted\n");
        printf("   on an IBM using a double density disk only @180k.\n");
        printf("   Make SURE you follow the prompts for changing disk 
&\n");
        printf("   everything's properly labeled, NO 2nd CHANCES! If 
you've\n");
        printf("   never labled a disk before in you life, label this 
one.\n");
        printf("   If the operation is (R)ead, the Mule disk will be 
read\n");
        printf("   then written as FILENAME to the default or specified 
drive\n");
        printf("   For (W)rite, an IBM file is read into a buffer, 
then\n");
        printf("   written a Mule disk.  Max file size is 32k! but it 
will\n");
        printf("   work with arced files. I've made it so the Atari end 
only\n");
        printf("   officially handles 24k, but if you disable basic, 
edit\n");
        printf("   the RT file, use a DOS with a good LOMEM, you 
should\n");
        printf("   be able to get the entire file transfered.\n");
        exit();
        }
if (!strcmp(argv[1],"R"))
        {
        muleread(argv[2]);
        exit();
        }
if (!strcmp(argv[1],"W"))
        {
        mulewrite(argv[2]);
        exit();
        }
else printf("Option %s not available!", argv[1]);
}
/* Read a mule disk & make a MS DOS file. Max file size is 32k! */
muleread(char *arg)
{
unsigned char buf[32000];
FILE *fp;
int fsize, j;
unsigned int x;
printf("Insert MULE disk in driv A now!\n");
printf("then hit <RETURN> to start\n");
x=getche();
absread(0, 1, 0, buf);
printf("%s\n", buf);
if (strcmp(buf, "Hello Atari"))
        {
        printf("Not a Mule disk!\n");
        exit();
        }
absread(0, 1, 1, buf);
j=buf[0]+buf[1]*256;
for (x=0; x*128<=j; x++)
        {
        printf("Reading sector number %d\n",x+2);
        absread(0, 1, x+2, &buf[x*128+2]);
        }
printf("Insert a MS DOS disk in the DEFAULT drive now! Then hit 
<RETURN>\n");
x=getche();
fp=fopen(arg, "wb");
fsize=buf[0]+256*buf[1];
printf("Writing %d bytes\n", fsize);
fwrite(buf+2, fsize, 1, fp);
fclose(fp);
}
/* Take a MS DOS file & make it into a Mule disk */
mulewrite(char *arg)
{
unsigned char buf[32000];
int j, fsize;
unsigned int x;
unsigned char ch;
FILE *fp;
printf("Put the MS DOS disk with the file to be transfered in DEFAULT 
drive\n");
printf("thn hit <RETURN> to continue\n");
x=getche();
if((fp=fopen(arg, "rb"))==NULL)
        {
        printf("Couldn't open %s\n", arg);
        exit();
        }
j=0;
while (!feof(fp)) buf[j++]=getc(fp);
--j;
fclose(fp);
printf("file size is %d bytes\n", j);
printf("Insert a Mule disk in DRIVE A: now!\n");
printf("then hit <RETURN> to continue\n");
printf("WARNING: THIS WILL ERASE ANY FILES CURRENTLY ON A:\n");
x=getche();
x=j;
abswrite(0, 1, 1, &x);
for (x=0; x*128<=j; x++)
        {
        printf("Writing sector number %d\n",x+2);
        abswrite(0, 1, x+2, &buf[x*128]);
        }
/* A simple way to I.D. this as a MULE disk */
strcpy(buf, "Hello Atari");
abswrite(0, 1, 0, buf);
}

--
Rick Cortese
internet: ricortes@TheRat.Kludge.COM     uucp: ...!apple!therat!ricortes


-----------------------------------------
Return to message index