Amiga Development HowTo

Development on the Amiga

Once upon a time there were many well supported tools available for developing software on and for the Amiga but these days the tools that are still available and up to date have a certain barrier to entry caused by the pain of setting the tools up just right. While tools such as VBCC require less ability to set up than programming will, it is still a chore, and using the likes of GCC, with it's dependence (on pre-OS4 systems anyway) on the GeekGadgets environment is enough to put off the new programmer who wants to be able to start learning and seeing results as soon as possible. Even for the rest of us the inconvenience of setting up a development environment installation wastes time better spent writing new software, and especially when taking on other people's open source projects, even just on function libraries you want to integrate with your program, the pain caused by even minor differences in the way the environments have been configured can waste hours.

For those utterly new to programming, know that the Amiga operating system uses the C language primarily and that it is this language which offers the most power in developing Amiga languages. Alternatives are however available, those found on all computer systems, such as Perl, Java, Python, C++, Modula 2, BASIC although with limits on how up to date and how well integrated with the OS they are, and some mainly Amiga specific ones (E, Oberon, 68000 assembler).

Finally, the other common programming language used on the Amiga is ARexx, called a scripting language, although really it is just a very high level interpreted langauge, just like BASIC or Python. ARexx is mainly used for processing text or for automating repetitive batches of functions and stringing different programs together, but it can be very powerful, if somewhat unwieldy, when used with tools like AWNPipe. Where does Python fit in? I'll cover that another day.

OS3.9 SDK

Now for the HowTo. The new OS4 comes with a Software Development Kit (SDK) installation that means everyone has a common basic setup that contains everything you need to get developing for the Amiga. Having that common setup is the first step to making it easy for Amiga users to get into developing for their computers and in helping multiple people work on one project, help reuse of code or help them transfer projects from one developer to another. The original Amiga SDK, known as the Native Developer Upgrade Kit, or NDK was not complete in the sense that you couldn't develop with it with out additional tools. Neither did it include all the files necessary for developing for what are, these days, standard extensions to the OS - the likes of Picasso96, AHI and bsdsocket.library for example. We will use the NDK as our starting point but complete it.

By mirroring the way the OS4 SDK is setup, we can make it easy for projects developed on OS3 to move to OS4, and even help OS4 projects port back to OS3. If you have OS4 and the OS4 SDK installed, I would recommend putting the OS3.9 SDK in a different directory, and using the SDK: assign to change between OS3.9 and OS4 targets, for want of a better solution.

Step 1) Setup the directory structure

First of all, put in place the directory structure for the SDK. Make a directory called SDK somewhere on your hard disk, even on a new partition if you want. Put the following folders, you can copy and paste the next section to make a shell script to do it for you if you like:

*in progress*

Copy the following lines into a new shell script in SDK/S/ called sdk-startup

*in progress*

Make sure there is an assign of SDK: to this directory in your User-Startup by adding the following lines, edited to suit your setup, to your S:User-Startup file

Assign SDK: Work:SDK ;assign SDK: to wherever you made your SDK directory
Execute SDK:S/sdk-startup

Step 2) Install the NDK, Developer CD contents and other files

*in progress*

Unpack NDK 3.9

Copy needed files from ADCD 2.1

Install Picasso96, AmiTCP, AHI, MUI developer kit

Run makeautodocguides

Install make, tar, gzip, bzip2

Install static libraries

Step 3) Install the compiler

Step 3a) SAS/C

I currently use SAS/C for my Amiga projects, because I bought it so I may as well use it, and because it deserves it's reputation as the Amiga's best development system.

Compared to current Amiga versions of GCC, SAS/C is faster at compiling and produces much smaller, faster code. I eagerly await the OS4 version of GCC and hope it is more "Amiga-like" than the current attempts.

Prior to SAS/C, I used DICE 3 for all my development. That's not a bad system, the biggest problem with it is that it's missing many commonly used standard C functions, especially to do with strings. This makes porting hard work.

SAS/C is unfortunately no longer available, and they have rejected the idea of making the Amiga version open source or at least free, so we must respect that.

I am interested however in exploring how we can have an alternative that is compatible. The core components of a C development system are:

  • Compilers, Assembler, Linker, Build script tools
  • Text editor
  • Profiler
  • Code coverage
  • Debugger
  • Documentation and navigation tools
  • Configuration Management

In SAS/C, these are provided by:

  • SC, SLINK and SMAKE
  • SE and SCMSG which allows other ARexx based editors to be used easily
  • SPROF
  • SCOVER
  • CodeProbe
  • HyperGST
  • RCS (not included with SAS/C but available for free separately)

If you have SAS/C I recommend installing it into a directory SDK:sc/, either do a clean install and then run all the updates, or copy your existing SAS/C installation there and change your assigns accordingly.

Also, add the SCC tool which will allow us to use the make program and standard makefiles

A standard SAS/C installation includes many out of date include files, to save space and avoid conflicts it's best to get rid of these. You can safely delete the files as follows:

*in progress*

Your default options (ENV:sc/scoptions) should be as follows:

*in progress*

Finally, add the following libraries to enhance the C library / POSIX compatibility

*in progress*

Step 3b) VBCC

The VBCC compiler is free, and have the dual advantages of being both compatible with GCC-like options, and thus is easily used in makefiles, and compatible with the Amiga HUNK format .lib static libraries. It is easier to configure, use and has more Amiga zen than GCC and it also uses the excellent PhxAss assembler from Frank Wille. This all makes it a great option if you need SAS/C compatibility and still want a future upgrade path (since there is already an OS4 version of VBCC).

Install VBCC to SDK:vbcc/

The following files are out of date or aren't needed if you're only targeting AmigaOS, so can safely be deleted:

You should also install Frank's PosixLib to enhance the C / POSIX library compatibility.

Step 3c) GCC

*in progress*

Convert .libs (HUNK) to lib.a (a.out) format

Step 3d) StormC

You will find free version of StormC 3 on the ADCD 2.1, or you may already have StormC 4. I would recommend installing either into SDK:StormC.

*in progress*

Standard Amiga Development Practices

Porting Guide

*Under construction*

  • C / POSIX
  • x11
  • SDL

Stationery

  • Command line
  • Workbench utility
  • Commodity
  • Workbench application
  • Rexxhost
  • Device driver
  • Library
  • DataType
  • Printer Driver
  • Handler
  • BOOPSI class / Gadget
  • SANA2 device
  • Envoy service?

Application packaging

Since the invention of Installer scripts, it has become much harder to manage the contents of your disks. Therefore I strongly suggest limiting the use of Installer scripts. Store all of your applications files in one folder. Don't use assigns, use PROGDIR: instead. This makes it easy for your user to delete or move your application if they want to. If you have multiple versions for different CPU targets, then either make separate distributions for each, or store key parts in private shared libraries and load the correct one as needed. If you really must, write an Installer script that modifies the package in place, then deletes itself. Store configuration information in your own directory in ENV: - again, the user only needs to delete this if they want to erase their settings.

e.g.

---- <application name> (dir)
----------Support (dir)
----------Rexx (dir) - Rexx scripts
----------Libs (dir) - Private shared libraries
----------Help (dir)
----------Catalogs (dir)
-------------- <locale name> (dir)

For distribution, the standard on the Amiga is of course Lha archive.

System enhancements

If, instead of developing an application, you are developing some add on to the AmigaOS, please bear in mind that your end users will prefer consistency with how the rest of the system is set up. Some minor indiscretion here can mean the difference between global adoption and failure. You don't have to stick to these guidelines, which have come purely from my own opinions and observations, but you'll have more Amiga zen if you do. N.B. items in italics are not part of OS 3.9, but are globally adopted add-ons.

---- Internet (dir) - Internet applications
----------Genesis (dir) - TCP/IP stack
-------------- bin (dir) - Internet/Unix related command line programs
-------------- config (dir)
-------------- db (dir)
-------------- devs (dir)
-------------- doc (dir)
--------------------napsaterm (dir)
-------------- graphics (dir)
-------------- home (dir)
-------------- kernel (dir)
-------------- l (dir)
-------------- libs (dir)
-------------- log (dir)
-------------- serv (dir)
----------<application> (dir)
---- Picasso96 (dir)
----------Picasso96 (dir)
-------------- Debug (dir)
-------------- P96Speed (dir)
--------------------catalogs (dir)
---- EMail (dir)
----------Addresses (dir)
---- C (dir) - System command line programs
----------C2 (dir) - User added command line programs
---- Envoy (dir)
----------Configuration (dir) - Prefs programs for Envoy networking
----------Accounts (dir) - User and Group databases
----------Services (dir) - Envoy service plugins
---- Classes (dir) - Public BOOPSI object shared libraries
----------USB (dir)
----------DataTypes (dir) - DataType codecs
----------Gadgets (dir) - GUI widgets
----------Images (dir) - GUI
---- Devs (dir) - Active device drivers
----------Networks (dir) - SANA2 network device drivers
----------PrinterPorts (dir)
----------USBHardware (dir) - device drivers for USB adapters
----------DOSDrivers (dir) - Configuration files (Mountlists) for devices
----------DataTypes (dir) - Descriptors for DataTypes
----------Keymaps (dir) - Keyboard keymaps
----------Monitors (dir) - Screenmode definitions
----------Printers (dir) - Printer drivers
----------AHI (dir) - device drivers for sound cards
----------AudioModes (dir)
----------MIDI (dir) - CAMD MIDI device drivers
---- Expansion (dir) - Device drivers for non-plug and play devices
---- Fonts (dir)
----------_bullet (dir) - Support files for bullet.library
----------_bullet_outlines (dir) - Compugraphic fonts
----------_cache (dir)
----------_truetype (dir) - TrueType fonts
---- L (dir) - Filesystems and related files
----------FileSystem_Trans (dir) - CrossDOS
---- Libs (dir) - Shared system libraries with publicly published APIs
----------Picasso96 (dir) - Picasso96 internal shared libraries
----------compressors (dir)
----------xad (dir)
----------Libs2 (dir) - User added shared libraries with public APIs
---- Locale (dir) - i18n and l10n
----------Catalogs (dir)
-------------- <locale name> (dir)
--------------------sys (dir)
--------------------vnc (dir)
----------Accents (dir)
----------Countries (dir)
----------Flags (dir)
-------------- Countries (dir)
-------------- Keymaps (dir)
----------Help (dir)
-------------- <locale name> (dir)
--------------------Sys (dir) - System AmigaGuide help files
----------Languages (dir)
----------Providers (dir)
---- Prefs (dir) - System settings editors
----------Env-Archive (dir) - Global settings registry
-------------- Picasso96 (dir)
-------------- Datatypes (dir)
-------------- Sana2 (dir)
-------------- mui (dir)
-------------- Sys (dir)
-------------- Multiview (dir)
-------------- AmigaGuide (dir)
-------------- classes (dir)
--------------------datatypes (dir)
------------------------ picture (dir)
------------------------ sound (dir)
-------------- Envoy (dir)
----------Presets (dir)
-------------- AmiDock (dir)
-------------- Animated GIFs (dir)
-------------- Backdrops (dir)
-------------- Beeps (dir)
-------------- Patterns (dir)
-------------- PlayCD (dir)
-------------- Pointers (dir)
-------------- Sounds (dir)
-------------- ViNCEd (dir)
-------------- WBClock (dir)
---- Rexxc (dir) - ARexx command line tools
---- S (dir) - Shell and ARexx scripts and plain text system configuration files
----------OS3.5 (dir)
---- Storage (dir) - Inactive device drivers
----------DOSDrivers (dir)
----------DataTypes (dir)
----------Keymaps (dir)
----------Locale (dir)
-------------- Countries-EURO (dir)
----------Monitors (dir)
----------Printers (dir)
---- System (dir) - Shells, basic disk programs, font managers
----------CacheCDFS (dir)
---- T (dir) - Temporary files only
---- Tools (dir) - Editing programs, advanced disk management tools, printer utilities
----------Commodities (dir) - Applets that offer commodities library functions like hotkeys and offer accessibility and user interface functions
---- Utilities (dir) - For multimedia viewers and clock related programs
----------AMPlifier (dir)
---- WBStartup (dir) - Copies of or shortcuts to programs that will be run on bootup

Amiga Development Links

  • Amiga CVS
  • JAmiga (Java)
  • Distributed BASIC (BASIC)
  • Perl

Scripting on the Amiga *Under construction*

ARexx versus other scripting languages

ARexx enhancements for new APIs e.g. rxsockets?

ARexx standard command sets (like AppleScript offers) - files, applications/commodity, image processing, viewing, internet, text editor