In addition to the BASIC version returned by the VER$ function, the operating system itself has a version number. We’re probably all used ot the two or three letter (or in the case of Minerva 4 character) version number such as the ‘JM’ or ‘JS’ ROMs.
QDOS version numbers are normally a 4-character string, such as 1.23. For example, a version JM QL ROM has QDOS 1.03, while a version JS has QDOS version 1.10. Some versions of the ROM replace the period character (‘.’) with a letter indicating the nationality, e.g. 1f13 for a French version.
Standard QDOS ROMs have no easy way of checking the QDOS version from SuperBASIC. Minerva and SMSQ/E can use a variant of the VER$ function – PRINT VER$(1) may return ‘3.26’ on current versions of SMSQ/E for example. There is a list of which OS version number corresponds to which ROM version on my website’s QL ROMs page at http://www.dilwyn.me.uk/qlrom/index.html
It rather surprised me to find there was no extension to do this on older systems, so I’ve added one to my website’s Toolkits page, a mere 66 byte extension called unsurprisingly QDOS$ which returns the 4-digit QDOS version:
which may return on a JM ROM:
The assembler source is included so you can see how it works. It’s copied from Andy Pennell’s QDOS Companion book, but with a correction to the maths stack handling, to prevent stack drift which may lead to a crash, especially if the function was used in an expression such as PRINT “<“&QDOS$&”>” or LET A$=”OS VERSION “&QDOS$. I am grateful to Norman Dunbar for an article he wrote in QReview magazine years ago on the subject of Maths Stack handling, which helped me debug this code – you can read his article at Maths Stack Article
Preparing this extension also showed me a minor error in the QL Technical Guide on page 135 where it described the BV.CHRIX function used ot reserve space on the maths stack – it says the number of bytes required should be in register D0 whereas it should in fact be in register D1.
The extension can also be linked into a QLiberator or Turbo compiled program if required (unlikely to be useful unless you wish to check if your programneeds different code when running on particular versions of the operating system).
Download the extension from the Toolkits page on my website at http://www.dilwyn.me.uk/tk/index.html