Amiga Files on macOS
Just like the C=64, the Amiga has its own unique files and dealing with them in macOS is fairly easy if you have the correct tools. You can even write C and Assembly programs on the Mac for the Amiga.
NOTE: While the installation process may be different, using the tools is the same under Linux as macOS, unless otherwise noted.
Required Mac Tools
You’ll need a few things for the tools:
NOTE: Setting these tools up is beyond the scope of this blog post.
A number of these tools are written in Python and will require Pip. It can be installed with brew.
Amitools
Amitools provides many useful tools. Some of which will be discussed below.
Installation
Then just use pip to install Amitools and Machine68K, which is needed for vamos.
pip3 install -U git+https://github.com/cnvogelg/machine68k.git
pip3 install -U git+https://github.com/cnvogelg/amitools.git
vamos
vamos provides a basic virtual machine that can run non-gui AmigaDos Applications
vamos hello
You can specify a processor to use with the minus -C flag:
vamos -C 20 test
That will use a 68020 CPU for example.
If you want to give the application flags, then use --
:
vamos -c 40 -- test -arg1 -arg2
xdftool
xdftool is a swiss army knife of ADF tools. It can do many of the things you can do on a real Amiga.
Such as …
List the files on an ADF file:
xdftool test.adf list
xdftool test.adf list dir all
Get ADF file information:
xdftool test.adf info
Copy files from ADF file:
xdftool test.adf read / .
xdftool test.adf read dir .
Create an ADF image:
xdftool test.adf create
xdftool test.adf format 'TEST'
Make a bootalbe ADF image:
NOTE: You’ll need a bootable ADF file, or the boot code from a bootable ADF file to make a bootable image
xdftool Install3.2.adf boot read boot32.code
xdftool test.adf boot write boot32.code
xdftool test.adf boot install
Copy a file to an ADF:
xdftool test.adf write file.txt /
xdftool test.adf write file.txt dir
xdftool test.adf write localdir
Delete a file from an ADF:
xdftool test.adf delete file.txt
xdftool test.adf delete dir all
Make a directory:
xdftool test.adf mkdir dir
You can even set the protect flags:
xdftool test.adf protect test.txt rwe
xdftool test.adf protect test.txt -w
There are other many other things, but this gives you an idea. Amitools has other tools as well, but these are the two I used the most.
lha files
lha files can be created and extracted using the lha program. It can be installed with brew, then it’s used just lha on an Amiga:
lha c test.lha dir
lha x test.lha
Other ways of handling ADF and MDS files & lha files
On a Mac, you can install Unarchiver from the App store. It can convert MDS files to ADF files. It can also extract the contents of ADF and LHA files. Just double click and it will do it.
On Linux, you can also mount AFS files like any other image:
mount -t affs -o loop test.adf /mnt
Physical floppies
Physical floppies require a solution such as the Greaseweazle and a physical drive. Setting up the Greaseweazle will be covered in more details in a future blog post.
But for now, here is how to use it for working with Amiga disks.
To make an ADF file from a floppy:
gw read --format amiga.amigados test.adf
To make a floppy from an ADF file:
gw write --format amiga.amigados test.adf
Graphics Files
To convert between iff and png files, you’ll need netpbm. That can be installed with brew.
Convert an iff to a PNG:
ilbmtoppm < test.pic | pnmtopng - > test.png
To convert a PNG to a 32 color iff:
pngtopnm < test.png | pnmquant 32 | ppmtoilbm - > test.pic
NOTE: When opening in a graphics program such as Deluxe Paint, be sure to select it’s color pallet, or it will look rather weird.
Burning Rom Images
To Burn ROM images, you’ll need a ROM burner, and some 27C400 EEPROM chips. I use a Minipro ROM Burner.
The ROM images can be obtained from Cloanto’s Amiga Forever. You’ll need the DVD release.
In addition to the Minipro, you’ll need an adapter and chips. As of the publication of this blog post, they are available from Retrorewind:
You’ll need the minipro program that can be installed with Brew. And you’ll need rom2bin which can be installed via pip.
You may also want a UV eraser if you want to re-use EEPROMs.
To make a Kickstart file, put the adapter in the Minipro, then put the EEPROM in.
Make sure it’s blank:
minipro --device 'AM27C4096@DIP40' --skip_id --blank_check
Then convert the ROM to a bin file and burn it:
rom2bin --to kick-31.bin kick-31.rom
minipro --device 'AM27C4096@DIP40' --no_id_error --vpp 12.5 --write kick-31.bin
If you have a kickstart ROM you wish to read, you can do that with:
minipro --device 'AM27C4096@DIP40' --skip_id --read kick.bin
Cross compiling and assembling
It is easy to write C and Assembly code for the Amiga on macOS. You just need the environment set up.
Core tools
First you’ll want to get the source code for VBCC, VASM, and VLink:
NOTE: My working directory is /tmp
wget -c http://sun.hasenbraten.de/vasm/release/vasm.tar.gz
wget -c http://www.ibaug.de/vbcc/vbcc.tar.gz
wget -c http://sun.hasenbraten.de/vlink/release/vlink.tar.gz
gzcat vasm.tar.gz | tar -xvf -
gzcat vlink.tar.gz | tar -xvf -
gzcat vbcc.tar.gz | tar -xvf -
You’ll need a few support files
wget http://phoenix.owl.de/vbcc/current/vbcc_target_m68k-amigaos.lha
wget -c http://phoenix.owl.de/vbcc/current/vbcc_unix_config.tar.gz
wget -c http://aminet.net/dev/misc/NDK3.2.lha
You’ll need a VBCC environment variable for where ever you want to put the includes and library files:
echo "VBCC=$HOME/lib/vbcc/" >> ~/.zprofile
VBCC=$HOME/lib/vbcc/
I used $HOME/lib/vbcc.
mkdir -p $VBCC
Build and install the binaries:
NOTE: I install binaries for stuff I build in ~/bin, they can go anywhere in your path though.
cd vasm
make CPU=m68k SYNTAX=mot
cp vasmm68k_mot vobjdump ~/bin
cd ..
cd vlink
make
cp vlink ~/bin
cd ..
cd vbcc
make TARGET=m68k
cp -r bin/{dtgen,vbccm68k,vc,vprof} ~/bin
cd ..
Amiga Bits
Now install the Amiga specific components:
lha x vbcc_target_m68k-amigaos.lha
cp -r vbcc_target_m68k-amigaos/{config,targets} $VBCC
cd $VBCC
gzcat /tmp/vbcc_unix_config.tar.gz | tar -xvzf -
if [ ! -d /tmp/NDK3.2 ] ; then mkdir /tmp/NDK3.2 ; fi
cd /tmp/NDK_3.2
lha x /tmp/NDK3.2.lha
cd ..
cp -r /tmp/NDK_3.2/Include_[Hh]/* $VBCC/targets/m68k-amigaos/include
And that’s it. You should now have a working C and Assembler environment.
Actually building stuff
To compile a C program, you’ll need to specify a couple things:
vc -c99 +aos68k -o test test.c -lauto
vc -c99 +aos68k -o test test.c -lauto -lamiga
For math without an FPU:
vc -c99 +aos68k -o test test.c -lauto -lmieee
For math with an FPU:
vc -c99 -O1 -cpu=68020 -fpu=68881 -lm881 program.c -o program
To assemble a 68K Assembly program:
vasmm68k_mot -devpac -w -Fhunkexe -o test test.s
A real world use
Amos is this wonderful BASIC based language for the Amiga. It lets you easily access the Amiga’s hardware. It was written in 68K Assembly and has been open sourced.
Once you have the environment set up and if you want to develop using AMOS on your Amiga or an emulator, I’ve made a release that can be easily built in macOS or Linux. Here is the Github Repo.