It is currently Mon Oct 20, 2014 5:47 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Shadow screens
PostPosted: Thu Jan 27, 2011 3:53 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi there,

I'm looking for a way to allow a program to know it is running on a BBC that has access to shadow screens.

Thanks in advance!

Kind regards,

Francis


Top
 
 Post subject: Re: Shadow screens
PostPosted: Sat Jan 29, 2011 1:17 am 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
Hi Francis ;)

It's not actually that straightforward but this should perhaps cover it...
Code:
   10 REM * SHADOW DETECTOR *
   20 :
   25 SHAD=FALSE
   30 OS%=FNhost
   40 IF OS%>1 SHAD=FNstate-1
   50 IF SHAD PRINT"SHADOW ON" ELSE PRINT"NO SHADOW AVAILABLE"
  998 END
  999 :
 1000 DEFFNhost
 1010 A%=0:X%=1
 1020 =(USR(&FFF4)AND&FF00)DIV256
 2000 DEFFNstate
 2010 A%=&EF:X%=0:Y%=&FF
 2020 =(USR(&FFF4)AND&FF00)DIV256

By line 50 we have the boolean SHAD set true if shadow ram is present and is enabled or false if there is no shadow ram present or it is present but is disabled.

Couple of things, the first test is simply ruling out an Elk or a Model B but it is possible to have shadow ram on a B if (for example) an Aries B32 board is fitted. If that edge case worries you I can check how to test for these B expansions. (Although if such a ram expansion causes the OS to report as a Master then we're ok.) Also, I don't know if the Compact or ET have shadow ram? If no for both, line 40 should be changed to...

40 IF OS%>1 AND OS%< 4 SHAD=FNstate-1

...which will then only consider a B+ (64 or 128) or a Master 128 for test 2. If either or both do have shadow ram then line 40 needs to be modified to include one or both for the second test where an ET will return OS%=4 from test 1 and a Compact will return OS%=5.

Any use?


Top
 
 Post subject: Re: Shadow screens
PostPosted: Sat Jan 29, 2011 12:06 pm 
Offline
 Profile

Joined: Sun May 02, 2010 2:07 pm
Posts: 42
MartinB wrote:
Also, I don't know if the Compact or ET have shadow ram? If no for both, line 40 should be changed to...


They both do, the SRAM utils are on the ET, just the help files are missing.


Top
 
 Post subject: Re: Shadow screens
PostPosted: Sat Jan 29, 2011 5:54 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Thanks for that Martin. :)

Do I really need to check what the host machine is though? I would have assumed that just checking for the shadow memory being available was enough.

Kind regards,

Francis


Top
 
 Post subject: Re: Shadow screens
PostPosted: Sat Jan 29, 2011 6:42 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hmm... I found that I had to change line 40 to the following for it to work:

Code:
   40 IF OS%>1 SHAD=FNstate


On BeebEm if I typed "P. FNstate" at the prompt I would get a 0 for the BBC B setting and 1 for the BBC Master.

Kind regards,

Francis


Top
 
 Post subject: Re: Shadow screens
PostPosted: Sat Jan 29, 2011 7:44 pm 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
I think I slightly misunderstood what you were after and I'm not as familiar with Masters etc. as I am with the Model B :roll:. The FNstate-1 is correct but what the routine is reporting is that shadow ram will not automatically be selected for screen Modes 0-7 if available, only for screen Modes 128-135 and therefore you couldn't guarantee that it was currently in use. I think one can inspect the ACCCON register but I was trying to do it legally!

Anyway, if you leave the utility as I posted but add line...

35 IF OS%>1 THEN *SHADOW

...then the subsequent report will be correct for the relevant machines and shadow will be used for any new sreen Mode regardless. I thought perhaps you were trying to see what state the machine was in rather than control the state.

You do need to eliminate the Elk and the B because they will return 0 for the second test simply because they don't support the call and this will a give an incorrect TRUE result. Also, now I'm including the *SHADOW command we have to skip the Elk and Beeb to avoid a Bad Command error.

You might then not even need the second test I suppose but I don't know if shadow can be turned off by some other stealth means!


Top
 
 Post subject: Re: Shadow screens
PostPosted: Sat Jan 29, 2011 8:26 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Thanks Martin.

To explain what I am trying to do: my aim is to see if a program could assess if it could use shadow screens and if so allow the user to optionally use something like a MODE 128 screen instead of MODE 7.

Kind regards,

Francis


Top
 
 Post subject: Re: Shadow screens
PostPosted: Mon Jan 31, 2011 3:59 am 
Offline
 Profile

Joined: Sun May 02, 2010 2:07 pm
Posts: 42
If you just want to use shadow screen modes, and don't care about the detection part, there is an easier way.

Code:
m=7:REM desired mode
P. ~(128+m)
> 87


then use that number thusly:
Code:
Mode &87


On model B it just ignores the &8 part.


Top
 
 Post subject: Re: Shadow screens
PostPosted: Mon Jan 31, 2011 10:19 am 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Thanks Paul.

I do need for my program to be able to detect the presence of shadow RAM otherwise the user would get a bad mode error on a BBC B if they tried to use a 20k screen mode.

Kind regards,

Francis


Top
 
 Post subject: Re: Shadow screens
PostPosted: Fri Feb 04, 2011 5:54 pm 
Offline
 Profile

Joined: Sat Aug 22, 2009 7:45 pm
Posts: 34
FrancisL wrote:
I do need for my program to be able to detect the presence of shadow RAM otherwise the user would get a bad mode error on a BBC B if they tried to use a 20k screen mode.

So, you need to know before trying to change screen mode. I often use:

MODE &83:IF HIMEM>&7FFF:MODE &80

In general, no code should try to detect the presence of features, they should just go ahead and try to use them, and not use the features if the features are not selected, and you certainly must not Stalinistically say "there is no way product X, which is the only one I have any experience of, can possible ever ever have the features I'm looking for, so I prohibit the user from even trying"

Electron can have shadow screen.
BBC B can have shadow screen.
*Any* BBC serial computer can have shadow screen, real-time clock, MODE 7, serial port, ADC, printer port. Just use the call to try to use it and respond to the "doesn't exist" return value if it doesn't exist.


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron