Date : Thu, 18 Nov 2010 11:24:39 +0000
From : jgh@... (J.G.Harston)
Subject: Hints'n'Tips: Assembling non-ARM code on ARM BASIC
Rick Murray wrote:
>> There isn't an OSCLI call to read what the machine type is
> Mmmm... "*FX 0,1" but how do you read the result in a multi-system
> friendly way?
A%=0:X%=1:X%=USR((&FFF4)AND&FF00)DIV256 as used in FNOS_GetEnv in
http://mdfs.net/blib/ProgEnv (http://mdfs.net/blib/Docs/ProgEnv.txt).
> One of my thoughts on the matter is that, by and large, a lot of source
> can be shared multisystem, but really it is better to write
> system-specific code with the generic back-end being shared. This may
> sound like it involves more work, and it does, but it also permits you
> to maximise the potential environment in which you will be operating in.
It ends up involving less work if done properly. I've put the work into
my shared BASIC libraries at mdfs.net/blib so that the mainline code can
just get on with what it wants to do without worrying about what platform
it is running on - the libaries calls deal with that.
> Would it not be better to code for RISC OS versions to make best use of
> the enhanced facilities available?
If it's something specific for that platform, yes go ahead. If I know I'm
writing something that needs BASIC V functionality (eg PROCname(RETURN)
such as in AsmPDP) then I'll not worry about using BASIC V functionality
in the rest of the program; or if I'm writing something that is dependant
on the underlying platform, such as a Wimp task.
But, if I'm writing something that can be platform-generic, such as a
file processing utility or a non-Wimp application, it's worthwhile not
going to the effort of deliberately breaking any multi-platform
functionality. Eg most of
http://mdfs.net/Spectrum/Tools
http://mdfs.net/Software/FileTools
http://mdfs.net/Apps/Emulators/Tube/PDPTube
http://mdfs.net/PDP11/Assembler
http://mdfs.net/BBCBasic/Windows/Compat.htm
http://mdfs.net/Apps/Archivers/Archiver
http://mdfs.net/Apps/Archivers/BBCZip
http://mdfs.net/Apps/Archivers/ZipTools
http://mdfs.net/Apps/DiskTools
http://mdfs.net/Apps/Filers
http://mdfs.net/Apps/FileUtils
http://mdfs.net/Apps/Font
http://mdfs.net/Apps/Graphics/Conversion
http://mdfs.net/Apps/Mapping/GridRef
http://mdfs.net/blib
and a lot more will run on BBC, Master, RISC OS, Windows, Unix...
--
J.G.Harston - jgh@...