68000 assembler toolchain for the classic Macintosh.
v1.2.1 MIT Linux macOS
macOS (Homebrew) - the formula builds from source:
brew install bircher988/tap/mac68k-asm
Debian, Ubuntu, Raspberry Pi OS - every release has a
.deb for arm64 (Raspberry Pi) and amd64 (PC):
wget https://github.com/bircher988/mac68k-asm/releases/download/v1.2.1/mac68k-asm_1.2.1_arm64.deb
sudo apt install ./mac68k-asm_1.2.1_arm64.deb # or ./mac68k-asm_1.2.1_amd64.deb on a PC
From source (Linux, macOS, any Unix) - needs only a C compiler and make:
git clone https://github.com/bircher988/mac68k-asm.git
cd mac68k-asm && make && sudo make install
mac68k-asm version shows what is installed.
mac68k-asm builds applications for the first Macs (Mac 128K, 512K and Plus, 64K ROM,
System 3.x) from 68000 assembler sources. One small C program contains the assembler,
the linker, the resource compiler and a MacBinary writer. The result goes onto a floppy
image with mac68k-disk and runs on real hardware just as in an
emulator.
The source dialect and the project files (.Job, .Link, .R) follow the Macintosh
assembler conventions of the mid-1980s, so projects written for the Macintosh 68000
Development System (MDS) should build too.
Quick start
git clone https://github.com/bircher988/mac68k-asm.git
cd mac68k-asm
make # needs only a C compiler and make
./mac68k-asm build example/Hello.Job -o out
out/Hello.bin is the finished application as MacBinary. Put it on a disk image and
boot it in Mini vMac or on the real machine:
mac68k-disk new Apps.dsk # 400K MFS, readable by every 68k Mac
mac68k-disk add Apps.dsk out/Hello.bin
Commands
mac68k-asm build <File.Job> [-o outdir] [-I dir]... run a .Job file (ASM / LINK / RMAKER)
mac68k-asm link <File.Link> [-o outdir] [-I dir]... assemble and link
mac68k-asm res <File.R> [-o outdir] [-I dir]... compile a resource file
mac68k-asm asm <Module.Asm>... [-I dir]... [-o out.raw] [-l listing]
mac68k-asm version | help
What is inside
- Assembler for the 68000 in the MDS dialect:
Include, macros with%1..%9,IF/ELSE/ENDIF,EQU/SET/DC/DCB/DS, local@labels, register aliases. It iterates until all addresses are stable and picks short branches where they reach. DSvariables live in the A5 globals area, not in the code, exactly as on the original system; labels are addressed PC-relative.- Linker for one
CODEsegment, with a.MAPof segment and globals sizes and a listing with addresses and bytes. - Resource compiler in the format of the MDS RMaker:
WIND,DLOG,ALRT,DITL,MENU,BNDL,FREF,STRandGNRLfor anything else, so an application gets its own Finder icon. - Include files with every Toolbox and OS trap and the system equates, under the classic names. Each trap knows its ROM: using a Mac Plus (128K ROM) trap in a program for the 64K ROM gives a warning.
- Diagnostics name the file and line of the original source, also inside includes.
Not implemented yet: several CODE segments with a jump table (/Segment in .Link).
The full reference is the README on GitHub.
Licence
MIT, including the include files: they are generated from the trap numbers and equate values documented in Inside Macintosh.