SetCmd Amiga Development part 2
Updated:
As I mentioned in my last post, I’ve been developing a new “SetCmd” tool for my Amiga systems, both for my own practical usage and also to serve as a re-introduction to the Amiga developer environment. This series of blog posts will cover the progress of this tool, as well as explore the challenges and technologies from my perspective of a returning AmigaOS fan.
I’ve learned a lot over the past few days and even though the tool is currently very much a “prototype” AmigaDOS script, it is working well enough at this stage that it has really helped my day-to-day activities at the Amiga shell. There’s a few screenshots at the end of this post showing my current progress, but to start off with I wanted to share my first “brain dump” covering some of the things I have picked up and/or re-learned :
NOTE : I’ve since published an updated article covering my development environment in 2023, check it out here.
Installer progress
As I want to make this tool as Amiga-native as possible, I also want to provide documentation in AmigaGuide format (an interactive hypertext-based system, somewhat similar to HTML), and an installer using the standard Amiga Installer utility. I decided to tackle the installer script first, and have already learned quite a bit.
There is apparently a new Python-based installer system present in AmigaOS 4 which can create much nicer and more modern-looking installer wizards (such as the SDK installer - I looked at this amongst other things in another post), but I chose to stick with the “classic” installer tool for several reasons:
- At some point, I would also like to provide this tool for classic AmigaOS 3.x so I don’t want to make too many choices at this point that limit my options.
- There are many Installer scripts to use as examples.
- Pretty much every Amiga user is familiar with the Installer tool.
- I remember it well from my classic Amiga days and always wanted to learn it!
I started off by examining some existing Installer scripts to get an idea of what the language looks like. It’s an odd sort of LISP-based system, which uses some patterns I found extremely jarring at first. For example, in most languages I am comfortable with, comparision is done like if thing == value
. In the Installer language, it looks instead like (if (= thing value))
. Still, once I’d got used to that it wasn’t too bad, and I discovered the language is pretty full-featured with procedures, control statements and lots of useful helper commands/functions.
As an example, here’s a block of code which copies the setcmd
program file over to a previously created directory, the value of which has been assigned to the #dname
variable:
(copyfiles
(source "setcmd")
(dest #dname)
(prompt ("Copy SetCmd program file?"))
(confirm "expert")
(all)
(help @copyfiles-help)
)
And there’s also a variant which can copy wildcards which is handy when copying .info
files along with something - note the pattern
parameter is now used and source
is empty:
(copyfiles
(source "")
(pattern "SetCmd.guide#?")
(dest #dname)
(prompt ("Copy SetCmd AmigaGuide documentation?"))
(confirm "expert")
(help @copyfiles-help)
)
And for running commands, you can use the run
command, along with cat
(short for “concatenate”) to build up the command string :
(run (cat "C:MakeLink FROM " #dname "/cmds/setcmd/release TO SETCMD:setcmd SOFT"))
I initially found it very difficult to find any definitive guide for this language as nothing was showing up on web searches. After struggling through with trial and error and only example scripts to help, I remembered that this is Amiga-land so there’s probably documentation in a native format. And sure enough, searching Aminet brought me to the Installer dev package. It dates from around 1996 which is shortly before I first left the Amiga scene but still seems to be a relevant source of information. The supplied Installer.guide
is a great resource, and you can see it open below along with my Installer work in progress:
I also discovered that you can pass useful information and configuration which controls the Installer tool through standard Amiga tooltypes:
The more I get back into the Amiga, the more I appreciate these details and features that never seemed to make it into other systems!
Version control
As I use version control (usually git
) for all my other projects on Unix, Mac and other systems like Haiku[1], I wanted to do the same for this project. However, this is something I’m kind of stuck with at the moment, so I’m curious what other Amiga developers use. Simply put, the only tools I could find (after an admittedly short search) were either very old or incomplete. There is for example, a port of Subversion to AmigaOS 4, but I consider that a technical step back and the port is already 10 years old.
My options for using git
seem quite limited - all I could find was sgit. This is sort of working OK at the moment, I have managed to initialise a local repository and commit code but various things don’t seem to work quite how I would expect. I still haven’t worked out how to add and push to an origin at Github.com, for example. Diffs and .gitignore
files also don’t seem to work although that’s probably something I’ve done wrong, and many of the commands don’t accept the same arguments as I’m used to.
Still, I’m extremely grateful for it as having a limited SCM system is infinitely better than the old approach of millions of files all called things like final_1.bak-v2-bug-fix_DO_NOT_DELETE
which you can never remember what they are or why they were labelled like that!
I’ll keep investigating - one option might be to see if the bundled Python installation is up to running Mercurial. I once submitted a patch for this to work on Irix, so maybe in the future they’ll get another patch from The Weirdo Who Likes Old Systems ;)
Remote access
This is more a “nice-to-have” but I admit to being stumped right now. The only way I have of developing this tool is by sitting at my Amiga X5000 which is fun (especially with AmigaAmp blasting some classic 90’s MODs in the background!), but it would be nice to be able to continue on with my work while sitting with a laptop in my living room. So far, the only route seems to be emulation on a Mac/Windows/Linux laptop which is not ideal.
I can’t seem to find a SSH or Telnet server for AmigaOS 4 (plenty of clients are available) which would have let me work from the shell remotely. There is a port of VNC, but using that for development work over Wifi is painful. I’d appreciate it if anyone has any insights - is there anything obvious I’m overlooking ?
Documentation
Brief shout out to whoever maintains the AmigaOS Documentation Wiki - this has been an invaluable resource. I managed to get myself back up to speed with AmigaDOS after a multi-decade absence using the great documentation, particularly these fantastic guides :
- AmigaDOS Commands - all commands described along with plenty of helpful usage examples and tips. The documentation for the list command is a revelation - I had always been mystified by that command back in the day!
- Using Scripts - lots of great examples and tips on how to write scripts, accept arguments and so on.
- AmigaDOS Advanced Features - more useful tips including a whole section on escape codes for colourised output. I remember working these all out by hand on my A1200 and working out what codes I needed to build up ASCII-art screens for my old scene group!
I saved all these guides locally as PDFs using the “Save as PDF” option from the Odyssey browser. I would have loved to have a resource like this back when I was starting out on my old Amiga, so again a big “Thank You!” to whoever is responsible for maintaining this wiki.
Onwards
I am now able to use the setcmd
running through itself to develop it. This has been very useful and has further validated my need for such a tool - take a look at the example below, where the setcmd
installation is pointing to my development version in my Work:
volume :
But now I want to switch to my release version, where I’ve installed it to my usual Software:Programs/
directory :
Note that the version number changes in the header of the command, and setcmd show setcmd
shows the versions changing. Also note the liberal use of AmigaDOS Assigns - one of my favourite features of this OS, and one that I really miss on other systems. VMS had something similar with System Logicals, and of course Unix systems have symlinks but they don’t work in the same way, and aren’t nearly as useful or efficient.
My next steps are to finish the Installer script, then learn enough AmigaGuide markup so I can together a set of documentation for my tool. A few more bug fixes and general polishing, and I should be ready to release it to the world! This is just the start, however. I have more plans like supporting AmigaOS3.x - probably limited to OS3.9 as that’s all I have readily available at the moment but I do have a set of 3.1.4 ROMs being shipped.
I’d also like to try out different editors, and use my setcmd
tool as a jumping-off point into re-learning C on the Amiga, eventually re-implementing it as a pure C program instead of the “prototype” script.
Part of the reason I started off on this journey was to develop my skills to a point where I can eventually start contributing more to the Amiga scene anyway, so hopefully learning enough C (and working out the build process, accessing Amiga libraries and so on) will get me to a point where I can help bring some more tools across to our platform.
Until next time…
[1]=Haiku is a recreation of the BeOS, which I used extensively after I left the Amiga scene. I’ll write more about this OS in some other posts, but it’s nothing short of amazing what this small group of dedicated developers has accomplished. I’ve also been continuing in my mission to submit patches to open-source projects for obscure platforms ;)