[stella] Compiling distella on OS X -- real dirty

Subject: [stella] Compiling distella on OS X -- real dirty
From: Ruffin Bailey <rufwork@xxxxxxxxxxx>
Date: Fri, 29 Jul 2005 11:11:09 -0400
I got stuck without a Mac with Classic and needed distella, so I'm afraid I
ported it again.  I'm attaching a binary (should be the same I posted in
2004, but it only just now occurred to me that bin00022.bin is #not# a
Stuffit file) and will put what little I did to make it work below for
posterity and in case a new version comes out and people want to compile.
Please feel more than free correct any oversights, like an official distella
for Mac location.  Sorry for old pony doing the same old one-trick.

For usage, see the last time I did this:

I have the Developer Tools installed on my Mac and made the few changes to
the distella code that I did in Xcode.

First, obviously, download distella.  I got it from here, though I'm not
certain it's the latest:

Though it says it's for MS-DOS, the source is included.  Unzip in a folder
by itself and open distella.c and QUEUE.c in a text editor of your choice.

In distella.c, you need to make two changes.  First look for the main method
and change its return type from void to int.  (Look, I'm a Java hacker, not
a C programmer.  When I compiled without doing this, I was told it needed to
return an int.  I'm doing as little as possible to make that happen.)

That means look for this line:
void main(int argc,char *argv[])

And change it to read:
int main(int argc,char *argv[])

You then have to make main return an int.  Find this line:
unsigned int filesize(FILE *stream)

Right above that is a close-bracket, }  That's the end of the main method.
(Note: Of course this could change in a new version of distella, if there
ever is one.  Try to figure out which bracket is main's closing bracket.
You can do it. ;^D)  Add this line:

    return 0

The section should now look something like this:

    free(mem); /* Free dynamic memory before program ends */
    return 0;

unsigned int filesize(FILE *stream)

For some reason QUEUE.c had an extra character at its end that appears as an
upside-down question mark in Xcode (extended char set or something -- /26).
Delete it and save the two files, distella.c and QUEUE.c.

Nav to the location where you have your code in Terminal.  Once there, type:
make distella

I get the following output:
cc     distella.c   -o distella

The balance is give or take what I did in Feb 04.  To run, type ./distella
-- Note: This blows up with a "Bus error" rather than giving the default
"howto" I'm used to getting on other systems.  I didn't spend any time
figuring out why this time either, since...
/distella -pafs toDecompile.bin > out.s

.. still works.

Enjoy.  The new [to me] config text file setting is pretty neat.

Ruffin Bailey

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

[demime 1.01d removed an attachment of type application/x-zip which had a name of macDistella.zip]

Current Thread