How to detect machine type

bbc micro/electron/atom/risc os coding queries and routines
Post Reply
User avatar
8271
Posts: 94
Joined: Sun May 24, 2020 1:20 pm
Contact:

How to detect machine type

Post by 8271 » Thu Jul 02, 2020 10:29 pm

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
Serial computer hoarder & econetophile
2 x BBC-B, 4 x Master128, Master Viglen, Master Domesday, A310, A4, A5000, RiscPC700 Level 4 Server, RPC_SA233 & RPC_SA200, RiscOS_Pi, Econet & Ethernet

RobC
Posts: 2993
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: How to detect machine type

Post by RobC » Thu Jul 02, 2020 10:41 pm

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.


SteveBagley
Posts: 259
Joined: Sun Mar 15, 2015 8:44 pm
Contact:

Re: How to detect machine type

Post by SteveBagley » Thu Jul 02, 2020 11:02 pm

Wasn’t there a !ArcBoot you could use to differentiate between Beeb and RiscOS, or am I misremembering?

Steve

User avatar
jgharston
Posts: 4118
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: How to detect machine type

Post by jgharston » Fri Jul 03, 2020 2:18 am

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.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.32
(C) Copyright J.G.Harston 1989,2005-2020
>_

User avatar
jgharston
Posts: 4118
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: How to detect machine type

Post by jgharston » Fri Jul 03, 2020 2:29 am

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.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.32
(C) Copyright J.G.Harston 1989,2005-2020
>_

Post Reply

Return to “programming”