a gcc-based cross-compiler for classic 68K and PPC Macintoshes
Go to file
Wolfgang Thaller 9cf0349de8 PPC: Add generated import libraries 2015-09-10 00:06:26 +02:00
Console add ConsoleTest application (test console without going through stdio/iostreams); make Console lib less likely to crash on bad_alloc 2015-09-08 23:47:46 +02:00
ImportLibraries PPC: Add generated import libraries 2015-09-10 00:06:26 +02:00
MakeAPPL MakeAPPL: fix warning 2015-07-20 03:27:45 +02:00
PEFTools MakeImport: clean up, combine multiple fragments into one file 2015-09-09 20:51:36 +02:00
ResourceFiles ppc: PEFTools: closer to working 2015-08-31 01:16:54 +02:00
Rez Rez: --data option for importing data fork 2015-08-31 23:47:25 +02:00
Samples update samples for powerpc 2015-09-08 18:05:00 +02:00
TestApps startup code & cmake stuff for ppc 2015-09-01 00:04:20 +02:00
binutils binutils: don't lose entry point when linking with -bnogc 2015-09-08 10:13:10 +02:00
cmake proper .r file for cfrg resource 2015-09-09 01:25:59 +02:00
docs add mac os rt architectures document (APPLE) 2012-04-10 23:56:07 +02:00
elf2flt elf2flt: new binutils pulls in a -ldl dependency 2015-08-29 02:20:31 +02:00
gcc setup libs for powerpc 2015-09-08 18:04:15 +02:00
hfsutils add hfsutils 3.2.6 2012-03-29 10:28:43 +02:00
libretro proper .r file for cfrg resource 2015-09-09 01:25:59 +02:00
.gitignore gitignore: CIncludes -> CIncludes* 2015-07-20 03:30:36 +02:00
CMakeLists.txt update samples for powerpc 2015-09-08 18:05:00 +02:00
COPYING add README, COPYING and license notices 2012-04-24 03:22:36 +02:00
COPYING.RUNTIME Add GCC Runtime Library Exception to license for libretro 2015-07-15 23:23:19 +02:00
README.md Finally make ASFilter unnecessary. 2015-08-29 03:33:14 +02:00
build-toolchain.sh powerpc: disable lto 2015-09-08 18:04:27 +02:00
elf.h add elf.h (from glibc) 2012-04-06 20:55:41 +02:00
prepare-headers.sh prepare-headers / ConditionalMacros: gcc supports microsoft-style "pack" pragma, use those 2015-09-08 18:01:57 +02:00
prepare-rincludes.sh move RIncludes install location, convert line endings 2015-07-20 03:29:25 +02:00

README.md

Retro68

A GCC-based cross-compilation environment for 68K Macs. Why? Because there is no decent C++11 Compiler targetting Apple's System 6. If that's not a sufficient reason for you, I'm sure you will find someting more useful elsewhere.

If you are crazy enough to try it out, please say hello at wolfgang.thaller@gmx.net.

Prerequisites

  • Linux or Mac OS X
  • boost
  • CMake 2.8
  • GCC dependencies: GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+
  • bison version 3.0.2 or later
  • Apple Universal Interfaces (tested with version 3.1 - see below)
  • An ancient Mac and/or an emulator.

For Ubuntu Linux, the following should help a bit:

sudo apt-get install cmake libgmp-dev libmpfr-dev libmpc-dev libboost-all-dev bison

On a Mac, get the homebrew package manager and:

brew install cmake gmp mpfr libmpc boost bison

In theory, you can also run Retro68 on a PowerMac G4 or G5 running Mac OS 10.4 (Tiger). In that case, get the tigerbrew package manager and

brew install gcc cmake

Apple Universal Interfaces

The Universal Interfaces used to be a free download from Apple. However, they have taken the site offline and the license agreement prohibits redistribution, so this might be a bit hard to find nowadays.

You do need a version that still supports 68K Mac development.

The package might be somewhere in this huge snapshot of Apple's FTP site made by the Internet Archive: https://archive.org/details/ftpsites_developer.apple.com

If you have a Mac or some other way to read DiskCopy images, grab the MPW 3.5 image from:

http://macintoshgarden.org/apps/macintosh-programmer%E2%80%99s-workshop

and use the CIncludes and RIncludes directories from there.

Put the C header files into a directory called "CIncludes" at the top level of the Retro68 directory; likewise, the Rez includes should go into a directory called "RIncludes".

Building

Once you have all the prerequisites, execute these commands from the top level of the Retro68 directory:

cd ..
mkdir Retro68-build
cd Retro68-build
sh ../Retro68/build-toolchain.sh 

The toolchain will be installed in the "toolchain" directory inside the build directory.

Sample programs

Sample programs are built in several formats:

  • On Macs: Real Mac Applications (ApplicationName.APPL)
  • Elsewhere: ApplicationName.APPL, .rsrc/ApplicationName.APPL, .finf/ApplicationName.APPL (BasiliskII/Sheepshaver compatible)
  • MacBinary files (ApplicationName.bin)
  • Raw HFS disk image (ApplicationName.dsk, containing ApplicationName)

Look under Retro68-build/build-target/ for the compiled binaries.

Overview

Retro68 is an aggegation of various existing free software projects with a few small key components added.

Third Party Components:

  • binutils 2.25.1
  • gcc 5.2.0 with some Retro68-specific hacks
  • newlib 2.10.1 (inside the gcc directory)
  • elf2flt (from the ucLinux project's CVS)
  • hfsutils 3.2.6 (just for convenience)

Retro68-Specific Components:

  • PrepareHeaders.hs
  • MakeAPPL
  • libretro
  • TestApps - a few tiny test programs
  • Sample Programs: Raytracer, HelloWorld, Launcher, Dialog

binutils

Currently unmodified from the original. Configured for m68k-unknown-elf.

gcc

Various patches and hacks, most importantly:

  • Changed register usage.
  • Change the way 1-byte and 2-byte parameters are passed.
  • support `"\pPascal String Literals"``
  • added a pascal calling convention (pascal or __attribute__((__pascal__)))
  • added __attribute__((__raw_inline__(word1, word2, word3))) to emulate ONEWORDINLINE and friends
  • added __attribute__((regparam("..."))) to specify custom register calling conventions
  • added #pragma parameter to specify custom register calling conventions
  • added support for the = { 0x1234 } syntax for inline machine code.

newlib

Standard C library. Currently unmodified. The missing platform-dependent bits haven't been added, instead they are found in 'libretro'.

elf2flt

Converts from ELF to a much simpler binary format. Minor patch: provide symbols around .init and .fini sections

hfsutils:

Included for convenience. No changes.

prepare-headers.sh:

Apply any necessary patches to Apple's headers; currently, this only modifies ConditionalMacros.h.

MakeAPPL

Reads a FLAT executable as output by elf2flt and converts it to a MacBinary file containing a classic Macintosh application.

Rez

A reimplementation of Apple's Rez resource compiler. Reads .r files containing textual resource descriptions and compiles them to binary resource files.

libretro

Contains startup code (handles relocations) and implementations for some standard library functions.

Console

Contains a library that implements basic text console functionality.

Sample Program: Hello World

The binary is in Retro68-build/build-target/Samples/HelloWorld/.

Sample Program: Raytracer

Calculates a nice 3D image, pixel by pixel. There are two versions: raytracer.c is a straightforward plain C implementation using floating point arithmetic.

Raytracer2 makes use of C++ features; it also uses fixed point arithmetic instead of floating point (operator overloading FTW).

The binaries are in Retro68-build/build-target/Samples/Raytracer/.

Sample Program: Launcher

A utility program for using Retro68 together with the minivmac emulator. Waits for a disk(image) to be inserted, and if it contains a single application, launches it. After the application exits, the disk is ejected again. This way, you can just drag a .dsk file generated by Retro68 on a minivmac Window to run your application.

Intended for System 6 without Multifinder.

Sample Program: Dialog

Shows a simple and useless dialog box. Demonstrates how to use Rez, the resource compiler. The binary is in Retro68-build/build-target/Samples/Dialog/.

License

The original parts of Retro68 are licensed under GPL3+, as are most other parts. Some parts are licensed GPL2+ or with more liberal licenses. Check the copyright notices in the individual files.