Amiga Techniques Programming in 2023

In case you ever get an opportunity to look by the basic Amiga OS source-code nonetheless floating round some murky corners of the web, it’s a factor of magnificence and astonishing capabilities. It’s an inspirational piece of computing historical past with unmatched capabilities for the time. Keep in mind, this was all initially on a pc launched within the Nineteen Eighties with 512Kb reminiscence, a 7Mhz 68000 16-bit CPU, and a single floppy drive with 880Kb storage. On these restricted specs, AmigaOS offered a pre-emptive multi-tasking working system, a full set of GUI primatives and built-in “Workbench” interface, growth card auto-configuration and a fully-featured filesystem with some distinctive and highly effective capabilities. Though to be honest, the AmigaDOS elements do actually come from a unique time (and presumably planet) – however extra on that later.
Oh and naturally, there was that tremendous chipset that meant even that humble base can do issues like this – whereas PCs of the time have been principally workplace packing containers that sometimes bleeped and residential computer systems nonetheless loaded video games from cassette tape. There’s understandably lots of on-line curiosity in these elements of the Amiga as they’re essentially the most spectacular in an apparent “wow!” manner. However whereas that was what drew me to the Amiga after I was a child (and the demo/cracking/bbs scene closely influenced me) I’ve all the time been extra of a methods geek at coronary heart.
I’ve all the time cherished constructing instruments and platforms, and have lengthy been fascinated with the world of working methods. Aside from studying by the supply code (the place that’s legally accessible, after all…) I feel there’s no higher option to discover and perceive a system – and the mindset that produced it – than to develop for it.
What follows is a brain-dump of what I’ve discovered about growing for the AmigaOS, each on basic 68k-powered {hardware} to fashionable PowerPC methods just like the X5000. I’ll cowl improvement environments, fashionable workflows like CI builds on containerised infrastructure, distribution of packages and even a glance again in time earlier than C
existed, because of AmigaDOS’s odd heritage.
SetCmd
There’s loads of guides and movies on establishing an old-school recreation or demo-coding atmosphere, however all of what follows is within the context of growing a methods software in C
as that’s the language of AmigaOS. I began a real-life project partly to resolve a small downside I had (switching between totally different variations of instructions/instruments on the Amiga CLI) however primarily to discover and dig deeper into the OS that influenced me a lot as a young person. SetCmd
was the outcome, and is a quite simple AmigaOS 4 PowerPC package. I’m working (very slowly) on porting it to run on basic AmigaOS and variants nevertheless it needs to be mentioned that is my first time writing C in any significant capability past wrestling with pointers at College. The supply code is on GitHub if you wish to have a look however keep in mind regardless of having owned Amigas since they have been launched, I’m a complete beginner at most of this! I wrote it to have enjoyable, discover the AmigaOS, arrange construct environments and work out bundle it up for re-distribution. I’ve written a bit about my improvement setup prior to now, however issues have modified a good bit since then – so with out additional ado, right here’s my improvement atmosphere and ideas in 2023.
SDK Updates
While issues do transfer at a glacial tempo on this planet of AmigaOS 4/PPC, there have been just a few massive updates. A-EON’s Enhancer Software has had a number of releases, every including new functions and developer APIs. In addition to transport their very own variations of key Amiga OS functions and utilities, additionally they now are putting in a number of core AmigaDOS command replacements. I are likely to skip the set up of those as I’ve encountered just a few edge circumstances the place they don’t fairly behave like the unique OS 4 instructions, however from latest discussions on-line it seems as if they’re making ready for their very own “clean-room” re-implementation and modernisation of Amiga OS 4. Presumably with the intention to free themselves from the everlasting authorized shenanigans with Hyperion et al. I’m not going to get into that raging dumpster fireplace right here, nevertheless it’ll be fascinating to see what comes of this.
On the Hyperion aspect, they launched an enormous SDK Update for OS 4 together with up to date GCC toolchains, cross-compilers, profilers and a great deal of up to date SDKs. Making an allowance for the traditional GCC 4.x toolchain that had been in place for years it was nice to have a extra fashionable atmosphere. On the basic Amiga entrance, Hyperion have additionally been pushing forward with their up to date AmigaOS 3.x OS for 68k-powered Amigas. Now on model 3.2.2.1 (I’ve received my boxed set of CD and floppy disks) there have additionally been a number of NDK (“Native Developer Equipment”) Updates offering up to date APIs and instruments. AmiKit additionally launched an excellent “all-in-one” atmosphere referred to as DevPack which incorporates an enormous vary of languages (C, Meeting, Amos, Lua, Primary…) and NDKs all configured and able to go. As a fast and simple manner of establishing a improvement atmosphere on basic Amigas, it’s laborious to beat and saves lots of guide downloading, configuring and glue-ing all the pieces collectively.
Editors
In my last update 3 years in the past, I’d extra or-less settled on utilizing a GUI VIM spinoff. Whereas I’m nonetheless a die-hard VIM person at $DAYJOB, I actually respect the fashionable comforts of e.g. VSCode. Because of the superb work of George Sokianos, there’s now a OS 4 package of the superior Lite-XL editor together with a complete set of plugins. Right here’s what a hacking session on my X5000 seems to be like:
In that session you may see alongside LiteXL two terminal home windows: I’m compiling and operating the PowerPC and basic 68k variations of setcmd
because of the cross-compilers and native “Petunia” JIT 68k emulation constructed into OS 4. Extra on that later, however whereas we’re speaking about basic Amigas…
Native {hardware}
Emulation is ok, however nothing beats operating on the precise {hardware}! Within the lead image to this text you may see my treasured Amiga 1200 (with older 8-bit buddy within the background operating my TNFS site) expanded with an Apollo Vampire accelerator. An Ethernet or Wifi adapter is kind of important although in relation to transferring knowledge round and luckily the Vampire card is able to community connectivity, high-resolution show and different niceities however can simply be switched again to a extra “inventory” atmosphere. I do nonetheless sometimes use my licensed copy of CubicIDE however as a result of age of this structure, I are likely to preserve my instruments gentle and have settled on the easy Jano editor or generally CygnusEd for previous time’s sake.
My construct toolchain is offered by Devpack and it’s included VBCC compiler. I take advantage of the vbcc_target_m68k-amigaos
goal with this makefile to construct:
Fashionable improvement
I’m (sadly) not all the time in entrance of my Amigas, however nowadays a contemporary laptop computer and cloud-native instruments provide lots of flexibility significantly with the superior state of emulation. I take advantage of VSCode as my editor, and a containerised cross-compiler toolchain constructed by – once more! – George Sokianos to focus on each 68k and PPC platforms. I can construct my undertaking on any system able to operating OCI containers, e.g.
docker run
--user $UID:$GID
-v ./:/choose/code
walkero/docker4amigavbcc:latest-m68k-amd64
make -f makefile.docker
Testing and operating the code is made straightforward by the very superior state of emulators. On Home windows, WinUAE is the gold normal and may emulate all the pieces from an authentic 1985-vintage A1000 as much as fashionable methods with PowerPC accelerators, graphics playing cards and different units. I’ve it multi-booting into clear Hyperion and Commodore/basic OS environments, with my supply code listing shared as a digital hard-drive:
I can compile in seconds with Docker, after which immediately take a look at the ensuing binary in my emulated Amiga. Supply-code is stored updated between methods utilizing Git; on the Amiga X5000 I take advantage of the port of SimpleGit, which is now bundled with the newest Hyperion SDK underneath SDK:c/sgit
. I haven’t but discovered an acceptable Git resolution for the basic Amigas, so on these I take advantage of a makeshift AmigaDOS shell script that makes use of Backup to repeat information over to a community mount in an rsync
-like style.
I additionally preserve that means to check operating AmigaOS 4.1 underneath QEMU as help for this has tremendously improved and appears quite a bit less complicated than the at the moment convoluted technique of getting “basic OS 4” operating on an emulated 68k Amiga with PPC accelerator configured. However for now, the WinUAE method is working fairly properly.
One other benefit of getting a containerised build-chain is that mixed with Git and Drone operating on my private Kubernetes clusters, I can construct and bundle my code with a easy git push
wherever I’m:
AmigaDOS is bizarre
Though AmigaOS is often lauded for it’s sophistication and class, there’s a notable “oddness” in regards to the AmigaDOS elements which deal with storage I/O, units and filesystems. The unique builders of the Amiga had an formidable DOS system deliberate, however in the long run Commodore needed to buy the Tripos working system and port elements of it to the Amiga as a consequence of deadline challenges. This mismatch is all of the extra pronounced as Tripos was written in BCPL – which in flip, influenced the B
programming language which begat the C
everyone knows and… properly, tolerate, in my case. So it truly is trying again into computing historical past and remnants of this nonetheless stay even within the “fashionable” AmigaOS 4.x and different derivatives.
When you begin diving into AmigaDOS code, you find yourself face-to-face with this legacy and must convert backwards and forwards with BCPL and C data-types. For instance, BCPL strings will not be NULL
-terminated, as a substitute they’ve a size within the first byte after which the characters comply with. And pointers are equally alien. This is the reason my code has stuff like this littered by it:
// Convert the brand new node to a BPTR
new_node_bptr = MKBADDR(new_node);
// Set the brand new path
cli->cli_CommandDir = new_node_bptr;
Because the NDK embrace file dos.h
explains: “All BCPL knowledge have to be lengthy phrase aligned. BCPL pointers are the lengthy phrase tackle (i.e byte tackle divided by 4 (»2))”. It additionally consists of helper features like MKBADDR
to assist with the conversion as most DOS system calls use BCPL pointers in arguments:
/* Convert BPTR to typical C pointer */
#outline BADDR(x) ((APTR)((ULONG)(x) << 2))
/* Convert tackle right into a BPTR */
#outline MKBADDR(x) (((LONG)(x)) >> 2)
All in all, a captivating look again into an obscure department of computing historical past, nevertheless it hasn’t furthered my appreciation of pointers any!
Distribution
If you wish to distribute your undertaking to a wider viewers, there’s just a few Amiga-specific issues you are able to do that makes life a lot simpler for individuals operating AmigaOS. These all make use of some fairly cool bits of Amiga know-how and have been broadly adopted by native software program since their introduction within the early Nineties.
Archive
Simply use LHA format archives. It’s the usual compression software on Amigas and despite the fact that there are fashionable (and technically higher) options, .lha
information are as ubiquitous as e.g. .zip
or .tar.gz
packages on different methods and will also be dealt with by low-spec machines. There are ports of CLI instruments and GUIs accessible on all platforms to deal with these archives and whereas the syntax could be a little totally different, it’s fairly straightforward to make use of. See my AmigaDOS script that builds the SetCmd launch artifact for a sensible instance.
Documentation
Together with a primary README.txt, it’s an excellent apply to distribute extra detailed documentation in AmigaGuide format. One other space the Amiga was manner forward of it’s time – AmigaGuide is a hyper-text format generally used for utility manuals though individuals have even used it to publish disk magazines! Launched in 1992, the bundled instruments on any AmigaOS (or clone/spinoff) can learn and use AmigaGuide as normal so you may embrace formatting, hyperlinks and different content material in your documentation. You may see the AmigaGuide docs I embrace with SetCmd within the screenshot above, or view the source to see what the syntax seems to be like.
It’s fairly easy to write down and is very similar to every other markdown or formatting code. You may set primary parameters:
Paperwork have “Nodes” which might be linked to, e.g.
1
2
@Node About "About SetCMD"
@{"About" Hyperlink About}
And formatting is very similar to HTML with opening and shutting tags:
@{b}@{u} Daring and Underlined! @{uu}@{ub}
Installer
A unbelievable addition to AmigaOS, the system installer utility reads a developer-provided script which handles copying information, evaluating variations, modifying system scripts and so forth, in a standardized style. You may go helpful data and configuration which controls the Installer software by normal Amiga tooltypes, and it makes use of a type of LISP-ey syntax which once more runs on all Amigas and derivatives. The syntax does some getting used to, however the perfect supply of documentation is the AmigaGuide documentation discovered within the Installer dev package. For example, right here’s an excerpt of the block of code which copies the setcmd
program file over to a beforehand created listing:
1
2
3
4
5
6
7
8
(copyfiles
(supply "setcmd")
(dest #dname)
(immediate ("Copy SetCmd program file?"))
(verify "professional")
(all)
(assist @copyfiles-help)
)
And for operating instructions, you should use the run
command, together with cat
(brief for “concatenate”) to construct up the command string :
(run (cat "C:MakeLink FROM " #dname "/cmds/setcmd/launch TO SETCMD:setcmd SOFT"))
I discovered the perfect method was to look at different Installer scripts to get a really feel for widespread practices and idioms. Right here’s my simplistic Install_SetCmd script, and if you wish to see one thing extra complicated, there’s all the time the AmigaOS set up scripts, or the Qt installer for OS 4 which taught me quite a bit.
File Websites
The Amiga doesn’t have a common bundle supervisor, so information are often downloaded manually and put in from the .lha
archives. The go-to place for Amiga software program for all methods is AmiNet. It’s the largest repository of Amiga packages on the web (and, at one level within the mid-90s was truly the biggest software program repository of any platform) and now additionally helps internet hosting packages for Amiga OS 4, MorphOS and AROS alongside basic 68k fare. There are additionally smaller, platform-focused websites for every platform e.g. os4depot.net for OS 4, morphos-storage.net for MorphOS and so forth.
Getting your bundle uploaded and accepted into the repository is broadly the identical for all these: You FTP your bundle up in accordance with the naming requirements, and provide a Readme
file which offers the required metadata like this excerpt in AmiNet format:
1
2
3
4
5
6
Brief: Swap between variations of software program
Writer: [email protected] (Mark Dastmalchi-Spherical)
Kind: util/shell
Model: 1.1.0
Structure: ppc-amigaos >= 4.0.0
Distribution: Aminet
There are some Amiga-native GUI instruments that help with creating these information, however the specs e.g. for os4depot.net are fairly straight ahead. And right here’s the top outcome - My bundle accessible on os4depot.net and aminet.
Exterior Documentation
When attempting to study or re-learn all the pieces from C to AmigaDOS scripting, I discovered just a few nice sources. Nonetheless, as with most issues in Amiga-land, there’s an awfully excessive “bus issue” for a lot of web sites and my largest advice is to make use of native instruments or save native copies of something you discover! With that mentioned, right here’s my important Amiga bookmarks:
-
Autodocs references. There’s a lot of web sites the place you may browse the auto-generated docs from the SDK header information, like this with clickable hyperlinks to leap between issues. If I’m truly at an Amiga although, there are some helpful native instruments I desire that may index and search by the native headers. The screenshot above reveals the usual “AutoDoc Reader” freeware software viewing the equal of a
man
web page for the AmigaDOS library, alongside the AmigaGuide Installer language reference. -
http://www.pjhutchison.org/tutorial/amiga_c.html - superb web site. That is what impressed me to select up a compiler once more and get to work. There’s an excellent refresher on the C language itself, after which it dives into Amiga-specific coding with all the pieces from low-level library entry, sound and GUI programming and extra.
- Amiga OS Dev wiki is a goldmine, though it could actually take a bit looking to seek out what you’re after. It’s principally OS 4-focused however as a result of all Amiga methods share a standard ancestor it’s often fairly relevant to all platforms. Particular articles that I discovered helpful embrace:
- And lastly, there are nice threads I consistently discovered on amigans.net which is the place lots of OS 4/”Subsequent Gen” technical dialogue occurs. For traditional methods, I discovered the Coders discussions on the English Amiga Board a useful useful resource.
The best way ahead is again ?
Once I began this undertaking, it was actually a option to get acquainted with my new X5000. Since then, I’ve determined to port my codebase again to the basic Amiga, in addition to discover porting over to different Amiga-like methods corresponding to MorphOS and AROS. This results in some selections: From a packaging and distribution perspective, a 68k binary is just about the common normal in Amiga land. It may run natively on basic Amigas, and fashionable methods like AmigaOS 4.x and MorphOS can run 68k binaries by translation. In a way just like how Apple has dealt with the transition between processors within the Mac, it’s a fairly seamless expertise and I run lots of basic 68k software program on my X5000. So long as you aren’t “banging on the steel” it really works very well and integrates smoothly with the remainder of the system.
The unique 68k AmigaOS from Commodore can be just about the usual for source-code compatibility; code targetting this launch might be constructed on many of the derivatives and later methods with little or no (if any) modification. On AmigaOS 4 for instance, you may merely add -D__USE_INLINE__
to your makefiles and in idea construct from a standard codebase. In case you begin the opposite manner as I did and write initially targetting AmigaOS 4, it’s more durable to port to different methods.
For instance, I initially adopted the AmigaOS 4 programming model which favours prefixing library calls with interface names. This isn’t suitable with every other system, so the simplest option to port this to extra Amiga-like platforms is to refactor this code again to the basic model of calling system features. I do plan on constructing platform-specific binaries utilizing #defines
so I can for instance use features like dos.library/AddCmdPathNode
on OS 4 that I in any other case need to manually implement, and whereas lots of higher-level layers (like e.g. MUI for constructing graphical functions) are shared throughout platforms that is in all probability the perfect wager for including particular options from one platform that aren’t accessible on others.
Actually although, at this level if you wish to simply get began I’d need to counsel you goal basic AmigaOS compatibility and construct a 68k binary. I’d personally goal AmigaOS 3.x or 2.1 if you wish to help a wider vary of really classic methods; 1.x is facinating from a retro-geek perspective however lacks lots of the great options that got here with later methods. The whole lot else just like the installer, archive format, documentation format and so forth is cross-platform anyway and supported from OS 2.1 and up.
MorphOS, AROS and OS 4 are actually enjoyable methods to discover, and I extremely advocate checking them out if this text has whetted your urge for food (and you'll find a system to run them on!) however basic is the simplest option to get your code out to the broader world and paradoxically offers a greater code-base for future porting than my “working backwards” method.
Wrap-up
In order that’s in regards to the sum complete of what I’ve picked up over the previous few years, anyway! I nonetheless get pleasure from engaged on my Amigas after I get some “hacking on code within the night” time, and particularly I discover AmigaOS 4 on my X5000 a refreshing mix of retro enchantment and nearly sufficient fashionable comfort to make use of it for improvement duties, and even for writing this text itself. My A1200 continues to impress me with how a lot utility there's in such a small field and is an excellent distraction from the fashionable period of bloated methods and functions. It's maybe an evolutionary dead-end, nevertheless it’s nonetheless lots of enjoyable and is among the uncommon events nowadays the place I really feel truly accountable for my laptop. Working backwards in time from OS 4.1 to my basic Amigas has additionally actually given me a higher perception and appreciation for what the Amiga engineers managed to tug off again then. In case you’re in any manner all in favour of laptop historical past - or just need to give one thing really totally different a attempt - it's best to positively try AmigaOS. I hope this fast kind BRAIN: > WEB:
dump offers you with some good beginning factors, and possibly will get you coding too!