Page 1 of 1

How to detect machine type

Posted: Thu Jul 02, 2020 10:29 pm
by 8271
I have an econet system set up with Model B's, Masters & Risc OS machines. I am writing a menu system for the boot login, but I would like to programatically detect what machine it is running on (potentially in the !boot file) so I can load and set different Library directories, and load different lists of programs that would be available. (I.e. if it is a Master it can load enhanced versions and soft load roms into SWRam.)

I Could trap an FX0 command but I am sure there is a more elegant way by looking into a memory address; I just don't know which one!

Thanks

Re: How to detect machine type

Posted: Thu Jul 02, 2020 10:41 pm
by RobC
I'd say OSBYTE 0 / *FX 0 is the right way of doing it as it's the official API for getting the host type.

Re: How to detect machine type

Posted: Thu Jul 02, 2020 10:43 pm
by IanS

Re: How to detect machine type

Posted: Thu Jul 02, 2020 11:02 pm
by SteveBagley
Wasn’t there a !ArcBoot you could use to differentiate between Beeb and RiscOS, or am I misremembering?

Steve

Re: How to detect machine type

Posted: Fri Jul 03, 2020 2:18 am
by jgharston
IanS wrote:
Thu Jul 02, 2020 10:43 pm
Inkey?
http://beebwiki.mdfs.net/INKEY#Check_machine_type
OSBYTE 0 as it is more specific. INKEY-256 gives you the sub-type within the OSBYTE 0 type. If you use OSBYTE 0 you're checking for X, if you use INKEY-256 you're checking for W or X or Y or Z but only some Zs as determined by checking OSBYTE 0 to determine which Z.
so I can load and set different Library directories
NetFS allows you to do that anyway with *OPT 5 and *Configure NetLibrary.

My NetBoot system does similar to what you're proposing, I made it flexible in that the per-OS and per-machine settings are in seperate files, BOOT.OSnnn for settings for OS n, and BOOT.StnNNN for settings for station n.

Re: How to detect machine type

Posted: Fri Jul 03, 2020 2:29 am
by jgharston
8271 wrote:
Thu Jul 02, 2020 10:29 pm
I Could trap an FX0 command but I am sure there is a more elegant way by looking into a memory address; I just don't know which one!
Looking into a memory location is a *less* elegant way, an API is there *specifically* to *avoid* having to peek into memory addresses. Which memory location would you peek on a BBC B that would also be the same memory location on RISC OS? Or on an Electron? Or on a Master?

And trapping FX0 wouldn't give you anything useful, just tell you that ERR is 247. You don't trap FX 0, you just call OSBYTE 0 and read the result it returns to you.